2015-02-21 21:04:03 +01:00
|
|
|
|
<!DOCTYPE HTML>
|
2015-03-27 07:04:23 +01:00
|
|
|
|
<!--
|
2015-12-18 21:59:34 +01:00
|
|
|
|
Rangitaki Blogging Engine
|
2016-04-22 19:28:27 +02:00
|
|
|
|
Code: https://gitlab.com/mmk2410/rangitaki
|
|
|
|
|
Issus and Project Management: https://phab.mmk2410.org
|
2015-07-05 18:02:19 +02:00
|
|
|
|
Web: https://marcel-kapfer.de/rangitaki
|
2016-04-22 19:28:27 +02:00
|
|
|
|
2015 - 2016 Marcel Kapfer (mmk2410)
|
|
|
|
|
License: MIT
|
2015-03-27 07:04:23 +01:00
|
|
|
|
-->
|
2015-02-21 21:04:03 +01:00
|
|
|
|
<html>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
2015-12-18 21:59:34 +01:00
|
|
|
|
* PHP Version 5.6
|
|
|
|
|
*
|
2015-11-17 22:46:20 +01:00
|
|
|
|
* Rangitaki PHP Blogging engine
|
2015-12-18 21:59:34 +01:00
|
|
|
|
*
|
2015-11-18 15:18:18 +01:00
|
|
|
|
* @category Blogging
|
2015-12-18 21:59:34 +01:00
|
|
|
|
* @package Rbe
|
|
|
|
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
|
|
|
|
* @license MIT https://opensource.org/licenses/MIT
|
|
|
|
|
* @link https://marcel-kapfer.de/rangitaki
|
2015-11-17 22:46:20 +01:00
|
|
|
|
*/
|
|
|
|
|
// Getting necessary php files
|
|
|
|
|
date_default_timezone_set('UTC');
|
2016-02-16 14:19:17 +01:00
|
|
|
|
require __DIR__ . '/vendor/autoload.php'; // loading composer libs
|
|
|
|
|
|
2016-04-22 19:28:27 +02:00
|
|
|
|
require './res/php/Config.php';
|
2016-12-29 21:54:37 +01:00
|
|
|
|
require_once './res/php/BlogListGenerator.php';
|
|
|
|
|
|
2016-04-22 19:28:27 +02:00
|
|
|
|
use mmk2410\rbe\config\Config as Config;
|
2016-12-29 21:54:37 +01:00
|
|
|
|
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
2016-04-22 19:28:27 +02:00
|
|
|
|
|
|
|
|
|
$configParser = new Config('config.yaml', 'vendor/autoload.php');
|
|
|
|
|
|
|
|
|
|
$config = $configParser->getConfig();
|
|
|
|
|
|
|
|
|
|
require './lang/' . $config["language"] . ".php"; // Language file
|
2015-11-17 22:46:20 +01:00
|
|
|
|
require_once 'res/php/ArticleGenerator.php'; // The article generator
|
2016-12-29 21:54:37 +01:00
|
|
|
|
|
2016-02-16 14:19:17 +01:00
|
|
|
|
|
2015-11-17 22:46:20 +01:00
|
|
|
|
// Getting some variables ($_GET and $_SERVER)
|
2015-12-18 21:59:34 +01:00
|
|
|
|
$getblog = filter_input(INPUT_GET, "blog"); // get the blog variable
|
|
|
|
|
$getarticle = filter_input(INPUT_GET, "article"); // get the article variable
|
2015-11-17 22:46:20 +01:00
|
|
|
|
$gettag = filter_input(INPUT_GET, "tag"); // getting the tag variable
|
2015-12-18 21:59:34 +01:00
|
|
|
|
$url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") .
|
|
|
|
|
filter_input(INPUT_SERVER, "REQUEST_URI"); // get the url (used for sharing)
|
2015-12-20 17:50:22 +01:00
|
|
|
|
$pagenumber = filter_input(INPUT_GET, "page"); // get the pagenumber
|
2015-12-18 21:59:34 +01:00
|
|
|
|
|
|
|
|
|
// Pagination algorithm
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["design"]["pagination"] == 0) {
|
|
|
|
|
$config["design"]["pagination"] = false;
|
2015-12-18 21:59:34 +01:00
|
|
|
|
} else {
|
2015-12-20 17:50:22 +01:00
|
|
|
|
// pag_max: the newest post to show on a page
|
2016-04-22 19:28:27 +02:00
|
|
|
|
$pag_max = $config["design"]["pagination"] * ( $pagenumber + 1 );
|
2015-12-20 17:50:22 +01:00
|
|
|
|
// pag_min: the oldest post to show on a page
|
2016-04-22 19:28:27 +02:00
|
|
|
|
$pag_min = $pag_max - $config["design"]["pagination"];
|
2015-12-20 17:50:22 +01:00
|
|
|
|
if ($pagenumber > 0) {
|
|
|
|
|
// Disable the blog intro if not on first page
|
2016-04-22 19:28:27 +02:00
|
|
|
|
$config["blog"]["intro"] = "off";
|
2015-12-20 17:50:22 +01:00
|
|
|
|
}
|
2015-12-18 21:59:34 +01:00
|
|
|
|
}
|
2015-11-22 00:59:07 +01:00
|
|
|
|
|
|
|
|
|
// Fetching necessary information about the current article
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// Set blog to "main" if on main blog, else to $getblog.
|
|
|
|
|
// This variable is needed later
|
2015-11-22 00:59:07 +01:00
|
|
|
|
if ($getblog == "") {
|
|
|
|
|
$blog = "main";
|
|
|
|
|
} else {
|
|
|
|
|
$blog = $getblog;
|
|
|
|
|
}
|
2015-12-18 21:59:34 +01:00
|
|
|
|
|
|
|
|
|
// generate a variable with the articles directory
|
|
|
|
|
$articlesdir = "./articles/$blog/";
|
2015-11-22 00:59:07 +01:00
|
|
|
|
// Fetching the articles title
|
|
|
|
|
if (isset($getarticle)) {
|
2015-12-18 21:59:34 +01:00
|
|
|
|
$articletitle
|
|
|
|
|
= ArticleGenerator::getTitle($articlesdir, $getarticle . '.md');
|
2015-11-22 00:59:07 +01:00
|
|
|
|
}
|
|
|
|
|
// Make sure that the entry has a title, because main.md hasn't one
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if (empty($config["blog"]["mainname"])) {
|
|
|
|
|
$blogmaintitle = $config["blog"]["title"];
|
2015-11-22 00:59:07 +01:00
|
|
|
|
} else {
|
2016-04-22 19:28:27 +02:00
|
|
|
|
$blogmaintitle = $config["blog"]["mainname"];
|
2015-11-22 00:59:07 +01:00
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
2016-02-16 14:19:17 +01:00
|
|
|
|
|
|
|
|
|
// url of the feed
|
2016-04-22 19:28:27 +02:00
|
|
|
|
$feedurl = $config["blog"]["url"] . "/feed/" . $blog . ".atom";
|
2016-02-16 14:19:17 +01:00
|
|
|
|
|
2015-11-17 22:46:20 +01:00
|
|
|
|
?>
|
2015-02-21 21:04:03 +01:00
|
|
|
|
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
2016-04-22 19:28:27 +02:00
|
|
|
|
<title><?php echo $config["blog"]["title"] . " » " .$hd_subblog_title; ?></title>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!--Metatags-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<meta name="author"
|
2016-04-22 19:28:27 +02:00
|
|
|
|
content="<?php echo $config["blog"]["author"]; // Set the blog author ?>"/>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<meta name="description"
|
2016-04-22 19:28:27 +02:00
|
|
|
|
content="<?php echo $config["blog"]["description"]; // the blog description ?>"/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!-- Meta tag for responsive ui-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<meta name='viewport'
|
|
|
|
|
content='width=device-width, initial-scale=1.0,
|
|
|
|
|
maximum-scale=1.0, user-scalable=0'/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!-- OpenGraph meta tags -->
|
2015-11-22 00:59:07 +01:00
|
|
|
|
<meta property="og:title" content="<?php echo $hd_subblog_title; ?>"/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<meta property="og:type" content="website"/>
|
|
|
|
|
<meta property="og:url" content="<?php echo $url; ?>"/>
|
2016-04-22 19:28:27 +02:00
|
|
|
|
<meta property="og:image" content="<?php echo $config['design']['favicon']; ?>"/>
|
|
|
|
|
<meta property="og:description" content="<?php echo $config['blog']['description']; ?>"/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!-- Twitter meta tags -->
|
|
|
|
|
<meta name="twitter:card" content="summary"/>
|
2016-07-17 08:42:46 +02:00
|
|
|
|
<meta name="twitter:site" content="<?php echo $config['social']['twitter']; ?>"/>
|
2015-11-22 00:59:07 +01:00
|
|
|
|
<meta name="twitter:title" content="<?php echo $hd_subblog_title; ?>"/>
|
2016-04-22 19:28:27 +02:00
|
|
|
|
<meta name="twitter:description" content="<?php echo $config['blog']['description']; ?>"/>
|
|
|
|
|
<meta name="twitter:image" content="<?php echo $config['design']['favicon']; ?>"/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<meta name="twitter:url" content="<?php echo $url; ?>"/>
|
2016-02-16 14:19:17 +01:00
|
|
|
|
<!-- atom feed -->
|
|
|
|
|
<?php
|
|
|
|
|
if (file_exists("feed/" . $blog . ".atom")) {
|
|
|
|
|
?>
|
|
|
|
|
<link rel='alternate' type='application/atom+xml' title='Atom 0.3' href=
|
|
|
|
|
'<?php
|
|
|
|
|
echo $feedurl;
|
|
|
|
|
?>'>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!--CSS files-->
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="res/css/rangitaki.css"/>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<!-- stylesheet for code highlighting-->
|
|
|
|
|
<link rel="stylesheet" href="./res/css/github-gist.css">
|
|
|
|
|
<link rel="stylesheet" type="text/css"
|
2016-04-22 19:28:27 +02:00
|
|
|
|
href="themes/<?php echo $config['design']['theme']; // getting the theme stylesheet?>.css"/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
|
|
|
|
// Checking if the drawer is enabled
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["design"]["drawer"] != 'on') {
|
2015-11-17 22:46:20 +01:00
|
|
|
|
// Loading additional stylesheet for disabling the drawer?>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="res/css/no-nav.css"/>
|
2015-06-15 11:27:57 +02:00
|
|
|
|
<?php
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
?>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
|
|
|
|
|
400italic,100,100italic,900' rel='stylesheet'
|
2015-11-17 22:46:20 +01:00
|
|
|
|
type='text/css'> <!--Font-->
|
|
|
|
|
<!--Favicons-->
|
2015-12-20 17:50:22 +01:00
|
|
|
|
<link rel="shortcut icon" type="image/x-icon"
|
2016-04-22 19:28:27 +02:00
|
|
|
|
href="<?php echo $config['design']['favicon']; ?>"/>
|
|
|
|
|
<link rel="apple-touch-icon-precomposed" href="<?php echo $config['design']['favicon']; ?>">
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!-- JavaScript Pt. 1: HightlightJS (get and load): Code highlighting-->
|
|
|
|
|
<script src="./res/js/highlight.pack.js"></script>
|
|
|
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
|
|
|
</head>
|
2015-06-18 20:45:49 +02:00
|
|
|
|
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<body>
|
|
|
|
|
<?php
|
|
|
|
|
// Checking if the navigation drawer is enabled. If not -> skip it
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["design"]["drawer"] == "on") {
|
2015-11-17 22:46:20 +01:00
|
|
|
|
?>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<!--
|
|
|
|
|
Darken the background when fading the drawer in. See also the JS file
|
|
|
|
|
-->
|
|
|
|
|
<div class="overlay"></div>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<div class="nav">
|
2015-11-22 00:59:07 +01:00
|
|
|
|
<div class="nav-close">
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<img src="./res/img/close-dark.svg" class="nav-close-img"
|
|
|
|
|
alt="Close"/>
|
2015-11-22 00:59:07 +01:00
|
|
|
|
</div>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<div class="divider"></div>
|
2015-07-25 09:34:51 +02:00
|
|
|
|
<?php
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// Getting everything from the blog directory
|
|
|
|
|
$blogs = scandir("./blogs/");
|
|
|
|
|
// 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', '.', '..'
|
|
|
|
|
if (!isset($getarticle) && !isset($gettag) && sizeof($blogs) > 3) {
|
2015-11-17 22:46:20 +01:00
|
|
|
|
echo "<section>";
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// 1. Set localized string 2. Set blogtitle
|
|
|
|
|
echo "<div class='nav-item-static'>" .
|
2016-05-21 19:46:33 +02:00
|
|
|
|
$BLOGLANG['Blogs on'] . " " . $config["blog"]["title"] .
|
2016-04-22 19:28:27 +02:00
|
|
|
|
":</div>";
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// iterating through the blogs/ directory
|
|
|
|
|
foreach ($blogs as $navblog) {
|
|
|
|
|
// check if filename is larger than three chars and if the
|
|
|
|
|
// file ends with ".md"
|
|
|
|
|
if (strlen($navblog) >= 3 && substr($navblog, -3) == ".md") {
|
2015-11-17 22:46:20 +01:00
|
|
|
|
if ($getblog == "") { // Run when on main blog
|
2015-11-22 00:59:07 +01:00
|
|
|
|
if ($navblog != "main.md") { // excluding main blog
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// creating navigation item
|
2016-12-29 21:59:55 +01:00
|
|
|
|
echo BlogListGenerator::listBlog(
|
2016-08-03 17:19:59 +02:00
|
|
|
|
"./blogs/",
|
|
|
|
|
$navblog,
|
|
|
|
|
$config["blog"]["title"]
|
2015-12-18 21:59:34 +01:00
|
|
|
|
);
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// Check if $blog is current blog
|
|
|
|
|
// -> this blog will be excluded
|
|
|
|
|
if ($getblog . ".md" != $navblog) {
|
|
|
|
|
// creating navigation item
|
2016-12-29 21:59:55 +01:00
|
|
|
|
echo BlogListGenerator::listBlog(
|
2016-08-03 17:19:59 +02:00
|
|
|
|
"./blogs/",
|
|
|
|
|
$navblog,
|
|
|
|
|
$blogmaintitle
|
2015-12-18 21:59:34 +01:00
|
|
|
|
);
|
2015-06-11 17:32:58 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
echo "</section>";
|
2015-12-18 21:59:34 +01:00
|
|
|
|
} elseif (isset($getarticle) || isset($gettag)) {
|
|
|
|
|
// If viewing a blog or a tag
|
2015-11-17 22:46:20 +01:00
|
|
|
|
?>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<!-- Set a back item instead of the blogs. -->
|
2016-05-18 07:38:40 +02:00
|
|
|
|
<a class="nav-item" onclick="history.go(-1);">Go back</a>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
|
|
|
|
}
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["blog"]["home"] == "on") { // If a blog home is existend
|
2015-11-17 22:46:20 +01:00
|
|
|
|
?>
|
|
|
|
|
<div class="divider"></div>
|
2016-04-22 19:28:27 +02:00
|
|
|
|
<a class="nav-item" href="<?php echo $config['blog']['homeurl']; ?>">
|
|
|
|
|
<?php echo $config['blog']['homename']; ?>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
</a>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
2015-06-11 17:32:58 +02:00
|
|
|
|
}
|
2016-02-16 14:19:17 +01:00
|
|
|
|
if (file_exists("feed/" . $blog . ".atom")) { ?>
|
|
|
|
|
<div class="divider"></div>
|
|
|
|
|
<a class="nav-item" href=
|
|
|
|
|
'<?php
|
|
|
|
|
echo $feedurl;
|
|
|
|
|
?>'>Feed</a><?php
|
|
|
|
|
}
|
2015-06-18 20:45:49 +02:00
|
|
|
|
?>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
</div> <!-- End of the navigation drawer-->
|
|
|
|
|
<?php
|
|
|
|
|
} // Endif from line 97; Yes, I really should think about alternative syntax...
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<div class="main"> <!-- Main page with content -->
|
|
|
|
|
<div class="header">
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<!--
|
|
|
|
|
Action Bar, but since there isn't much action I call it header.
|
|
|
|
|
One day a search feature would be nice...
|
|
|
|
|
-->
|
|
|
|
|
<!-- Ham,ham,hamburger-->
|
|
|
|
|
<img src="./res/img/menu.svg" class="nav-img"/>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<!-- Blog title with subblog title and links to each one-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<!-- link to main blog-->
|
2016-04-22 19:28:27 +02:00
|
|
|
|
<nobr><span class="title"><a href="./"><?php echo $config["blog"]["title"]; ?>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
|
|
|
|
if (empty($getblog)) { // if not on a subblog
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if (!empty($config['blog']['mainname'])) {
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// If you see a › (square) here : This is not a bug,
|
|
|
|
|
// but a missing sign in your font
|
2016-04-22 19:28:27 +02:00
|
|
|
|
echo "›" . $config['blog']['mainname'];
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
} else { // On subblog: set also a link to the subblog
|
|
|
|
|
?>
|
|
|
|
|
</a>
|
2015-07-03 14:37:32 +02:00
|
|
|
|
› <a href="<?php echo "./?blog=$getblog" ?>">
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// get the blog name
|
|
|
|
|
echo BlogListGenerator::getName("./blogs/$getblog.md");
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</a>
|
2015-07-03 10:59:54 +02:00
|
|
|
|
</span>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
</nobr>
|
|
|
|
|
<div class="fadeout"></div>
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<!--
|
|
|
|
|
if the blog name is to long (especially on mobile devices), a fadeout
|
|
|
|
|
fades the text out at the end of the header
|
|
|
|
|
-->
|
2015-11-17 22:46:20 +01:00
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
// Blog Intro text
|
2015-12-18 21:59:34 +01:00
|
|
|
|
if (file_exists("blogs/$blog.md")
|
|
|
|
|
&& $getarticle == ""
|
2016-04-22 19:28:27 +02:00
|
|
|
|
&& $config["blog"]["intro"] == "on"
|
2015-12-18 21:59:34 +01:00
|
|
|
|
&& $gettag == ""
|
|
|
|
|
) {
|
|
|
|
|
// only shown if not in article or tag view
|
|
|
|
|
// and if the blogintro is enabled
|
|
|
|
|
// get content of the blog file
|
|
|
|
|
$file = file_get_contents("blogs/$blog.md");
|
|
|
|
|
// add a line break. necessary if the editor didn't make
|
|
|
|
|
// one while saving
|
|
|
|
|
$file = $file . "\n";
|
|
|
|
|
// basically removing the first line, which contains the blog title
|
|
|
|
|
$file = substr($file, strpos($file, "\n"));
|
2015-11-17 22:46:20 +01:00
|
|
|
|
if (strlen($file) > 3) { // if there is no content, don't show the intro
|
|
|
|
|
?>
|
|
|
|
|
<section class="card" id="intro">
|
|
|
|
|
<div class="articletext">
|
2016-04-25 18:47:02 +02:00
|
|
|
|
<?php // generate the html text from the markdown file
|
|
|
|
|
$intro = Parsedown::instance()
|
|
|
|
|
->setBreaksEnabled(true)// with linebreaks
|
|
|
|
|
->text($file);
|
|
|
|
|
echo $intro; // PRINTS THE SH****
|
2015-06-18 20:45:49 +02:00
|
|
|
|
?>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// TAG VIEW
|
|
|
|
|
if (isset($gettag)) { // if there's a tag -> tag view
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// 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(
|
2016-08-03 17:19:59 +02:00
|
|
|
|
$articlesdir,
|
|
|
|
|
$article,
|
|
|
|
|
$getblog,
|
|
|
|
|
$config["design"]["excerpt"],
|
|
|
|
|
$BLOGLANG["Read More"]
|
2015-12-18 21:59:34 +01:00
|
|
|
|
);
|
2015-06-15 11:27:57 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
2015-12-18 21:59:34 +01:00
|
|
|
|
} 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
|
2015-12-20 17:50:22 +01:00
|
|
|
|
$posts_amount = 0;
|
2015-12-18 21:59:34 +01:00
|
|
|
|
foreach ($articles as $article) {
|
|
|
|
|
// check if the file is a article file
|
|
|
|
|
if (strlen($article) >= 3 && substr($article, -3) == ".md") {
|
|
|
|
|
// generate the article
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["design"]["pagination"]) {
|
2015-12-20 17:50:22 +01:00
|
|
|
|
if ($posts_amount < $pag_max && $posts_amount >= $pag_min) {
|
|
|
|
|
ArticleGenerator::newArticle(
|
2016-08-03 17:19:59 +02:00
|
|
|
|
$articlesdir,
|
|
|
|
|
$article,
|
|
|
|
|
$getblog,
|
|
|
|
|
$config["design"]["excerpt"],
|
|
|
|
|
$BLOGLANG["Read More"]
|
2015-12-20 17:50:22 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ArticleGenerator::newArticle(
|
2016-08-03 17:19:59 +02:00
|
|
|
|
$articlesdir,
|
|
|
|
|
$article,
|
|
|
|
|
$getblog,
|
|
|
|
|
$config["design"]["excerpt"],
|
|
|
|
|
$BLOGLANG["Read More"]
|
2015-12-20 17:50:22 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
2015-06-12 10:31:28 +02:00
|
|
|
|
}
|
2015-12-20 17:50:22 +01:00
|
|
|
|
$posts_amount++;
|
|
|
|
|
}
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["design"]["pagination"]) {
|
2015-12-20 17:50:22 +01:00
|
|
|
|
include './res/php/Pagination.php';
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
} elseif (isset($getarticle)) { // ARTICLE VIEW
|
2015-12-18 21:59:34 +01:00
|
|
|
|
// generate the requested article
|
|
|
|
|
ArticleGenerator::newArticle(
|
2016-08-03 17:19:59 +02:00
|
|
|
|
$articlesdir,
|
|
|
|
|
$getarticle . ".md",
|
|
|
|
|
$getblog,
|
|
|
|
|
'off',
|
|
|
|
|
$BLOGLANG["Read More"]
|
2015-12-18 21:59:34 +01:00
|
|
|
|
);
|
2015-11-17 22:46:20 +01:00
|
|
|
|
include './res/php/Disqus.php'; // include disques
|
|
|
|
|
} else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN
|
|
|
|
|
echo "Some error occured, please go back.";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<div class="footer">
|
2016-04-22 19:28:27 +02:00
|
|
|
|
<?php echo $config["blog"]["footer"]; //print the blog footer?>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
// show the fab if it's enabled
|
2016-04-22 19:28:27 +02:00
|
|
|
|
if ($config["design"]["fab"] == "on") {
|
2015-11-17 22:46:20 +01:00
|
|
|
|
?>
|
|
|
|
|
<div class="fabmenu">
|
|
|
|
|
<div class="subfab"><!--Email subfab-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<a href='mailto:?subject=<?php
|
2016-04-22 19:28:27 +02:00
|
|
|
|
echo $config["blog"]["title"];
|
2015-12-18 21:59:34 +01:00
|
|
|
|
?>&body=<?php
|
|
|
|
|
echo $BLOGLANG['Check out this blog'];
|
|
|
|
|
?>: <?php
|
|
|
|
|
echo $url;
|
|
|
|
|
?>' target="blank">
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<img src="./res/img/email.svg" class="subfab-img"/>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="subfab"><!--twitter subfav-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<a href='https://twitter.com/intent/tweet?text=<?php
|
|
|
|
|
echo $BLOGLANG['Check out'];
|
|
|
|
|
?>: <?php
|
|
|
|
|
echo $url;
|
|
|
|
|
?>&original_referer=' target="blank">
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<img src="./res/img/twitter.svg" class="subfab-img"/>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="subfab"><!--gplus subfab-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<a href='https://plus.google.com/share?url=<?php
|
|
|
|
|
echo $url;
|
|
|
|
|
?>&hl=en-US' target="blank">
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<img src="./res/img/gplus.svg" class="subfab-img"/>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="subfab"><!--facebook subfab-->
|
2015-12-18 21:59:34 +01:00
|
|
|
|
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php
|
|
|
|
|
echo $url;
|
|
|
|
|
?>&t=<?php
|
2016-04-22 19:28:27 +02:00
|
|
|
|
echo "echo " . $config["blog"]["title"];
|
2015-12-18 21:59:34 +01:00
|
|
|
|
?>' target="blank">
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<img src="./res/img/facebook.svg" class="subfab-img"/>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="fab"><!-- share fab-->
|
|
|
|
|
<img src="./res/img/share.svg" class="fab-img" alt="Share"/>
|
|
|
|
|
</div>
|
2015-02-21 21:04:03 +01:00
|
|
|
|
</div>
|
2015-06-18 20:45:49 +02:00
|
|
|
|
<?php
|
2015-11-17 22:46:20 +01:00
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<script src="./res/js/jquery-2.1.4.min.js"></script> <!-- include jquery-->
|
|
|
|
|
<script src="./res/js/app.js"></script> <!--include main javascript-->
|
2015-12-05 18:21:22 +01:00
|
|
|
|
<!-- JS extension support -->
|
|
|
|
|
<?php
|
2016-08-03 17:19:59 +02:00
|
|
|
|
if (file_exists("./extensions")) {
|
|
|
|
|
$extensions = scandir('./extensions');
|
|
|
|
|
foreach ($extensions as $extension) {
|
|
|
|
|
if (substr($extension, -3) == ".js") {
|
|
|
|
|
echo "<script src='./extensions/$extension'></script>";
|
2015-12-24 12:13:33 +01:00
|
|
|
|
}
|
2015-12-05 18:21:22 +01:00
|
|
|
|
}
|
2016-08-03 17:19:59 +02:00
|
|
|
|
}
|
2015-12-05 18:21:22 +01:00
|
|
|
|
?>
|
2015-11-17 22:46:20 +01:00
|
|
|
|
<?php
|
|
|
|
|
require './res/php/GoogleAnalytics.php'; // include google analytics
|
|
|
|
|
?>
|
|
|
|
|
</body>
|
2015-02-21 21:04:03 +01:00
|
|
|
|
</html>
|