From 352095a6d231e341d35d97bb5d2e6bbd2e052d4b Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 15:20:09 +0200 Subject: [PATCH 1/7] Fixed .gitignore to prevent hiding the rcc/feed directory. Ref T118 --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3189517..427b7fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ nbproject/ .idea/ completer.hist -feed/ +/feed/ node_modules/ From 0baffcc5cf91b428ab1276d10d83f17ebc6c8870 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 15:25:59 +0200 Subject: [PATCH 2/7] Check first if value exists --- rcc/ssl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcc/ssl.php b/rcc/ssl.php index 0923208..9c2f971 100644 --- a/rcc/ssl.php +++ b/rcc/ssl.php @@ -3,7 +3,7 @@ // License: MIT License // SSL Verification -if ($settings["rcc"]["debug"] != "on") { +if (isset($settings["rcc"]["debug"]) && $settings["rcc"]["debug"] != "on") { if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") { header('HTTP/1.1 400 Bad Request'); exit(); From 9fa47ecfd5306eb2cd2618e3311ad951f7dd9864 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 15:28:02 +0200 Subject: [PATCH 3/7] Updated copyright text --- rcc/feed/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rcc/feed/index.php b/rcc/feed/index.php index f98b79b..7c399c2 100644 --- a/rcc/feed/index.php +++ b/rcc/feed/index.php @@ -6,13 +6,13 @@ * @package Rcc * @author Marcel Kapfer (mmk2410) * @license MIT License - * @link https://github.com/mmk2410/rangitaki + * @link https://gitlab.com/mmk2410/rangitaki * * Feed Generator * * The MIT License * - * Copyright 2015 mmk2410. + * Copyright 2015 - 2016 (c) mmk2410. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From 6d1a7c7e09e2552f36127ad2569f8270cbf00660 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 15:30:41 +0200 Subject: [PATCH 4/7] feed: New dependencies, YAML config --- rcc/feed/index.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rcc/feed/index.php b/rcc/feed/index.php index 7c399c2..461be03 100644 --- a/rcc/feed/index.php +++ b/rcc/feed/index.php @@ -36,14 +36,20 @@ date_default_timezone_set('UTC'); require "../../vendor/autoload.php"; -require_once "../../config.php"; +require "../../res/php/Config.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(); if ($_SESSION['login']) { - $art_dir = "./../../articles/" . $_GET['blog'] . "/"; $feed_path = "./../../feed/" . $_GET['blog'] . ".atom"; From f1cfc0c08c2283a1eaf8c17c1b22d2bcf94c7321 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 15:31:37 +0200 Subject: [PATCH 5/7] feed: Switched to new PicoFeed implementation --- rcc/feed/index.php | 83 +++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 23 deletions(-) diff --git a/rcc/feed/index.php b/rcc/feed/index.php index 461be03..ed7e56a 100644 --- a/rcc/feed/index.php +++ b/rcc/feed/index.php @@ -53,16 +53,18 @@ if ($_SESSION['login']) { $art_dir = "./../../articles/" . $_GET['blog'] . "/"; $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; - $writer->site_url = $blogurl; - $writer->feed_url = $blogurl . "/feed/" . $_GET['blog'] . ".atom"; - $writer->author = array( - 'name' => $blogauthor, - 'url' => $blogurl, - 'email' => '' - ); + $feedBuilder = AtomFeedBuilder::create() + ->withTitle($blogtitle) + ->withAuthor($settings['blog']['author']) + ->withFeedUrl($settings['blog']['url'] . "/feed/" . $_GET['blog'] . ".atom") + ->withSiteUrl($settings['blog']['url']) + ->withDate(new DateTime(date(DATE_ATOM))); $articles = scandir($art_dir, 1); @@ -77,25 +79,45 @@ if ($_SESSION['login']) { $text = Parsedown::instance() ->setBreaksEnabled(true)// with linebreaks ->text($file); - $writer->items[] = array( - 'title' => ArticleGenerator::getTitle($art_dir, $article), - 'updated' => strtotime( - ArticleGenerator::getDate($art_dir . $article) - ), - 'url' => $blogurl . "./?article=" . - substr($article, 0, strlen($article) - 3), - 'summary'=> ArticleGenerator::getSummary( - $art_dir, $article - ), - 'content' => $text - ); + if (new DateTime(date(DATE_ATOM, strtotime($datestring))) != null) { + $date = new DateTime( + date( + DATE_ATOM, + strtotime($datestring) + ) + ); + } else { + $date = new DateTime(date(DATE_ATOM)); + } + $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; } } } - $feed = $writer->execute(); + $feed = $feedBuilder->build(); $file = fopen($feed_path, "w"); @@ -108,4 +130,19 @@ if ($_SESSION['login']) { 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; +} From e994eb074a13110bf9d76841370dfc12f90b1ca6 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 16:39:47 +0200 Subject: [PATCH 6/7] Update Script for 1.4.4 --- update-scripts/1-4-3_1-4-4.sh | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 update-scripts/1-4-3_1-4-4.sh diff --git a/update-scripts/1-4-3_1-4-4.sh b/update-scripts/1-4-3_1-4-4.sh new file mode 100755 index 0000000..1573ae3 --- /dev/null +++ b/update-scripts/1-4-3_1-4-4.sh @@ -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" From 39f022d2ddcadbcb309700cc6bdab7eb446f1ed7 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 3 Jun 2016 16:41:53 +0200 Subject: [PATCH 7/7] Version bump to 1.4.4 --- CHANGELOG.md | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 264e7cf..32a0eb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,15 @@ - [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] - **[FIX]** Missing space in drawer between "Blogs on" and blogname - **[FIX]** Background layer was not removed if drawer was closed - **[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 - ## Version 1.4.2 (2016-05-18) [S] - [FIX]: Password verification not implemented in RCC login page diff --git a/package.json b/package.json index a89095f..9f99af3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rangitaki", - "version": "1.4.3", + "version": "1.4.4", "description": "A simple PHP blogging engine without any database dependencies", "main": "index.php", "scripts": {