* @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"); // getting the blog variable
$getarticle = filter_input(INPUT_GET, "article"); // getting 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"); // getting the url (used for sharing)
// 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;
}
$articlesdir = "./articles/$blog/"; // generate a variable with the articles directory
// 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;
}
?>
3) { // Checking if not in article or tag view and if there are more the one blog. The 3 is for these three array entries: 'main.md', '.', '..'
echo "
";
echo "" . $BLOGLANG['Blogs on'] . " $blogtitle:
"; // 1. Set localized string 2. Set blogtitle
foreach ($blogs as $navblog) { // iterating through the blogs/ directory
if (strlen($navblog) >= 3 && substr($navblog, -3) == ".md") { // check if filename is larger than three chars and if the file ends with ".md"
if ($getblog == "") { // Run when on main blog
if ($navblog != "main.md") { // excluding main blog
BlogListGenerator::listBlog("./blogs/", $navblog, $blogtitle); // creating navigation item
}
} else {
if ($getblog . ".md" != $navblog) { // Check if $blog is current blog -> this blog will be excluded
BlogListGenerator::listBlog("./blogs/", $navblog, $blogmaintitle); // creating navigation item
}
}
}
}
echo "";
} elseif (isset($getarticle) || isset($gettag)) { // If viewing a blog or a tag
?>
Go back
3) { // if there is no content, don't show the intro
?>
setBreaksEnabled(true)// with linebreaks
->text($file);
echo $intro; // PRINTS THE SH****
?>
tag view
$articles = scandir($articlesdir, 1); // save the content of the directory in the articles variable
foreach ($articles as $article) { // iterate through all articles
$tags = ArticleGenerator::getTags($articlesdir, $article); // get the article tags
if (in_array($gettag, $tags)) { // if the article has the requested tag
if (strlen($article) >= 3 && substr($article, -3) == ".md") { // check if the file is a article file
ArticleGenerator::newArticle($articlesdir, $article, $getblog); // generate the article
}
}
}
} elseif ($getarticle == "") { // NORMAL VIEW if there's no article request -> normal view
$articles = scandir($articlesdir, 1); // save the content of the directory in the articles variable
foreach ($articles as $article) { // iterate through this variable
if (strlen($article) >= 3 && substr($article, -3) == ".md") { // check if the file is a article file
ArticleGenerator::newArticle($articlesdir, $article, $getblog); // generate the article
}
}
} elseif (isset($getarticle)) { // ARTICLE VIEW
ArticleGenerator::newArticle($articlesdir, $getarticle . ".md", $getblog); // generate the requested article
include './res/php/Disqus.php'; // include disques
} else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN
echo "Some error occured, please go back.";
}
?>