RCC: Write blog posts online

This commit is contained in:
mmk2410 2015-11-17 22:46:20 +01:00
parent 5568943994
commit e8a2557c4a
6 changed files with 378 additions and 222 deletions

View file

@ -29,7 +29,7 @@ $bloganalytics = '';
// Footer - set here the text for your footer (e.g. a copyright info). You can replace the whole text after the '=' with your own one.
$blogfooter = 'Rangitaki ' . date("Y") . ' <a href="https://github.com/mmk2410/Rangitaki" target="blank">github.com/mmk2410/Rangitaki</a>';
// This enables the optional rangitaki control center. Please read the documentation before you enable it.
$rcc = 'no';
$rcc = 'yes';
// Here you can disable and enable the navigation menu. Usefull if you have no subblogs and no home directory
$nav_drawer = 'yes';
// Set here the name of your theme. Read the documentation for more themes

View file

@ -82,7 +82,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<?php
}
?>
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,400italic,100,100italic,900' rel='stylesheet' type='text/css'> <!--Font-->
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700,300,400italic,100,100italic,900' rel='stylesheet'
type='text/css'> <!--Font-->
<link rel="stylesheet" href="./res/css/github-gist.css"> <!-- stylesheet for code highlighting-->
<!--Favicons-->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $favicon; ?>"/>
@ -149,7 +150,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}
?>
<div class="main"> <!-- Main page with content -->
<div class="header"> <!-- Action Bar, but since there isn't much action I call it header. One day a search feature would be nice...-->
<div class="header">
<!-- Action Bar, but since there isn't much action I call it header. One day a search feature would be nice...-->
<img src="./res/img/menu.svg" class="nav-img"/> <!-- Ham,ham,hamburger-->
<!-- Blog title with subblog title and links to each one-->
<nobr><span class="title"><a href="./"><?php echo $blogtitle; ?><!-- link to main blog-->
@ -169,7 +171,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</a>
</span>
</nobr>
<div class="fadeout"></div> <!-- if the blog name is to long (especially on mobile devices), a fadeout fades the test out at the end of the header-->
<div class="fadeout"></div>
<!-- if the blog name is to long (especially on mobile devices), a fadeout fades the test out at the end of the header-->
</div>
<?php
// Blog Intro text
@ -234,7 +237,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</a>
</div>
<div class="subfab"><!--twitter subfav-->
<a href='https://twitter.com/intent/tweet?text=<?php echo $BLOGLANG['Check out']; ?>: <?php echo $url; ?>&original_referer=' target="blank">
<a href='https://twitter.com/intent/tweet?text=<?php echo $BLOGLANG['Check out']; ?>: <?php echo $url; ?>&original_referer='
target="blank">
<img src="./res/img/twitter.svg" class="subfab-img"/>
</a>
</div>
@ -244,7 +248,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</a>
</div>
<div class="subfab"><!--facebook subfab-->
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&t=<?php echo "echo $blogtitle" ?>' target="blank">
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>&t=<?php echo "echo $blogtitle" ?>'
target="blank">
<img src="./res/img/facebook.svg" class="subfab-img"/>
</a>
</div>

View file

@ -60,7 +60,7 @@ THE SOFTWARE.
$_SESSION['login'] = true;
?>
<section class="card">
<div class="headline">File Upload</div>
<div class="headline">Post Upload</div>
<form enctype="multipart/form-data" action="uploaded/" method="POST">
<select name="blog">
<?php
@ -80,6 +80,36 @@ THE SOFTWARE.
<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>
<?php
} else {
?>
@ -105,5 +135,6 @@ THE SOFTWARE.
}
?>
</div>
<script src="./res/rcc.js"></script>
</body>
</html>

69
rcc/newpost/index.php Normal file
View file

@ -0,0 +1,69 @@
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
<link rel="stylesheet" href="../res/rcc.css"/>
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">New Post</div>
<?php
session_start();
if ($_SESSION['login']) {
$title = $_POST["blog"];
$date = $_POST["date"];
$author = $_POST["author"];
$tags = $_POST["tags"];
$text = $_POST["text"];
$blog = $_POST["blog"];
$md = <<<EOD
%TITLE: $title
%DATE: $date
%AUTHOR: $author
%TAGS: $tags
$text
EOD;
$filename = date("Y-m-d") . ".md";
$handle = fopen("../../articles/$blog/$filename", "c");
fwrite($handle, $md);
if (fclose($handle)) {
echo "Post successfully published.";
} else {
echo "Some error happend, while publishing.";
}
}
?>
</section>
</div>
</body>
</html>

View file

@ -166,6 +166,8 @@ input.button{
border-width: 1px;
font-size: 16px;
line-height: 22px;
width: 400px;
max-width: 100%;
border-bottom-color: #aaa;
transition-property: border-bottom-color;
transition-delay: 50ms;
@ -187,6 +189,38 @@ input.button{
outline: none;
}
/* TEXTAREA */
.itextarea {
border-color: transparent;
border-width: 1px;
font-size: 16px;
line-height: 22px;
height: auto;
resize: none;
min-height: 100px;
width: calc(100% - 10px);
border-bottom-color: #aaa;
transition-property: border-bottom-color;
transition-delay: 50ms;
transition-duration: 125ms;
transition-timing-function: ease;
-moz-transition-property: border-bottom-color;
-moz-transition-delay: 50ms;
-moz-transition-duration: 125ms;
-moz-transition-timing-function: ease;
-webkit-transition-property: border-bottom-color;
-webkit-transition-delay: 50ms;
-webkit-transition-duration: 125ms;
-webkit-transition-timing-function: ease;
}
.itextarea:focus {
border-bottom-color: #ff4415;
border-width: 2px;
outline: none;
}
/* FORM */
form{
margin-top: 20px;

17
rcc/res/rcc.js Normal file
View file

@ -0,0 +1,17 @@
window.onload = function () {
var t = document.getElementsByTagName('textarea')[0];
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width')));
var resize = function (t) {
t.style.height = 'auto';
t.style.height = (t.scrollHeight + offset ) + 'px';
}
t.addEventListener && t.addEventListener('input', function (event) {
resize(t);
});
t['attachEvent'] && t.attachEvent('onkeyup', function () {
resize(t);
});
}