* @license MIT https://opensource.org/licenses/MIT * @link https://marcel-kapfer.de/rangitaki */ // Getting necessary php files date_default_timezone_set('UTC'); require __DIR__ . '/vendor/autoload.php'; // loading composer libs require './res/php/Config.php'; require_once './res/php/BlogListGenerator.php'; use mmk2410\rbe\config\Config as Config; use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator; $configParser = new Config('config.yaml', 'vendor/autoload.php'); $config = $configParser->getConfig(); require './lang/' . $config["language"] . ".php"; // Language file require_once 'res/php/ArticleGenerator.php'; // The article generator // Getting some variables ($_GET and $_SERVER) $getblog = filter_input(INPUT_GET, "blog"); // get the blog variable $getarticle = filter_input(INPUT_GET, "article"); // get the article variable $gettag = filter_input(INPUT_GET, "tag"); // getting the tag variable $url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") . filter_input(INPUT_SERVER, "REQUEST_URI"); // get the url (used for sharing) $pagenumber = filter_input(INPUT_GET, "page"); // get the pagenumber // Pagination algorithm if ($config["design"]["pagination"] == 0) { $config["design"]["pagination"] = false; } else { // pag_max: the newest post to show on a page $pag_max = $config["design"]["pagination"] * ( $pagenumber + 1 ); // pag_min: the oldest post to show on a page $pag_min = $pag_max - $config["design"]["pagination"]; if ($pagenumber > 0) { // Disable the blog intro if not on first page $config["blog"]["intro"] = "off"; } } // Fetching necessary information about the current article // Set blog to "main" if on main blog, else to $getblog. // This variable is needed later if ($getblog == "") { $blog = "main"; } else { $blog = $getblog; } // generate a variable with the articles directory $articlesdir = "./articles/$blog/"; // Fetching the articles title if (isset($getarticle)) { $articletitle = ArticleGenerator::getTitle($articlesdir, $getarticle . '.md'); } // Make sure that the entry has a title, because main.md hasn't one if (empty($config["blog"]["mainname"])) { $blogmaintitle = $config["blog"]["title"]; } else { $blogmaintitle = $config["blog"]["mainname"]; } if (isset($getblog)) { $subblogtitle = BlogListGenerator::getName('./blogs/' . $getblog . '.md'); } else { $subblogtitle = $blogmaintitle; } // Generate title for the html head if (isset($getarticle)) { $hd_subblog_title = $articletitle . ' - ' . $subblogtitle; } else { $hd_subblog_title = $subblogtitle; } // url of the feed $feedurl = $config["blog"]["url"] . "/feed/" . $blog . ".atom"; ?>