RCC: Write blog posts online
This commit is contained in:
parent
5568943994
commit
e8a2557c4a
6 changed files with 378 additions and 222 deletions
|
@ -29,7 +29,7 @@ $bloganalytics = '';
|
||||||
// Footer - set here the text for your footer (e.g. a copyright info). You can replace the whole text after the '=' with your own one.
|
// Footer - set here the text for your footer (e.g. a copyright info). You can replace the whole text after the '=' with your own one.
|
||||||
$blogfooter = 'Rangitaki ' . date("Y") . ' <a href="https://github.com/mmk2410/Rangitaki" target="blank">github.com/mmk2410/Rangitaki</a>';
|
$blogfooter = 'Rangitaki ' . date("Y") . ' <a href="https://github.com/mmk2410/Rangitaki" target="blank">github.com/mmk2410/Rangitaki</a>';
|
||||||
// This enables the optional rangitaki control center. Please read the documentation before you enable it.
|
// This enables the optional rangitaki control center. Please read the documentation before you enable it.
|
||||||
$rcc = 'no';
|
$rcc = 'yes';
|
||||||
// Here you can disable and enable the navigation menu. Usefull if you have no subblogs and no home directory
|
// Here you can disable and enable the navigation menu. Usefull if you have no subblogs and no home directory
|
||||||
$nav_drawer = 'yes';
|
$nav_drawer = 'yes';
|
||||||
// Set here the name of your theme. Read the documentation for more themes
|
// Set here the name of your theme. Read the documentation for more themes
|
||||||
|
|
445
index.php
445
index.php
|
@ -31,235 +31,240 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
-->
|
-->
|
||||||
<html>
|
<html>
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Rangitaki PHP Blogging engine
|
|
||||||
*/
|
|
||||||
// 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)
|
|
||||||
?>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title><?php echo $blogtitle; // Setting the blog article?></title>
|
|
||||||
<!--Metatags-->
|
|
||||||
<meta name="author" content="<?php echo $blogauthor; // Setting the blog author ?>" />
|
|
||||||
<meta name="description" content="<?php echo $blogdescription; // the blog description ?>" />
|
|
||||||
<!-- Meta tag for responsive ui-->
|
|
||||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
|
|
||||||
<!-- OpenGraph meta tags -->
|
|
||||||
<meta property="og:title" content="<?php echo $blogtitle; ?>" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="<?php echo $url; ?>" />
|
|
||||||
<meta property="og:image" content="<?php echo $favicon; ?>" />
|
|
||||||
<meta property="og:description" content="<?php echo $blogdescription; ?>" />
|
|
||||||
<meta property="og:locale:alternate" content="<?php echo $lang; ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta name="twitter:card" content="summary" />
|
|
||||||
<meta name="twitter:site" content="<?php echo $twitter; ?>" />
|
|
||||||
<meta name="twitter:title" content="<?php echo $blogtitle; ?>" />
|
|
||||||
<meta name="twitter:description" content="<?php echo $blogdescription; ?>" />
|
|
||||||
<meta name="twitter:image" content="<?php echo $favicon; ?>" />
|
|
||||||
<meta name="twitter:url" content="<?php echo $url; ?>" />
|
|
||||||
<!--CSS files-->
|
|
||||||
<link rel="stylesheet" type="text/css" href="res/css/rangitaki.css" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="themes/<?php echo $theme; // getting the theme stylesheet?>.css" />
|
|
||||||
<?php
|
|
||||||
// Checking if the drawer is enabled
|
|
||||||
if ($nav_drawer == 'no') {
|
|
||||||
// Loading additional stylesheet for disabling the drawer?>
|
|
||||||
<link rel="stylesheet" type="text/css" href="res/css/no-nav.css" />
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,400italic,100,100italic,900' rel='stylesheet' type='text/css'> <!--Font-->
|
|
||||||
<link rel="stylesheet" href="./res/css/github-gist.css"> <!-- stylesheet for code highlighting-->
|
|
||||||
<!--Favicons-->
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $favicon; ?>" />
|
|
||||||
<link rel="apple-touch-icon-precomposed" href="<?php echo $favicon; ?>">
|
|
||||||
<!-- JavaScript Pt. 1: HightlightJS (get and load): Code highlighting-->
|
|
||||||
<script src="./res/js/highlight.pack.js"></script>
|
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
// Checking if the navigation drawer is enabled. If not -> skip it
|
|
||||||
if ($nav_drawer == "yes") {
|
|
||||||
?>
|
|
||||||
<div class="overlay"></div> <!-- Darken the background when fading the drawer in. See also the JS file-->
|
|
||||||
<div class="nav">
|
|
||||||
<div class="divider"></div>
|
|
||||||
<?php
|
|
||||||
$blogs = scandir("./blogs/"); // Getting everything from the blog directory
|
|
||||||
if (!isset($getarticle) && !isset($gettag) && sizeof($blogs) > 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 "<section>";
|
|
||||||
echo "<div class='nav-item-static'>" . $BLOGLANG['Blogs on'] . " $blogtitle:</div>"; // 1. Set localized string 2. Set blogtitle
|
|
||||||
foreach ($blogs as $blog) { // iterating through the blogs/ directory
|
|
||||||
if (strlen($blog) >= 3 && substr($blog, -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 ($blog != "main.md") { // excluding main blog
|
|
||||||
BlogListGenerator::listBlog("./blogs/", $blog, $blogtitle); // creating navigation item
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($getblog . ".md" != $blog) { // Check if $blog is current blog -> this blog will be excluded
|
|
||||||
// Make sure that the entry has a title, because main.md hasn't one
|
|
||||||
if (empty($blogmainname)) {
|
|
||||||
$blogmaintitle = $blogtitle;
|
|
||||||
} else {
|
|
||||||
$blogmaintitle = $blogmainname;
|
|
||||||
}
|
|
||||||
BlogListGenerator::listBlog("./blogs/", $blog, $blogmaintitle); // creating navigation item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</section>";
|
|
||||||
} elseif (isset($getarticle) || isset($gettag)) { // If viewing a blog or a tag
|
|
||||||
?>
|
|
||||||
<a class="nav-item" onclick="goBack()">Go back</a> <!-- Set a back item instead of the blogs. -->
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
if ($bloghome == "yes") { // If a blog home is existend
|
|
||||||
?>
|
|
||||||
<div class="divider"></div>
|
|
||||||
<a class="nav-item" href="<?php echo $bloghomeurl; ?>"><?php echo $bloghomename; ?></a>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div> <!-- End of the navigation drawer-->
|
|
||||||
<?php
|
<?php
|
||||||
} // Endif from line 97; Yes, I really should think about alternative syntax...
|
/**
|
||||||
|
* Rangitaki PHP Blogging engine
|
||||||
|
*/
|
||||||
|
// 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)
|
||||||
|
?>
|
||||||
|
|
||||||
// Set blog to "main" if on main blog, else to $getblog. This variable is needed later
|
<head>
|
||||||
if ($getblog == "") {
|
<meta charset="utf-8">
|
||||||
$blog = "main";
|
<title><?php echo $blogtitle; // Setting the blog article?></title>
|
||||||
} else {
|
<!--Metatags-->
|
||||||
$blog = $getblog;
|
<meta name="author" content="<?php echo $blogauthor; // Setting the blog author ?>"/>
|
||||||
}
|
<meta name="description" content="<?php echo $blogdescription; // the blog description ?>"/>
|
||||||
?>
|
<!-- Meta tag for responsive ui-->
|
||||||
<div class="main"> <!-- Main page with content -->
|
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
|
||||||
<div class="header"> <!-- Action Bar, but since there isn't much action I call it header. One day a search feature would be nice...-->
|
<!-- OpenGraph meta tags -->
|
||||||
<img src="./res/img/menu.svg" class="nav-img" /> <!-- Ham,ham,hamburger-->
|
<meta property="og:title" content="<?php echo $blogtitle; ?>"/>
|
||||||
<!-- Blog title with subblog title and links to each one-->
|
<meta property="og:type" content="website"/>
|
||||||
<nobr><span class="title"><a href="./"><?php echo $blogtitle; ?><!-- link to main blog-->
|
<meta property="og:url" content="<?php echo $url; ?>"/>
|
||||||
<?php
|
<meta property="og:image" content="<?php echo $favicon; ?>"/>
|
||||||
if (empty($getblog)) { // if not on a subblog
|
<meta property="og:description" content="<?php echo $blogdescription; ?>"/>
|
||||||
if (!empty($blogmainname)) {
|
<meta property="og:locale:alternate" content="<?php echo $lang; ?>"/>
|
||||||
echo "›" . $blogmainname; // If you see a › (square) here : This is not a bug, but a missing sign in your font
|
<!-- Twitter meta tags -->
|
||||||
}
|
<meta name="twitter:card" content="summary"/>
|
||||||
} else { // On subblog: set also a link to the subblog
|
<meta name="twitter:site" content="<?php echo $twitter; ?>"/>
|
||||||
?>
|
<meta name="twitter:title" content="<?php echo $blogtitle; ?>"/>
|
||||||
</a>
|
<meta name="twitter:description" content="<?php echo $blogdescription; ?>"/>
|
||||||
› <a href="<?php echo "./?blog=$getblog" ?>">
|
<meta name="twitter:image" content="<?php echo $favicon; ?>"/>
|
||||||
<?php
|
<meta name="twitter:url" content="<?php echo $url; ?>"/>
|
||||||
echo BlogListGenerator::getName("./blogs/$getblog.md"); // get the blog name
|
<!--CSS files-->
|
||||||
|
<link rel="stylesheet" type="text/css" href="res/css/rangitaki.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="themes/<?php echo $theme; // getting the theme stylesheet?>.css"/>
|
||||||
|
<?php
|
||||||
|
// Checking if the drawer is enabled
|
||||||
|
if ($nav_drawer == 'no') {
|
||||||
|
// Loading additional stylesheet for disabling the drawer?>
|
||||||
|
<link rel="stylesheet" type="text/css" href="res/css/no-nav.css"/>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,400italic,100,100italic,900' rel='stylesheet'
|
||||||
|
type='text/css'> <!--Font-->
|
||||||
|
<link rel="stylesheet" href="./res/css/github-gist.css"> <!-- stylesheet for code highlighting-->
|
||||||
|
<!--Favicons-->
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $favicon; ?>"/>
|
||||||
|
<link rel="apple-touch-icon-precomposed" href="<?php echo $favicon; ?>">
|
||||||
|
<!-- JavaScript Pt. 1: HightlightJS (get and load): Code highlighting-->
|
||||||
|
<script src="./res/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
// Checking if the navigation drawer is enabled. If not -> skip it
|
||||||
|
if ($nav_drawer == "yes") {
|
||||||
|
?>
|
||||||
|
<div class="overlay"></div> <!-- Darken the background when fading the drawer in. See also the JS file-->
|
||||||
|
<div class="nav">
|
||||||
|
<div class="divider"></div>
|
||||||
|
<?php
|
||||||
|
$blogs = scandir("./blogs/"); // Getting everything from the blog directory
|
||||||
|
if (!isset($getarticle) && !isset($gettag) && sizeof($blogs) > 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 "<section>";
|
||||||
|
echo "<div class='nav-item-static'>" . $BLOGLANG['Blogs on'] . " $blogtitle:</div>"; // 1. Set localized string 2. Set blogtitle
|
||||||
|
foreach ($blogs as $blog) { // iterating through the blogs/ directory
|
||||||
|
if (strlen($blog) >= 3 && substr($blog, -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 ($blog != "main.md") { // excluding main blog
|
||||||
|
BlogListGenerator::listBlog("./blogs/", $blog, $blogtitle); // creating navigation item
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($getblog . ".md" != $blog) { // Check if $blog is current blog -> this blog will be excluded
|
||||||
|
// Make sure that the entry has a title, because main.md hasn't one
|
||||||
|
if (empty($blogmainname)) {
|
||||||
|
$blogmaintitle = $blogtitle;
|
||||||
|
} else {
|
||||||
|
$blogmaintitle = $blogmainname;
|
||||||
}
|
}
|
||||||
?>
|
BlogListGenerator::listBlog("./blogs/", $blog, $blogmaintitle); // creating navigation item
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</nobr>
|
|
||||||
<div class="fadeout"></div> <!-- if the blog name is to long (especially on mobile devices), a fadeout fades the test out at the end of the header-->
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
// Blog Intro text
|
|
||||||
if (file_exists("blogs/$blog.md") && $getarticle == "" && $blogintro == "yes" && $gettag == "") { // only shown if not in article or tag view and if the blogintro is enabled
|
|
||||||
$file = file_get_contents("blogs/$blog.md"); // get content of the blog file
|
|
||||||
$file = $file . "\n"; // add a line break. necessary if the editor didn't make one while saving
|
|
||||||
$file = substr($file, strpos($file, "\n")); // basically removing the first line, which contains the blog title
|
|
||||||
if (strlen($file) > 3) { // if there is no content, don't show the intro
|
|
||||||
?>
|
|
||||||
<section class="card" id="intro">
|
|
||||||
<div class="articletext">
|
|
||||||
<?php // generate the html text from the markdown file
|
|
||||||
$intro = Parsedown::instance()
|
|
||||||
->setBreaksEnabled(true) // with linebreaks
|
|
||||||
->text($file);
|
|
||||||
echo $intro; // PRINTS THE SH****
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$articlesdir = "./articles/$blog/"; // generate a variable with the articles directory
|
|
||||||
// TAG VIEW
|
|
||||||
if (isset($gettag)) { // if there's a tag -> 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.";
|
|
||||||
}
|
}
|
||||||
|
echo "</section>";
|
||||||
|
} elseif (isset($getarticle) || isset($gettag)) { // If viewing a blog or a tag
|
||||||
?>
|
?>
|
||||||
<div class="footer">
|
<a class="nav-item" onclick="goBack()">Go back</a> <!-- Set a back item instead of the blogs. -->
|
||||||
<?php echo $blogfooter; //print the blog footer?>
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
// show the fab if it's enabled
|
}
|
||||||
if ($sharefab == "yes") {
|
if ($bloghome == "yes") { // If a blog home is existend
|
||||||
?>
|
|
||||||
<div class="fabmenu">
|
|
||||||
<div class="subfab"><!--Email subfab-->
|
|
||||||
<a href='mailto:?subject=
|
|
||||||
<?php echo $blogtitle; ?>&body=<?php echo $BLOGLANG['Check out this blog']; ?>: <?php echo $url; ?>'
|
|
||||||
target="blank">
|
|
||||||
<img src="./res/img/email.svg" class="subfab-img" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="subfab"><!--twitter subfav-->
|
|
||||||
<a href='https://twitter.com/intent/tweet?text=<?php echo $BLOGLANG['Check out']; ?>: <?php echo $url; ?>&original_referer=' target="blank">
|
|
||||||
<img src="./res/img/twitter.svg" class="subfab-img" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="subfab"><!--gplus subfab-->
|
|
||||||
<a href='https://plus.google.com/share?url=<?php echo $url; ?>&hl=en-US' target="blank">
|
|
||||||
<img src="./res/img/gplus.svg" class="subfab-img" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="subfab"><!--facebook subfab-->
|
|
||||||
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&t=<?php echo "echo $blogtitle" ?>' target="blank">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</div>
|
<div class="divider"></div>
|
||||||
<script src="./res/js/jquery-2.1.4.min.js"></script> <!-- include jquery-->
|
<a class="nav-item" href="<?php echo $bloghomeurl; ?>"><?php echo $bloghomename; ?></a>
|
||||||
<script src="./res/js/app.js"></script> <!--include main javascript-->
|
<?php
|
||||||
<?php
|
}
|
||||||
require './res/php/GoogleAnalytics.php'; // include google analytics
|
|
||||||
?>
|
?>
|
||||||
</body>
|
</div> <!-- End of the navigation drawer-->
|
||||||
|
<?php
|
||||||
|
} // Endif from line 97; Yes, I really should think about alternative syntax...
|
||||||
|
|
||||||
|
// Set blog to "main" if on main blog, else to $getblog. This variable is needed later
|
||||||
|
if ($getblog == "") {
|
||||||
|
$blog = "main";
|
||||||
|
} else {
|
||||||
|
$blog = $getblog;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="main"> <!-- Main page with content -->
|
||||||
|
<div class="header">
|
||||||
|
<!-- Action Bar, but since there isn't much action I call it header. One day a search feature would be nice...-->
|
||||||
|
<img src="./res/img/menu.svg" class="nav-img"/> <!-- Ham,ham,hamburger-->
|
||||||
|
<!-- Blog title with subblog title and links to each one-->
|
||||||
|
<nobr><span class="title"><a href="./"><?php echo $blogtitle; ?><!-- link to main blog-->
|
||||||
|
<?php
|
||||||
|
if (empty($getblog)) { // if not on a subblog
|
||||||
|
if (!empty($blogmainname)) {
|
||||||
|
echo "›" . $blogmainname; // If you see a › (square) here : This is not a bug, but a missing sign in your font
|
||||||
|
}
|
||||||
|
} else { // On subblog: set also a link to the subblog
|
||||||
|
?>
|
||||||
|
</a>
|
||||||
|
› <a href="<?php echo "./?blog=$getblog" ?>">
|
||||||
|
<?php
|
||||||
|
echo BlogListGenerator::getName("./blogs/$getblog.md"); // get the blog name
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</nobr>
|
||||||
|
<div class="fadeout"></div>
|
||||||
|
<!-- if the blog name is to long (especially on mobile devices), a fadeout fades the test out at the end of the header-->
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
// Blog Intro text
|
||||||
|
if (file_exists("blogs/$blog.md") && $getarticle == "" && $blogintro == "yes" && $gettag == "") { // only shown if not in article or tag view and if the blogintro is enabled
|
||||||
|
$file = file_get_contents("blogs/$blog.md"); // get content of the blog file
|
||||||
|
$file = $file . "\n"; // add a line break. necessary if the editor didn't make one while saving
|
||||||
|
$file = substr($file, strpos($file, "\n")); // basically removing the first line, which contains the blog title
|
||||||
|
if (strlen($file) > 3) { // if there is no content, don't show the intro
|
||||||
|
?>
|
||||||
|
<section class="card" id="intro">
|
||||||
|
<div class="articletext">
|
||||||
|
<?php // generate the html text from the markdown file
|
||||||
|
$intro = Parsedown::instance()
|
||||||
|
->setBreaksEnabled(true)// with linebreaks
|
||||||
|
->text($file);
|
||||||
|
echo $intro; // PRINTS THE SH****
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$articlesdir = "./articles/$blog/"; // generate a variable with the articles directory
|
||||||
|
// TAG VIEW
|
||||||
|
if (isset($gettag)) { // if there's a tag -> 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.";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="footer">
|
||||||
|
<?php echo $blogfooter; //print the blog footer?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
// show the fab if it's enabled
|
||||||
|
if ($sharefab == "yes") {
|
||||||
|
?>
|
||||||
|
<div class="fabmenu">
|
||||||
|
<div class="subfab"><!--Email subfab-->
|
||||||
|
<a href='mailto:?subject=
|
||||||
|
<?php echo $blogtitle; ?>&body=<?php echo $BLOGLANG['Check out this blog']; ?>: <?php echo $url; ?>'
|
||||||
|
target="blank">
|
||||||
|
<img src="./res/img/email.svg" class="subfab-img"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="subfab"><!--twitter subfav-->
|
||||||
|
<a href='https://twitter.com/intent/tweet?text=<?php echo $BLOGLANG['Check out']; ?>: <?php echo $url; ?>&original_referer='
|
||||||
|
target="blank">
|
||||||
|
<img src="./res/img/twitter.svg" class="subfab-img"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="subfab"><!--gplus subfab-->
|
||||||
|
<a href='https://plus.google.com/share?url=<?php echo $url; ?>&hl=en-US' target="blank">
|
||||||
|
<img src="./res/img/gplus.svg" class="subfab-img"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="subfab"><!--facebook subfab-->
|
||||||
|
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&t=<?php echo "echo $blogtitle" ?>'
|
||||||
|
target="blank">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<script src="./res/js/jquery-2.1.4.min.js"></script> <!-- include jquery-->
|
||||||
|
<script src="./res/js/app.js"></script> <!--include main javascript-->
|
||||||
|
<?php
|
||||||
|
require './res/php/GoogleAnalytics.php'; // include google analytics
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -60,7 +60,7 @@ THE SOFTWARE.
|
||||||
$_SESSION['login'] = true;
|
$_SESSION['login'] = true;
|
||||||
?>
|
?>
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<div class="headline">File Upload</div>
|
<div class="headline">Post Upload</div>
|
||||||
<form enctype="multipart/form-data" action="uploaded/" method="POST">
|
<form enctype="multipart/form-data" action="uploaded/" method="POST">
|
||||||
<select name="blog">
|
<select name="blog">
|
||||||
<?php
|
<?php
|
||||||
|
@ -80,6 +80,36 @@ THE SOFTWARE.
|
||||||
<input id="button" type="submit" value="Upload" class="button"/>
|
<input id="button" type="submit" value="Upload" class="button"/>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">New Post</div>
|
||||||
|
<form action="newpost/" method="POST">
|
||||||
|
<p>Blog:</p>
|
||||||
|
<select name="blog">
|
||||||
|
<?php
|
||||||
|
$blogs = scandir("../blogs/");
|
||||||
|
foreach ($blogs as $blog) {
|
||||||
|
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
||||||
|
$blog = substr($blog, 0, -3);
|
||||||
|
echo "<option value='$blog'>$blog</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<p>Title:<br><br><input type="text" class="itextfield" name="title"/></p>
|
||||||
|
|
||||||
|
<p>Date:<br><br><input type="text" class="itextfield" name="date"/></p>
|
||||||
|
|
||||||
|
<p>Author:<br><br><input type="text" class="itextfield" name="author"/></p>
|
||||||
|
|
||||||
|
<p>Tags:<br><br><input type="text" class="itextfield" name="tags"/></p>
|
||||||
|
|
||||||
|
<p>Text:</p>
|
||||||
|
<textarea class="itextarea" name="text"></textarea>
|
||||||
|
<br><br>
|
||||||
|
<input id="button" type="submit" value="Post" class="button"/>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
|
@ -105,5 +135,6 @@ THE SOFTWARE.
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="./res/rcc.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
69
rcc/newpost/index.php
Normal file
69
rcc/newpost/index.php
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright 2015 mmk2410.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Rangitaki Control Center</title>
|
||||||
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
|
||||||
|
<link rel="stylesheet" href="../res/rcc.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<a href="../" class="title">Rangitaki Control Center</a>
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">New Post</div>
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if ($_SESSION['login']) {
|
||||||
|
$title = $_POST["blog"];
|
||||||
|
$date = $_POST["date"];
|
||||||
|
$author = $_POST["author"];
|
||||||
|
$tags = $_POST["tags"];
|
||||||
|
$text = $_POST["text"];
|
||||||
|
$blog = $_POST["blog"];
|
||||||
|
$md = <<<EOD
|
||||||
|
%TITLE: $title
|
||||||
|
%DATE: $date
|
||||||
|
%AUTHOR: $author
|
||||||
|
%TAGS: $tags
|
||||||
|
|
||||||
|
$text
|
||||||
|
EOD;
|
||||||
|
$filename = date("Y-m-d") . ".md";
|
||||||
|
$handle = fopen("../../articles/$blog/$filename", "c");
|
||||||
|
fwrite($handle, $md);
|
||||||
|
if (fclose($handle)) {
|
||||||
|
echo "Post successfully published.";
|
||||||
|
} else {
|
||||||
|
echo "Some error happend, while publishing.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -166,6 +166,8 @@ input.button{
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
|
width: 400px;
|
||||||
|
max-width: 100%;
|
||||||
border-bottom-color: #aaa;
|
border-bottom-color: #aaa;
|
||||||
transition-property: border-bottom-color;
|
transition-property: border-bottom-color;
|
||||||
transition-delay: 50ms;
|
transition-delay: 50ms;
|
||||||
|
@ -187,6 +189,38 @@ input.button{
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TEXTAREA */
|
||||||
|
|
||||||
|
.itextarea {
|
||||||
|
border-color: transparent;
|
||||||
|
border-width: 1px;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 22px;
|
||||||
|
height: auto;
|
||||||
|
resize: none;
|
||||||
|
min-height: 100px;
|
||||||
|
width: calc(100% - 10px);
|
||||||
|
border-bottom-color: #aaa;
|
||||||
|
transition-property: border-bottom-color;
|
||||||
|
transition-delay: 50ms;
|
||||||
|
transition-duration: 125ms;
|
||||||
|
transition-timing-function: ease;
|
||||||
|
-moz-transition-property: border-bottom-color;
|
||||||
|
-moz-transition-delay: 50ms;
|
||||||
|
-moz-transition-duration: 125ms;
|
||||||
|
-moz-transition-timing-function: ease;
|
||||||
|
-webkit-transition-property: border-bottom-color;
|
||||||
|
-webkit-transition-delay: 50ms;
|
||||||
|
-webkit-transition-duration: 125ms;
|
||||||
|
-webkit-transition-timing-function: ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.itextarea:focus {
|
||||||
|
border-bottom-color: #ff4415;
|
||||||
|
border-width: 2px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* FORM */
|
/* FORM */
|
||||||
form{
|
form{
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
|
17
rcc/res/rcc.js
Normal file
17
rcc/res/rcc.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
window.onload = function () {
|
||||||
|
var t = document.getElementsByTagName('textarea')[0];
|
||||||
|
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width')));
|
||||||
|
|
||||||
|
var resize = function (t) {
|
||||||
|
t.style.height = 'auto';
|
||||||
|
t.style.height = (t.scrollHeight + offset ) + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
t.addEventListener && t.addEventListener('input', function (event) {
|
||||||
|
resize(t);
|
||||||
|
});
|
||||||
|
|
||||||
|
t['attachEvent'] && t.attachEvent('onkeyup', function () {
|
||||||
|
resize(t);
|
||||||
|
});
|
||||||
|
}
|
Reference in a new issue