From ac65f5ee700634ccfcefd70583005d18b7d1b117 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Fri, 22 Apr 2016 19:28:27 +0200 Subject: [PATCH] Config switch to YAML --- index.php | 96 +++++++++++++++++++------------------ rcc/index.php | 10 ++-- res/php/Disqus.php | 2 +- res/php/GoogleAnalytics.php | 2 +- 4 files changed, 58 insertions(+), 52 deletions(-) diff --git a/index.php b/index.php index d22c4de..7b3e7df 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 @@ -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/rcc/index.php b/rcc/index.php index df64979..79c7878 100644 --- a/rcc/index.php +++ b/rcc/index.php @@ -64,17 +64,21 @@
getConfig(); + +if ($config["rcc"]["rcc"] == "on") { include 'password.php'; session_start(); if (isset($_POST['passwd'])) { $passwd = $_POST['passwd']; $_SESSION['passwd'] = $_POST['passwd']; - } else if (isset($_SESSION['passwd'])) { + } elseif (isset($_SESSION['passwd'])) { $passwd = $_SESSION['passwd']; } 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.