* @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'; use mmk2410\rbe\config\Config as Config; $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 require_once './res/php/BlogListGenerator.php'; // and the blog list 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"; ?> <?php echo $config["blog"]["title"] . " » " .$hd_subblog_title; ?> "/> "/> skip it if ($config["design"]["drawer"] == "on") { ?>
">
3) { // if there is no content, don't show the intro ?>
setBreaksEnabled(true)// with linebreaks ->text($file); echo $intro; // PRINTS THE SH**** ?>
tag view // save the content of the directory in the articles variable $articles = scandir($articlesdir, 1); // iterate through all articles foreach ($articles as $article) { // get the article tags $tags = ArticleGenerator::getTags($articlesdir, $article); // if the article has the requested tag if (in_array($gettag, $tags)) { // check if the file is a article file if (strlen($article) >= 3 && substr($article, -3) == ".md") { // generate the article ArticleGenerator::newArticle( $articlesdir, $article, $getblog, $config["design"]["excerpt"], $BLOGLANG["Read More"] ); } } } } elseif ($getarticle == "") { // NORMAL VIEW if there's no article request -> normal view // save the content of the directory in the articles variable $articles = scandir($articlesdir, 1); // iterate through this variable $posts_amount = 0; foreach ($articles as $article) { // check if the file is a article file if (strlen($article) >= 3 && substr($article, -3) == ".md") { // generate the article if ($config["design"]["pagination"]) { if ($posts_amount < $pag_max && $posts_amount >= $pag_min) { ArticleGenerator::newArticle( $articlesdir, $article, $getblog, $config["design"]["excerpt"], $BLOGLANG["Read More"] ); } } else { ArticleGenerator::newArticle( $articlesdir, $article, $getblog, $config["design"]["excerpt"], $BLOGLANG["Read More"] ); } } $posts_amount++; } if ($config["design"]["pagination"]) { include './res/php/Pagination.php'; } } elseif (isset($getarticle)) { // ARTICLE VIEW // generate the requested article ArticleGenerator::newArticle( $articlesdir, $getarticle . ".md", $getblog, 'off', '' ); include './res/php/Disqus.php'; // include disques } else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN echo "Some error occured, please go back."; } ?>
Share
"; } } } ?>