* @license MIT https://opensource.org/licenses/MIT * @link https://marcel-kapfer.de/rangitaki */ // Getting necessary php files date_default_timezone_set('UTC'); require 'config.php'; // Config file (this must be the first line) require './lang/' . $language . ".php"; // Language file require_once 'res/php/Parsedown.php'; // The soul of the beast: Parsedown 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 ($pagination == 0) { $pagination = false; } else { // pag_max: the newest post to show on a page $pag_max = $pagination * ( $pagenumber + 1 ); // pag_min: the oldest post to show on a page $pag_min = $pag_max - $pagination; if ($pagenumber > 0) { // Disable the blog intro if not on first page $blogintro = "no"; } } // 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($blogmainname)) { $blogmaintitle = $blogtitle; } else { $blogmaintitle = $blogmainname; } 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; } ?> <?php echo $hd_subblog_title; ?> skip it if ($nav_drawer == "yes") { ?>
">
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 ); } } } } 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 ($pagination) { if ($posts_amount < $pag_max && $posts_amount >= $pag_min) { ArticleGenerator::newArticle( $articlesdir, $article, $getblog ); } } else { ArticleGenerator::newArticle( $articlesdir, $article, $getblog ); } } $posts_amount++; } if ($pagination) { include './res/php/Pagination.php'; } } elseif (isset($getarticle)) { // ARTICLE VIEW // generate the requested article ArticleGenerator::newArticle( $articlesdir, $getarticle . ".md", $getblog ); include './res/php/Disqus.php'; // include disques } else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN echo "Some error occured, please go back."; } ?>
Share
"; } } ?>