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/
.idea/
completer.hist
feed/
/feed/
node_modules/

View File

@ -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

View File

@ -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": {

View File

@ -6,13 +6,13 @@
* @package Rcc
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @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
@ -36,27 +36,35 @@
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";
$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);
@ -71,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");
@ -102,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;
}

View File

@ -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();

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"