From 75b705ee2c8da1793ddc47d7f3eb5a72cd3ec8fe Mon Sep 17 00:00:00 2001 From: mmk2410 Date: Fri, 11 Mar 2016 18:54:58 +0100 Subject: [PATCH] Code Improvements --- rcc/edit/index.php | 202 +++++++++++------ rcc/feed/index.php | 7 +- rcc/index.php | 467 ++++++++++++++++++++++++---------------- rcc/media/index.php | 152 ++++++++----- rcc/newpost/index.php | 139 +++++++----- rcc/res/atom.js | 3 - rcc/res/delete.js | 40 +++- rcc/res/delete_post.php | 58 +++-- rcc/res/edit.js | 33 ++- rcc/res/get_posts.php | 61 ++++-- rcc/res/rcc.css | 53 +++-- rcc/res/rcc.js | 22 +- rcc/res/save.php | 62 ++++-- rcc/uploaded/index.php | 155 ++++++++----- 14 files changed, 933 insertions(+), 521 deletions(-) diff --git a/rcc/edit/index.php b/rcc/edit/index.php index 7875fe5..40b9dec 100644 --- a/rcc/edit/index.php +++ b/rcc/edit/index.php @@ -1,112 +1,172 @@ + * @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'); ?> - + + Rangitaki Control Center - + + + + + + + + + + + -
- Rangitaki Control Center -
-
- + +
+ +
+
Edit Post
-

Title:

+ +

Title: +

+

-

Date:

+

Date: +

+

-

Author:

+

Author: +

+ +

-

Tags:

" - class="itextfield" name="tags" - id="tags"/>

+

Tags: +

+ " name="tags" id="tags"/> +

Text:

+

SAVE CHANGES +
+ +
+
Back
+

Go back to the RCC home. All changes will be lost.

+ BACK +
- + + +
+
Access denied
+

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

+ BACK +
- -
- - - - + + + +
+ + + + + diff --git a/rcc/feed/index.php b/rcc/feed/index.php index 9a35aa2..6c69105 100644 --- a/rcc/feed/index.php +++ b/rcc/feed/index.php @@ -3,11 +3,13 @@ * PHP Version 7 * * @category Atom_Feed - * @package Rbe + * @package Rcc * @author Marcel Kapfer (mmk2410) * @license MIT License * @link https://github.com/mmk2410/rangitaki * + * Feed Generator + * * The MIT License * * Copyright 2015 mmk2410. @@ -88,11 +90,14 @@ if ($_SESSION['login']) { $feed = $writer->execute(); $file = fopen($feed_path, "w"); + if (fwrite($file, $feed) === false) { echo "-1"; exit; } + fclose($file); + echo "0"; } ?> diff --git a/rcc/index.php b/rcc/index.php index 9657df7..2114789 100644 --- a/rcc/index.php +++ b/rcc/index.php @@ -1,207 +1,298 @@ + + * @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. + */ +?> + - Rangitaki Control Center - + + + + + + + + + + - -
+ + + +
+ + + +
+
Log In
+
+

Password: +

+ +

+ + +
+
+ -
-
Log In
-
-

Password:

- -
-
- -
-
Post Upload
-
- - - -
-
- -
-
-
-
New Post
-
-

Blog:

- - -

Title:

- -

Date:

- -

Author:

- -

Tags:

- -

Text:

- -

- -
-
-
-
Edit post
-

- First select the blog of the post you wan't to edit. -

- -

- -

- GET POSTS -
-
-
Delete Post
-

- First select the subblog of the post you want to delete. -

- -

- -

- GET POSTS -
-
-
Media Upload
-
- - -
-
- -
-
-
-
Atom Feed Generator
-

- -

- GENERATE -
- -
-
Wrong Password
-

- Please go back and try again. -

- GO BACK -
- + + +
+
Post Upload
+
+ + + + + +

+ + +
+
+ + +
+
New Post
+
+

Blog:

+ + +

Title: +

+ +

+ +

Date: +

+ +

+ +

Author: +

+ +

+ +

Tags: +

+ +

+ +

Text:

+ +

+ +
+
+ + +
+
Edit post
+

+ First select the blog of the post you wan't to edit. +

+ +

+ +

+ GET POSTS +
+ + +
+
Delete Post
+

+ First select the subblog of the post you want to delete. +

+ +

+ +

+ GET POSTS +
+ + +
+
Media Upload
+
+ + +

+ +
+
+ + +
+
Atom Feed Generator
+

+ +

+ GENERATE +
+ + + + +
+
Wrong Password
+

+ Please go back and try again. +

+ GO BACK +
+ + + +
Rangitaki Control Center

- The Rangitaki Control Center is disabled. You can enable it in - your config file. But please read first the documentation. + The Rangitaki Control Center is disabled. You can enable + it in your config file. But please read first the + documentation.

- -
-
Back
-

- Go back to your blog. -

- GO BACK -
-
- - - - - + + + +
+
Back
+

Go back to your blog.

+ GO BACK +
+
+ + + + + diff --git a/rcc/media/index.php b/rcc/media/index.php index 1e66ea8..db16346 100644 --- a/rcc/media/index.php +++ b/rcc/media/index.php @@ -1,60 +1,100 @@ + + * @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. + */ +?> + - - - - Rangitaki Control Center - - - - - -
-
-
File Upload
- You have to choose a file!

"; - } else { - $uploaddir = "../../media/"; - $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + + - if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { - echo "

The post was successfully uploaded and is now published.

"; - } else { - echo "

During the uploading process an error occured!
Error Code:" . ($_FILES['userfile']['error'] . "

"); - } - } - ?>GO BACK -
-
- + Rangitaki Control Center + + + + + + + + + + + + + + +
+ +
+
File Upload
+ +You have to choose a file!

"; + } else { + $uploaddir = "../../media/"; + $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); + + if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { + echo + "

+ The post was successfully uploaded and is now published. +

"; + } else { + echo + "

During the uploading process an error occured!
+ Error Code:" + . ($_FILES['userfile']['error'] . "

"); + } + } +?> + + GO BACK + + + +
+
+ diff --git a/rcc/newpost/index.php b/rcc/newpost/index.php index 3d45780..526d3a8 100644 --- a/rcc/newpost/index.php +++ b/rcc/newpost/index.php @@ -1,54 +1,82 @@ + * @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'); ?> + - + Rangitaki Control Center - + + + + + + + + + + - -
-
-
New Post
- + Rangitaki Control Center +
+ +
+
+
New Post
+ +GO BACK -
-
+ $filename = date("Y-m-d-H-i-s") . ".md"; + $handle = fopen("../../articles/$blog/$filename", "c"); + fwrite($handle, $md); + if (fclose($handle)) { + echo "Post successfully published."; + } else { + echo "Some error happend, while publishing."; + } + ?> + + GO BACK + + + + + diff --git a/rcc/res/atom.js b/rcc/res/atom.js index b5873c2..91fdc8f 100644 --- a/rcc/res/atom.js +++ b/rcc/res/atom.js @@ -1,13 +1,10 @@ /** - * Created by mmk2410 on 2016-02-16. - * * JavaScript for the ajax request to generate a atom feed * * Copyright (c) 2016 by mmk2410 * License: MIT License */ - function main() { // listener and function for calling the ajax request to create the // requested atom feed diff --git a/rcc/res/delete.js b/rcc/res/delete.js index a48d5c3..725df6c 100644 --- a/rcc/res/delete.js +++ b/rcc/res/delete.js @@ -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() { // listener and function for recieving the posts of the selected blogs $("#delete_get_posts").click(function () { + var selectedBlog = $("#delete_selected_blog").val(); + $.get("res/get_posts.php", { blog: selectedBlog }, function (data) { + $("#delete_select_post").remove(); $("#delete_select_post_info").remove(); $("#delete_post_button").remove(); $("#delete_get_posts").after("

"); - $("#delete_get_posts").after("

Now select the post you want to delete. " + - "Remember that once a post is deleted it can't be restored.

"); - $("#delete_select_post").append(""); + $("#delete_get_posts").after( + "

" + + "Now select the post you want to delete. " + + "Remember that once a post is deleted it can't be restored.

" + ); + $("#delete_select_post").append( + "" + ); + $.each($.parseJSON(data), function (index, value) { var post = value.substring(0, value.length - 3); - $("#delete_selected_post").append(""); + $("#delete_selected_post").append( + "" + ); }); - $("#delete_select_post").after("DELETE POST") + + $("#delete_select_post").after( + "DELETE POST" + ); }); }); @@ -37,10 +52,12 @@ function deletePostButton() { var selectedBlog = $("#delete_selected_blog").val(); var selectedPost = $("#delete_selected_post").val(); + $.get("res/delete_post.php", { blog: selectedBlog, post: selectedPost }, function (data) { + $("#delete_select_post").remove(); $("#delete_select_post_info").remove(); $("#delete_post_button").remove(); @@ -51,7 +68,10 @@ function deletePostButton() { } else if (data == "941") { alert("ERROR 941: No blog as get argument given"); } 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") { alert("Post successfully deleted."); } @@ -59,4 +79,4 @@ function deletePostButton() { } -$(document).ready(main()); \ No newline at end of file +$(document).ready(main()); diff --git a/rcc/res/delete_post.php b/rcc/res/delete_post.php index 77b46ee..ac5450b 100644 --- a/rcc/res/delete_post.php +++ b/rcc/res/delete_post.php @@ -2,8 +2,35 @@ /** * PHP Version 7 * - * User: mmk2410 - * Date: 12/6/15 + * @category Blogging + * @package Rcc + * @author Marcel Kapfer (mmk2410) + * @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: * 901 No post given as get argument @@ -11,17 +38,24 @@ * 941 No blog given as get argument * 961 Error while deleting the post */ + $post = $_GET["post"]; $blog = $_GET["blog"]; -if (!isset($post)) { - echo "901"; -} else if (!isset($blog)) { - echo "941"; -} else if (!file_exists("./../../articles/$blog/$post.md")) { - echo "921"; -} else { - if (unlink("./../../articles/$blog/$post.md")) { - echo "0"; + +session_start(); +if ($_SESSION['login']) { + if (!isset($post)) { + echo "901"; + } else if (!isset($blog)) { + echo "941"; + } else if (!file_exists("./../../articles/$blog/$post.md")) { + echo "921"; + } else { + if (unlink("./../../articles/$blog/$post.md")) { + echo "0"; + } + echo "961"; } - echo "961"; } + +?> diff --git a/rcc/res/edit.js b/rcc/res/edit.js index 6f101bd..3ff4973 100644 --- a/rcc/res/edit.js +++ b/rcc/res/edit.js @@ -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() { // listener and function for recieving the posts of the selected blogs $("#edit_get_posts").click(function () { + var selectedBlog = $("#edit_selected_blog").val(); $.get("res/get_posts.php", { blog: selectedBlog }, function (data) { + $("#edit_select_post").remove(); $("#edit_select_post_info").remove(); $("#edit_post_button").remove(); $("#edit_get_posts").after("

"); - $("#edit_get_posts").after("

Now select the post you want to edit.

"); - $("#edit_select_post").append(""); + $("#edit_get_posts").after( + "

" + + "Now select the post you want to edit.

" + ); + $("#edit_select_post").append( + "" + ); $.each($.parseJSON(data), function (index, value) { var post = value.substring(0, value.length - 3); - $("#edit_selected_post").append(""); + $("#edit_selected_post").append( + "" + ); }); - $("#edit_select_post").after("EDIT POST") + $("#edit_select_post").after( + "EDIT POST" + ); }); }); $("#save_changes").click(function () { + var postTitle = $("#title").val(); var postDate = $("#date").val(); var postAuthor = $("#author").val(); var postTags = $("#tags").val(); var postText = $("#text").val(); - var file = "../../articles/" + getVariables['blog'] + "/" + getVariables['post'] + ".md"; - console.log(file); + var file = "../../articles/" + getVariables.blog + + "/" + getVariables.post + ".md"; $.post("../res/save.php", { title: postTitle, @@ -69,4 +82,4 @@ function editPostButton() { } -$(document).ready(main()); \ No newline at end of file +$(document).ready(main()); diff --git a/rcc/res/get_posts.php b/rcc/res/get_posts.php index 313d3db..fb3a2c0 100644 --- a/rcc/res/get_posts.php +++ b/rcc/res/get_posts.php @@ -2,26 +2,57 @@ /** * PHP Version 7 * - * User: mmk2410 - * Date: 12/6/15 + * @category Blogging + * @package Rcc + * @author Marcel Kapfer (mmk2410) + * @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: * 901 No blog given as get argument * 921 No blog with the given name available */ -$blog = $_GET["blog"]; -if (!isset($blog)) { - echo "901"; -} else if (!file_exists("./../../blogs/$blog.md")) { - echo "921"; -} else { - $posts = array(); - $i = 0; - foreach (scandir("./../../articles/$blog/") as $article) { - if (substr($article, -3) == ".md") { - $posts[$i] = $article; - $i++; + +session_start(); +if ($_SESSION['login']) { + $blog = $_GET["blog"]; + if (!isset($blog)) { + echo "901"; + } else if (!file_exists("./../../blogs/$blog.md")) { + echo "921"; + } else { + $posts = array(); + $i = 0; + foreach (scandir("./../../articles/$blog/") as $article) { + if (substr($article, -3) == ".md") { + $posts[$i] = $article; + $i++; + } } + print json_encode($posts); } - print json_encode($posts); } diff --git a/rcc/res/rcc.css b/rcc/res/rcc.css index d86933b..b3a6f2f 100644 --- a/rcc/res/rcc.css +++ b/rcc/res/rcc.css @@ -1,30 +1,29 @@ /* -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. -*/ -/* - Created on : Jun 14, 2015, 6:13:38 PM - Author : mmk2410 -*/ + * RCC cascade style sheet + * + * Copyright (C) 2015-2016 Marcel Kapfer (mmk2410) + * MIT License + * + * The 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 + * 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. + */ /* BODY */ @@ -273,4 +272,4 @@ form{ #back-card { display: none; } -} \ No newline at end of file +} diff --git a/rcc/res/rcc.js b/rcc/res/rcc.js index 6539a71..f95995b 100644 --- a/rcc/res/rcc.js +++ b/rcc/res/rcc.js @@ -1,20 +1,32 @@ +/** + * JavaScript for RCC + * + * Copyright (c) 2016 by mmk2410 + * License: MIT License + */ + 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 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) { 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 () { + t.attachEvent && t.attachEvent('onkeyup', function () { resize(t); }); -} \ No newline at end of file +}; diff --git a/rcc/res/save.php b/rcc/res/save.php index bd96296..88abcf7 100644 --- a/rcc/res/save.php +++ b/rcc/res/save.php @@ -1,11 +1,46 @@ + * @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 = << + * @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. + */ +?> + - - - - Rangitaki Control Center - - - - - -
-
-
File Upload
- You have to choose a file!

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

The post was successfully uploaded and is now published.

"; - } else { - echo "

During the uploading process an error occured!
Error Code:" . ($_FILES['userfile']['error'] . "

"); - } - } - ?>GO BACK -
-
- + Rangitaki Control Center + + + + + + + + + + + + + + + + +
+
+
File Upload
+ +You have to choose a file!

"; + } 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 + "

The post was successfully uploaded and is now + published.

"; + } else { + echo + "

During the uploading process an error occured!
+ Error Code:" + . ($_FILES['userfile']['error'] . "

"); + } + } +?> + + GO BACK + + + +
+
+