Code Improvements
This commit is contained in:
parent
08ee5eaf39
commit
75b705ee2c
14 changed files with 933 additions and 521 deletions
|
@ -1,112 +1,172 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP Version 7
|
||||||
|
*
|
||||||
|
* @category Blogging
|
||||||
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* Edit page of RCC (Rangitaki Control Center)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!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>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
<title>Rangitaki Control Center</title>
|
<title>Rangitaki Control Center</title>
|
||||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
|
|
||||||
|
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
|
||||||
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
|
||||||
|
user-scalable=0" name="viewport"/>
|
||||||
|
|
||||||
|
<meta name="theme-color" content="#383838">
|
||||||
|
<meta name="description" content="Rangitaki Control Center (RCC)">
|
||||||
|
|
||||||
<link rel="stylesheet" href="../res/rcc.css"/>
|
<link rel="stylesheet" href="../res/rcc.css"/>
|
||||||
|
|
||||||
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
|
||||||
|
400italic,100,100italic,900' rel='stylesheet'
|
||||||
|
type='text/css'> <!--Font-->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="../" class="title">Rangitaki Control Center</a>
|
<a href="../" class="title">Rangitaki Control Center</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
if ($_SESSION['login']) {
|
if ($_SESSION['login']) {
|
||||||
include_once("../../res/php/ArticleGenerator.php");
|
include_once "../../res/php/ArticleGenerator.php";
|
||||||
$directory = "./../../articles/" . $_GET['blog'] . "/";
|
$directory = "./../../articles/" . $_GET['blog'] . "/";
|
||||||
$article = $_GET['post'] . ".md";
|
$article = $_GET['post'] . ".md";
|
||||||
?>
|
?>
|
||||||
|
<!-- Edit Post -->
|
||||||
<section class="card">
|
<section class="card">
|
||||||
|
|
||||||
<div class="headline">Edit Post</div>
|
<div class="headline">Edit Post</div>
|
||||||
<p>Title:<br><br><input type="text" class="itextfield"
|
|
||||||
value="<?php echo ArticleGenerator::getTitle($directory, $article) ?>"
|
<p>Title:
|
||||||
name="title"
|
<br><br>
|
||||||
id="title"/>
|
<input type="text" class="itextfield"
|
||||||
|
value="<?php
|
||||||
|
echo ArticleGenerator::getTitle($directory, $article);
|
||||||
|
?>" name="title" id="title"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Date:<br><br><input type="text" class="itextfield"
|
<p>Date:
|
||||||
value="<?php echo ArticleGenerator::getDate($directory, $article) ?>" name="date"
|
<br><br>
|
||||||
id="date"/>
|
<input type="text" class="itextfield"
|
||||||
|
value="<?php
|
||||||
|
echo ArticleGenerator::getDate($directory, $article);
|
||||||
|
?>" name="date" id="date"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Author:<br><br><input type="text"
|
<p>Author:
|
||||||
value="<?php echo ArticleGenerator::getAuthor($directory, $article) ?>"
|
<br><br>
|
||||||
class="itextfield" name="author"
|
<input type="text" class="itextfield"
|
||||||
id="author"/></p>
|
value="<?php
|
||||||
|
echo ArticleGenerator::getAuthor($directory, $article);
|
||||||
|
?>" name="author" id="author"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>Tags:<br><br><input type="text"
|
<p>Tags:
|
||||||
value="<?php
|
<br><br>
|
||||||
$tags = "";
|
<input type="text" class="itextfield"
|
||||||
foreach (ArticleGenerator::getTags($directory, $article) as $tag) {
|
value="<?php
|
||||||
$tags = $tags . ', ' . $tag;
|
$tags = "";
|
||||||
}
|
foreach (
|
||||||
$tags = substr($tags, 2);
|
ArticleGenerator::getTags($directory, $article)
|
||||||
echo $tags;
|
as $tag) {
|
||||||
?>"
|
$tags = $tags . ', ' . $tag;
|
||||||
class="itextfield" name="tags"
|
}
|
||||||
id="tags"/></p>
|
$tags = substr($tags, 2);
|
||||||
|
echo $tags;
|
||||||
|
?>" name="tags" id="tags"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>Text:</p>
|
<p>Text:</p>
|
||||||
<textarea class="itextarea" name="text" id="text">
|
<textarea class="itextarea" name="text" id="text">
|
||||||
<?php echo ArticleGenerator::getText($directory, $article) ?>
|
<?php
|
||||||
|
echo ArticleGenerator::getText($directory, $article);
|
||||||
|
?>
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<a class="button" id="save_changes">SAVE CHANGES</a>
|
<a class="button" id="save_changes">SAVE CHANGES</a>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!-- Go Back -->
|
||||||
<section class="card">
|
<section class="card">
|
||||||
|
|
||||||
<div class="headline">Back</div>
|
<div class="headline">Back</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Go back to the RCC home. All changes will be lost.
|
Go back to the RCC home. All changes will be lost.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<a class="button" href="../">BACK</a>
|
<a class="button" href="../">BACK</a>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<!-- Access denied -->
|
||||||
<section class="card">
|
<section class="card">
|
||||||
|
|
||||||
<div class="headline">Access denied</div>
|
<div class="headline">Access denied</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The access to this area is not granted. Make sure you're logged in.
|
The access to this area is not granted. Make sure you're logged
|
||||||
|
in.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<a class="button" href="../">BACK</a>
|
<a class="button" href="../">BACK</a>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<?php
|
|
||||||
}
|
<?php
|
||||||
?>
|
}
|
||||||
</div>
|
?>
|
||||||
<script>
|
|
||||||
var getVariables = <?php echo json_encode($_GET); ?>;
|
</div>
|
||||||
</script>
|
|
||||||
<script src="../../res/js/jquery-2.1.4.min.js"></script>
|
<script>
|
||||||
<script src="../res/rcc.js"></script>
|
var getVariables = <?php echo json_encode($_GET); ?>;
|
||||||
<script src="../res/edit.js"></script>
|
</script>
|
||||||
|
<script src="../../res/js/jquery-2.1.4.min.js"></script>
|
||||||
|
<script src="../res/rcc.js"></script>
|
||||||
|
<script src="../res/edit.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
* PHP Version 7
|
* PHP Version 7
|
||||||
*
|
*
|
||||||
* @category Atom_Feed
|
* @category Atom_Feed
|
||||||
* @package Rbe
|
* @package Rcc
|
||||||
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
* @license MIT License
|
* @license MIT License
|
||||||
* @link https://github.com/mmk2410/rangitaki
|
* @link https://github.com/mmk2410/rangitaki
|
||||||
*
|
*
|
||||||
|
* Feed Generator
|
||||||
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Copyright 2015 mmk2410.
|
* Copyright 2015 mmk2410.
|
||||||
|
@ -88,11 +90,14 @@ if ($_SESSION['login']) {
|
||||||
$feed = $writer->execute();
|
$feed = $writer->execute();
|
||||||
|
|
||||||
$file = fopen($feed_path, "w");
|
$file = fopen($feed_path, "w");
|
||||||
|
|
||||||
if (fwrite($file, $feed) === false) {
|
if (fwrite($file, $feed) === false) {
|
||||||
echo "-1";
|
echo "-1";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
echo "0";
|
echo "0";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
467
rcc/index.php
467
rcc/index.php
|
@ -1,207 +1,298 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP Version 7
|
||||||
|
*
|
||||||
|
* @category Blogging
|
||||||
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* Main page of RCC (Rangitaki Control Center)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<!--
|
|
||||||
Rangitaki Blogging Engine - RCC (Rangitaki Control Center)
|
|
||||||
|
|
||||||
Copyright (c) 2016 by Marcel Kapfer (mmk2410)
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
-->
|
|
||||||
<title>Rangitaki Control Center</title>
|
<title>Rangitaki Control Center</title>
|
||||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
|
|
||||||
|
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
|
||||||
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
|
||||||
|
user-scalable=0" name="viewport"/>
|
||||||
|
|
||||||
|
<meta name="theme-color" content="#383838">
|
||||||
|
<meta name="description" content="Rangitaki Control Center (RCC)">
|
||||||
|
|
||||||
<link rel="stylesheet" href="./res/rcc.css"/>
|
<link rel="stylesheet" href="./res/rcc.css"/>
|
||||||
|
|
||||||
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
|
||||||
|
400italic,100,100italic,900' rel='stylesheet'
|
||||||
|
type='text/css'> <!--Font-->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
|
||||||
<a href="./" class="title">Rangitaki Control Center</a>
|
<div class="header">
|
||||||
<a href="../" class="back">Back to the blog</a>
|
<a href="./" class="title">Rangitaki Control Center</a>
|
||||||
</div>
|
<a href="../" class="back">Back to the blog</a>
|
||||||
<div class="main">
|
</div>
|
||||||
|
|
||||||
|
<div class="main">
|
||||||
|
<?php
|
||||||
|
require '../config.php';
|
||||||
|
|
||||||
|
if ($rcc == "yes") {
|
||||||
|
|
||||||
|
include 'password.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (isset($_POST['passwd'])) {
|
||||||
|
$passwd = $_POST['passwd'];
|
||||||
|
$_SESSION['passwd'] = $_POST['passwd'];
|
||||||
|
} else if (isset($_SESSION['passwd'])) {
|
||||||
|
$passwd = $_SESSION['passwd'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($passwd == "") {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Login Card -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Log In</div>
|
||||||
|
<form action="./" method="post">
|
||||||
|
<p>Password:
|
||||||
|
<br><br>
|
||||||
|
<input type="password" class="itextfield" name="passwd"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<input type="Submit" class="button" value="Log in"/>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require '../config.php';
|
|
||||||
if ($rcc == "yes") {
|
|
||||||
include 'password.php';
|
|
||||||
session_start();
|
|
||||||
if (isset($_POST['passwd'])) {
|
|
||||||
$passwd = $_POST['passwd'];
|
|
||||||
$_SESSION['passwd'] = $_POST['passwd'];
|
|
||||||
} else if (isset($_SESSION['passwd'])) {
|
|
||||||
$passwd = $_SESSION['passwd'];
|
|
||||||
}
|
|
||||||
if ($passwd == "") {
|
|
||||||
?>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Log In</div>
|
|
||||||
<form action="./" method="post">
|
|
||||||
<p>Password:<br><br><input type="password" class="itextfield" name="passwd"/></p>
|
|
||||||
<input type="Submit" class="button" value="Log in"/>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
<?php
|
|
||||||
} else {
|
|
||||||
if ($passwd == $password) {
|
|
||||||
$_SESSION['login'] = true;
|
|
||||||
include_once("./../res/php/BlogListGenerator.php");
|
|
||||||
?>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Post Upload</div>
|
|
||||||
<form enctype="multipart/form-data" action="uploaded/" method="POST">
|
|
||||||
<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>
|
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000"/>
|
|
||||||
<input id="" name="userfile" type="file" value="Choose a file"/>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<input id="button" type="submit" value="Upload" class="button"/>
|
|
||||||
</form>
|
|
||||||
</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>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Edit post</div>
|
|
||||||
<p>
|
|
||||||
First select the blog of the post you wan't to edit.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p id="edit_select_blog">
|
|
||||||
<select name="blog" id="edit_selected_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>
|
|
||||||
<a class="button" id="edit_get_posts">GET POSTS</a>
|
|
||||||
</section>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Delete Post</div>
|
|
||||||
<p>
|
|
||||||
First select the subblog of the post you want to delete.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p id="delete_select_blog">
|
|
||||||
<select name="blog" id="delete_selected_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>
|
|
||||||
<a class="button" id="delete_get_posts">GET POSTS</a>
|
|
||||||
</section>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Media Upload</div>
|
|
||||||
<form enctype="multipart/form-data" action="media/" method="POST">
|
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000"/>
|
|
||||||
<input id="" name="userfile" type="file" value="Choose a file"/>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<input id="button" type="submit" value="Upload" class="button"/>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Atom Feed Generator</div>
|
|
||||||
<p>
|
|
||||||
<select name="blog" id="generate_atom_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>
|
|
||||||
<a class="button" id="generate_atom">GENERATE</a>
|
|
||||||
</section>
|
|
||||||
<?php
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
<section class="card">
|
|
||||||
<div class="headline">Wrong Password</div>
|
|
||||||
<p>
|
|
||||||
Please go back and try again.
|
|
||||||
</p>
|
|
||||||
<a href="./" class="button">GO BACK</a>
|
|
||||||
</section>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if ($passwd == $password) {
|
||||||
|
$_SESSION['login'] = true;
|
||||||
|
include_once "./../res/php/BlogListGenerator.php";
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Post Upload -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Post Upload</div>
|
||||||
|
<form enctype="multipart/form-data" action="uploaded/"
|
||||||
|
method="POST">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE" value="100000"/>
|
||||||
|
<input id="" name="userfile" type="file" value="Choose a file"/>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<input id="button" type="submit" value="Upload" class="button"/>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- New Post -->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- Edit post -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Edit post</div>
|
||||||
|
<p>
|
||||||
|
First select the blog of the post you wan't to edit.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p id="edit_select_blog">
|
||||||
|
<select name="blog" id="edit_selected_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>
|
||||||
|
<a class="button" id="edit_get_posts">GET POSTS</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Delete Post -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Delete Post</div>
|
||||||
|
<p>
|
||||||
|
First select the subblog of the post you want to delete.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p id="delete_select_blog">
|
||||||
|
<select name="blog" id="delete_selected_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>
|
||||||
|
<a class="button" id="delete_get_posts">GET POSTS</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Media Upload -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Media Upload</div>
|
||||||
|
<form enctype="multipart/form-data" action="media/" method="POST">
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE"
|
||||||
|
value="100000000000"/>
|
||||||
|
<input id="" name="userfile" type="file" value="Choose a file"/>
|
||||||
|
<br><br>
|
||||||
|
<input id="button" type="submit" value="Upload" class="button"/>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Atom Feed Generator -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Atom Feed Generator</div>
|
||||||
|
<p>
|
||||||
|
<select name="blog" id="generate_atom_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>
|
||||||
|
<a class="button" id="generate_atom">GENERATE</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<!-- Wrong Password -->
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Wrong Password</div>
|
||||||
|
<p>
|
||||||
|
Please go back and try again.
|
||||||
|
</p>
|
||||||
|
<a href="./" class="button">GO BACK</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Not enabled -->
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<div class="headline">Rangitaki Control Center</div>
|
<div class="headline">Rangitaki Control Center</div>
|
||||||
<p>
|
<p>
|
||||||
The Rangitaki Control Center is disabled. You can enable it in
|
The Rangitaki Control Center is disabled. You can enable
|
||||||
your config file. But please read first the documentation.
|
it in your config file. But please read first the
|
||||||
|
documentation.
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<section class="card" id="back-card">
|
|
||||||
<div class="headline">Back</div>
|
<!-- Back -->
|
||||||
<p>
|
<section class="card" id="back-card">
|
||||||
Go back to your blog.
|
<div class="headline">Back</div>
|
||||||
</p>
|
<p>Go back to your blog.</p>
|
||||||
<a href="../" class="button">GO BACK</a>
|
<a href="../" class="button">GO BACK</a>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<script src="./res/rcc.js"></script>
|
<script src="./res/rcc.js"></script>
|
||||||
<script src="../res/js/jquery-2.1.4.min.js"></script>
|
<script src="../res/js/jquery-2.1.4.min.js"></script>
|
||||||
<script src="./res/delete.js"></script>
|
<script src="./res/delete.js"></script>
|
||||||
<script src="./res/edit.js"></script>
|
<script src="./res/edit.js"></script>
|
||||||
<script src="./res/atom.js"></script>
|
<script src="./res/atom.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,60 +1,100 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP Version 7
|
||||||
|
*
|
||||||
|
* @category Blogging
|
||||||
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* Media page of RCC (Rangitaki Control Center)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!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>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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">File Upload</div>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
if($_SESSION['login']) {
|
|
||||||
if ($_FILES['userfile']['name'] == "") {
|
|
||||||
echo "<p>You have to choose a file!</p>";
|
|
||||||
} else {
|
|
||||||
$uploaddir = "../../media/";
|
|
||||||
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
|
|
||||||
|
|
||||||
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
<title>Rangitaki Control Center</title>
|
||||||
echo "<p>The post was successfully uploaded and is now published.</p>";
|
|
||||||
} else {
|
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
|
||||||
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
|
||||||
}
|
user-scalable=0" name="viewport"/>
|
||||||
}
|
|
||||||
?><a href="../" class="button">GO BACK</a><?php
|
<meta name="theme-color" content="#383838">
|
||||||
}
|
<meta name="description" content="Rangitaki Control Center (RCC)">
|
||||||
?>
|
|
||||||
</section>
|
<link rel="stylesheet" href="../res/rcc.css"/>
|
||||||
</div>
|
|
||||||
</body>
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
|
||||||
|
400italic,100,100italic,900' rel='stylesheet'
|
||||||
|
type='text/css'> <!--Font-->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<a href="../" class="title">Rangitaki Control Center</a>
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">File Upload</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if ($_SESSION['login']) {
|
||||||
|
if ($_FILES['userfile']['name'] == "") {
|
||||||
|
echo "<p>You have to choose a file!</p>";
|
||||||
|
} else {
|
||||||
|
$uploaddir = "../../media/";
|
||||||
|
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
|
||||||
|
|
||||||
|
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
||||||
|
echo
|
||||||
|
"<p>
|
||||||
|
The post was successfully uploaded and is now published.
|
||||||
|
</p>";
|
||||||
|
} else {
|
||||||
|
echo
|
||||||
|
"<p>During the uploading process an error occured! <br>
|
||||||
|
Error Code:"
|
||||||
|
. ($_FILES['userfile']['error'] . "</p>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a href="../" class="button">GO BACK</a>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,54 +1,82 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP Version 7
|
||||||
|
*
|
||||||
|
* @category Blogging
|
||||||
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* Newpost page of RCC (Rangitaki Control Center)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!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>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
<title>Rangitaki Control Center</title>
|
<title>Rangitaki Control Center</title>
|
||||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
|
|
||||||
|
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
|
||||||
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
|
||||||
|
user-scalable=0" name="viewport"/>
|
||||||
|
|
||||||
|
<meta name="theme-color" content="#383838">
|
||||||
|
<meta name="description" content="Rangitaki Control Center (RCC)">
|
||||||
|
|
||||||
<link rel="stylesheet" href="../res/rcc.css"/>
|
<link rel="stylesheet" href="../res/rcc.css"/>
|
||||||
|
|
||||||
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
|
||||||
|
400italic,100,100italic,900' rel='stylesheet'
|
||||||
|
type='text/css'> <!--Font-->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
|
||||||
<a href="../" class="title">Rangitaki Control Center</a>
|
<div class="header">
|
||||||
</div>
|
<a href="../" class="title">Rangitaki Control Center</a>
|
||||||
<div class="main">
|
</div>
|
||||||
<section class="card">
|
|
||||||
<div class="headline">New Post</div>
|
<div class="main">
|
||||||
<?php
|
<section class="card">
|
||||||
session_start();
|
<div class="headline">New Post</div>
|
||||||
if ($_SESSION['login']) {
|
|
||||||
$title = $_POST["title"];
|
<?php
|
||||||
$date = $_POST["date"];
|
session_start();
|
||||||
$author = $_POST["author"];
|
|
||||||
$tags = $_POST["tags"];
|
if ($_SESSION['login']) {
|
||||||
$text = $_POST["text"];
|
$title = $_POST["title"];
|
||||||
$blog = $_POST["blog"];
|
$date = $_POST["date"];
|
||||||
$md = <<<EOD
|
$author = $_POST["author"];
|
||||||
|
$tags = $_POST["tags"];
|
||||||
|
$text = $_POST["text"];
|
||||||
|
$blog = $_POST["blog"];
|
||||||
|
$md = <<<EOD
|
||||||
%TITLE: $title
|
%TITLE: $title
|
||||||
%DATE: $date
|
%DATE: $date
|
||||||
%AUTHOR: $author
|
%AUTHOR: $author
|
||||||
|
@ -56,18 +84,23 @@ THE SOFTWARE.
|
||||||
|
|
||||||
$text
|
$text
|
||||||
EOD;
|
EOD;
|
||||||
$filename = date("Y-m-d-H-i-s") . ".md";
|
$filename = date("Y-m-d-H-i-s") . ".md";
|
||||||
$handle = fopen("../../articles/$blog/$filename", "c");
|
$handle = fopen("../../articles/$blog/$filename", "c");
|
||||||
fwrite($handle, $md);
|
fwrite($handle, $md);
|
||||||
if (fclose($handle)) {
|
if (fclose($handle)) {
|
||||||
echo "Post successfully published.";
|
echo "Post successfully published.";
|
||||||
} else {
|
} else {
|
||||||
echo "Some error happend, while publishing.";
|
echo "Some error happend, while publishing.";
|
||||||
}
|
}
|
||||||
?><a href="../" class="button">GO BACK</a><?php
|
?>
|
||||||
}
|
|
||||||
?>
|
<a href="../" class="button">GO BACK</a>
|
||||||
</section>
|
|
||||||
</div>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* Created by mmk2410 on 2016-02-16.
|
|
||||||
*
|
|
||||||
* JavaScript for the ajax request to generate a atom feed
|
* JavaScript for the ajax request to generate a atom feed
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016 by mmk2410
|
* Copyright (c) 2016 by mmk2410
|
||||||
* License: MIT License
|
* License: MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
// listener and function for calling the ajax request to create the
|
// listener and function for calling the ajax request to create the
|
||||||
// requested atom feed
|
// requested atom feed
|
||||||
|
|
|
@ -1,30 +1,45 @@
|
||||||
/**
|
/**
|
||||||
* Created by mmk2410 on 12/6/15.
|
* JavaScript for the ajax request to delete blog post
|
||||||
*
|
*
|
||||||
* JavaScript for the functionality to delete blogs
|
* Copyright (c) 2016 by mmk2410
|
||||||
|
* License: MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
||||||
// listener and function for recieving the posts of the selected blogs
|
// listener and function for recieving the posts of the selected blogs
|
||||||
$("#delete_get_posts").click(function () {
|
$("#delete_get_posts").click(function () {
|
||||||
|
|
||||||
var selectedBlog = $("#delete_selected_blog").val();
|
var selectedBlog = $("#delete_selected_blog").val();
|
||||||
|
|
||||||
$.get("res/get_posts.php", {
|
$.get("res/get_posts.php", {
|
||||||
blog: selectedBlog
|
blog: selectedBlog
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
|
|
||||||
$("#delete_select_post").remove();
|
$("#delete_select_post").remove();
|
||||||
$("#delete_select_post_info").remove();
|
$("#delete_select_post_info").remove();
|
||||||
$("#delete_post_button").remove();
|
$("#delete_post_button").remove();
|
||||||
$("#delete_get_posts").after("<p id='delete_select_post'></p>");
|
$("#delete_get_posts").after("<p id='delete_select_post'></p>");
|
||||||
$("#delete_get_posts").after("<p id='delete_select_post_info'>Now select the post you want to delete. " +
|
$("#delete_get_posts").after(
|
||||||
"Remember that once a post is deleted it can't be restored.</p>");
|
"<p id='delete_select_post_info'>" +
|
||||||
$("#delete_select_post").append("<select id='delete_selected_post'></select>");
|
"Now select the post you want to delete. " +
|
||||||
|
"Remember that once a post is deleted it can't be restored.</p>"
|
||||||
|
);
|
||||||
|
$("#delete_select_post").append(
|
||||||
|
"<select id='delete_selected_post'></select>"
|
||||||
|
);
|
||||||
|
|
||||||
$.each($.parseJSON(data), function (index, value) {
|
$.each($.parseJSON(data), function (index, value) {
|
||||||
var post = value.substring(0, value.length - 3);
|
var post = value.substring(0, value.length - 3);
|
||||||
$("#delete_selected_post").append("<option value='" + post + "'>" + post + "</option>");
|
$("#delete_selected_post").append(
|
||||||
|
"<option value='" + post + "'>" + post + "</option>"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
$("#delete_select_post").after("<a class='button' id='delete_post_button' " +
|
|
||||||
"onclick='deletePostButton()'>DELETE POST</a>")
|
$("#delete_select_post").after(
|
||||||
|
"<a class='button' id='delete_post_button' " +
|
||||||
|
"onclick='deletePostButton()'>DELETE POST</a>"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -37,10 +52,12 @@ function deletePostButton() {
|
||||||
|
|
||||||
var selectedBlog = $("#delete_selected_blog").val();
|
var selectedBlog = $("#delete_selected_blog").val();
|
||||||
var selectedPost = $("#delete_selected_post").val();
|
var selectedPost = $("#delete_selected_post").val();
|
||||||
|
|
||||||
$.get("res/delete_post.php", {
|
$.get("res/delete_post.php", {
|
||||||
blog: selectedBlog,
|
blog: selectedBlog,
|
||||||
post: selectedPost
|
post: selectedPost
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
|
|
||||||
$("#delete_select_post").remove();
|
$("#delete_select_post").remove();
|
||||||
$("#delete_select_post_info").remove();
|
$("#delete_select_post_info").remove();
|
||||||
$("#delete_post_button").remove();
|
$("#delete_post_button").remove();
|
||||||
|
@ -51,7 +68,10 @@ function deletePostButton() {
|
||||||
} else if (data == "941") {
|
} else if (data == "941") {
|
||||||
alert("ERROR 941: No blog as get argument given");
|
alert("ERROR 941: No blog as get argument given");
|
||||||
} else if (data == "961") {
|
} else if (data == "961") {
|
||||||
alert("ERROR 961: Error while deleting the file. Check if the web server has the permission to do so.");
|
alert(
|
||||||
|
"ERROR 961: Error while deleting the file. Check if the" +
|
||||||
|
"web server has the permission to do so."
|
||||||
|
);
|
||||||
} else if (data == "0") {
|
} else if (data == "0") {
|
||||||
alert("Post successfully deleted.");
|
alert("Post successfully deleted.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,35 @@
|
||||||
/**
|
/**
|
||||||
* PHP Version 7
|
* PHP Version 7
|
||||||
*
|
*
|
||||||
* User: mmk2410
|
* @category Blogging
|
||||||
* Date: 12/6/15
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* delete post script
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
*
|
*
|
||||||
* Error Codes:
|
* Error Codes:
|
||||||
* 901 No post given as get argument
|
* 901 No post given as get argument
|
||||||
|
@ -11,17 +38,24 @@
|
||||||
* 941 No blog given as get argument
|
* 941 No blog given as get argument
|
||||||
* 961 Error while deleting the post
|
* 961 Error while deleting the post
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$post = $_GET["post"];
|
$post = $_GET["post"];
|
||||||
$blog = $_GET["blog"];
|
$blog = $_GET["blog"];
|
||||||
if (!isset($post)) {
|
|
||||||
echo "901";
|
session_start();
|
||||||
} else if (!isset($blog)) {
|
if ($_SESSION['login']) {
|
||||||
echo "941";
|
if (!isset($post)) {
|
||||||
} else if (!file_exists("./../../articles/$blog/$post.md")) {
|
echo "901";
|
||||||
echo "921";
|
} else if (!isset($blog)) {
|
||||||
} else {
|
echo "941";
|
||||||
if (unlink("./../../articles/$blog/$post.md")) {
|
} else if (!file_exists("./../../articles/$blog/$post.md")) {
|
||||||
echo "0";
|
echo "921";
|
||||||
|
} else {
|
||||||
|
if (unlink("./../../articles/$blog/$post.md")) {
|
||||||
|
echo "0";
|
||||||
|
}
|
||||||
|
echo "961";
|
||||||
}
|
}
|
||||||
echo "961";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
|
@ -1,41 +1,54 @@
|
||||||
/**
|
/**
|
||||||
* Created by mmk2410 on 12/6/15.
|
* JavaScript for the ajax request to edit a article
|
||||||
*
|
*
|
||||||
* JavaScript for the functionality to delete blogs
|
* Copyright (c) 2016 by mmk2410
|
||||||
|
* License: MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
||||||
// listener and function for recieving the posts of the selected blogs
|
// listener and function for recieving the posts of the selected blogs
|
||||||
$("#edit_get_posts").click(function () {
|
$("#edit_get_posts").click(function () {
|
||||||
|
|
||||||
var selectedBlog = $("#edit_selected_blog").val();
|
var selectedBlog = $("#edit_selected_blog").val();
|
||||||
$.get("res/get_posts.php", {
|
$.get("res/get_posts.php", {
|
||||||
blog: selectedBlog
|
blog: selectedBlog
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
|
|
||||||
$("#edit_select_post").remove();
|
$("#edit_select_post").remove();
|
||||||
$("#edit_select_post_info").remove();
|
$("#edit_select_post_info").remove();
|
||||||
$("#edit_post_button").remove();
|
$("#edit_post_button").remove();
|
||||||
$("#edit_get_posts").after("<p id='edit_select_post'></p>");
|
$("#edit_get_posts").after("<p id='edit_select_post'></p>");
|
||||||
$("#edit_get_posts").after("<p id='edit_select_post_info'>Now select the post you want to edit.</p>");
|
$("#edit_get_posts").after(
|
||||||
$("#edit_select_post").append("<select id='edit_selected_post'></select>");
|
"<p id='edit_select_post_info'>" +
|
||||||
|
"Now select the post you want to edit.</p>"
|
||||||
|
);
|
||||||
|
$("#edit_select_post").append(
|
||||||
|
"<select id='edit_selected_post'></select>"
|
||||||
|
);
|
||||||
$.each($.parseJSON(data), function (index, value) {
|
$.each($.parseJSON(data), function (index, value) {
|
||||||
var post = value.substring(0, value.length - 3);
|
var post = value.substring(0, value.length - 3);
|
||||||
$("#edit_selected_post").append("<option value='" + post + "'>" + post + "</option>");
|
$("#edit_selected_post").append(
|
||||||
|
"<option value='" + post + "'>" + post + "</option>"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
$("#edit_select_post").after("<a class='button' id='edit_post_button' " +
|
$("#edit_select_post").after(
|
||||||
"onclick='editPostButton()'>EDIT POST</a>")
|
"<a class='button' id='edit_post_button' " +
|
||||||
|
"onclick='editPostButton()'>EDIT POST</a>"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#save_changes").click(function () {
|
$("#save_changes").click(function () {
|
||||||
|
|
||||||
var postTitle = $("#title").val();
|
var postTitle = $("#title").val();
|
||||||
var postDate = $("#date").val();
|
var postDate = $("#date").val();
|
||||||
var postAuthor = $("#author").val();
|
var postAuthor = $("#author").val();
|
||||||
var postTags = $("#tags").val();
|
var postTags = $("#tags").val();
|
||||||
var postText = $("#text").val();
|
var postText = $("#text").val();
|
||||||
|
|
||||||
var file = "../../articles/" + getVariables['blog'] + "/" + getVariables['post'] + ".md";
|
var file = "../../articles/" + getVariables.blog +
|
||||||
console.log(file);
|
"/" + getVariables.post + ".md";
|
||||||
|
|
||||||
$.post("../res/save.php", {
|
$.post("../res/save.php", {
|
||||||
title: postTitle,
|
title: postTitle,
|
||||||
|
|
|
@ -2,26 +2,57 @@
|
||||||
/**
|
/**
|
||||||
* PHP Version 7
|
* PHP Version 7
|
||||||
*
|
*
|
||||||
* User: mmk2410
|
* @category Blogging
|
||||||
* Date: 12/6/15
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* get post script
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
*
|
*
|
||||||
* Error Codes:
|
* Error Codes:
|
||||||
* 901 No blog given as get argument
|
* 901 No blog given as get argument
|
||||||
* 921 No blog with the given name available
|
* 921 No blog with the given name available
|
||||||
*/
|
*/
|
||||||
$blog = $_GET["blog"];
|
|
||||||
if (!isset($blog)) {
|
session_start();
|
||||||
echo "901";
|
if ($_SESSION['login']) {
|
||||||
} else if (!file_exists("./../../blogs/$blog.md")) {
|
$blog = $_GET["blog"];
|
||||||
echo "921";
|
if (!isset($blog)) {
|
||||||
} else {
|
echo "901";
|
||||||
$posts = array();
|
} else if (!file_exists("./../../blogs/$blog.md")) {
|
||||||
$i = 0;
|
echo "921";
|
||||||
foreach (scandir("./../../articles/$blog/") as $article) {
|
} else {
|
||||||
if (substr($article, -3) == ".md") {
|
$posts = array();
|
||||||
$posts[$i] = $article;
|
$i = 0;
|
||||||
$i++;
|
foreach (scandir("./../../articles/$blog/") as $article) {
|
||||||
|
if (substr($article, -3) == ".md") {
|
||||||
|
$posts[$i] = $article;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
print json_encode($posts);
|
||||||
}
|
}
|
||||||
print json_encode($posts);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,29 @@
|
||||||
/*
|
/*
|
||||||
The MIT License
|
* RCC cascade style sheet
|
||||||
|
*
|
||||||
Copyright 2015 mmk2410.
|
* Copyright (C) 2015-2016 Marcel Kapfer (mmk2410)
|
||||||
|
* MIT License
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
*
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
* The MIT License
|
||||||
in the Software without restriction, including without limitation the rights
|
*
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
furnished to do so, subject to the following conditions:
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
The above copyright notice and this permission notice shall be included in
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
all copies or substantial portions of the Software.
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* The above copyright notice and this permission notice shall be included in
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* all copies or substantial portions of the Software.
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
*
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
THE SOFTWARE.
|
* 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
|
||||||
Created on : Jun 14, 2015, 6:13:38 PM
|
* THE SOFTWARE.
|
||||||
Author : mmk2410
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
/* BODY */
|
/* BODY */
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,32 @@
|
||||||
|
/**
|
||||||
|
* JavaScript for RCC
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 by mmk2410
|
||||||
|
* License: MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
var t = document.getElementsByTagName('textarea')[0];
|
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 offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (
|
||||||
|
t.offsetHeight + parseInt(
|
||||||
|
window.getComputedStyle(t, null).getPropertyValue('border-top-width')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following three code clocks are for proper resizing of the input textarea
|
* The following three code clocks are for proper resizing of the input
|
||||||
|
* textarea
|
||||||
*/
|
*/
|
||||||
var resize = function (t) {
|
var resize = function (t) {
|
||||||
t.style.height = 'auto';
|
t.style.height = 'auto';
|
||||||
t.style.height = (t.scrollHeight + offset ) + 'px';
|
t.style.height = (t.scrollHeight + offset ) + 'px';
|
||||||
}
|
};
|
||||||
|
|
||||||
t.addEventListener && t.addEventListener('input', function (event) {
|
t.addEventListener && t.addEventListener('input', function (event) {
|
||||||
resize(t);
|
resize(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
t['attachEvent'] && t.attachEvent('onkeyup', function () {
|
t.attachEvent && t.attachEvent('onkeyup', function () {
|
||||||
resize(t);
|
resize(t);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,11 +1,46 @@
|
||||||
<?php
|
<?php
|
||||||
$title = $_POST["title"];
|
/**
|
||||||
$date = $_POST["date"];
|
* PHP Version 7
|
||||||
$author = $_POST["author"];
|
*
|
||||||
$tags = $_POST["tags"];
|
* @category Blogging
|
||||||
$text = $_POST["text"];
|
* @package Rcc
|
||||||
$filename = $_POST["file"];
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
$md = <<<EOD
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
if ($_SESSION['login']) {
|
||||||
|
$title = $_POST["title"];
|
||||||
|
$date = $_POST["date"];
|
||||||
|
$author = $_POST["author"];
|
||||||
|
$tags = $_POST["tags"];
|
||||||
|
$text = $_POST["text"];
|
||||||
|
$filename = $_POST["file"];
|
||||||
|
$md = <<<EOD
|
||||||
%TITLE: $title
|
%TITLE: $title
|
||||||
%DATE: $date
|
%DATE: $date
|
||||||
%AUTHOR: $author
|
%AUTHOR: $author
|
||||||
|
@ -13,10 +48,11 @@ $md = <<<EOD
|
||||||
|
|
||||||
$text
|
$text
|
||||||
EOD;
|
EOD;
|
||||||
if (file_put_contents($filename, $md)) {
|
if (file_put_contents($filename, $md)) {
|
||||||
echo 0;
|
echo 0;
|
||||||
} else if (file_exists(($filename))) {
|
} else if (file_exists(($filename))) {
|
||||||
echo 1;
|
echo 1;
|
||||||
} else {
|
} else {
|
||||||
echo -1;
|
echo -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +1,102 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP Version 7
|
||||||
|
*
|
||||||
|
* @category Blogging
|
||||||
|
* @package Rcc
|
||||||
|
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* @license MIT License
|
||||||
|
* @link https://mmk2410.org/rangitaki
|
||||||
|
*
|
||||||
|
* Main page of RCC (Rangitaki Control Center)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!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>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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">File Upload</div>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
if($_SESSION['login']) {
|
|
||||||
if ($_FILES['userfile']['name'] == "") {
|
|
||||||
echo "<p>You have to choose a file!</p>";
|
|
||||||
} else {
|
|
||||||
$blog = filter_input(INPUT_POST, "blog");
|
|
||||||
$uploaddir = "../..//articles/$blog/";
|
|
||||||
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
|
|
||||||
|
|
||||||
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
<title>Rangitaki Control Center</title>
|
||||||
echo "<p>The post was successfully uploaded and is now published.</p>";
|
|
||||||
} else {
|
<meta name="robots" content="nofollow, noindex, noarchive, nosnippet">
|
||||||
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
|
||||||
}
|
user-scalable=0" name="viewport"/>
|
||||||
}
|
|
||||||
?><a href="../" class="button">GO BACK</a><?php
|
<meta name="theme-color" content="#383838">
|
||||||
}
|
<meta name="description" content="Rangitaki Control Center (RCC)">
|
||||||
?>
|
|
||||||
</section>
|
<link rel="stylesheet" href="./res/rcc.css"/>
|
||||||
</div>
|
|
||||||
</body>
|
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,
|
||||||
|
400italic,100,100italic,900' rel='stylesheet'
|
||||||
|
type='text/css'> <!--Font-->
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
<a href="../" class="title">Rangitaki Control Center</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main">
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">File Upload</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if ($_SESSION['login']) {
|
||||||
|
|
||||||
|
if ($_FILES['userfile']['name'] == "") {
|
||||||
|
echo "<p>You have to choose a file!</p>";
|
||||||
|
} else {
|
||||||
|
$blog = filter_input(INPUT_POST, "blog");
|
||||||
|
$uploaddir = "../..//articles/$blog/";
|
||||||
|
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
|
||||||
|
|
||||||
|
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
||||||
|
echo
|
||||||
|
"<p>The post was successfully uploaded and is now
|
||||||
|
published.</p>";
|
||||||
|
} else {
|
||||||
|
echo
|
||||||
|
"<p>During the uploading process an error occured! <br>
|
||||||
|
Error Code:"
|
||||||
|
. ($_FILES['userfile']['error'] . "</p>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a href="../" class="button">GO BACK</a>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Reference in a new issue