diff --git a/.gitignore b/.gitignore index 87a12bb..3189517 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ nbproject/ .idea/ completer.hist +feed/ +node_modules/ diff --git a/CHANGELOG.txt b/CHANGELOG.md similarity index 61% rename from CHANGELOG.txt rename to CHANGELOG.md index 570f655..b914f39 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.md @@ -1,24 +1,54 @@ -[S] = stable release -[B] = beta release -[D] = development release +# Changelog -[S] release are always compared to the previous [S] release. + - [S] = stable release + - [B] = beta release + - [D] = development release -Version 1.3.0 (2016-02-16) [S] -============= + - [S] release are always compared to the previous [S] release. + +## Version 1.4.0 (2016-05-07) [S] + + - Fix: Feeds contain no text + - Switch to YAML as config language + - Scripts for + - Switching from config.php to config.yaml + - Initializing RCC + - Initializing Rangitaki + - Rangitaki API + - Switch from JavaScript to CoffeeScript + - Switch from CSS to SASS + - Building and minimizing with Gulp + - Open links in articles in a new tab + - Better code style: PSR-2 + +## Version 1.4.0-beta (2016-04-27) [B] + + - Fix: Feeds contain no text + - Switch to YAML as config language + - Scripts for + - Switching from config.php to config.yaml + - Initializing RCC + - Initializing Rangitaki + - Rangitaki API + - Switch from JavaScript to CoffeeScript + - Switch from CSS to SASS + - Building and minimizing with Gulp + - Open links in articles in a new tab + - Better code style: PSR-2 + + +## Version 1.3.0 (2016-02-16) [S] - Respecting do-not-track - Atom feed - Title fix - Switch to composer -Version 1.2.1 (2016-01-11) [S] -============= +## Version 1.2.1 (2016-01-11) [S] - Support for PHP 7 -Version 1.2.0 (2015-12-24) [S] -============= +## Version 1.2.0 (2015-12-24) [S] - Pagination: Split your blog posts over several page - JavaScript Extension Support @@ -27,20 +57,17 @@ Version 1.2.0 (2015-12-24) [S] - RCC: Upload Media - RCC: Edit Posts -Version 1.1.90 (2015-12-21) [B] -============== +## Version 1.1.90 (2015-12-21) [B] - BUGFIX: ArticleGenerator error when no tags set - Pagination: Localized strings -Version 1.1.2 (2015-12-20) [D] -============= +## Version 1.1.2 (2015-12-20) [D] - Pagination - Code style imporvements -Version 1.1.1 (2015-12-07) [D] -============= +## Version 1.1.1 (2015-12-07) [D] - BUGFIX: RCC: new post: post title was the blog title - BUGFIX: RCC: new post filename just the date without the time. @@ -50,8 +77,7 @@ Version 1.1.1 (2015-12-07) [D] - RCC: Delete posts - RCC: Edit posts -Version 1.1.0 (2015-11-22) [D] -============= +## Version 1.1.0 (2015-11-22) [D] - RCC: Write blog posts - RCC: Media Upload @@ -61,8 +87,7 @@ Version 1.1.0 (2015-11-22) [D] - Metatags / Title based on subblog and / or article - Update script -Version 1.0.0 (2015-08-22) [S] -============= +## Version 1.0.0 (2015-08-22) [S] - Post writing in Markdown with a few keywords for the title, tags, date and the author (all optional) - Multiple blogs @@ -82,8 +107,7 @@ Version 1.0.0 (2015-08-22) [S] - Rangitaki Control Center (aka RCC; optional, Read the RCC Documentation) - Online post upload -Version 0.9.0 (2015-07-25) [B] -============= +## Version 0.9.0 (2015-07-25) [B] - BUGFIX: 'Blogs of {BLOG NAME}' always shown (even if there are no other blogs) - pictures in articles not centred @@ -91,53 +115,46 @@ Version 0.9.0 (2015-07-25) [B] - Localization strings are now grouped in one array - Better code (in some parts) -Version 0.8.0 (2015-07-14) [B] -============= +## Version 0.8.0 (2015-07-14) [B] + - Bugfixes and other improvements -Version 0.7.0 (2015-07-05) [D] -============= +## Version 0.7.0 (2015-07-05) [D] -Version 0.6.0 (2015-07-03) [D] -============= +## Version 0.6.0 (2015-07-03) [D] - Localization support. More information will follow soon - Theme support. More information will follow (hopefully) soon - Various improvements (Check the commits for more) -Version 0.5.0 (2015-06-16) [D] -============= +## Version 0.5.0 (2015-06-16) [D] - Improvements to the Rangitaki Control Center (rcc) - Material Design (Blog and rcc) -Version 0.4 (2015-06-14) [D] -=========== +## Version 0.4 (2015-06-14) [D] - Multiple Blogs - Online post upload (optional) - Tags - Author -Version 0.3 (2015-06-11) [D] -=========== +## Version 0.3 (2015-06-11) [D] - Portation of all main features of Version 0.2.2 - Code highlighting -The first release with the name Rangitaki. -The following releases are of pBlog. +*The first release with the name Rangitaki. +The following releases are of pBlog.* -Version 0.2.2 (2015-05-13) [S] -============= +## Version 0.2.2 (2015-05-13) [S] - Links are now underlined, when you hover over them - Simplified it to add the disqus comments - Added and configuration option for setting a favicon - Added the option to use Google Analytics -Version 0.2.1 / pBlog 2.1 (2015-03-29) [S] -============= +## Version 0.2.1 / pBlog 2.1 (2015-03-29) [S] - Fix problems when creating article links diff --git a/LICENSE b/LICENSE index 48a1619..218f258 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Marcel Kapfer +Copyright (c) 2015 - 2016 Marcel Kapfer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bin/config.php b/bin/config.php new file mode 100644 index 0000000..05f4535 --- /dev/null +++ b/bin/config.php @@ -0,0 +1,67 @@ + array( + "title" => $blogtitle, + "author" => $blogauthor, + "description" => $blogdescription, + "home" => $bloghome, + "homeurl" => $bloghomeurl, + "homename" => $bloghomename, + "mainname" => $blogmainname, + "intro" => $blogintro, + "disqus" => $blogdisqus, + "analytics" => $bloganalytics, + "footer" => $blogfooter, + "url" => $blogurl + ), + "design" => array( + "fab" => $sharefab, + "drawer" => $nav_drawer, + "theme" => $theme, + "pagination" => $pagination, + "favicon" => $favicon, + ), + "rcc" => array( + "rcc" => "off", + "api" => "off", + ), + "language" => $language, +); + +$config = new Config('config.yaml', 'vendor/autoload.php'); + +if ($config->writeConfig($yaml)) { + echo "YAML config saved.\nYou can delete the config.php file\n"; +} else { + echo "Failed to save YAML config."; +} diff --git a/bin/init.php b/bin/init.php new file mode 100644 index 0000000..f38a892 --- /dev/null +++ b/bin/init.php @@ -0,0 +1,107 @@ +getConfig(); +} + +// blog part +$yaml["blog"]["title"] = get("Title of your blog", $yaml["blog"]["title"], "Example Blog"); +$yaml["blog"]["author"] = get("Your name:", $yaml["blog"]["author"], "John"); +$yaml["blog"]["description"] = get("A description of your blog:", $yaml["blog"]["description"], "A short description of your blog"); +$yaml["blog"]["home"] = getBool("Do you have a top site? (on/off)", $yaml["blog"]["home"], "on"); +if ($yaml["blog"]["home"] == "on") { + $yaml["blog"]["homeurl"] = get("Path / Url to home page", $yaml["blog"]["homeurl"], "../"); + $yaml["blog"]["homename"] = get("Name of your home page", $yaml["blog"]["homename"], "Home"); +} +$yaml["blog"]["mainname"] = get("Name of the main blog (if empty, the blog title will be used)", ""); +$yaml["blog"]["intro"] = getBool("Do you want a blog intro text? (on/off)", $yaml["blog"]["intro"], "on"); +$yaml["blog"]["disqus"] = get("Your Disqus shortname (Leave empty to disable)", $yaml["blog"]["disqus"], ""); +$yaml["blog"]["analytics"] = get("Google Analytics ID (Leave empty to disable)", $yaml["blog"]["analytics"], ""); +$yaml["blog"]["footer"] = get("The footer of your blog", $yaml["blog"]["footer"], "Example Blog 2016 CC-BY-SA 4.0"); + +// design part +$yaml["design"]["fab"] = getBool("Would you like to use the share buttons (on/off)", $yaml["design"]["blog"], "on"); +$yaml["design"]["drawer"] = getBool("Would you like the use the navigation drawer? (on/off)", $yaml["design"]["drawer"], "on"); +$themes = getDir('./themes'); +$yaml["design"]["theme"] = get("Which theme would you like to use? (" . $themes . ")", $yaml["design"]["theme"], "material-light"); +$yaml["design"]["pagination"] = + get("Which posts should be displayed on one page (0 to disable)", $yaml["design"]["pagination"], "0"); +$yaml["design"]["favicon"] = get("URL to your favicon", $yaml["design"]["favicon"], "https://example.com/fav.ico"); + +// rcc +$yaml["rcc"]["rcc"] = "off"; +$yaml["rcc"]["api"] = "off"; + +// languages +$langs = getDir('./lang'); +$yaml["language"] = get("Choose a language (" . $langs . ")", $yaml["language"], "en"); + +$config->writeConfig($yaml); + +function get($question, $value, $default) +{ + if (isset($value) && $value != "") { + $input = readline($question . " (" . $value . "): "); + if ($input == "") { + return $value; + } else { + return $input; + } + } else { + $input = readline($question . " (" . $default . ")" . ": "); + if ($input == "") { + return $default; + } else { + return $input; + } + } +} + +function getBool($question, $value, $default) +{ + if (isset($value) && $value != "") { + $input = "someval"; + while (!in_array($input, array("on", "off", ""))) { + $input = readline($question . " (" . $value . "): "); + } + if ($input == "") { + return $value; + } else { + return $input; + } + } else { + $input = ""; + while (!in_array($input, array("on", "off"))) { + $input = readline($question . " (" . $default . ")" . ": "); + } + if ($input == "") { + return $default; + } else { + return $input; + } + } + +} + +function getDir($path) +{ + $dir = scandir($path, SCANDIR_SORT_DESCENDING); + + unset($dir[sizeof($dir) - 1]); + unset($dir[sizeof($dir) - 1]); + + return implode(", ", $dir); +} diff --git a/bin/init_rcc.php b/bin/init_rcc.php new file mode 100644 index 0000000..54f236f --- /dev/null +++ b/bin/init_rcc.php @@ -0,0 +1,70 @@ +getConfig(); + +$rccOn = ""; + +while (!(in_array($rccOn, array("y", "Y", "n", "N")))) { + $rccOn = readline("Enable RCC: (y/n) "); +} + +if (in_array($rccOn, array("y", "Y"))) { + $yaml["rcc"]["rcc"] = "on"; +} else { + $yaml["rcc"]["rcc"] = "off"; +} + +$apiOn = ""; + +while (!(in_array($apiOn, array("Y", "y", "n", "N")))) { + $apiOn = readline("Enable RCC API: (y/n) "); +} + +if (in_array($apiOn, array("y", "Y"))) { + $yaml["rcc"]["api"] = "on"; +} else { + $yaml["rcc"]["api"] = "off"; +} + +$config = new Config('config.yaml', 'vendor/autoload.php'); + +if ($config->writeConfig($yaml)) { + echo "Changes saved.\n"; +} else { + echo "Failed to save changes.\n"; +} diff --git a/composer.json b/composer.json index 32d27af..f730591 100644 --- a/composer.json +++ b/composer.json @@ -4,12 +4,15 @@ "type": "project", "require": { "erusev/parsedown": "^1.6", - "fguillot/picofeed": "^0.1.18" + "fguillot/picofeed": "^0.1.18", + "slim/slim": "^3.0", + "symfony/yaml": "^3.0", + "codeguy/upload": "^1.3" }, "license": "MIT License", "authors": [ { - "name": "mmk2410", + "name": "Marcel Kapfer (mmk2410)", "email": "marcelmichaelkapfer@yahoo.co.nz" } ], diff --git a/composer.lock b/composer.lock index 9f712e5..278d103 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,132 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4f3494edee00a6dd92be308e4f860622", - "content-hash": "d93c93221ea797a445a0313f18feccda", + "hash": "bf0772b9501ce6231c06bfbcdb671d1d", + "content-hash": "49b3f5550e60b62ffeb5306a75a87d97", "packages": [ + { + "name": "bshaffer/oauth2-server-php", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/bshaffer/oauth2-server-php.git", + "reference": "058c98f73209f9c49495e1799d32c035196fe8b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bshaffer/oauth2-server-php/zipball/058c98f73209f9c49495e1799d32c035196fe8b8", + "reference": "058c98f73209f9c49495e1799d32c035196fe8b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "suggest": { + "aws/aws-sdk-php": "~2.8 is required to use the DynamoDB storage engine", + "firebase/php-jwt": "~2.2 is required to use JWT features", + "predis/predis": "Required to use the Redis storage engine", + "thobbs/phpcassa": "Required to use the Cassandra storage engine" + }, + "type": "library", + "autoload": { + "psr-0": { + "OAuth2": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brent Shaffer", + "email": "bshafs@gmail.com", + "homepage": "http://brentertainment.com" + } + ], + "description": "OAuth2 Server for PHP", + "homepage": "http://github.com/bshaffer/oauth2-server-php", + "keywords": [ + "auth", + "oauth", + "oauth2" + ], + "time": "2015-09-18 18:05:10" + }, + { + "name": "codeguy/upload", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/codeguy/Upload.git", + "reference": "6a9e5e1fb58d65346d0e557db2d46fb25efd3e37" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/codeguy/Upload/zipball/6a9e5e1fb58d65346d0e557db2d46fb25efd3e37", + "reference": "6a9e5e1fb58d65346d0e557db2d46fb25efd3e37", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "Upload": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "info@joshlockhart.com", + "homepage": "http://www.joshlockhart.com/" + } + ], + "description": "Handle file uploads with extensible validation and storage strategies", + "homepage": "http://github.com/codeguy/Upload", + "keywords": [ + "file", + "upload", + "validation" + ], + "time": "2013-07-07 17:01:41" + }, + { + "name": "container-interop/container-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "time": "2014-12-30 15:22:37" + }, { "name": "erusev/parsedown", "version": "1.6.0", @@ -48,16 +171,16 @@ }, { "name": "fguillot/picofeed", - "version": "v0.1.18", + "version": "v0.1.23", "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "8f776343b0dada397c2a950a7c3f7be57442fa35" + "reference": "a7c3d420c239fe9ffc39b0d06b6e57db39ce3797" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/8f776343b0dada397c2a950a7c3f7be57442fa35", - "reference": "8f776343b0dada397c2a950a7c3f7be57442fa35", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/a7c3d420c239fe9ffc39b0d06b6e57db39ce3797", + "reference": "a7c3d420c239fe9ffc39b0d06b6e57db39ce3797", "shasum": "" }, "require": { @@ -92,7 +215,261 @@ ], "description": "Modern library to handle RSS/Atom feeds", "homepage": "https://github.com/fguillot/picoFeed", - "time": "2016-02-09 02:49:54" + "time": "2016-04-17 22:31:55" + }, + { + "name": "nikic/fast-route", + "version": "v0.6.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "31fa86924556b80735f98b294a7ffdfb26789f22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/31fa86924556b80735f98b294a7ffdfb26789f22", + "reference": "31fa86924556b80735f98b294a7ffdfb26789f22", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "time": "2015-06-18 19:15:47" + }, + { + "name": "pimple/pimple", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2015-09-11 15:10:35" + }, + { + "name": "psr/http-message", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2015-05-04 20:22:00" + }, + { + "name": "slim/slim", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "939f2e85d57508de9cff241d10091cd972f221c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/939f2e85d57508de9cff241d10091cd972f221c3", + "reference": "939f2e85d57508de9cff241d10091cd972f221c3", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "nikic/fast-route": "^0.6", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "http://slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "time": "2016-03-10 21:37:40" + }, + { + "name": "symfony/yaml", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "0047c8366744a16de7516622c5b7355336afae96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0047c8366744a16de7516622c5b7355336afae96", + "reference": "0047c8366744a16de7516622c5b7355336afae96", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-03-04 07:55:57" }, { "name": "zendframework/zendxml", diff --git a/config.php b/config.php deleted file mode 100644 index af390bf..0000000 --- a/config.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @license MIT License - * @link http://marcel-kapfer.de/rangitaki - */ - -// Blog Title / Set here an individual title of yourblog by replacing -// Rangitaki Blog with it. -$blogtitle = 'Example Blog'; - -// Blog Author - Set here your name -$blogauthor = 'John'; - -// Blog description -$blogdescription = 'A short description of your blog'; - -// Home - set yes if you want to link to your homepage and no if not -$bloghome = 'yes'; - -// Home URL - Set here the url to your main page. Either as a path (e.g. '../') -// or as an url (e.g. 'http://github.com') -$bloghomeurl = '../'; - -// Home name - Set here an individual name for your main page -$bloghomename = 'Home'; - -// Main Blog name -> Set a specific name for your main blog -// This value is empty by default -$blogmainname = ''; - -// Intro - set yes if you have a blog intro and no if you don't have one -$blogintro = 'yes'; - -// Disqus - Provide here your Disqus shortname. Leave empty if you don't -// want to use it. -$blogdisqus = 'rangitaki'; - -// Share FAB - this enables or disables the share button -$sharefab = 'yes'; - -// Google Analytics - Provide here your Google Analytics Tracking-ID. Leave -// empty if you don't want to use it. -$bloganalytics = ''; - -// Footer - set here the text for your footer (e.g. a copyright info). You can -// replace the whole text after the '=' with your own one. -$blogfooter = 'Rangitaki ' . date("Y") . - ' - github.com/mmk2410/Rangitaki'; - -// This enables the optional rangitaki control center. Please read the -// documentation before you enable it. -$rcc = 'yes'; - -// Here you can disable and enable the navigation menu. Usefull if you have -// no subblogs and no home directory -$nav_drawer = 'yes'; - -// Set here the name of your theme. Read the documentation for more themes -$theme = 'material-light'; - -// Set here your language. The file must exist in the lang directory -$language = "en"; - -// pagination: how many articles should be on one page -// set to 0 to disable it -$pagination = 0; - -// Favicon - Set here the path to your favicon -$favicon = "http://example.com/res/img/favicon.png"; - -// Blog url - set here the blog url -$blogurl = "https://example.com/blog/"; diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..818a280 --- /dev/null +++ b/config.yaml @@ -0,0 +1,23 @@ +blog: + title: 'Example Blog' + author: John + description: 'A short description of your blog' + home: 'on' + homeurl: ../ + homename: Home + mainname: '' + intro: 'on' + disqus: rangitaki + analytics: '' + footer: "Rangitaki 2016 \n github.com/mmk2410/Rangitaki" + url: 'https://example.com/blog/' +design: + fab: 'on' + drawer: 'on' + theme: material-light + pagination: 0 + favicon: 'http://example.com/res/img/favicon.png' +rcc: + rcc: 'on' + api: 'on' +language: en diff --git a/extensions/example.js b/extensions/example.js index 3219b03..fdb3e77 100644 --- a/extensions/example.js +++ b/extensions/example.js @@ -1,11 +1 @@ -/** - * Created by mmk2410 on 12/5/15. - * - * Example JavaScript file to demonstrate the rangitaki extension support - */ - -function main() { - console.log("Welcome Developer! \nYou're seeing the output of a javascript extension for the rangitaki blogging engine.") -} - -$(document).ready(main()); +(function(){var e;e=function(){return console.log("Welcome Developer! \nYou're seeing the output of a\nJavaScript extension for the Rangitaki blogging engine.")},$(document).ready(e())}).call(this); \ No newline at end of file diff --git a/gulpfile.coffee b/gulpfile.coffee new file mode 100644 index 0000000..6d428cb --- /dev/null +++ b/gulpfile.coffee @@ -0,0 +1,67 @@ +### + +2015 - 2016 (c) by Marcel Kapfer (mmk2410) + +Licensed under MIT License + +Rangitaki Gulp File + +### + +gulp = require 'gulp' +sass = require 'gulp-sass' +sourcemaps = require 'gulp-sourcemaps' +minifyCss = require 'gulp-csso' +coffee = require 'gulp-coffee' +coffeelint = require 'gulp-coffeelint' +uglify = require 'gulp-uglify' +merge = require 'merge-stream' +del = require 'del' +size = require 'gulp-size' + +gulp.task 'coffee', -> + main = gulp.src './src/coffee/*.coffee' + .pipe coffeelint() + .pipe coffeelint.reporter() + .pipe coffee() + .pipe uglify() + .pipe gulp.dest './res/js/' + + extensions = gulp.src './src/coffee-extensions/*.coffee' + .pipe coffeelint() + .pipe coffeelint.reporter() + .pipe coffee() + .pipe uglify() + .pipe gulp.dest './extensions/' + + merge(main, extensions) + .pipe size {title: 'Coffee'} + +gulp.task 'sass', -> + main = gulp.src './src/sass/*.sass' + .pipe sourcemaps.init() + .pipe sass { + outputStyle: 'compressed' + } + .pipe sourcemaps.write './' + .pipe gulp.dest './res/css/' + + theme = gulp.src './src/sass-themes/*.sass' + .pipe sourcemaps.init() + .pipe sass { + outputStyle: 'compressed' + } + .pipe sourcemaps.write './' + .pipe gulp.dest './themes/' + + merge(theme, main) + .pipe size {title: 'SASS'} + +gulp.task 'clean', del.bind null, ['res/css/no-nav.css', 'res/css/rangitaki.css', 'themes/', 'res/js/app.js'] + +gulp.task 'init', ['coffee', 'sass'] + +gulp.task 'default', -> + gulp.watch './src/**/*.sass', ['sass'] + gulp.watch './src/**/*.coffee', ['coffee'] + diff --git a/index.php b/index.php index d22c4de..d2ae689 100644 --- a/index.php +++ b/index.php @@ -1,15 +1,11 @@ - getConfig(); + +require './lang/' . $config["language"] . ".php"; // Language file require_once 'res/php/ArticleGenerator.php'; // The article generator require_once './res/php/BlogListGenerator.php'; // and the blog list generator @@ -42,16 +44,16 @@ $url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") . $pagenumber = filter_input(INPUT_GET, "page"); // get the pagenumber // Pagination algorithm -if ($pagination == 0) { - $pagination = false; +if ($config["design"]["pagination"] == 0) { + $config["design"]["pagination"] = false; } else { // pag_max: the newest post to show on a page - $pag_max = $pagination * ( $pagenumber + 1 ); + $pag_max = $config["design"]["pagination"] * ( $pagenumber + 1 ); // pag_min: the oldest post to show on a page - $pag_min = $pag_max - $pagination; + $pag_min = $pag_max - $config["design"]["pagination"]; if ($pagenumber > 0) { // Disable the blog intro if not on first page - $blogintro = "no"; + $config["blog"]["intro"] = "off"; } } @@ -72,10 +74,10 @@ if (isset($getarticle)) { = ArticleGenerator::getTitle($articlesdir, $getarticle . '.md'); } // Make sure that the entry has a title, because main.md hasn't one -if (empty($blogmainname)) { - $blogmaintitle = $blogtitle; +if (empty($config["blog"]["mainname"])) { + $blogmaintitle = $config["blog"]["title"]; } else { - $blogmaintitle = $blogmainname; + $blogmaintitle = $config["blog"]["mainname"]; } if (isset($getblog)) { $subblogtitle = BlogListGenerator::getName('./blogs/' . $getblog . '.md'); @@ -90,18 +92,18 @@ if (isset($getarticle)) { } // url of the feed -$feedurl = $blogurl . "/feed/" . $blog . ".atom"; +$feedurl = $config["blog"]["url"] . "/feed/" . $blog . ".atom"; ?> - <?php echo $blogtitle . " » " .$hd_subblog_title; ?> + <?php echo $config["blog"]["title"] . " » " .$hd_subblog_title; ?> + content=""/> + content=""/> "/> + - - + + + href="themes/.css"/> - + href=""/> + @@ -160,7 +162,7 @@ $feedurl = $blogurl . "/feed/" . $blog . ".atom"; skip it -if ($nav_drawer == "yes") { +if ($config["design"]["drawer"] == "on") { ?> - + @@ -276,7 +278,7 @@ if ($nav_drawer == "yes") { // Blog Intro text if (file_exists("blogs/$blog.md") && $getarticle == "" - && $blogintro == "yes" + && $config["blog"]["intro"] == "on" && $gettag == "" ) { // only shown if not in article or tag view @@ -292,11 +294,11 @@ if ($nav_drawer == "yes") { ?>
- setBreaksEnabled(true)// with linebreaks - ->text($file); - echo $intro; // PRINTS THE SH**** + setBreaksEnabled(true)// with linebreaks + ->text($file); + echo $intro; // PRINTS THE SH**** ?>
@@ -332,7 +334,7 @@ if ($nav_drawer == "yes") { // check if the file is a article file if (strlen($article) >= 3 && substr($article, -3) == ".md") { // generate the article - if ($pagination) { + if ($config["design"]["pagination"]) { if ($posts_amount < $pag_max && $posts_amount >= $pag_min) { ArticleGenerator::newArticle( $articlesdir, $article, $getblog @@ -346,7 +348,7 @@ if ($nav_drawer == "yes") { } $posts_amount++; } - if ($pagination) { + if ($config["design"]["pagination"]) { include './res/php/Pagination.php'; } } elseif (isset($getarticle)) { // ARTICLE VIEW @@ -360,16 +362,16 @@ if ($nav_drawer == "yes") { } ?>
: &t=' target="blank"> diff --git a/package.json b/package.json new file mode 100644 index 0000000..e0379b9 --- /dev/null +++ b/package.json @@ -0,0 +1,35 @@ +{ + "name": "rangitaki", + "version": "1.4.0", + "description": "A simple PHP blogging engine without any database dependencies", + "main": "index.php", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@gitlab.com/mmk2410/rangitaki.git" + }, + "keywords": [ + "blogging", + "php" + ], + "author": "Marcel Kapfer (mmk2410)", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/mmk2410/rangitaki/issues" + }, + "homepage": "https://gitlab.com/mmk2410/rangitaki#README", + "devDependencies": { + "del": "^2.2.0", + "gulp": "^3.9.1", + "gulp-coffee": "^2.3.2", + "gulp-coffeelint": "^0.6.0", + "gulp-csso": "^2.0.0", + "gulp-sass": "^2.3.1", + "gulp-size": "^2.1.0", + "gulp-sourcemaps": "^2.0.0-alpha", + "gulp-uglify": "^1.5.3", + "merge-stream": "^1.0.0" + } +} diff --git a/rcc/api/auth/DigestAuth.php b/rcc/api/auth/DigestAuth.php new file mode 100644 index 0000000..ed3ea1d --- /dev/null +++ b/rcc/api/auth/DigestAuth.php @@ -0,0 +1,52 @@ + + * @license MIT License + * @link http://marcel-kapfer.de/rangitaki + */ +namespace mmk2410\rbe\digestAuth; + +/** + * PHP Version 7 + * + * Authentication Helper Class + * + * @category Authentication + * @package Rbe + * @author Marcel Kapfer (mmk2410) + * @license MIT License + * @link http://marcel-kapfer.de/rangitaki + */ +class DigestAuth +{ + + /** + * parser for http digest + * + * @param $txt data to parse + * + * @return parsed data or FALSE + */ + public function httpDigestParse($txt) + { + // protect against missing data + $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1); + $data = array(); + $keys = implode('|', array_keys($needed_parts)); + + preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER); + + foreach ($matches as $m) { + $data[$m[1]] = $m[3] ? $m[3] : $m[4]; + unset($needed_parts[$m[1]]); + } + + return $needed_parts ? false : $data; + } +} diff --git a/rcc/api/auth/auth.php b/rcc/api/auth/auth.php new file mode 100644 index 0000000..f02646e --- /dev/null +++ b/rcc/api/auth/auth.php @@ -0,0 +1,39 @@ + $password); + +if (empty($_SERVER['PHP_AUTH_DIGEST'])) { + header('HTTP/1.1 401 Unauthorized'); + header('WWW-Authenticate: Digest realm="'.$realm. + '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"'); + + die('Access to RCC API not granted'); +} + + +// analyze the PHP_AUTH_DIGEST variable +if (!($data = DigestAuth::httpDigestParse($_SERVER['PHP_AUTH_DIGEST'])) || + !isset($users[$data['username']])) { + die('Wrong Credentials!'); +} + + +// generate the valid response +$A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]); +$A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']); +$valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2); + +if ($data['response'] != $valid_response) { + die('Wrong Credentials!'); +} diff --git a/rcc/api/list/index.php b/rcc/api/list/index.php new file mode 100644 index 0000000..287f073 --- /dev/null +++ b/rcc/api/list/index.php @@ -0,0 +1,59 @@ +getConfig(); + +if ($settings["rcc"]["api"] == "on" && $settings["rcc"]["rcc"] == "on") { + $app = new \Slim\App(); + + /** + * api for get the list of blogs and if $_GET["blog"] is set the list of + * blogs posts in that blog + * + * @param string $_GET["blog"] optional name of the blog + * + * @return JSON json string containing the blogs / blog posts + */ + $app->get('/', function (Request $request, Response $response) { + $blog = $_GET["blog"]; + + + if (!isset($blog)) { + $files = scandir('../../../blogs/', SCANDIR_SORT_DESCENDING); + + unset($files[sizeof($files) - 1]); + unset($files[sizeof($files) - 1]); + + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($files, 201); + return $response; + } + + $path = "../../../articles/" . $blog . "/"; + + $files = scandir($path, SCANDIR_SORT_DESCENDING); + + unset($files[sizeof($files) - 1]); + unset($files[sizeof($files) - 1]); + + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($files, 201); + + return $response; + }); + + $app->run(); +} diff --git a/rcc/api/media/index.php b/rcc/api/media/index.php new file mode 100644 index 0000000..fd6804c --- /dev/null +++ b/rcc/api/media/index.php @@ -0,0 +1,48 @@ +getConfig(); + +if ($settings["rcc"]["api"] == "on" && $settings["rcc"]["rcc"] == "on") { + $app = new \Slim\App(); + + /** + * api for uploading files + * + * @return JSON json string with status + */ + $app->post('/', function (Request $request, Response $response) { + $storage = new \Upload\Storage\FileSystem('../../../media/'); + $file = new \Upload\File('file', $storage); + + try { + $file->upload(); + $data = array("code" => 201); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 201); + } catch (\Exception $e) { + $errors = $file->getErrors(); + $data = array("code" => 500, "error" => $Errors); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 500); + } + + return $response; + }); + + $app->run(); +} diff --git a/rcc/api/post/index.php b/rcc/api/post/index.php new file mode 100644 index 0000000..cc04e70 --- /dev/null +++ b/rcc/api/post/index.php @@ -0,0 +1,141 @@ +getConfig(); + +if ($settings["rcc"]["api"] == "on" && $settings["rcc"]["rcc"] == "on") { + $app = new \Slim\App(); + + /** + * api for fetching a blog post + * + * @param string $_GET["blog"] name of the blog + * @param string $_GET["post"] filename of the blog post + * + * @return JSON json string containing the blog post + */ + $app->get('/', function (Request $request, Response $response) { + $blog = $_GET["blog"]; + $post = $_GET["post"]; + + if (!isset($blog) || !isset($post)) { + $data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'Not enough arguments'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 400); + return $response; + } + + $path = "../../../articles/" . $blog . "/"; + $data = + ArticleGenerator::getArray($path, $post); + + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 201); + + return $response; + }); + + /** + * api for changing/creating a blog post + * + * @param string $_POST["data"] all data + */ + $app->post('/', function (Request $request, Response $response) { + $blog = $_POST["blog"]; + $post = $_POST["post"]; + $title = $_POST["title"]; + $author = $_POST["author"]; + $date = $_POST["date"]; + $tags = $_POST["tags"]; + $text = $_POST["text"]; + + if (!isset($blog) || !isset($post) || (!isset($title) && !isset($text))) { + $data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'Not enough arguments'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 400); + return $response; + } + + $text = str_replace('\n', '
', $text); + + $md = << 201, 'status' => 'Post created successfully'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 201); + } else { + $data = array('code' => 500, 'status' => 'Internal server error'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 500); + } + + return $response; + }); + + /** + * api for deleting a blog post + * + * @param string $_GET["blog"] name of the blog + * @param string $_GET["post"] filename of the blog post + * + * @return JSON json string containing the blog post + */ + $app->delete('/', function (Request $request, Response $response) { + $blog = $_GET["blog"]; + $post = $_GET["post"]; + + if (!isset($blog) || !isset($post)) { + $data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'Not enough arguments'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 400); + return $response; + } + + $path = "../../../articles/$blog/$post"; + + if (!file_exists($path)) { + $data = array('code' => 400, 'status' => 'Bad Request', 'error' => 'No such file'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 400); + return $response; + } + + if (!unlink($path)) { + $data = array('code' => 500, 'status' => 'Bad Request', 'error' => 'Internal server error'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 500); + return $response; + } + + $data = array('code' => 201, 'status' => 'File successfully deleted'); + $response = $response->withHeader('Content-type', 'application/json'); + $response = $response->withJson($data, 201); + + return $response; + }); + + $app->run(); +} diff --git a/rcc/edit/index.php b/rcc/edit/index.php index 7875fe5..40b9dec 100644 --- a/rcc/edit/index.php +++ b/rcc/edit/index.php @@ -1,112 +1,172 @@ + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * Edit page of RCC (Rangitaki Control Center) + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ date_default_timezone_set('UTC'); ?> - + + Rangitaki Control Center - + + + + + + + + + + + - -
- + +
+ +
+
Edit Post
-

Title:

+ +

Title: +

+

-

Date:

+

Date: +

+

-

Author:

+

Author: +

+ +

-

Tags:

" - class="itextfield" name="tags" - id="tags"/>

+

Tags: +

+ " name="tags" id="tags"/> +

Text:

+

SAVE CHANGES +
+ +
+
Back
+

Go back to the RCC home. All changes will be lost.

+ BACK +
- + + +
+
Access denied
+

- The access to this area is not granted. Make sure you're logged in. + The access to this area is not granted. Make sure you're logged + in.

+ BACK +
- -
- - - - + + + +
+ + + + + diff --git a/rcc/feed/index.php b/rcc/feed/index.php index 9a35aa2..f98b79b 100644 --- a/rcc/feed/index.php +++ b/rcc/feed/index.php @@ -3,11 +3,13 @@ * PHP Version 7 * * @category Atom_Feed - * @package Rbe + * @package Rcc * @author Marcel Kapfer (mmk2410) * @license MIT License * @link https://github.com/mmk2410/rangitaki * + * Feed Generator + * * The MIT License * * Copyright 2015 mmk2410. @@ -49,7 +51,7 @@ if ($_SESSION['login']) { $writer->title = $blogtitle; $writer->site_url = $blogurl; - $writer->feed_url = $blogurl . "/feed/feed.atom"; + $writer->feed_url = $blogurl . "/feed/" . $_GET['blog'] . ".atom"; $writer->author = array( 'name' => $blogauthor, 'url' => $blogurl, @@ -65,6 +67,10 @@ if ($_SESSION['login']) { if ($amount == 10) { break; } else { + $file = ArticleGenerator::getText($art_dir, $article); + $text = Parsedown::instance() + ->setBreaksEnabled(true)// with linebreaks + ->text($file); $writer->items[] = array( 'title' => ArticleGenerator::getTitle($art_dir, $article), 'updated' => strtotime( @@ -73,11 +79,9 @@ if ($_SESSION['login']) { 'url' => $blogurl . "./?article=" . substr($article, 0, strlen($article) - 3), 'summary'=> ArticleGenerator::getSummary( - $art_dir, $articles + $art_dir, $article ), - 'content' => "

" . ArticleGenerator::getText( - $art_dir, $articles - ) . "

" + 'content' => $text ); $amount += 1; } @@ -88,11 +92,14 @@ if ($_SESSION['login']) { $feed = $writer->execute(); $file = fopen($feed_path, "w"); + if (fwrite($file, $feed) === false) { echo "-1"; exit; } + fclose($file); + echo "0"; } ?> diff --git a/rcc/index.php b/rcc/index.php index 9657df7..e7cdf75 100644 --- a/rcc/index.php +++ b/rcc/index.php @@ -1,207 +1,308 @@ + + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * Main page of RCC (Rangitaki Control Center) + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +?> + - Rangitaki Control Center - + + + + + + + + + + - -
+ + + +
+getConfig(); + +if ($config["rcc"]["rcc"] == "on") { + include 'password.php'; + session_start(); + + if (isset($_POST['passwd'])) { + $passwd = $_POST['passwd']; + $_SESSION['passwd'] = $_POST['passwd']; + } elseif (isset($_SESSION['passwd'])) { + $passwd = $_SESSION['passwd']; + } + + if ($passwd == "") { +?> + + +
+
Log In
+
+

Password: +

+ +

+ + +
+
+ -
-
Log In
-
-

Password:

- -
-
- -
-
Post Upload
-
- - - -
-
- -
-
-
-
New Post
-
-

Blog:

- - -

Title:

- -

Date:

- -

Author:

- -

Tags:

- -

Text:

- -

- -
-
-
-
Edit post
-

- First select the blog of the post you wan't to edit. -

- -

- -

- GET POSTS -
-
-
Delete Post
-

- First select the subblog of the post you want to delete. -

- -

- -

- GET POSTS -
-
-
Media Upload
-
- - -
-
- -
-
-
-
Atom Feed Generator
-

- -

- GENERATE -
- -
-
Wrong Password
-

- Please go back and try again. -

- GO BACK -
- + + +
+
Post Upload
+
+ + + + + +

+ + +
+
+ + +
+
New Post
+
+

Blog:

+ + +

Title: +

+ +

+ +

Date: +

+ +

+ +

Author: +

+ +

+ +

Tags: +

+ +

+ +

Text:

+ +

+ +
+
+ + +
+
Edit post
+

+ First select the blog of the post you wan't to edit. +

+ +

+ +

+ GET POSTS +
+ + +
+
Delete Post
+

+ First select the subblog of the post you want to delete. +

+ +

+ +

+ GET POSTS +
+ + +
+
Media Upload
+
+ + +

+ +
+
+ + +
+
Atom Feed Generator
+

+ +

+ GENERATE +
+ + + + +
+
Wrong Password
+

+ The entered password was wrong, please try again. +

+
+

Password: +

+ +

+ + +
+
+ + + +
Rangitaki Control Center

- The Rangitaki Control Center is disabled. You can enable it in - your config file. But please read first the documentation. + The Rangitaki Control Center is disabled. You can enable + it in your config file. But please read first the + documentation.

- -
-
Back
-

- Go back to your blog. -

- GO BACK -
-
- - - - - + + + +
+
Back
+

Go back to your blog.

+ GO BACK +
+
+ + + + + diff --git a/rcc/media/index.php b/rcc/media/index.php index 1e66ea8..db16346 100644 --- a/rcc/media/index.php +++ b/rcc/media/index.php @@ -1,60 +1,100 @@ + + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * Media page of RCC (Rangitaki Control Center) + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +?> + - - - - Rangitaki Control Center - - - - - -
-
-
File Upload
- You have to choose a file!

"; - } else { - $uploaddir = "../../media/"; - $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + + - if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { - echo "

The post was successfully uploaded and is now published.

"; - } else { - echo "

During the uploading process an error occured!
Error Code:" . ($_FILES['userfile']['error'] . "

"); - } - } - ?>GO BACK -
-
- + Rangitaki Control Center + + + + + + + + + + + + + + +
+ +
+
File Upload
+ +You have to choose a file!

"; + } else { + $uploaddir = "../../media/"; + $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + + if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { + echo + "

+ The post was successfully uploaded and is now published. +

"; + } else { + echo + "

During the uploading process an error occured!
+ Error Code:" + . ($_FILES['userfile']['error'] . "

"); + } + } +?> + + GO BACK + + + +
+
+ diff --git a/rcc/newpost/index.php b/rcc/newpost/index.php index 3d45780..526d3a8 100644 --- a/rcc/newpost/index.php +++ b/rcc/newpost/index.php @@ -1,54 +1,82 @@ + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * Newpost page of RCC (Rangitaki Control Center) + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ date_default_timezone_set('UTC'); ?> + - + Rangitaki Control Center - + + + + + + + + + + - -
-
-
New Post
- + Rangitaki Control Center +
+ +
+
+
New Post
+ +GO BACK -
-
+ $filename = date("Y-m-d-H-i-s") . ".md"; + $handle = fopen("../../articles/$blog/$filename", "c"); + fwrite($handle, $md); + if (fclose($handle)) { + echo "Post successfully published."; + } else { + echo "Some error happend, while publishing."; + } + ?> + + GO BACK + + + + +
diff --git a/rcc/password.php b/rcc/password.php index 973ada0..d267c54 100644 --- a/rcc/password.php +++ b/rcc/password.php @@ -1,3 +1,3 @@

"); - $("#delete_get_posts").after("

Now select the post you want to delete. " + - "Remember that once a post is deleted it can't be restored.

"); - $("#delete_select_post").append(""); + $("#delete_get_posts").after( + "

" + + "Now select the post you want to delete. " + + "Remember that once a post is deleted it can't be restored.

" + ); + $("#delete_select_post").append( + "" + ); + $.each($.parseJSON(data), function (index, value) { var post = value.substring(0, value.length - 3); - $("#delete_selected_post").append(""); + $("#delete_selected_post").append( + "" + ); }); - $("#delete_select_post").after("DELETE POST") + + $("#delete_select_post").after( + "DELETE POST" + ); }); }); @@ -37,10 +52,12 @@ function deletePostButton() { var selectedBlog = $("#delete_selected_blog").val(); var selectedPost = $("#delete_selected_post").val(); + $.get("res/delete_post.php", { blog: selectedBlog, post: selectedPost }, function (data) { + $("#delete_select_post").remove(); $("#delete_select_post_info").remove(); $("#delete_post_button").remove(); @@ -51,7 +68,10 @@ function deletePostButton() { } else if (data == "941") { alert("ERROR 941: No blog as get argument given"); } else if (data == "961") { - alert("ERROR 961: Error while deleting the file. Check if the web server has the permission to do so."); + alert( + "ERROR 961: Error while deleting the file. Check if the" + + "web server has the permission to do so." + ); } else if (data == "0") { alert("Post successfully deleted."); } @@ -59,4 +79,4 @@ function deletePostButton() { } -$(document).ready(main()); \ No newline at end of file +$(document).ready(main()); diff --git a/rcc/res/delete_post.php b/rcc/res/delete_post.php index 77b46ee..ac5450b 100644 --- a/rcc/res/delete_post.php +++ b/rcc/res/delete_post.php @@ -2,8 +2,35 @@ /** * PHP Version 7 * - * User: mmk2410 - * Date: 12/6/15 + * @category Blogging + * @package Rcc + * @author Marcel Kapfer (mmk2410) + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * delete post script + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * * Error Codes: * 901 No post given as get argument @@ -11,17 +38,24 @@ * 941 No blog given as get argument * 961 Error while deleting the post */ + $post = $_GET["post"]; $blog = $_GET["blog"]; -if (!isset($post)) { - echo "901"; -} else if (!isset($blog)) { - echo "941"; -} else if (!file_exists("./../../articles/$blog/$post.md")) { - echo "921"; -} else { - if (unlink("./../../articles/$blog/$post.md")) { - echo "0"; + +session_start(); +if ($_SESSION['login']) { + if (!isset($post)) { + echo "901"; + } else if (!isset($blog)) { + echo "941"; + } else if (!file_exists("./../../articles/$blog/$post.md")) { + echo "921"; + } else { + if (unlink("./../../articles/$blog/$post.md")) { + echo "0"; + } + echo "961"; } - echo "961"; } + +?> diff --git a/rcc/res/edit.js b/rcc/res/edit.js index 6f101bd..3ff4973 100644 --- a/rcc/res/edit.js +++ b/rcc/res/edit.js @@ -1,41 +1,54 @@ /** - * Created by mmk2410 on 12/6/15. + * JavaScript for the ajax request to edit a article * - * JavaScript for the functionality to delete blogs + * Copyright (c) 2016 by mmk2410 + * License: MIT License */ function main() { // listener and function for recieving the posts of the selected blogs $("#edit_get_posts").click(function () { + var selectedBlog = $("#edit_selected_blog").val(); $.get("res/get_posts.php", { blog: selectedBlog }, function (data) { + $("#edit_select_post").remove(); $("#edit_select_post_info").remove(); $("#edit_post_button").remove(); $("#edit_get_posts").after("

"); - $("#edit_get_posts").after("

Now select the post you want to edit.

"); - $("#edit_select_post").append(""); + $("#edit_get_posts").after( + "

" + + "Now select the post you want to edit.

" + ); + $("#edit_select_post").append( + "" + ); $.each($.parseJSON(data), function (index, value) { var post = value.substring(0, value.length - 3); - $("#edit_selected_post").append(""); + $("#edit_selected_post").append( + "" + ); }); - $("#edit_select_post").after("EDIT POST") + $("#edit_select_post").after( + "EDIT POST" + ); }); }); $("#save_changes").click(function () { + var postTitle = $("#title").val(); var postDate = $("#date").val(); var postAuthor = $("#author").val(); var postTags = $("#tags").val(); var postText = $("#text").val(); - var file = "../../articles/" + getVariables['blog'] + "/" + getVariables['post'] + ".md"; - console.log(file); + var file = "../../articles/" + getVariables.blog + + "/" + getVariables.post + ".md"; $.post("../res/save.php", { title: postTitle, @@ -69,4 +82,4 @@ function editPostButton() { } -$(document).ready(main()); \ No newline at end of file +$(document).ready(main()); diff --git a/rcc/res/get_posts.php b/rcc/res/get_posts.php index 313d3db..fb3a2c0 100644 --- a/rcc/res/get_posts.php +++ b/rcc/res/get_posts.php @@ -2,26 +2,57 @@ /** * PHP Version 7 * - * User: mmk2410 - * Date: 12/6/15 + * @category Blogging + * @package Rcc + * @author Marcel Kapfer (mmk2410) + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * get post script + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * * Error Codes: * 901 No blog given as get argument * 921 No blog with the given name available */ -$blog = $_GET["blog"]; -if (!isset($blog)) { - echo "901"; -} else if (!file_exists("./../../blogs/$blog.md")) { - echo "921"; -} else { - $posts = array(); - $i = 0; - foreach (scandir("./../../articles/$blog/") as $article) { - if (substr($article, -3) == ".md") { - $posts[$i] = $article; - $i++; + +session_start(); +if ($_SESSION['login']) { + $blog = $_GET["blog"]; + if (!isset($blog)) { + echo "901"; + } else if (!file_exists("./../../blogs/$blog.md")) { + echo "921"; + } else { + $posts = array(); + $i = 0; + foreach (scandir("./../../articles/$blog/") as $article) { + if (substr($article, -3) == ".md") { + $posts[$i] = $article; + $i++; + } } + print json_encode($posts); } - print json_encode($posts); } diff --git a/rcc/res/rcc.css b/rcc/res/rcc.css index d86933b..ddda642 100644 --- a/rcc/res/rcc.css +++ b/rcc/res/rcc.css @@ -1,30 +1,29 @@ /* -The MIT License - -Copyright 2015 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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -/* - Created on : Jun 14, 2015, 6:13:38 PM - Author : mmk2410 -*/ + * RCC cascade style sheet + * + * Copyright (C) 2015-2016 Marcel Kapfer (mmk2410) + * MIT License + * + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ /* BODY */ @@ -38,19 +37,19 @@ body{ .main{ height: 100%; width: 100%; - margin-left: 0px; + margin-left: 0; } /* HEADER */ .header{ background-color: #ff4415; position: fixed; - top: 0px; - right: 0px; - left: 0px; + top: 0; + right: 0; + left: 0; width: 100%; height: 64px; - box-shadow: 2px 0px 2px 2px rgba(62, 62, 62, 0.45); + box-shadow: 2px 0 2px 2px rgba(62, 62, 62, 0.45); } .title{ @@ -82,7 +81,7 @@ body{ background: #fff; border-radius: 2px; padding: 24px; - box-shadow: 0px 1px 1.5px 1.5px rgba(62, 62, 62, 0.3); + box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3); margin-bottom: 40px; max-width: 1160px; } @@ -145,9 +144,9 @@ body{ border-width: 1px; border-style: solid; border-color: #ff4415; - box-shadow: 0.4px 1px 1.5px 1px #aaa; - -moz-box-shadow: 0.4px 1px 1.5px 1px #aaa; -webkit-box-shadow: 0.4px 1px 1.5px 1px #aaa; + -moz-box-shadow: 0.4px 1px 1.5px 1px #aaa; + box-shadow: 0.4px 1px 1.5px 1px #aaa; border-radius: 2px; margin-top: 4px; margin-bottom: 5px; @@ -158,6 +157,10 @@ body{ transition-delay: 50ms; transition-duration: 125ms; transition-timing-function: ease; + -o-transition-property: box-shadow; + -o-transition-delay: 50ms; + -o-transition-duration: 125ms; + -o-transition-timing-function: ease; -moz-transition-property: box-shadow; -moz-transition-delay: 50ms; -moz-transition-duration: 125ms; @@ -170,12 +173,13 @@ body{ } .button:hover, .button:hover { - box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa; + -webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa; -moz-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa; - -webkit-box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa; } + box-shadow: 0.5px 1.8px 2.1px 1.4px #aaa; +} input.button{ - padding: 0px 8px; + padding: 0 8px; } /* INPUT FIELD */ @@ -192,6 +196,10 @@ input.button{ transition-delay: 50ms; transition-duration: 125ms; transition-timing-function: ease; + -o-transition-property: border-bottom-color; + -o-transition-delay: 50ms; + -o-transition-duration: 125ms; + -o-transition-timing-function: ease; -moz-transition-property: border-bottom-color; -moz-transition-delay: 50ms; -moz-transition-duration: 125ms; @@ -224,6 +232,10 @@ input.button{ transition-delay: 50ms; transition-duration: 125ms; transition-timing-function: ease; + -o-transition-property: border-bottom-color; + -o-transition-delay: 50ms; + -o-transition-duration: 125ms; + -o-transition-timing-function: ease; -moz-transition-property: border-bottom-color; -moz-transition-delay: 50ms; -moz-transition-duration: 125ms; @@ -273,4 +285,4 @@ form{ #back-card { display: none; } -} \ No newline at end of file +} diff --git a/rcc/res/rcc.js b/rcc/res/rcc.js index 6539a71..f95995b 100644 --- a/rcc/res/rcc.js +++ b/rcc/res/rcc.js @@ -1,20 +1,32 @@ +/** + * JavaScript for RCC + * + * Copyright (c) 2016 by mmk2410 + * License: MIT License + */ + window.onload = function () { var t = document.getElementsByTagName('textarea')[0]; - var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width'))); + var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : ( + t.offsetHeight + parseInt( + window.getComputedStyle(t, null).getPropertyValue('border-top-width') + ) + ); /** - * The following three code clocks are for proper resizing of the input textarea + * The following three code clocks are for proper resizing of the input + * textarea */ var resize = function (t) { t.style.height = 'auto'; t.style.height = (t.scrollHeight + offset ) + 'px'; - } + }; t.addEventListener && t.addEventListener('input', function (event) { resize(t); }); - t['attachEvent'] && t.attachEvent('onkeyup', function () { + t.attachEvent && t.attachEvent('onkeyup', function () { resize(t); }); -} \ No newline at end of file +}; diff --git a/rcc/res/save.php b/rcc/res/save.php index bd96296..88abcf7 100644 --- a/rcc/res/save.php +++ b/rcc/res/save.php @@ -1,11 +1,46 @@ + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +session_start(); +if ($_SESSION['login']) { + $title = $_POST["title"]; + $date = $_POST["date"]; + $author = $_POST["author"]; + $tags = $_POST["tags"]; + $text = $_POST["text"]; + $filename = $_POST["file"]; + $md = << + * @license MIT License + * @link https://mmk2410.org/rangitaki + * + * Main page of RCC (Rangitaki Control Center) + * + * The MIT License + * + * Copyright 2015 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +?> + - - - - Rangitaki Control Center - - - - - -
-
-
File Upload
- You have to choose a file!

"; - } else { - $blog = filter_input(INPUT_POST, "blog"); - $uploaddir = "../..//articles/$blog/"; - $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + + - if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { - echo "

The post was successfully uploaded and is now published.

"; - } else { - echo "

During the uploading process an error occured!
Error Code:" . ($_FILES['userfile']['error'] . "

"); - } - } - ?>GO BACK -
-
- + Rangitaki Control Center + + + + + + + + + + + + + + + + +
+
+
File Upload
+ +You have to choose a file!

"; + } else { + $blog = filter_input(INPUT_POST, "blog"); + $uploaddir = "../..//articles/$blog/"; + $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + + if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { + echo + "

The post was successfully uploaded and is now + published.

"; + } else { + echo + "

During the uploading process an error occured!
+ Error Code:" + . ($_FILES['userfile']['error'] . "

"); + } + } +?> + + GO BACK + + + +
+
+ diff --git a/res/css/no-nav.css b/res/css/no-nav.css index e455925..716ee41 100644 --- a/res/css/no-nav.css +++ b/res/css/no-nav.css @@ -1,57 +1,3 @@ -/* -Rangitaki Project +.nav{display:none}.nav-img{display:none}@media screen and (min-width: 1440px){.header{left:0}.main{margin-left:0;width:100%}}@media screen and (max-width: 720px){.title{left:25px}} -The MIT License - -Copyright 2015 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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -/* - Created on : Jun 18, 2015, 7:07:45 PM - Author : mmk2410 -*/ -/* - A stylesheet for overriding the default styles if the navigation drawer is disabled -*/ - -.nav{ /* hide the navigation drawer */ - display: none; -} - -.nav-img{ /* hide the hamburger icon */ - display: none; -} - -@media screen and (min-width: 1440px) { /* large devices */ - .header { /* full width */ - left: 0; - } - - .main{ /* full width */ - margin-left: 0; - width: 100%; - } -} - -@media screen and (max-width: 720px){ /* small devices */ - .title{ /* move the title more to the left */ - left: 25px; - } -} +/*# sourceMappingURL=no-nav.css.map */ diff --git a/res/css/no-nav.css.map b/res/css/no-nav.css.map new file mode 100644 index 0000000..c12e32a --- /dev/null +++ b/res/css/no-nav.css.map @@ -0,0 +1 @@ +{"version":3,"file":"no-nav.css","sources":["no-nav.sass"],"sourcesContent":["/*\n * Rangitaki Project\n *\n * The MIT License\n *\n * Copyright 2015 mmk2410.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * A stylesheet for overriding the default styles if the navigation drawer is disabled\n */\n\n.nav {\n display: none; }\n\n.nav-img {\n display: none; }\n\n@media screen and (min-width: 1440px) {\n .header {\n left: 0; }\n\n .main {\n margin-left: 0;\n width: 100%; } }\n\n@media screen and (max-width: 720px) {\n\n .title {\n left: 25px; } }\n"],"mappings":"AA4BA,AAAA,IAAI,AAAC,CACD,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,QAAQ,AAAC,CACL,OAAO,CAAE,IAAK,CAAG,AAErB,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,MAAM,EACzB,AAAA,OAAO,AAAC,CACJ,IAAI,CAAE,CAAE,CAAG,AAEf,AAAA,KAAK,AAAC,CACF,WAAW,CAAE,CAAE,CACf,KAAK,CAAE,IAAK,CAAG,CAEvB,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK,EAExB,AAAA,MAAM,AAAC,CACH,IAAI,CAAE,IAAK,CAAG","names":[]} \ No newline at end of file diff --git a/res/css/rangitaki.css b/res/css/rangitaki.css index 54ecfea..58fe6aa 100644 --- a/res/css/rangitaki.css +++ b/res/css/rangitaki.css @@ -1,305 +1,3 @@ -/* -Rangitaki Project +body{margin-top:94px}.main{height:100%;margin-left:0}.overlay{opacity:0;position:fixed;top:0;left:0;background-color:black;width:100%;z-index:30;height:100%;display:none}.header{top:0;right:0;left:0;width:100%;height:64px;position:absolute}.title{color:#fff;font-size:23px;text-decoration:none;line-height:64px;vertical-align:middle;left:75px}.title>a{text-decoration:none;color:#fff}.fadeout{position:absolute;height:64px;top:0;right:0;width:40px}.nav-img{height:26px;padding:19px;cursor:pointer}.nav{width:300px;position:fixed;height:100%;top:0;left:-301px;z-index:40}.nav-item,.nav-item-static{text-decoration:none;text-indent:0;display:inline-block;height:48px;vertical-align:middle;width:284px;line-height:48px;padding-left:16px;transition:background-color 125ms ease-in-out 0ms}.nav-close{cursor:pointer}.nav-close-img{height:35px;padding:12px}.nav-item{cursor:pointer}.divider{width:100%}.card{margin-right:auto;margin-left:auto;width:75%;padding:24px;margin-bottom:40px;max-width:1160px}.card a{-moz-hyphens:auto;-epub-hyphens:auto;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;word-wrap:break-word}.headline{display:block;padding-bottom:8px}.card img{max-width:100%;max-height:400px;display:block;margin-left:auto;margin-right:auto}.author{display:block}.fabmenu{position:fixed;bottom:20px;right:20px}.fab{height:60px;width:60px;border-radius:30px;cursor:pointer}.fab-img{width:28px;padding:15px}.subfab{height:45px;width:45px;border-radius:30px;margin-right:auto;margin-left:auto;margin-bottom:25px;display:none}.subfab-img{width:22px;padding:12px}.pag_buttons{margin-right:auto;margin-left:auto;width:calc(75% + 48px);margin-bottom:80px;max-width:1160px;text-align:right}.button{text-decoration:none;color:#fff;line-height:36px;min-width:64px;text-align:center;height:36px;padding:8px;margin-top:4px;margin-bottom:5px;cursor:pointer}.pag_next{margin-left:8px}.footer a{transition:border-bottom-color 150ms ease-in-out 100ms}.footer a:hover{border-bottom-color:#383838}@media screen and (min-width: 1440px){.nav{left:0;padding-top:64px}.nav-close-img{display:none}.nav-close{display:none}.nav-img{display:none}.header{left:300px}.main{margin-left:300px;width:calc(100% - 300px)}}@media screen and (max-width: 720px){.card{width:82%}.pag_buttons{width:calc(82% + 48px)}} -The MIT License - -Copyright 2015 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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -/* - Created on : Jun 14, 2015, 6:13:38 PM - Author : mmk2410 -*/ - -/* BODY */ - -body{ - margin-top: 94px; /* Set enough space for the header */ -} - -.main{ /* main content */ - height: 100%; - margin-left: 0; -} - -.overlay { /* overlay: used for a darker background when the navigation drawer is open */ - opacity: 0; - position: fixed; - top: 0; - left: 0; - background-color: black; - width: 100%; - z-index: 30; - height: 100%; - display: none; /* because the thing is hidden at the beginning and shown with js */ -} - -/* HEADER */ -.header{ - top: 0; - right: 0; - left: 0; - width: 100%; - height: 64px; - position: absolute; -} - -.title{ /* title in the header */ - color: #fff; - font-size: 23px; - text-decoration: none; - line-height: 64px; - vertical-align: middle; - left: 75px; -} - -.title > a{ /* and a a styling */ - text-decoration: none; - color: #fff; -} - -.fadeout{ /* a fadeout if the title is to long */ - position: absolute; - height: 64px; - top: 0; - right: 0; - width: 40px; -} - -.nav-img{ /* the hamburger icon */ - height: 26px; - padding: 19px; - cursor: pointer; -} - -/* NAV DRAWER */ - -.nav{ /* the main object */ - width: 300px; - position: fixed; - height: 100%; - top: 0; - left: -301px; - z-index: 40; -} - -.nav-item, .nav-item-static{ /* a nav-item */ - text-decoration: none; - text-indent: 0; - display: inline-block; - height: 48px; - vertical-align: middle; - width: 284px; - line-height: 48px; - padding-left: 16px; - transition: background-color 125ms ease-in-out 0ms; -} - -.nav-close { - cursor: pointer; -} - -.nav-close-img{ /* the hamburger icon */ - height: 35px; - padding: 12px; -} - -.nav-item{ /* additional setting for clickable nav items */ - cursor: pointer; -} - -.divider{ /* a simple divider with all options. better than
*/ - width: 100%; -} - -/* MAIN */ - -.card{ /* just a card */ - margin-right: auto; - margin-left: auto; - width: 75%; - padding: 24px; - margin-bottom: 40px; - max-width: 1160px; -} - -.card a{ /* and another a styling */ - -moz-hyphens: auto; - -epub-hyphens: auto; - -ms-hyphens: auto; - -webkit-hyphens: auto; - hyphens: auto; - word-wrap: break-word; /* until here: break long links */ -} - -.card a:hover{ /* hovered card links; just here to help you create a own theme*/ - -} - -.headline{ /* title in a card */ - display: block; - padding-bottom: 8px; -} - - -.card img{ /* image in a card*/ - max-width: 100%; /* regulate width */ - max-height: 400px; /* regulate height */ - display: block; /* centered */ - margin-left: auto; /* centerd */ - margin-right: auto; /* centred */ -} - -.date{ /* possibility to style the date */ - -} - -.articletext{ /* posibitlity to style the text */ - -} - -.author{ /* styling for the author */ - display: block; -} - -.tag{ /* possibility to style the text */ - -} - -/* FAB */ - -.fabmenu{ /* surrounds the complete fab menu */ - position: fixed; - bottom: 20px; - right: 20px; -} - -.fab{ /* the main fab (always visible if enabled) */ - height: 60px; - width: 60px; - border-radius: 30px; - cursor: pointer; -} - -.fab-img{ /* fab image for the main fab */ - width: 28px; - padding: 15px; -} - -.subfab{ /* a smaller fab in the fab menu */ - height: 45px; - width: 45px; - border-radius: 30px; - margin-right: auto; - margin-left: auto; - margin-bottom: 25px; - display: none; -} - -.subfab-img{ /* and the image for it */ - width: 22px; - padding: 12px; -} - -/* BUTTON */ - -.pag_buttons { - margin-right: auto; - margin-left: auto; - width: calc(75% + 48px); - margin-bottom: 80px; - max-width: 1160px; - text-align: right; -} - -.button { - text-decoration: none; - color: #fff; - line-height: 36px; - min-width: 64px; - text-align: center; - height: 36px; - padding: 8px; - margin-top: 4px; - margin-bottom: 5px; - cursor: pointer; -} - -.pag_next{ - margin-left: 8px; -} - -/* FOOTER */ - -.footer{ /* possibility for styling the footer */ - -} - - -.footer a{ /* styling of the footer a */ - transition: border-bottom-color 150ms ease-in-out 100ms; -} - -.footer a:hover{ /* and the hovered one*/ - border-bottom-color: #383838; -} - -@media screen and (min-width: 1440px) { /* make it responsive: large devices */ - - .nav{ /* always show navigation bar */ - left: 0; - padding-top: 64px; - } - - .nav-close-img { - display: none; - } - - .nav-close { - display: none; - } - - .nav-img{ /* always hide navigation bar icon*/ - display: none; - } - - .header{ /* move header to the right */ - left: 300px; - } - - .main{ /* move main content to the right and limit its width */ - margin-left: 300px; - width: calc(100% - 300px); - } - -} - - -@media screen and (max-width: 720px){ /* make it responsive: small devices */ - - .card{ /* wider cards */ - width: 82%; - } - - .pag_buttons { - width: calc(82% + 48px); - } - -} +/*# sourceMappingURL=rangitaki.css.map */ diff --git a/res/css/rangitaki.css.map b/res/css/rangitaki.css.map new file mode 100644 index 0000000..c02a79c --- /dev/null +++ b/res/css/rangitaki.css.map @@ -0,0 +1 @@ +{"version":3,"file":"rangitaki.css","sources":["rangitaki.sass"],"sourcesContent":["/*\n * Rangitaki Project\n *\n * The MIT License\n *\n * Copyright 2015 mmk2410.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * A stylesheet for overriding the default styles if the navigation drawer is disabled\n */\n\n/* BODY */\n\nbody {\n margin-top: 94px; }\n\n.main {\n height: 100%;\n margin-left: 0; }\n\n.overlay {\n opacity: 0;\n position: fixed;\n top: 0;\n left: 0;\n background-color: black;\n width: 100%;\n z-index: 30;\n height: 100%;\n display: none; }\n\n/* HEADER */\n.header {\n top: 0;\n right: 0;\n left: 0;\n width: 100%;\n height: 64px;\n position: absolute; }\n\n.title {\n color: #fff;\n font-size: 23px;\n text-decoration: none;\n line-height: 64px;\n vertical-align: middle;\n left: 75px; }\n\n.title > a {\n text-decoration: none;\n color: #fff; }\n\n.fadeout {\n position: absolute;\n height: 64px;\n top: 0;\n right: 0;\n width: 40px; }\n\n.nav-img {\n height: 26px;\n padding: 19px;\n cursor: pointer; }\n\n/* NAV DRAWER */\n\n.nav {\n width: 300px;\n position: fixed;\n height: 100%;\n top: 0;\n left: -301px;\n z-index: 40; }\n\n.nav-item, .nav-item-static {\n text-decoration: none;\n text-indent: 0;\n display: inline-block;\n height: 48px;\n vertical-align: middle;\n width: 284px;\n line-height: 48px;\n padding-left: 16px;\n transition: background-color 125ms ease-in-out 0ms; }\n\n.nav-close {\n cursor: pointer; }\n\n.nav-close-img {\n height: 35px;\n padding: 12px; }\n\n.nav-item {\n cursor: pointer; }\n\n.divider {\n width: 100%; }\n\n/* MAIN */\n\n.card {\n margin-right: auto;\n margin-left: auto;\n width: 75%;\n padding: 24px;\n margin-bottom: 40px;\n max-width: 1160px; }\n\n.card a {\n -moz-hyphens: auto;\n -epub-hyphens: auto;\n -ms-hyphens: auto;\n -webkit-hyphens: auto;\n hyphens: auto;\n word-wrap: break-word; }\n\n.card a:hover {}\n\n.headline {\n display: block;\n padding-bottom: 8px; }\n\n.card img {\n max-width: 100%;\n max-height: 400px;\n display: block;\n margin-left: auto;\n margin-right: auto; }\n\n.date {}\n\n.articletext {}\n\n.author {\n display: block; }\n\n.tag {}\n\n/* FAB */\n\n.fabmenu {\n position: fixed;\n bottom: 20px;\n right: 20px; }\n\n.fab {\n height: 60px;\n width: 60px;\n border-radius: 30px;\n cursor: pointer; }\n\n.fab-img {\n width: 28px;\n padding: 15px; }\n\n.subfab {\n height: 45px;\n width: 45px;\n border-radius: 30px;\n margin-right: auto;\n margin-left: auto;\n margin-bottom: 25px;\n display: none; }\n\n.subfab-img {\n width: 22px;\n padding: 12px; }\n\n/* BUTTON */\n\n.pag_buttons {\n margin-right: auto;\n margin-left: auto;\n width: calc(75% + 48px);\n margin-bottom: 80px;\n max-width: 1160px;\n text-align: right; }\n\n.button {\n text-decoration: none;\n color: #fff;\n line-height: 36px;\n min-width: 64px;\n text-align: center;\n height: 36px;\n padding: 8px;\n margin-top: 4px;\n margin-bottom: 5px;\n cursor: pointer; }\n\n.pag_next {\n margin-left: 8px; }\n\n/* FOOTER */\n\n.footer {}\n\n.footer a {\n transition: border-bottom-color 150ms ease-in-out 100ms; }\n\n.footer a:hover {\n border-bottom-color: #383838; }\n\n@media screen and (min-width: 1440px) {\n\n .nav {\n left: 0;\n padding-top: 64px; }\n\n .nav-close-img {\n display: none; }\n\n .nav-close {\n display: none; }\n\n .nav-img {\n display: none; }\n\n .header {\n left: 300px; }\n\n .main {\n margin-left: 300px;\n width: calc(100% - 300px); } }\n\n@media screen and (max-width: 720px) {\n\n .card {\n width: 82%; }\n\n .pag_buttons {\n width: calc(82% + 48px); } }\n"],"mappings":"AA8BA,AAAA,IAAI,AAAC,CACD,UAAU,CAAE,IAAK,CAAG,AAExB,AAAA,KAAK,AAAC,CACF,MAAM,CAAE,IAAK,CACb,WAAW,CAAE,CAAE,CAAG,AAEtB,AAAA,QAAQ,AAAC,CACL,OAAO,CAAE,CAAE,CACX,QAAQ,CAAE,KAAM,CAChB,GAAG,CAAE,CAAE,CACP,IAAI,CAAE,CAAE,CACR,gBAAgB,CAAE,KAAM,CACxB,KAAK,CAAE,IAAK,CACZ,OAAO,CAAE,EAAG,CACZ,MAAM,CAAE,IAAK,CACb,OAAO,CAAE,IAAK,CAAG,AAGrB,AAAA,OAAO,AAAC,CACJ,GAAG,CAAE,CAAE,CACP,KAAK,CAAE,CAAE,CACT,IAAI,CAAE,CAAE,CACR,KAAK,CAAE,IAAK,CACZ,MAAM,CAAE,IAAK,CACb,QAAQ,CAAE,QAAS,CAAG,AAE1B,AAAA,MAAM,AAAC,CACH,KAAK,CAAE,IAAK,CACZ,SAAS,CAAE,IAAK,CAChB,eAAe,CAAE,IAAK,CACtB,WAAW,CAAE,IAAK,CAClB,cAAc,CAAE,MAAO,CACvB,IAAI,CAAE,IAAK,CAAG,AAElB,AAAS,MAAH,CAAG,CAAC,AAAC,CACP,eAAe,CAAE,IAAK,CACtB,KAAK,CAAE,IAAK,CAAG,AAEnB,AAAA,QAAQ,AAAC,CACL,QAAQ,CAAE,QAAS,CACnB,MAAM,CAAE,IAAK,CACb,GAAG,CAAE,CAAE,CACP,KAAK,CAAE,CAAE,CACT,KAAK,CAAE,IAAK,CAAG,AAEnB,AAAA,QAAQ,AAAC,CACL,MAAM,CAAE,IAAK,CACb,OAAO,CAAE,IAAK,CACd,MAAM,CAAE,OAAQ,CAAG,AAIvB,AAAA,IAAI,AAAC,CACD,KAAK,CAAE,KAAM,CACb,QAAQ,CAAE,KAAM,CAChB,MAAM,CAAE,IAAK,CACb,GAAG,CAAE,CAAE,CACP,IAAI,CAAE,MAAO,CACb,OAAO,CAAE,EAAG,CAAG,AAEnB,AAAA,SAAS,CAAE,AAAA,gBAAgB,AAAC,CACxB,eAAe,CAAE,IAAK,CACtB,WAAW,CAAE,CAAE,CACf,OAAO,CAAE,YAAa,CACtB,MAAM,CAAE,IAAK,CACb,cAAc,CAAE,MAAO,CACvB,KAAK,CAAE,KAAM,CACb,WAAW,CAAE,IAAK,CAClB,YAAY,CAAE,IAAK,CACnB,UAAU,CAAE,sCAAuC,CAAG,AAE1D,AAAA,UAAU,AAAC,CACP,MAAM,CAAE,OAAQ,CAAG,AAEvB,AAAA,cAAc,AAAC,CACX,MAAM,CAAE,IAAK,CACb,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,SAAS,AAAC,CACN,MAAM,CAAE,OAAQ,CAAG,AAEvB,AAAA,QAAQ,AAAC,CACL,KAAK,CAAE,IAAK,CAAG,AAInB,AAAA,KAAK,AAAC,CACF,YAAY,CAAE,IAAK,CACnB,WAAW,CAAE,IAAK,CAClB,KAAK,CAAE,GAAI,CACX,OAAO,CAAE,IAAK,CACd,aAAa,CAAE,IAAK,CACpB,SAAS,CAAE,MAAO,CAAG,AAEzB,AAAM,KAAD,CAAC,CAAC,AAAC,CACJ,YAAY,CAAE,IAAK,CACnB,aAAa,CAAE,IAAK,CACpB,WAAW,CAAE,IAAK,CAClB,eAAe,CAAE,IAAK,CACtB,OAAO,CAAE,IAAK,CACd,SAAS,CAAE,UAAW,CAAG,AAI7B,AAAA,SAAS,AAAC,CACN,OAAO,CAAE,KAAM,CACf,cAAc,CAAE,GAAI,CAAG,AAE3B,AAAM,KAAD,CAAC,GAAG,AAAC,CACN,SAAS,CAAE,IAAK,CAChB,UAAU,CAAE,KAAM,CAClB,OAAO,CAAE,KAAM,CACf,WAAW,CAAE,IAAK,CAClB,YAAY,CAAE,IAAK,CAAG,AAM1B,AAAA,OAAO,AAAC,CACJ,OAAO,CAAE,KAAM,CAAG,AAMtB,AAAA,QAAQ,AAAC,CACL,QAAQ,CAAE,KAAM,CAChB,MAAM,CAAE,IAAK,CACb,KAAK,CAAE,IAAK,CAAG,AAEnB,AAAA,IAAI,AAAC,CACD,MAAM,CAAE,IAAK,CACb,KAAK,CAAE,IAAK,CACZ,aAAa,CAAE,IAAK,CACpB,MAAM,CAAE,OAAQ,CAAG,AAEvB,AAAA,QAAQ,AAAC,CACL,KAAK,CAAE,IAAK,CACZ,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,OAAO,AAAC,CACJ,MAAM,CAAE,IAAK,CACb,KAAK,CAAE,IAAK,CACZ,aAAa,CAAE,IAAK,CACpB,YAAY,CAAE,IAAK,CACnB,WAAW,CAAE,IAAK,CAClB,aAAa,CAAE,IAAK,CACpB,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,WAAW,AAAC,CACR,KAAK,CAAE,IAAK,CACZ,OAAO,CAAE,IAAK,CAAG,AAIrB,AAAA,YAAY,AAAC,CACT,YAAY,CAAE,IAAK,CACnB,WAAW,CAAE,IAAK,CAClB,KAAK,CAAE,gBAAI,CACX,aAAa,CAAE,IAAK,CACpB,SAAS,CAAE,MAAO,CAClB,UAAU,CAAE,KAAM,CAAG,AAEzB,AAAA,OAAO,AAAC,CACJ,eAAe,CAAE,IAAK,CACtB,KAAK,CAAE,IAAK,CACZ,WAAW,CAAE,IAAK,CAClB,SAAS,CAAE,IAAK,CAChB,UAAU,CAAE,MAAO,CACnB,MAAM,CAAE,IAAK,CACb,OAAO,CAAE,GAAI,CACb,UAAU,CAAE,GAAI,CAChB,aAAa,CAAE,GAAI,CACnB,MAAM,CAAE,OAAQ,CAAG,AAEvB,AAAA,SAAS,AAAC,CACN,WAAW,CAAE,GAAI,CAAG,AAMxB,AAAQ,OAAD,CAAC,CAAC,AAAC,CACN,UAAU,CAAE,2CAA4C,CAAG,AAE/D,AAAS,OAAF,CAAC,CAAC,AAAA,MAAM,AAAC,CACZ,mBAAmB,CAAE,OAAQ,CAAG,AAEpC,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,MAAM,EAEzB,AAAA,IAAI,AAAC,CACD,IAAI,CAAE,CAAE,CACR,WAAW,CAAE,IAAK,CAAG,AAEzB,AAAA,cAAc,AAAC,CACX,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,UAAU,AAAC,CACP,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,QAAQ,AAAC,CACL,OAAO,CAAE,IAAK,CAAG,AAErB,AAAA,OAAO,AAAC,CACJ,IAAI,CAAE,KAAM,CAAG,AAEnB,AAAA,KAAK,AAAC,CACF,WAAW,CAAE,KAAM,CACnB,KAAK,CAAE,kBAAI,CAAiB,CAEpC,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK,EAExB,AAAA,KAAK,AAAC,CACF,KAAK,CAAE,GAAI,CAAG,AAElB,AAAA,YAAY,AAAC,CACT,KAAK,CAAE,gBAAI,CAAe","names":[]} \ No newline at end of file diff --git a/res/js/app.js b/res/js/app.js index 88b9e0e..397dbcc 100644 --- a/res/js/app.js +++ b/res/js/app.js @@ -1,112 +1 @@ -/* - * Rangitaki Project - * - * The MIT License - * - * Copyright 2015 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 - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -var main = function () { // main function; called below - - var fabActive = false; // fab hidden at begin - $('.fabmenu').click( // action on fab click - function () { - if (!(fabActive)) { // if fab is hidden - fabFadeIn(); // fade fab in - fabActive = true; // fab = active - } else { // if fab is shown - fabFadeOut(); // fade fab out - fabActive = false; // fab = hidden - } - } - ); - - var navOpen = false; // nav hidden at begin - $('.nav-img, .overlay, .nav-close').click( // action on hamburger click - function () { - if (!(navOpen)) { // if nav is hidden - openNav(); // open the nav drawer - navOpen = true; // nav = open - } else { // if nav is closed - closeNav(); // close the nav drawer - navOpen = false; // nav = closed - } - } - ); - - /** - * Keyhandling for the navigation drawer. - * opens the drawer on 'm' (key code: 77) - * closes the drawer on 'Esc' (key code: 27) - */ - $(document).keyup(function (e) { - if (navOpen && (e.which === 27)) { - closeNav(); - navOpen = false; - } else if (!(navOpen) && (e.which === 77)) { - openNav(); - navOpen = true; - } - }); - - -}; - -$(document).ready(main); // run if document is loaded - -function goBack() { // go back function - history.go(-1); -} - -function fabFadeIn() { // fade fab in - $('.subfab').fadeIn(125); // fade subfabs in - $('.fab-img').fadeOut( // fade fab share image out - 60, function callback() { - $('.fab-img').attr("src", "./res/img/close.svg"); // change to fab close image - } - ); - $('.fab-img').fadeIn(60); // fade fab close image in -} - -function fabFadeOut() { // fade fab out - $('.subfab').fadeOut(125); // fade subfabs out - $('.fab-img').fadeOut( // fade fab close image out - 60, function callback() { - $('.fab-img').attr("src", "./res/img/share.svg"); // change to fab share image - } - ); - $('.fab-img').fadeIn(60); // fade fab share image in -} - -function openNav() { // fade navigation drawer in - $('.nav').animate({"left": "0px"}, 125); // slide in - $('.overlay').show(); // set overlay to show ... - $('.overlay').animate({"opacity": "0.4"}, 125); // ... and fade to a darker transparent color -} - -function closeNav() { // fade navigation drawer out - $('.nav').animate({"left": "-301px"}, 125); // slide out - $('.overlay').animate( - {"opacity": "0.0"}, 125, function () { // fade the overlay to complete transparency - $('.overlay').hide(); // hide it then - } - ); -} +(function(){var n,t,a,e,r,i;r=function(){var e,r;return e=!1,$(".fabmenu").click(function(){return e?(a(),e=!1):(t(),e=!0)}),r=!1,$(".nav-img, .overlay, .nav-close").click(function(){return r?(n(),r=!1):(i(),r=!0)}),$(document).keyup(function(t){return r&&27===t.which?(n(),r=!1):r||77!==t.which?void 0:(i(),r=!0)}),$(".articletext a").attr("target","_blank")},$(document).ready(r),e=function(){return history.go(-1)},t=function(){return $(".subfab").fadeIn(125),$(".fab-img").fadeOut(60,function(){return $(".fab-img").attr("src","./res/img/close.svg"),$(".fab-img").fadeIn(60)})},a=function(){return $(".subfab").fadeOut(125),$(".fab-img").fadeOut(60,function(){return $(".fab-img").attr("src","./res/img/share.svg"),$(".fab-img").fadeIn(60)})},i=function(){return $(".nav").animate({left:"0px"},125),$(".overlay").show(),$(".overlay").animate({opacity:"0.4"},125)},n=function(){return $(".nav").animate({left:"-301px"},125),$(".overlay").animate({opacity:"0.0"},125,function(){return $(".overlay").hide})}}).call(this); \ No newline at end of file diff --git a/res/php/ArticleGenerator.php b/res/php/ArticleGenerator.php index 86f4fa5..f259c9d 100644 --- a/res/php/ArticleGenerator.php +++ b/res/php/ArticleGenerator.php @@ -265,4 +265,46 @@ class ArticleGenerator return $article; } + /** + * A function to get a array of the article + * + * @param $directory The directory where the article is stored + * @param $articlefile The name of the article file + * @return string + */ + public function getArray($directory, $articlefile) + { + $article = file_get_contents($directory . $articlefile); + + if (substr($article, 0, 6) == "%TITLE") { // get and remove the title + $title = substr($article, 8, strpos($article, "\n") - 8); + $article = substr($article, strpos($article, "\n") + 1); + } + + if (substr($article, 0, 5) == "%DATE") { // get and remove the title + $date = substr($article, 7, strpos($article, "\n") - 7); + $article = substr($article, strpos($article, "\n") + 1); + } + + if (substr($article, 0, 7) == "%AUTHOR") { // get and remove the title + $author = substr($article, 9, strpos($article, "\n") - 9); + $article = substr($article, strpos($article, "\n") + 1); + } + + if (substr($article, 0, 5) == "%TAGS") { // get and remove the tags + $tags = substr($article, 7, strpos($article, "\n") - 7); // get the tags + $tags = explode(", ", $tags); // split them into an array + $article = substr($article, strpos($article, "\n") + 1); + } + + $data = array( + "title" => $title, + "date" => $date, + "author" => $author, + "tags" => $tags, + "text" => $article + ); + + return $data; + } } diff --git a/res/php/Config.php b/res/php/Config.php new file mode 100644 index 0000000..7eab4f4 --- /dev/null +++ b/res/php/Config.php @@ -0,0 +1,74 @@ + + * @license MIT License + * @link http://marcel-kapfer.de/rangitaki + */ +namespace mmk2410\rbe\config; + +/** + * PHP Version 7 + * + * Configuration parser for yaml configuration files + * + * @category Configuration + * @package Rbe + * @author Marcel Kapfer (mmk2410) + * @license MIT License + * @link http://marcel-kapfer.de/rangitaki + */ +class Config +{ + + /** + * Path to yaml file + * @var string + */ + private $file; + + /** + * Constructor for the Config class + * + * @param $config path to the yaml file + * @param $composer path to the composer autoload + */ + public function __construct($config, $composer) + { + $this->file = $config; + require $composer; + } + + /** + * Return yaml config as PHP array + * + * @return config array + */ + public function getConfig() + { + $yaml = new \Symfony\Component\Yaml\Parser(); + return $yaml->parse(file_get_contents($this->file)); + } + + /* + * Write array into confi* + * Write array into config file + * + * @param array config new config + * + * @return FALSE if failed to write + */ + public function writeConfig($config) + { + $dumper = new \Symfony\Component\Yaml\Dumper(); + + $yaml = $dumper->dump($config, 2); + + return file_put_contents($this->file, $yaml); + } +} diff --git a/res/php/Disqus.php b/res/php/Disqus.php index c97f89f..45c1f20 100644 --- a/res/php/Disqus.php +++ b/res/php/Disqus.php @@ -27,7 +27,7 @@ THE SOFTWARE.