Merge branch 'master' of gitlab.com:mmk2410/rangitaki

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-06-04 09:46:34 +02:00
commit f938e60c2e
6 changed files with 128 additions and 32 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
nbproject/ nbproject/
.idea/ .idea/
completer.hist completer.hist
feed/ /feed/
node_modules/ node_modules/

View File

@ -7,13 +7,15 @@
- [S] release are always compared to the previous [S] release. - [S] release are always compared to the previous [S] release.
## Version 1.4.4 (2016-06-03) [S]
- **[FIX]** Error when trying to create a feed
## Version 1.4.3 (2016-05-21) [S] ## Version 1.4.3 (2016-05-21) [S]
- **[FIX]** Missing space in drawer between "Blogs on" and blogname - **[FIX]** Missing space in drawer between "Blogs on" and blogname
- **[FIX]** Background layer was not removed if drawer was closed - **[FIX]** Background layer was not removed if drawer was closed
- **[FEATURE]** nextDESIGN theme added to delivered themes - **[FEATURE]** nextDESIGN theme added to delivered themes
- **[NOTE]** The update script to 1.4.3 works with 1.4.0, 1.4.1 and 1.4.2 - **[NOTE]** The update script to 1.4.3 works with 1.4.0, 1.4.1 and 1.4.2
## Version 1.4.2 (2016-05-18) [S] ## Version 1.4.2 (2016-05-18) [S]
- [FIX]: Password verification not implemented in RCC login page - [FIX]: Password verification not implemented in RCC login page

View File

@ -1,6 +1,6 @@
{ {
"name": "rangitaki", "name": "rangitaki",
"version": "1.4.3", "version": "1.4.4",
"description": "A simple PHP blogging engine without any database dependencies", "description": "A simple PHP blogging engine without any database dependencies",
"main": "index.php", "main": "index.php",
"scripts": { "scripts": {

View File

@ -6,13 +6,13 @@
* @package Rcc * @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz> * @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License * @license MIT License
* @link https://github.com/mmk2410/rangitaki * @link https://gitlab.com/mmk2410/rangitaki
* *
* Feed Generator * Feed Generator
* *
* The MIT License * The MIT License
* *
* Copyright 2015 mmk2410. * Copyright 2015 - 2016 (c) mmk2410.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -36,27 +36,35 @@
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
require "../../vendor/autoload.php"; require "../../vendor/autoload.php";
require_once "../../config.php"; require "../../res/php/Config.php";
require_once "../../res/php/ArticleGenerator.php"; require_once "../../res/php/ArticleGenerator.php";
use PicoFeed\Syndication\Atom; use PicoFeed\Syndication\AtomFeedBuilder;
use PicoFeed\Syndication\AtomItemBuilder;
use \mmk2410\rbe\config\Config as Config;
$config = new Config('../../config.yaml', '../../vendor/autoload.php');
$settings = $config->getConfig();
include '../ssl.php';
session_start(); session_start();
if ($_SESSION['login']) { if ($_SESSION['login']) {
$art_dir = "./../../articles/" . $_GET['blog'] . "/"; $art_dir = "./../../articles/" . $_GET['blog'] . "/";
$feed_path = "./../../feed/" . $_GET['blog'] . ".atom"; $feed_path = "./../../feed/" . $_GET['blog'] . ".atom";
$writer = new Atom(); if ($_GET['blog'] == "main") {
$blogtitle = $settings['blog']['title'];
} else {
$blogtitl = $settings['blog']['title'] . " - " . ucwords($_GET['blog']);
}
$writer->title = $blogtitle; $feedBuilder = AtomFeedBuilder::create()
$writer->site_url = $blogurl; ->withTitle($blogtitle)
$writer->feed_url = $blogurl . "/feed/" . $_GET['blog'] . ".atom"; ->withAuthor($settings['blog']['author'])
$writer->author = array( ->withFeedUrl($settings['blog']['url'] . "/feed/" . $_GET['blog'] . ".atom")
'name' => $blogauthor, ->withSiteUrl($settings['blog']['url'])
'url' => $blogurl, ->withDate(new DateTime(date(DATE_ATOM)));
'email' => ''
);
$articles = scandir($art_dir, 1); $articles = scandir($art_dir, 1);
@ -71,25 +79,45 @@ if ($_SESSION['login']) {
$text = Parsedown::instance() $text = Parsedown::instance()
->setBreaksEnabled(true)// with linebreaks ->setBreaksEnabled(true)// with linebreaks
->text($file); ->text($file);
$writer->items[] = array( if (new DateTime(date(DATE_ATOM, strtotime($datestring))) != null) {
'title' => ArticleGenerator::getTitle($art_dir, $article), $date = new DateTime(
'updated' => strtotime( date(
ArticleGenerator::getDate($art_dir . $article) DATE_ATOM,
), strtotime($datestring)
'url' => $blogurl . "./?article=" . )
substr($article, 0, strlen($article) - 3), );
'summary'=> ArticleGenerator::getSummary( } else {
$art_dir, $article $date = new DateTime(date(DATE_ATOM));
), }
'content' => $text $date = new DateTime(date(DATE_ATOM));
); $feedBuilder
->withItem(AtomItemBuilder::create($feedBuilder)
->withTitle(
ArticleGenerator::getTitle($art_dir, $article)
)
->withUrl(
$settings['blog']['url'] . "./?article=" . substr($article, 0, strlen($article) - 3)
)
->withAuthor(
ArticleGenerator::getAuthor($art_dir, $article)
)
->withPublishedDate(
parseDate(ArticleGenerator::getDate($art_dir, $article))
)
->withUpdatedDate(
parseDate(ArticleGenerator::getDate($art_dir, $article))
)
->withSummary(
ArticleGenerator::getSummary($art_dir, $article)
)
->withContent($text));
$amount += 1; $amount += 1;
} }
} }
} }
$feed = $writer->execute(); $feed = $feedBuilder->build();
$file = fopen($feed_path, "w"); $file = fopen($feed_path, "w");
@ -102,4 +130,19 @@ if ($_SESSION['login']) {
echo "0"; echo "0";
} }
?>
function parseDate($datestring)
{
$datetime = new DateTime(date(DATE_ATOM));
try {
$datetime = new DateTime(
date(
DATE_ATOM,
strtotime($datestring)
)
);
} catch (Exception $e) {
$datetime = new DateTime(date(DATE_ATOM));
}
return $datetime;
}

View File

@ -3,7 +3,7 @@
// License: MIT License // License: MIT License
// SSL Verification // SSL Verification
if ($settings["rcc"]["debug"] != "on") { if (isset($settings["rcc"]["debug"]) && $settings["rcc"]["debug"] != "on") {
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") { if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
exit(); exit();

51
update-scripts/1-4-3_1-4-4.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
# Update script for Rangitaki from version 1.4.3 to 1.4.4
version="1.4.4"
new="./rbe-new"
echo -n "Downloading version $version from GitLab... "
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
if [[ $1 == "--debug" ]]; then
cd $new
git checkout -q master
cd ../
fi
echo "done"
echo -n "Updating RCC... "
mv ./rcc/password.php ./password.php
rm -rf ./rcc/
mv $new/rcc ./
rm ./rcc/password.php
mv ./password.php ./rcc/password.php
echo "done"
echo -n "Updating npm... "
mv $new/package.json ./
echo "done"
echo -n "Updating Changelog... "
if [ -f ./CHANGELOG.txt ]; then
rm CHANGELOG.txt
fi
mv $new/CHANGELOG.md ./
echo "done"
echo -n "Cleaning up... "
if [[ $1 != "--debug" ]]; then
echo -n "Cleaning up... "
rm -rf $new
echo "done"
fi
if [ -d "./update-scripts" ]; then
echo -n "Remove obsolete update scripts folder... "
rm -rf "./update-scripts"
echo "done"
fi
echo "Your Rangitaki installation is updated to version $version"