Code Improvements

This commit is contained in:
mmk2410 2016-03-11 18:54:58 +01:00
parent 08ee5eaf39
commit 75b705ee2c
14 changed files with 933 additions and 521 deletions

View file

@ -1,37 +1,63 @@
<?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>
@ -40,68 +66,102 @@ THE SOFTWARE.
<?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:
<br><br>
<input type="text" class="itextfield"
value="<?php value="<?php
$tags = ""; $tags = "";
foreach (ArticleGenerator::getTags($directory, $article) as $tag) { foreach (
ArticleGenerator::getTags($directory, $article)
as $tag) {
$tags = $tags . ', ' . $tag; $tags = $tags . ', ' . $tag;
} }
$tags = substr($tags, 2); $tags = substr($tags, 2);
echo $tags; echo $tags;
?>" ?>" name="tags" id="tags"/>
class="itextfield" name="tags" </p>
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> </div>
<script> <script>
var getVariables = <?php echo json_encode($_GET); ?>; var getVariables = <?php echo json_encode($_GET); ?>;
</script> </script>

View file

@ -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";
} }
?> ?>

View file

@ -1,53 +1,113 @@
<?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"> <div class="header">
<a href="./" class="title">Rangitaki Control Center</a> <a href="./" class="title">Rangitaki Control Center</a>
<a href="../" class="back">Back to the blog</a> <a href="../" class="back">Back to the blog</a>
</div> </div>
<div class="main"> <div class="main">
<?php <?php
require '../config.php'; require '../config.php';
if ($rcc == "yes") { if ($rcc == "yes") {
include 'password.php'; include 'password.php';
session_start(); session_start();
if (isset($_POST['passwd'])) { if (isset($_POST['passwd'])) {
$passwd = $_POST['passwd']; $passwd = $_POST['passwd'];
$_SESSION['passwd'] = $_POST['passwd']; $_SESSION['passwd'] = $_POST['passwd'];
} else if (isset($_SESSION['passwd'])) { } else if (isset($_SESSION['passwd'])) {
$passwd = $_SESSION['passwd']; $passwd = $_SESSION['passwd'];
} }
if ($passwd == "") { if ($passwd == "") {
?> ?>
<!-- Login Card -->
<section class="card"> <section class="card">
<div class="headline">Log In</div> <div class="headline">Log In</div>
<form action="./" method="post"> <form action="./" method="post">
<p>Password:<br><br><input type="password" class="itextfield" name="passwd"/></p> <p>Password:
<br><br>
<input type="password" class="itextfield" name="passwd"/>
</p>
<input type="Submit" class="button" value="Log in"/> <input type="Submit" class="button" value="Log in"/>
</form> </form>
</section> </section>
<?php <?php
} else { } else {
if ($passwd == $password) { if ($passwd == $password) {
$_SESSION['login'] = true; $_SESSION['login'] = true;
include_once("./../res/php/BlogListGenerator.php"); include_once "./../res/php/BlogListGenerator.php";
?> ?>
<!-- Post Upload -->
<section class="card"> <section class="card">
<div class="headline">Post 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
$blogs = scandir("../blogs/"); $blogs = scandir("../blogs/");
@ -59,13 +119,16 @@
} }
?> ?>
</select> </select>
<input type="hidden" name="MAX_FILE_SIZE" value="100000"/> <input type="hidden" name="MAX_FILE_SIZE" value="100000"/>
<input id="" name="userfile" type="file" value="Choose a file"/> <input id="" name="userfile" type="file" value="Choose a file"/>
<br> <br><br>
<br>
<input id="button" type="submit" value="Upload" class="button"/> <input id="button" type="submit" value="Upload" class="button"/>
</form> </form>
</section> </section>
<!-- New Post -->
<section class="card"> <section class="card">
<div class="headline">New Post</div> <div class="headline">New Post</div>
<form action="newpost/" method="POST"> <form action="newpost/" method="POST">
@ -82,20 +145,35 @@
?> ?>
</select> </select>
<p>Title:<br><br><input type="text" class="itextfield" name="title"/></p> <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>Date:
<br><br>
<input type="text" class="itextfield" name="date"/>
</p>
<p>Author:<br><br><input type="text" class="itextfield" name="author"/></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>Tags:
<br><br>
<input type="text" class="itextfield" name="tags"/>
</p>
<p>Text:</p> <p>Text:</p>
<textarea class="itextarea" name="text"></textarea> <textarea class="itextarea" name="text"></textarea>
<br><br> <br><br>
<input id="button" type="submit" value="Post" class="button"/> <input id="button" type="submit" value="Post"
class="button"/>
</form> </form>
</section> </section>
<!-- Edit post -->
<section class="card"> <section class="card">
<div class="headline">Edit post</div> <div class="headline">Edit post</div>
<p> <p>
@ -117,6 +195,8 @@
</p> </p>
<a class="button" id="edit_get_posts">GET POSTS</a> <a class="button" id="edit_get_posts">GET POSTS</a>
</section> </section>
<!-- Delete Post -->
<section class="card"> <section class="card">
<div class="headline">Delete Post</div> <div class="headline">Delete Post</div>
<p> <p>
@ -138,16 +218,20 @@
</p> </p>
<a class="button" id="delete_get_posts">GET POSTS</a> <a class="button" id="delete_get_posts">GET POSTS</a>
</section> </section>
<!-- Media Upload -->
<section class="card"> <section class="card">
<div class="headline">Media Upload</div> <div class="headline">Media Upload</div>
<form enctype="multipart/form-data" action="media/" method="POST"> <form enctype="multipart/form-data" action="media/" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000"/> <input type="hidden" name="MAX_FILE_SIZE"
value="100000000000"/>
<input id="" name="userfile" type="file" value="Choose a file"/> <input id="" name="userfile" type="file" value="Choose a file"/>
<br> <br><br>
<br>
<input id="button" type="submit" value="Upload" class="button"/> <input id="button" type="submit" value="Upload" class="button"/>
</form> </form>
</section> </section>
<!-- Atom Feed Generator -->
<section class="card"> <section class="card">
<div class="headline">Atom Feed Generator</div> <div class="headline">Atom Feed Generator</div>
<p> <p>
@ -165,9 +249,12 @@
</p> </p>
<a class="button" id="generate_atom">GENERATE</a> <a class="button" id="generate_atom">GENERATE</a>
</section> </section>
<?php <?php
} else { } else {
?> ?>
<!-- Wrong Password -->
<section class="card"> <section class="card">
<div class="headline">Wrong Password</div> <div class="headline">Wrong Password</div>
<p> <p>
@ -175,26 +262,30 @@
</p> </p>
<a href="./" class="button">GO BACK</a> <a href="./" class="button">GO BACK</a>
</section> </section>
<?php <?php
} }
} }
} else { } 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
} }
?> ?>
<!-- Back -->
<section class="card" id="back-card"> <section class="card" id="back-card">
<div class="headline">Back</div> <div class="headline">Back</div>
<p> <p>Go back to your blog.</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>

View file

@ -1,43 +1,72 @@
<?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> <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">
<section class="card"> <section class="card">
<div class="headline">File Upload</div> <div class="headline">File Upload</div>
<?php <?php
session_start(); session_start();
if ($_SESSION['login']) { if ($_SESSION['login']) {
if ($_FILES['userfile']['name'] == "") { if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>"; echo "<p>You have to choose a file!</p>";
@ -46,14 +75,25 @@ THE SOFTWARE.
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']); $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<p>The post was successfully uploaded and is now published.</p>"; echo
"<p>
The post was successfully uploaded and is now published.
</p>";
} else { } else {
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>"); echo
"<p>During the uploading process an error occured! <br>
Error Code:"
. ($_FILES['userfile']['error'] . "</p>");
} }
} }
?><a href="../" class="button">GO BACK</a><?php
}
?> ?>
<a href="../" class="button">GO BACK</a>
<?php
}
?>
</section> </section>
</div> </div>
</body> </body>

View file

@ -1,46 +1,74 @@
<?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"> <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">
<section class="card"> <section class="card">
<div class="headline">New Post</div> <div class="headline">New Post</div>
<?php <?php
session_start(); session_start();
if ($_SESSION['login']) { if ($_SESSION['login']) {
$title = $_POST["title"]; $title = $_POST["title"];
$date = $_POST["date"]; $date = $_POST["date"];
@ -64,9 +92,14 @@ EOD;
} 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>
<?php
} }
?> ?>
</section> </section>
</div> </div>
</body> </body>

View file

@ -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

View file

@ -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.");
} }

View file

@ -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,8 +38,12 @@
* 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"];
session_start();
if ($_SESSION['login']) {
if (!isset($post)) { if (!isset($post)) {
echo "901"; echo "901";
} else if (!isset($blog)) { } else if (!isset($blog)) {
@ -25,3 +56,6 @@ if (!isset($post)) {
} }
echo "961"; echo "961";
} }
}
?>

View file

@ -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,

View file

@ -2,13 +2,43 @@
/** /**
* 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
*/ */
session_start();
if ($_SESSION['login']) {
$blog = $_GET["blog"]; $blog = $_GET["blog"];
if (!isset($blog)) { if (!isset($blog)) {
echo "901"; echo "901";
@ -25,3 +55,4 @@ if (!isset($blog)) {
} }
print json_encode($posts); print json_encode($posts);
} }
}

View file

@ -1,29 +1,28 @@
/* /*
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 */

View file

@ -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);
}); });
} };

View file

@ -1,4 +1,39 @@
<?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
*
*
* 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"]; $title = $_POST["title"];
$date = $_POST["date"]; $date = $_POST["date"];
$author = $_POST["author"]; $author = $_POST["author"];
@ -20,3 +55,4 @@ if (file_put_contents($filename, $md)) {
} else { } else {
echo -1; echo -1;
} }
}

View file

@ -1,44 +1,75 @@
<?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> <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" /> <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 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">
<section class="card"> <section class="card">
<div class="headline">File Upload</div> <div class="headline">File Upload</div>
<?php <?php
session_start(); session_start();
if ($_SESSION['login']) { if ($_SESSION['login']) {
if ($_FILES['userfile']['name'] == "") { if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>"; echo "<p>You have to choose a file!</p>";
} else { } else {
@ -47,14 +78,24 @@ THE SOFTWARE.
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']); $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<p>The post was successfully uploaded and is now published.</p>"; echo
"<p>The post was successfully uploaded and is now
published.</p>";
} else { } else {
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>"); echo
"<p>During the uploading process an error occured! <br>
Error Code:"
. ($_FILES['userfile']['error'] . "</p>");
} }
} }
?><a href="../" class="button">GO BACK</a><?php
}
?> ?>
<a href="../" class="button">GO BACK</a>
<?php
}
?>
</section> </section>
</div> </div>
</body> </body>