| @ -1,78 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_POST['submit'])) { | |||||
| $post_title = $_POST['title']; | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $_POST['content']; | |||||
| } | |||||
| if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $filename = $post_url . '.md'; | |||||
| $dir = '../../content/static/'; | |||||
| if(is_dir($dir)) { | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| mkdir($dir, 0777, true); | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Create page</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_post.php">Create post</a> | | |||||
| <a href="../action/edit_bio.php">Edit bio</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" class="text" name="title"/><br><br> | |||||
| Url: <br><input type="text" class="text" name="url"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"></textarea><br/> | |||||
| <input type="submit" name="submit" class="submit" value="Publish"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,83 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_POST['submit'])) { | |||||
| $post_date = date('Y-m-d-H-i'); | |||||
| $post_title = $_POST['title']; | |||||
| $post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['tag']); | |||||
| $post_tag = rtrim($post_tag, ',\.\-'); | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $_POST['content']; | |||||
| } | |||||
| if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $user = $_SESSION['user']; | |||||
| $filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md'; | |||||
| $dir = '../../content/' . $user. '/blog/'; | |||||
| if(is_dir($dir)) { | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| mkdir($dir, 0777, true); | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Create post</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_page.php">Create page</a> | | |||||
| <a href="../action/edit_bio.php">Edit bio</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" class="text" name="title"/><br><br> | |||||
| Tag: <br><input type="text" class="text" name="tag"/><br><br> | |||||
| Url: <br><input type="text" class="text" name="url"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"></textarea><br/> | |||||
| <input type="submit" name="submit" class="submit" value="Publish"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,60 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_GET['url'])) { | |||||
| $url = $_GET['url']; | |||||
| } | |||||
| else { | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if(isset($_POST['submit'])) { | |||||
| $deleted_content = $_POST['delete']; | |||||
| } | |||||
| if(!empty($deleted_content)) { | |||||
| unlink($deleted_content); | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Delete page</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_post.php">Create post</a> | | |||||
| <a href="../action/create_page.php">Create page</a> | | |||||
| <a href="../action/edit_bio.php">Edit bio</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <?php echo '<p>Are you sure want to delete <strong>' . $url . '</strong>?</p>';?> | |||||
| <form method="POST"> | |||||
| <input type="hidden" name="delete" value="<?php echo $url ?>"/><br> | |||||
| <input type="submit" name="submit" value="Delete"/> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,60 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_GET['url'])) { | |||||
| $url = $_GET['url']; | |||||
| } | |||||
| else { | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if(isset($_POST['submit'])) { | |||||
| $deleted_content = $_POST['delete']; | |||||
| } | |||||
| if(!empty($deleted_content)) { | |||||
| unlink($deleted_content); | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Delete post</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_post.php">Create post</a> | | |||||
| <a href="../action/create_page.php">Create page</a> | | |||||
| <a href="../action/edit_bio.php">Edit bio</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <?php echo '<p>Are you sure want to delete <strong>' . $url . '</strong>?</p>';?> | |||||
| <form method="POST"> | |||||
| <input type="hidden" name="delete" value="<?php echo $url ?>"/><br> | |||||
| <input type="submit" name="submit" value="Delete"/> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,101 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_SESSION['user'])) { | |||||
| $user = $_SESSION['user']; | |||||
| } | |||||
| else { | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| $filename = '../../content/' . $user . '/author.md'; | |||||
| if(file_exists($filename)) { | |||||
| $content = file_get_contents($filename); | |||||
| $arr = explode('t-->', $content); | |||||
| if(isset($arr[1])) { | |||||
| $oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' ')); | |||||
| $oldcontent = ltrim($arr[1]); | |||||
| } | |||||
| else { | |||||
| $oldtitle = $user; | |||||
| $oldcontent = ltrim($arr[0]); | |||||
| } | |||||
| } | |||||
| else { | |||||
| $oldtitle = $user; | |||||
| $oldcontent = 'Just another HTMLy user.'; | |||||
| } | |||||
| if(isset($_POST['submit'])) { | |||||
| $bio_title = $_POST['title']; | |||||
| $bio_content = '<!--t ' . $bio_title . ' t-->' . "\n\n" . $_POST['content']; | |||||
| } | |||||
| if(!empty($bio_title) && !empty($bio_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $bio_content = stripslashes($bio_content); | |||||
| } | |||||
| $dir = '../../content/' . $user. '/'; | |||||
| if(is_dir($dir)) { | |||||
| file_put_contents($dir . $filename, print_r($bio_content, true)); | |||||
| } | |||||
| else { | |||||
| mkdir($dir, 0777, true); | |||||
| file_put_contents($dir . $filename, print_r($bio_content, true)); | |||||
| } | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Edit bio</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_post.php">Create post</a> | | |||||
| <a href="../action/create_page.php">Create page</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" name="title" class="text" value="<?php echo $oldtitle?>"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent; ?></textarea><br> | |||||
| <input type="submit" name="submit" class="submit" value="Submit"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,101 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_GET['url'])) { | |||||
| $url = $_GET['url']; | |||||
| } | |||||
| else { | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| $content = file_get_contents($url); | |||||
| $arr = explode('t-->', $content); | |||||
| if(isset($arr[1])) { | |||||
| $oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' ')); | |||||
| $oldcontent = ltrim($arr[1]); | |||||
| } | |||||
| else { | |||||
| $oldtitle = 'Untitled'; | |||||
| $oldcontent = ltrim($arr[0]); | |||||
| } | |||||
| $dir = substr($url, 0, strrpos($url, '/')); | |||||
| $oldurl = str_replace($dir . '/','',$url); | |||||
| $oldmd = str_replace('.md','',$oldurl); | |||||
| if(isset($_POST['submit'])) { | |||||
| $post_title = $_POST['title']; | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $_POST['content']; | |||||
| } | |||||
| if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $newurl = $dir . '/' . $post_url . '.md'; | |||||
| if($url === $newurl) { | |||||
| file_put_contents($url, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| rename($url, $newurl); | |||||
| file_put_contents($newurl, print_r($post_content, true)); | |||||
| } | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Edit page</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_post.php">Create post</a> | | |||||
| <a href="../action/create_page.php">Create page</a> | | |||||
| <a href="../action/edit_bio.php">Edit bio</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" name="title" class="text" value="<?php echo $oldtitle?>"/><br><br> | |||||
| Url: <br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br> | |||||
| <input type="submit" name="submit" class="submit" value="Submit"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,108 +0,0 @@ | |||||
| <?php | |||||
| // Change this to your timezone | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../../system/includes/dispatch.php'; | |||||
| config('source', '../../config/config.ini'); | |||||
| include '../includes/session.php'; | |||||
| if(isset($_GET['url'])) { | |||||
| $url = $_GET['url']; | |||||
| } | |||||
| else { | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| $content = file_get_contents($url); | |||||
| $arr = explode('t-->', $content); | |||||
| if(isset($arr[1])) { | |||||
| $oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' ')); | |||||
| $oldcontent = ltrim($arr[1]); | |||||
| } | |||||
| else { | |||||
| $oldtitle = 'Untitled'; | |||||
| $oldcontent = ltrim($arr[0]); | |||||
| } | |||||
| $dir = substr($url, 0, strrpos($url, '/')); | |||||
| $oldurl = explode('_', $url); | |||||
| $oldtag = $oldurl[1]; | |||||
| $oldmd = str_replace('.md','',$oldurl[2]); | |||||
| if(isset($_POST['submit'])) { | |||||
| $post_title = $_POST['title']; | |||||
| $post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['tag']); | |||||
| $post_tag = rtrim($post_tag, ',\.\-'); | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $_POST['content']; | |||||
| } | |||||
| if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $newurl = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md'; | |||||
| if($url === $newurl) { | |||||
| file_put_contents($url, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| rename($url, $newurl); | |||||
| file_put_contents($newurl, print_r($post_content, true)); | |||||
| } | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| if (login()) { | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Edit post</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| <link rel="stylesheet" type="text/css" href="../editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="../action/create_post.php">Create post</a> | | |||||
| <a href="../action/create_page.php">Create page</a> | | |||||
| <a href="../action/edit_bio.php">Edit bio</a> | | |||||
| <a href="../action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" name="title" class="text" value="<?php echo $oldtitle?>"/><br><br> | |||||
| Tag: <br><input type="text" name="tag" class="text" value="<?php echo $oldtag?>"/><br><br> | |||||
| Url: <br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br> | |||||
| <input type="submit" name="submit" class="submit" value="Submit"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| <?php } else {header('location: ../index.php');} ?> | |||||
| @ -1,77 +0,0 @@ | |||||
| <?php | |||||
| include '../includes/session.php'; | |||||
| include '../includes/user.php'; | |||||
| if(!empty($_REQUEST['user']) && !empty($_REQUEST['password'])) { | |||||
| $user = $_REQUEST['user']; | |||||
| $pass = $_REQUEST['password']; | |||||
| $user_file = '../../config/users/' . $user . '.ini'; | |||||
| $user_pass = user('password', $user); | |||||
| if(file_exists($user_file)) { | |||||
| if($pass === $user_pass) { | |||||
| $_SESSION['user'] = $user; | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| else { | |||||
| echo <<<EOF | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <title>Admin Panel</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <p>Password and username not match!</p> | |||||
| <p>Login Form</p> | |||||
| <form method="POST" action="login.php"> | |||||
| User:<br> | |||||
| <input type="text" class="text" name="user"/><br><br> | |||||
| Pass:<br> | |||||
| <input type="password" class="password" name="password"/><br><br> | |||||
| <input type="submit" name="submit" class="submit" value="Login"/> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| EOF; | |||||
| } | |||||
| } | |||||
| else { | |||||
| echo <<<EOF | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Admin Panel</title> | |||||
| <link rel="stylesheet" type="text/css" href="../resources/style.css" /> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <p>Please create username.txt inside "admin/users" folder and put your password inside it.</p> | |||||
| <p>Login Form</p> | |||||
| <form method="POST" action="login.php"> | |||||
| User:<br> | |||||
| <input type="text" class="text" name="user"/><br><br> | |||||
| Pass:<br> | |||||
| <input type="password" class="password" name="password"/><br><br> | |||||
| <input type="submit" name="submit" class="submit" value="Login"/> | |||||
| </form> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| EOF; | |||||
| } | |||||
| } | |||||
| else { | |||||
| header('location: ../index.php'); | |||||
| } | |||||
| ?> | |||||
| @ -1,9 +0,0 @@ | |||||
| <?php | |||||
| include '../includes/session.php'; | |||||
| session_destroy(); | |||||
| header('location: ../index.php'); | |||||
| ?> | |||||
| @ -1 +0,0 @@ | |||||
| deny from all | |||||
| @ -1,42 +0,0 @@ | |||||
| <?php | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| config('source', '../../config/config.ini'); | |||||
| // Get static page path. Unsorted. | |||||
| function admin_get_static(){ | |||||
| static $_cache = array(); | |||||
| if(empty($_cache)){ | |||||
| // Get the names of all the | |||||
| // static page. | |||||
| $_cache = glob('../content/static/*.md', GLOB_NOSORT); | |||||
| } | |||||
| return $_cache; | |||||
| } | |||||
| // Auto generate menu from static page | |||||
| function get_page_list() { | |||||
| $posts = admin_get_static(); | |||||
| krsort($posts); | |||||
| echo '<table>'; | |||||
| foreach($posts as $index => $v){ | |||||
| echo '<tr>'; | |||||
| echo '<td>' . $v . '</td>'; | |||||
| echo '<td><form method="GET" action="action/edit_page.php"><input type="submit" name="submit" value="Edit"/><input type="hidden" name="url" value="../' . $v . '"/></form></td>'; | |||||
| echo '<td><form method="GET" action="action/delete_page.php"><input type="submit" name="submit" value="Delete"/><input type="hidden" name="url" value="../' . $v . '"/></form></td>'; | |||||
| echo '</tr>'; | |||||
| } | |||||
| echo '</table>'; | |||||
| } | |||||
| ?> | |||||
| @ -1,148 +0,0 @@ | |||||
| <?php | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| config('source', '../../config/config.ini'); | |||||
| // Get blog post with more info about the path. Sorted by filename. | |||||
| function admin_get_post(){ | |||||
| static $tmp= array(); | |||||
| static $_cache = array(); | |||||
| if(empty($_cache)){ | |||||
| // Get the names of all the posts | |||||
| $tmp = glob('../content/*/blog/*.md', GLOB_NOSORT); | |||||
| foreach($tmp as $file) { | |||||
| $_cache[] = pathinfo($file); | |||||
| } | |||||
| } | |||||
| usort($_cache, "sortfile"); | |||||
| return $_cache; | |||||
| } | |||||
| // usort function. Sort by filename. | |||||
| function sortfile($a, $b) { | |||||
| return $a['filename'] == $b['filename'] ? 0 : ( $a['filename'] < $b['filename'] ) ? 1 : -1; | |||||
| } | |||||
| // Return blog posts. | |||||
| function get_posts($posts, $page = 1, $perpage = 0){ | |||||
| if(empty($posts)) { | |||||
| $posts = admin_get_post(); | |||||
| } | |||||
| $tmp = array(); | |||||
| // Extract a specific page with results | |||||
| $posts = array_slice($posts, ($page-1) * $perpage, $perpage); | |||||
| foreach($posts as $index => $v){ | |||||
| $post = new stdClass; | |||||
| $filepath = $v['dirname'] . '/' . $v['basename']; | |||||
| // Extract the date | |||||
| $arr = explode('_', $filepath); | |||||
| // Replaced string | |||||
| $replaced = substr($arr[0], 0,strrpos($arr[0], '/')) . '/'; | |||||
| // Author string | |||||
| $str = explode('/', $replaced); | |||||
| $author = $str[count($str)-3]; | |||||
| // The post author + author url | |||||
| $post->author = $author; | |||||
| $post->authorurl = site_url() . 'author/' . $author; | |||||
| // The post date | |||||
| $post->date = strtotime(str_replace($replaced,'',$arr[0])); | |||||
| // The archive per day | |||||
| $post->archive = site_url(). 'archive/' . date('Y-m-d', $post->date) ; | |||||
| // The post URL | |||||
| $post->url = site_url().date('Y/m', $post->date).'/'.str_replace('.md','',$arr[2]); | |||||
| $tag = array(); | |||||
| $url = array(); | |||||
| $t = explode(',', $arr[1]); | |||||
| foreach($t as $tt) { | |||||
| $tag[] = array($tt, site_url(). 'tag/' . $tt); | |||||
| } | |||||
| foreach($tag as $a) { | |||||
| $url[] = '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . $a[1] . '">'. $a[0] .'</a></span>'; | |||||
| } | |||||
| $post->tag = implode(', ', $url); | |||||
| $post->tagb = implode(' » ', $url); | |||||
| $post->file = $filepath; | |||||
| // Get the contents and convert it to HTML | |||||
| // $content = file_get_contents($filepath); | |||||
| // $post->content = $content; | |||||
| $tmp[] = $post; | |||||
| } | |||||
| return $tmp; | |||||
| } | |||||
| // Return posts list on profile. | |||||
| function get_profile($profile, $page, $perpage){ | |||||
| $posts = admin_get_post(); | |||||
| $tmp = array(); | |||||
| foreach ($posts as $index => $v) { | |||||
| $url = $v['dirname']; | |||||
| $str = explode('/', $url); | |||||
| $author = $str[count($str)-2]; | |||||
| if($profile === $author){ | |||||
| $tmp[] = $v; | |||||
| } | |||||
| } | |||||
| if(empty($tmp)) { | |||||
| echo '<table><tr><td>No posts found!</td></tr></table>'; | |||||
| return; | |||||
| } | |||||
| return $tmp = get_posts($tmp, $page, $perpage); | |||||
| } | |||||
| function get_post_list() { | |||||
| if (isset($_SESSION['user'])) { | |||||
| $posts = get_profile($_SESSION['user'], null, null); | |||||
| if(!empty($posts)) { | |||||
| echo '<table>'; | |||||
| foreach($posts as $p) { | |||||
| echo '<tr>'; | |||||
| echo '<td>' . $p->file . '</td>'; | |||||
| echo '<td><form method="GET" action="action/edit_post.php"><input type="submit" name="submit" value="Edit"/><input type="hidden" name="url" value="../' . $p->file . '"/></form></td>'; | |||||
| echo '<td><form method="GET" action="action/delete_post.php"><input type="submit" name="submit" value="Delete"/><input type="hidden" name="url" value="../' . $p->file . '"/></form></td>'; | |||||
| echo '</tr>'; | |||||
| } | |||||
| echo '</table>'; | |||||
| } | |||||
| } | |||||
| } | |||||
| ?> | |||||
| @ -1,10 +0,0 @@ | |||||
| <?php | |||||
| function user($key, $user=null) { | |||||
| $value = '../../config/users/' . $user . '.ini'; | |||||
| static $_config = array(); | |||||
| if (file_exists($value)) { | |||||
| $_config = parse_ini_file($value, true); | |||||
| return $_config[$key]; | |||||
| } | |||||
| } | |||||
| @ -1,52 +0,0 @@ | |||||
| <?php | |||||
| date_default_timezone_set('Asia/Jakarta'); | |||||
| require '../system/includes/dispatch.php'; | |||||
| config('source', '../config/config.ini'); | |||||
| include 'includes/session.php'; | |||||
| include 'includes/post_list.php'; | |||||
| include 'includes/page_list.php'; | |||||
| ?> | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8" /> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <title>Admin Panel</title> | |||||
| <link rel="stylesheet" type="text/css" href="resources/style.css" /> | |||||
| </head> | |||||
| <body> | |||||
| <div class="wrapper-outer"> | |||||
| <div class="wrapper-inner"> | |||||
| <?php if (login()) { ?> | |||||
| <div class="nav"> | |||||
| <a href="<?php echo config('site.url');?>" target="_blank">Home</a> | | |||||
| <a href="<?php echo config('site.url');?>/admin">Admin</a> | | |||||
| <a href="action/create_post.php">Create post</a> | | |||||
| <a href="action/create_page.php">Create page</a> | | |||||
| <a href="action/edit_bio.php">Edit bio</a> | | |||||
| <a href="action/logout.php">Logout</a> | | |||||
| <span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span> | |||||
| </div> | |||||
| <p>Your blog posts:</p> | |||||
| <?php echo get_post_list(); ?> | |||||
| <p>Static page:</p> | |||||
| <?php echo get_page_list(); ?> | |||||
| <?php } else {?> | |||||
| <p>Login Form</p> | |||||
| <form method="POST" action="action/login.php"> | |||||
| User:<br> | |||||
| <input type="text" size="60" maxlength="60" name="user"/><br><br> | |||||
| Pass:<br> | |||||
| <input type="password" size="60" maxlength="60" name="password"/><br><br> | |||||
| <input type="submit" name="submit" value="Login"/> | |||||
| </form> | |||||
| <?php } ?> | |||||
| </div> | |||||
| </div> | |||||
| </body> | |||||
| </html> | |||||
| @ -1,159 +0,0 @@ | |||||
| body { | |||||
| font-size: 16px; | |||||
| font-family: Arial, Verdana; | |||||
| margin:0 auto; | |||||
| padding:0; | |||||
| background: none repeat scroll 0 0 #F9F9F9; | |||||
| width:100%; | |||||
| } | |||||
| .wrapper-outer { | |||||
| float:left; | |||||
| position:relative; | |||||
| width:100%; | |||||
| padding-bottom: 30px; | |||||
| } | |||||
| .wrapper-inner { | |||||
| margin:0 auto; | |||||
| width:980px; | |||||
| } | |||||
| .nav { | |||||
| width: 96%; | |||||
| padding:2% 0; | |||||
| border-bottom: 4px solid #cccccc; | |||||
| margin-bottom: 30px; | |||||
| } | |||||
| input.text, input.password { | |||||
| width: 75%; | |||||
| } | |||||
| img { | |||||
| border: 0 none; | |||||
| height: auto; | |||||
| max-width: 100%; | |||||
| outline: 0 none; | |||||
| } | |||||
| /*------------------------- | |||||
| Link | |||||
| --------------------------*/ | |||||
| a, a:visited { | |||||
| outline:none; | |||||
| text-decoration:none; | |||||
| } | |||||
| a:hover{ | |||||
| text-decoration:underline; | |||||
| } | |||||
| /*------------------------- | |||||
| Table | |||||
| --------------------------*/ | |||||
| table { | |||||
| font-size:14px; | |||||
| border: none; | |||||
| color:#333333; | |||||
| border: 1px solid #E3E3E3; | |||||
| margin: 1em 0; | |||||
| } | |||||
| table h2.title { | |||||
| margin:5px 0; | |||||
| } | |||||
| th, td { | |||||
| padding: 5px 10px; | |||||
| border: none; | |||||
| } | |||||
| th.title { | |||||
| margin:5px 0; | |||||
| font-family: Arial,sans-serif; | |||||
| font-size:18px; | |||||
| font-weight:normal; | |||||
| } | |||||
| td.title { | |||||
| font-weight:normal; | |||||
| background-color: #eeeeee; | |||||
| font-family: Arial,sans-serif; | |||||
| } | |||||
| th { | |||||
| background-color: #eeeeee; | |||||
| border-bottom: 1px solid #E3E3E3; | |||||
| border-right: 1px solid #E3E3E3; | |||||
| font-family: Arial,sans-serif; | |||||
| font-size:18px; | |||||
| } | |||||
| td { | |||||
| background-color: #eeeeee; | |||||
| border: 1px solid #E3E3E3; | |||||
| border-top: none; | |||||
| border-left:none; | |||||
| } | |||||
| @media all and (max-width: 980px) { | |||||
| .wrapper-inner { | |||||
| margin:0 auto; | |||||
| width:100%; | |||||
| } | |||||
| } | |||||
| /*---------------------------- | |||||
| Video | |||||
| -----------------------------*/ | |||||
| .video-wrapper { | |||||
| margin:1em 0; | |||||
| } | |||||
| @media all and (min-width: 420px) { | |||||
| .video-wrapper { | |||||
| padding-top:315px!important; | |||||
| position:relative; | |||||
| width:100%; | |||||
| max-width:420px!important; | |||||
| max-height:315px!important; | |||||
| } | |||||
| .video-wrapper iframe, .video-wrapper object, .video-wrapper embed { | |||||
| height: 100%; | |||||
| left: 0; | |||||
| position: absolute; | |||||
| top: 0; | |||||
| max-width:420px!important; | |||||
| width: 100%; | |||||
| max-height:315px!important; | |||||
| } | |||||
| } | |||||
| @media all and (max-width: 420px) { | |||||
| .video-wrapper { | |||||
| position: relative; | |||||
| padding-bottom: 56.25%; | |||||
| padding-top: 30px; | |||||
| height: 0; | |||||
| overflow: hidden; | |||||
| } | |||||
| .video-wrapper iframe, .video-wrapper object, .video-wrapper embed { | |||||
| height: 100%; | |||||
| left: 0; | |||||
| position: absolute; | |||||
| top: 0; | |||||
| width: 100%; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,228 @@ | |||||
| <?php | |||||
| function user($key, $user=null) { | |||||
| $value = 'config/users/' . $user . '.ini'; | |||||
| static $_config = array(); | |||||
| if (file_exists($value)) { | |||||
| $_config = parse_ini_file($value, true); | |||||
| return $_config[$key]; | |||||
| } | |||||
| } | |||||
| function login_message($str = null) { | |||||
| echo $str; | |||||
| } | |||||
| function session($user, $pass) { | |||||
| $user_file = 'config/users/' . $user . '.ini'; | |||||
| $user_pass = user('password', $user); | |||||
| if(file_exists($user_file)) { | |||||
| if($pass === $user_pass) { | |||||
| $_SESSION['user'] = $user; | |||||
| header('location: admin'); | |||||
| } | |||||
| else { | |||||
| $str = '<div style="text-align:center;padding-top:50px;"><h1>Your username and password are wrong.</h1><p><a href="' . site_url() . 'login">Back</a></p></div>'; | |||||
| login_message($str); | |||||
| } | |||||
| } | |||||
| else { | |||||
| $str = '<div style="text-align:center;padding-top:50px;"><h1>Username not found in our record.</h1><p><a href="' . site_url() . 'login">Back</a></p></div>'; | |||||
| login_message($str); | |||||
| } | |||||
| } | |||||
| function edit_post($title, $tag, $url, $content, $oldfile) { | |||||
| $oldurl = explode('_', $oldfile); | |||||
| $post_title = $title; | |||||
| $post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $tag); | |||||
| $post_tag = rtrim($post_tag, ',\.\-'); | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $url); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $content; | |||||
| if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $newfile = $oldurl[0] . '_' . $post_tag . '_' . $post_url . '.md'; | |||||
| if($oldfile === $newfile) { | |||||
| file_put_contents($oldfile, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| rename($oldfile, $newfile); | |||||
| file_put_contents($newfile, print_r($post_content, true)); | |||||
| } | |||||
| $redirect = site_url() . 'admin/posts'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function edit_page($title, $url, $content, $oldfile) { | |||||
| $dir = substr($oldfile, 0, strrpos($oldfile, '/')); | |||||
| $post_title = $title; | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $url); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $content; | |||||
| if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $newfile = $dir . '/' . $post_url . '.md'; | |||||
| if($oldfile === $newfile) { | |||||
| file_put_contents($oldfile, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| rename($oldfile, $newfile); | |||||
| file_put_contents($newfile, print_r($post_content, true)); | |||||
| } | |||||
| $redirect = site_url() . 'admin'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function add_post($title, $tag, $url, $content, $user) { | |||||
| $post_date = date('Y-m-d-H-i'); | |||||
| $post_title = $title; | |||||
| $post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $tag); | |||||
| $post_tag = rtrim($post_tag, ',\.\-'); | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $url); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $content; | |||||
| if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md'; | |||||
| $dir = 'content/' . $user. '/blog/'; | |||||
| if(is_dir($dir)) { | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| mkdir($dir, 0777, true); | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| $redirect = site_url() . 'admin/posts'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function add_page($title, $url, $content) { | |||||
| $post_title = $title; | |||||
| $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $url); | |||||
| $post_url = rtrim($post_url, ',\.\-'); | |||||
| $post_content = '<!--t ' . $post_title . ' t-->' . "\n\n" . $content; | |||||
| if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $post_content = stripslashes($post_content); | |||||
| } | |||||
| $filename = $post_url . '.md'; | |||||
| $dir = 'content/static/'; | |||||
| if(is_dir($dir)) { | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| else { | |||||
| mkdir($dir, 0777, true); | |||||
| file_put_contents($dir . $filename, print_r($post_content, true)); | |||||
| } | |||||
| $redirect = site_url() . 'admin'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function delete_post($file) { | |||||
| $deleted_content = $file; | |||||
| if(!empty($deleted_content)) { | |||||
| unlink($deleted_content); | |||||
| $redirect = site_url() . 'admin/posts'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function delete_page($file) { | |||||
| $deleted_content = $file; | |||||
| if(!empty($deleted_content)) { | |||||
| unlink($deleted_content); | |||||
| $redirect = site_url() . 'admin'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function edit_profile($title, $content, $user) { | |||||
| $user_title = $title; | |||||
| $user_content = '<!--t ' . $user_title . ' t-->' . "\n\n" . $content; | |||||
| if(!empty($user_title) && !empty($user_content)) { | |||||
| if(get_magic_quotes_gpc()) { | |||||
| $user_content = stripslashes($user_content); | |||||
| } | |||||
| $dir = 'content/' . $user. '/'; | |||||
| $filename = 'content/' . $user . '/author.md'; | |||||
| if(is_dir($dir)) { | |||||
| file_put_contents($filename, print_r($user_content, true)); | |||||
| } | |||||
| else { | |||||
| mkdir($dir, 0777, true); | |||||
| file_put_contents($filename, print_r($user_content, true)); | |||||
| } | |||||
| $redirect = site_url() . 'admin'; | |||||
| header("Location: $redirect"); | |||||
| } | |||||
| } | |||||
| function get_recent_posts() { | |||||
| if (isset($_SESSION['user'])) { | |||||
| $posts = get_profile($_SESSION['user'], 1, 5); | |||||
| if(!empty($posts)) { | |||||
| echo '<table>'; | |||||
| echo '<tr><th>Title</th><th>Published</th><th>Tag</th><th>Operations</th></tr>'; | |||||
| foreach($posts as $p) { | |||||
| echo '<tr>'; | |||||
| echo '<td>' . $p->title . '</td>'; | |||||
| echo '<td>' . date('d F Y', $p->date) . '</td>'; | |||||
| echo '<td>' . $p->tag . '</td>'; | |||||
| echo '<td><a href="' . $p->url . '/edit">Edit</a> <a href="' . $p->url . '/delete">Delete</a></td>'; | |||||
| echo '</tr>'; | |||||
| } | |||||
| echo '</table>'; | |||||
| } | |||||
| } | |||||
| } | |||||
| // Auto generate menu from static page | |||||
| function get_recent_pages() { | |||||
| if (isset($_SESSION['user'])) { | |||||
| $posts = get_static_post(null); | |||||
| krsort($posts); | |||||
| echo '<table>'; | |||||
| echo '<tr><th>Title</th><th>Operations</th></tr>'; | |||||
| foreach($posts as $p) { | |||||
| echo '<tr>'; | |||||
| echo '<td>' . $p->title . '</td>'; | |||||
| echo '<td><a href="' . $p->url . '/edit">Edit</a> <a href="' . $p->url . '/delete">Delete</a></td>'; | |||||
| echo '</tr>'; | |||||
| } | |||||
| echo '</table>'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,23 @@ | |||||
| <link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" class="text" name="title"/><br><br> | |||||
| Url: <br><input type="text" class="text" name="url"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"></textarea><br/> | |||||
| <input type="submit" name="submit" class="submit" value="Publish"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| @ -0,0 +1,24 @@ | |||||
| <link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" class="text" name="title"/><br><br> | |||||
| Tag: <br><input type="text" class="text" name="tag"/><br><br> | |||||
| Url: <br><input type="text" class="text" name="url"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"></textarea><br/> | |||||
| <input type="submit" name="submit" class="submit" value="Publish"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| @ -0,0 +1,820 @@ | |||||
| /*------------------------- | |||||
| Simple reset | |||||
| --------------------------*/ | |||||
| *{ | |||||
| margin:0; | |||||
| padding:0; | |||||
| } | |||||
| body { | |||||
| font-family: Georgia, sans-serif, Arial; | |||||
| font-size: 17px; | |||||
| line-height: 1.6; | |||||
| color: #343A3F; | |||||
| padding: 0; | |||||
| margin: 0; | |||||
| } | |||||
| section, footer, header, aside, nav{ | |||||
| display: block; | |||||
| } | |||||
| img { | |||||
| border: 0 none; | |||||
| height: auto; | |||||
| max-width: 100%; | |||||
| outline: 0 none; | |||||
| } | |||||
| /*------------------------- | |||||
| Heading | |||||
| --------------------------*/ | |||||
| h1, h2, h3, h4, h5, h6 { | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| line-height: 1.3; | |||||
| margin: 0.5em 0; | |||||
| } | |||||
| h1 { | |||||
| font-size: 28px; | |||||
| } | |||||
| h2 { | |||||
| font-size: 24px; | |||||
| } | |||||
| h3 { | |||||
| font-size: 18px; | |||||
| } | |||||
| h4 { | |||||
| font-size: 16px; | |||||
| } | |||||
| h5 { | |||||
| font-size: 14px; | |||||
| } | |||||
| h6 { | |||||
| font-size: 12px; | |||||
| } | |||||
| /*------------------------- | |||||
| Toolbar | |||||
| --------------------------*/ | |||||
| #toolbar { | |||||
| background: none repeat scroll 0 0 #666666; | |||||
| box-shadow: 0 3px 20px #000000; | |||||
| color: #CCCCCC; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| left: 0; | |||||
| margin: 0 -20px; | |||||
| padding: 0 25px; | |||||
| position: fixed; | |||||
| right: 0; | |||||
| top: 0; | |||||
| z-index: 600; | |||||
| border: 0 none; | |||||
| font-size: 15px; | |||||
| text-align: left; | |||||
| vertical-align: baseline; | |||||
| } | |||||
| #toolbar ul { | |||||
| margin:0; | |||||
| } | |||||
| #toolbar ul li, #toolbar ul li a { | |||||
| float: left; | |||||
| list-style: none outside none; | |||||
| } | |||||
| #toolbar a { | |||||
| color: #FFFFFF; | |||||
| font-size: 0.846em; | |||||
| text-decoration: none; | |||||
| border-radius: 10px; | |||||
| padding: 0 10px; | |||||
| } | |||||
| /*------------------------- | |||||
| Layout | |||||
| --------------------------*/ | |||||
| #outer-wrapper { | |||||
| margin:0; | |||||
| padding:0; | |||||
| float:left; | |||||
| width: 100%; | |||||
| } | |||||
| #inner-wrapper { | |||||
| padding: 0 10px; | |||||
| } | |||||
| .container { | |||||
| padding: 0 20px; | |||||
| } | |||||
| #header-wrapper { | |||||
| background: #546673; | |||||
| position:relative; | |||||
| padding: 1em 0; | |||||
| float:left; | |||||
| width: 100%; | |||||
| color: #ffffff; | |||||
| font-family: Georgia, sans-serif; | |||||
| font-style:italic; | |||||
| } | |||||
| #content-wrapper { | |||||
| float:left; | |||||
| width: 100%; | |||||
| padding: 3em 0; | |||||
| background-color: #FAFAFA; | |||||
| } | |||||
| #menu, #header, #content, #footer { | |||||
| width: 980px; | |||||
| margin: 0 auto; | |||||
| } | |||||
| #header { | |||||
| text-align:center; | |||||
| } | |||||
| .hide { | |||||
| display:none; | |||||
| } | |||||
| .wmd-panel { | |||||
| display:table-row; | |||||
| } | |||||
| /*------------------------- | |||||
| Link | |||||
| --------------------------*/ | |||||
| a, a:visited { | |||||
| outline:none; | |||||
| color:#2E9FFF; | |||||
| text-decoration:none; | |||||
| } | |||||
| a:hover{ | |||||
| text-decoration:underline; | |||||
| } | |||||
| /*------------------------- | |||||
| Text element | |||||
| --------------------------*/ | |||||
| blockquote:before { | |||||
| color: #BBBBBB; | |||||
| content: "“"; | |||||
| font-size: 3em; | |||||
| line-height: 0.1em; | |||||
| margin-right: 0.2em; | |||||
| vertical-align: -0.4em; | |||||
| } | |||||
| blockquote:after { | |||||
| color: #BBBBBB; | |||||
| content: "”"; | |||||
| font-size: 3em; | |||||
| line-height: 0.1em; | |||||
| vertical-align: -0.45em; | |||||
| } | |||||
| blockquote { | |||||
| font-style: italic; | |||||
| margin: 1em 0 1em 1em; | |||||
| } | |||||
| blockquote p { | |||||
| display:inline; | |||||
| } | |||||
| pre { | |||||
| margin: 1em 0; | |||||
| overflow: auto; | |||||
| background: #F1F1FF; | |||||
| } | |||||
| code { | |||||
| color: #333333; | |||||
| font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; | |||||
| font-size: 15px; | |||||
| padding: 5px 10px; | |||||
| background: #F1F1FF; | |||||
| } | |||||
| pre code { | |||||
| color: #333333; | |||||
| display: block; | |||||
| font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; | |||||
| font-size: 14px; | |||||
| padding: 5px 10px; | |||||
| } | |||||
| .thumbnail { | |||||
| float: left; | |||||
| height: 80px; | |||||
| width: 80px; | |||||
| margin: 5px 15px 0 0; | |||||
| overflow: hidden; | |||||
| display: block; | |||||
| background-repeat: no-repeat; | |||||
| background-position: center; | |||||
| background-size: cover; | |||||
| } | |||||
| ul, ol { | |||||
| padding-left: 30px; | |||||
| margin: 1em 0; | |||||
| } | |||||
| ul li, ol li{ | |||||
| margin: 0.25em 0; | |||||
| } | |||||
| input.text, input.password { | |||||
| width: 75%; | |||||
| } | |||||
| /*------------------------- | |||||
| Table | |||||
| --------------------------*/ | |||||
| table { | |||||
| font-size:12px; | |||||
| border: none; | |||||
| width:100%; | |||||
| color:#333333; | |||||
| border: 1px solid #E3E3E3; | |||||
| margin: 1em 0; | |||||
| } | |||||
| table h2.title { | |||||
| margin:5px 0; | |||||
| } | |||||
| th, td { | |||||
| padding: 5px 10px; | |||||
| border: none; | |||||
| } | |||||
| th.title { | |||||
| margin:5px 0; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| font-size:16px; | |||||
| font-weight:normal; | |||||
| } | |||||
| td.title { | |||||
| font-weight:normal; | |||||
| background-color: #f6f6f6; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| } | |||||
| th { | |||||
| background-color: #f6f6f6; | |||||
| border-bottom: 1px solid #E3E3E3; | |||||
| border-right: 1px solid #E3E3E3; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| font-size:16px; | |||||
| } | |||||
| td { | |||||
| background-color: #fafafa; | |||||
| border: 1px solid #E3E3E3; | |||||
| border-top: none; | |||||
| border-left:none; | |||||
| } | |||||
| /*------------------------- | |||||
| Menu | |||||
| --------------------------*/ | |||||
| #menu-wrapper { | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| color: #7E909D; | |||||
| padding: 10px 0; | |||||
| float:left; | |||||
| width:100%; | |||||
| } | |||||
| #menu { | |||||
| font-weight:bold; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| color: #7E909D; | |||||
| font-size: 14px; | |||||
| } | |||||
| #menu ul { | |||||
| margin:0; | |||||
| padding:0; | |||||
| } | |||||
| #menu a { | |||||
| color: #7E909D; | |||||
| } | |||||
| #menu ul li { | |||||
| float:left; | |||||
| margin:0 20px 0 0; | |||||
| list-style:none; | |||||
| padding-top:3px; | |||||
| } | |||||
| #menu ul li:last-child { | |||||
| margin:0; | |||||
| } | |||||
| /*---------------------------- | |||||
| Search form | |||||
| -----------------------------*/ | |||||
| #search-form { | |||||
| position:relative; | |||||
| float:right; | |||||
| } | |||||
| .search-input{ | |||||
| margin: 0; | |||||
| padding: 4px 15px; | |||||
| font-size:14px; | |||||
| border:1px solid #0076a3; | |||||
| border-top-left-radius: 5px 5px; | |||||
| border-bottom-left-radius: 5px 5px; | |||||
| width: 120px; | |||||
| color: #888888; | |||||
| } | |||||
| .search-button { | |||||
| margin: 0; | |||||
| padding: 4px; | |||||
| font-size:14px; | |||||
| outline: none; | |||||
| cursor: pointer; | |||||
| text-align: center; | |||||
| text-decoration: none; | |||||
| color: #ffffff; | |||||
| border: solid 1px #546673; | |||||
| border-right:0px; | |||||
| background: #0095cd; | |||||
| background: -webkit-gradient(linear, left top, left bottom, from(#2E9FFF), to(#2E9CCC)); | |||||
| background: -moz-linear-gradient(top, #2E9FFF, #2E9CCC); | |||||
| border-top-right-radius: 5px 5px; | |||||
| border-bottom-right-radius: 5px 5px; | |||||
| width: 60px; | |||||
| } | |||||
| .search-button:hover { | |||||
| text-decoration: none; | |||||
| background: #007ead; | |||||
| background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e)); | |||||
| background: -moz-linear-gradient(top, #0095cc, #00678e); | |||||
| } | |||||
| /* Fixes submit button height problem in Firefox */ | |||||
| .search-button::-moz-focus-inner { | |||||
| border: 0; | |||||
| } | |||||
| /*------------------------- | |||||
| Post | |||||
| --------------------------*/ | |||||
| .post { | |||||
| border-bottom: 1px solid #EBF2F6; | |||||
| padding: 1em 0; | |||||
| float: left; | |||||
| width: 100%; | |||||
| } | |||||
| .inpost .post { | |||||
| padding-bottom: 0; | |||||
| } | |||||
| p, ul { | |||||
| margin :1em 0; | |||||
| } | |||||
| .breadcrumb { | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| font-size: 14px; | |||||
| font-weight:normal; | |||||
| } | |||||
| .date { | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| font-size: 14px; | |||||
| color: #A7A7A7; | |||||
| font-weight:normal; | |||||
| margin:1em 0; | |||||
| } | |||||
| h1.blog-title { | |||||
| font-style:normal; | |||||
| } | |||||
| h1.title-post a, h2.title-index a{ | |||||
| color:#4f4f4f; | |||||
| text-decoration: none; | |||||
| } | |||||
| h1.title-post a:hover, h2.title-index a:hover { | |||||
| color: #2E9FFF; | |||||
| } | |||||
| .inpost .post { | |||||
| padding-top:0; | |||||
| border: none; | |||||
| } | |||||
| .inpage .border { | |||||
| padding:0; | |||||
| margin:0; | |||||
| border:0; | |||||
| } | |||||
| .inpage .post { | |||||
| padding-top:0; | |||||
| } | |||||
| .infront .first, .inpost .post, .intag .first, .inarchive .first, .insearch .first { | |||||
| padding-top:0; | |||||
| } | |||||
| .infront .first h2.title-index { | |||||
| margin-top:0; | |||||
| } | |||||
| .inprofile .bio { | |||||
| font-size: 14px; | |||||
| font-style:italic; | |||||
| border-bottom: 1px solid #EBF2F6; | |||||
| padding-bottom: 1em; | |||||
| margin-bottom: 2em; | |||||
| } | |||||
| .post-list { | |||||
| font-size: 14px; | |||||
| } | |||||
| /*------------------------- | |||||
| Comments | |||||
| --------------------------*/ | |||||
| .comments { | |||||
| position:relative; | |||||
| display:block; | |||||
| font-size:16px; | |||||
| float:left; | |||||
| width:100%; | |||||
| } | |||||
| .border { | |||||
| border-top: 1px solid #DFDFDF; | |||||
| margin-bottom: 15px; | |||||
| margin-top: 10px; | |||||
| padding-bottom: 15px; | |||||
| width: 100%; | |||||
| float:left; | |||||
| } | |||||
| .border #disqus_thread { | |||||
| padding-top: 1.2em; | |||||
| } | |||||
| #disqus_thread { | |||||
| font-family: Georgia, Times, Cambria, serif; | |||||
| float:left; | |||||
| width:100%; | |||||
| } | |||||
| /*------------------------- | |||||
| Raleted posts | |||||
| --------------------------*/ | |||||
| .related { | |||||
| font-size: 14px; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| width:100%; | |||||
| float:left; | |||||
| margin-bottom: 1em; | |||||
| } | |||||
| .related ul { | |||||
| margin:0; | |||||
| } | |||||
| /*------------------------- | |||||
| Pagination + Postnav | |||||
| --------------------------*/ | |||||
| .postnav{ | |||||
| width:100%; | |||||
| float:left; | |||||
| padding-bottom:1em; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| font-size: 12px; | |||||
| font-weight:bold; | |||||
| } | |||||
| .postnav a { | |||||
| background: none repeat scroll 0 0 #E4E7EE; | |||||
| border-radius: 3px; | |||||
| color: #555555; | |||||
| line-height: 1; | |||||
| text-align: center; | |||||
| } | |||||
| .postnav a:hover { | |||||
| text-decoration:none; | |||||
| color:#333333; | |||||
| } | |||||
| .postnav .newer { | |||||
| float:left; | |||||
| margin-right:1em; | |||||
| margin-bottom:0.1em; | |||||
| padding: 10px 15px 10px 25px; | |||||
| } | |||||
| .postnav .older { | |||||
| float:right; | |||||
| padding: 10px 25px 10px 15px; | |||||
| } | |||||
| .postnav .pagination-arrow{ | |||||
| display: inline-block; | |||||
| border-radius: 3px; | |||||
| color: #555 !important; | |||||
| text-decoration: none !important; | |||||
| text-transform: none; | |||||
| position: relative; | |||||
| } | |||||
| .postnav .pagination-arrow.newer:before, | |||||
| .postnav .pagination-arrow.older:before{ | |||||
| content: ''; | |||||
| border: 5px solid #555; | |||||
| border-color: transparent #555 transparent transparent; | |||||
| width: 0; | |||||
| height: 0; | |||||
| position: absolute; | |||||
| left: 5px; | |||||
| top: 12px; | |||||
| } | |||||
| .postnav .pagination-arrow.older:before{ | |||||
| left:auto; | |||||
| right:5px; | |||||
| border-color: transparent transparent transparent #555; | |||||
| } | |||||
| .pager { | |||||
| width:100%; | |||||
| float:left; | |||||
| padding: 30px 0 1em 0; | |||||
| font-family: 'Open Sans',sans-serif; | |||||
| font-size: 12px; | |||||
| font-weight:bold; | |||||
| } | |||||
| .pager a { | |||||
| background: none repeat scroll 0 0 #E4E7EE; | |||||
| border-radius: 3px; | |||||
| color: #555555; | |||||
| line-height: 1; | |||||
| padding: 10px 20px; | |||||
| text-align: center; | |||||
| } | |||||
| .pager .newer { | |||||
| float:left; | |||||
| } | |||||
| .pager .older { | |||||
| float:right; | |||||
| } | |||||
| .pager a:hover { | |||||
| text-decoration:none; | |||||
| color:#333333; | |||||
| } | |||||
| /*------------------------- | |||||
| Footer | |||||
| --------------------------*/ | |||||
| #footer-wrapper { | |||||
| background: #546673; | |||||
| position:relative; | |||||
| padding: 20px 0; | |||||
| float:left; | |||||
| width: 100%; | |||||
| color: #ABB6C5; | |||||
| font-family: 'Open Sans', sans-serif; | |||||
| } | |||||
| #footer { | |||||
| font-size: 14px; | |||||
| } | |||||
| #footer a { | |||||
| color: #CBD2DC; | |||||
| font-weight:bold; | |||||
| } | |||||
| #footer ul { | |||||
| margin:0.5em 0; | |||||
| } | |||||
| .footer-column { | |||||
| padding-bottom: 1.5em; | |||||
| float:left; | |||||
| width:100%; | |||||
| } | |||||
| .column { | |||||
| float: left; | |||||
| width: 33%; | |||||
| } | |||||
| .social { | |||||
| float:right; | |||||
| } | |||||
| .social .inner { | |||||
| padding-left:30px; | |||||
| } | |||||
| .tagcloud ul { | |||||
| padding:0; | |||||
| margin:0; | |||||
| } | |||||
| .tagcloud ul li { | |||||
| float:left; | |||||
| list-style:none; | |||||
| margin-right: 10px; | |||||
| } | |||||
| .copyright { | |||||
| font-size: 12px; | |||||
| float:left; | |||||
| width: 100%; | |||||
| border-top: 1px solid #ABB6C5; | |||||
| padding-top:1em; | |||||
| } | |||||
| .copyright p { | |||||
| margin: 0.5em 0; | |||||
| line-height: 1.2; | |||||
| } | |||||
| /*---------------------------- | |||||
| The 404 page | |||||
| -----------------------------*/ | |||||
| .message{ | |||||
| padding:50px 20px 20px 20px; | |||||
| } | |||||
| .message h1{ | |||||
| font-size:36px; | |||||
| margin-bottom: 18px; | |||||
| } | |||||
| .message p{ | |||||
| font-size:13px; | |||||
| } | |||||
| .center{ | |||||
| text-align:center; | |||||
| } | |||||
| .search-404 { | |||||
| position:relative; | |||||
| float:left; | |||||
| width:100%; | |||||
| margin-bottom: 1.2em; | |||||
| } | |||||
| .search-404 #search-form { | |||||
| float:none; | |||||
| } | |||||
| /*---------------------------- | |||||
| Media queries | |||||
| -----------------------------*/ | |||||
| @media all and (max-width: 700px) { | |||||
| #menu, #header, #content, #footer { | |||||
| margin: 0 auto; | |||||
| width: 100%; | |||||
| } | |||||
| #menu-wrapper { | |||||
| text-align:center; | |||||
| } | |||||
| #menu ul li { | |||||
| float:none; | |||||
| display:inline-block; | |||||
| } | |||||
| #search-form { | |||||
| float:none; | |||||
| padding: 10px 0; | |||||
| } | |||||
| .author-info { | |||||
| width: 100%; | |||||
| float:left; | |||||
| } | |||||
| .share { | |||||
| width:100%; | |||||
| margin-right: 0; | |||||
| padding-bottom: 1em; | |||||
| } | |||||
| .column { | |||||
| float:left; | |||||
| width:100%; | |||||
| } | |||||
| .postnav .newer { | |||||
| float:left; | |||||
| margin-bottom:1em; | |||||
| } | |||||
| .postnav .older { | |||||
| float:left; | |||||
| } | |||||
| .social .inner { | |||||
| padding-left:0px; | |||||
| } | |||||
| pre { | |||||
| white-space: pre-wrap; | |||||
| word-wrap:break-word; | |||||
| } | |||||
| } | |||||
| /*---------------------------- | |||||
| Video | |||||
| -----------------------------*/ | |||||
| .video-wrapper { | |||||
| margin:1em 0; | |||||
| } | |||||
| @media all and (min-width: 420px) { | |||||
| .video-wrapper { | |||||
| padding-top:315px!important; | |||||
| position:relative; | |||||
| width:100%; | |||||
| max-width:420px!important; | |||||
| max-height:315px!important; | |||||
| } | |||||
| .video-wrapper iframe, .video-wrapper object, .video-wrapper embed { | |||||
| height: 100%; | |||||
| left: 0; | |||||
| position: absolute; | |||||
| top: 0; | |||||
| max-width:420px!important; | |||||
| width: 100%; | |||||
| max-height:315px!important; | |||||
| } | |||||
| } | |||||
| @media all and (max-width: 420px) { | |||||
| .video-wrapper { | |||||
| position: relative; | |||||
| padding-bottom: 56.25%; | |||||
| padding-top: 30px; | |||||
| height: 0; | |||||
| overflow: hidden; | |||||
| } | |||||
| .video-wrapper iframe, .video-wrapper object, .video-wrapper embed { | |||||
| height: 100%; | |||||
| left: 0; | |||||
| position: absolute; | |||||
| top: 0; | |||||
| width: 100%; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,6 @@ | |||||
| <?php echo '<p>Are you sure want to delete <strong>' . $p->title . '</strong>?</p>';?> | |||||
| <form method="POST"> | |||||
| <input type="hidden" name="file" value="<?php echo $p->file ?>"/><br> | |||||
| <input type="submit" name="submit" value="Delete"/> | |||||
| <span><a href="<?php echo site_url() . 'admin' ?>">Cancel</a></span> | |||||
| </form> | |||||
| @ -0,0 +1,6 @@ | |||||
| <?php echo '<p>Are you sure want to delete <strong>' . $p->title . '</strong>?</p>';?> | |||||
| <form method="POST"> | |||||
| <input type="hidden" name="file" value="<?php echo $p->file ?>"/><br> | |||||
| <input type="submit" name="submit" value="Delete"/> | |||||
| <span><a href="<?php echo site_url() . 'admin/posts' ?>">Cancel</a></span> | |||||
| </form> | |||||
| @ -0,0 +1,43 @@ | |||||
| <?php | |||||
| $url = $p->file; | |||||
| $content = file_get_contents($url); | |||||
| $arr = explode('t-->', $content); | |||||
| if(isset($arr[1])) { | |||||
| $oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' ')); | |||||
| $oldcontent = ltrim($arr[1]); | |||||
| } | |||||
| else { | |||||
| $oldtitle = 'Untitled'; | |||||
| $oldcontent = ltrim($arr[0]); | |||||
| } | |||||
| $dir = substr($url, 0, strrpos($url, '/')); | |||||
| $oldurl = str_replace($dir . '/','',$url); | |||||
| $oldmd = str_replace('.md','',$oldurl); | |||||
| ?> | |||||
| <link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" name="title" class="text" value="<?php echo $oldtitle?>"/><br><br> | |||||
| Url: <br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br> | |||||
| <input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/> | |||||
| <input type="submit" name="submit" class="submit" value="Submit"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| @ -0,0 +1,47 @@ | |||||
| <?php | |||||
| $url = $p->file; | |||||
| $content = file_get_contents($url); | |||||
| $arr = explode('t-->', $content); | |||||
| if(isset($arr[1])) { | |||||
| $oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' ')); | |||||
| $oldcontent = ltrim($arr[1]); | |||||
| } | |||||
| else { | |||||
| $oldtitle = 'Untitled'; | |||||
| $oldcontent = ltrim($arr[0]); | |||||
| } | |||||
| $dir = substr($url, 0, strrpos($url, '/')); | |||||
| $oldurl = explode('_', $url); | |||||
| $oldtag = $oldurl[1]; | |||||
| $oldmd = str_replace('.md','',$oldurl[2]); | |||||
| ?> | |||||
| <link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" name="title" class="text" value="<?php echo $oldtitle?>"/><br><br> | |||||
| Tag: <br><input type="text" name="tag" class="text" value="<?php echo $oldtag?>"/><br><br> | |||||
| Url: <br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br> | |||||
| <input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/> | |||||
| <input type="submit" name="submit" class="submit" value="Submit"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| @ -0,0 +1,50 @@ | |||||
| <?php | |||||
| if(isset($_SESSION['user'])) { | |||||
| $user = $_SESSION['user']; | |||||
| } | |||||
| $filename = 'content/' . $user . '/author.md'; | |||||
| if(file_exists($filename)) { | |||||
| $content = file_get_contents($filename); | |||||
| $arr = explode('t-->', $content); | |||||
| if(isset($arr[1])) { | |||||
| $oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' ')); | |||||
| $oldcontent = ltrim($arr[1]); | |||||
| } | |||||
| else { | |||||
| $oldtitle = $user; | |||||
| $oldcontent = ltrim($arr[0]); | |||||
| } | |||||
| } | |||||
| else { | |||||
| $oldtitle = $user; | |||||
| $oldcontent = 'Just another HTMLy user.'; | |||||
| } | |||||
| ?> | |||||
| <link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css" /> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script> | |||||
| <script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script> | |||||
| <div class="wmd-panel"> | |||||
| <form method="POST"> | |||||
| Title: <br><input type="text" name="title" class="text" value="<?php echo $oldtitle?>"/><br><br> | |||||
| <div id="wmd-button-bar" class="wmd-button-bar"></div> | |||||
| <textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br> | |||||
| <input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/> | |||||
| <input type="submit" name="submit" class="submit" value="Submit"/> | |||||
| </form> | |||||
| </div> | |||||
| <div id="wmd-preview" class="wmd-panel wmd-preview"></div> | |||||
| <script type="text/javascript"> | |||||
| (function () { | |||||
| var converter = new Markdown.Converter(); | |||||
| var editor = new Markdown.Editor(converter); | |||||
| editor.run(); | |||||
| })(); | |||||
| </script> | |||||
| @ -0,0 +1,76 @@ | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <title><?php echo $title; ?></title> | |||||
| <link href='<?php echo site_url() ?>favicon.ico' rel='icon' type='image/x-icon'/> | |||||
| <meta charset="utf-8" /> | |||||
| <meta content='htmly' name='generator'/> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" /> | |||||
| <meta name="description" content="<?php echo $description; ?>" /> | |||||
| <link rel="sitemap" href="<?php echo site_url() ?>sitemap.xml" /> | |||||
| <link rel="canonical" href="<?php echo $canonical; ?>" /> | |||||
| <link rel="alternate" type="application/rss+xml" title="<?php echo config('blog.title')?> Feed" href="<?php echo site_url()?>feed/rss" /> | |||||
| <link href="<?php echo site_url() ?>system/admin/views/css/style.css" rel="stylesheet" /> | |||||
| <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> | |||||
| <?php if (publisher() == true):?><link href="<?php echo publisher() ?>" rel="publisher" /><?php endif;?> | |||||
| <!--[if lt IE 9]> | |||||
| <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |||||
| <![endif]--> | |||||
| </head> | |||||
| <body itemscope="itemscope" itemtype="http://schema.org/Blog"> | |||||
| <div class="hide"> | |||||
| <meta content="<?php echo config('blog.title') ?>" itemprop="name"/> | |||||
| <meta content="<?php echo config('blog.description')?>" itemprop="description"/> | |||||
| </div> | |||||
| <?php if(login()) {?> | |||||
| <style> #outer-wrapper{ padding-top:30px;}</style> | |||||
| <div id="toolbar"> | |||||
| <ul> | |||||
| <li><a href="<?php echo site_url() ?>">Home</a></li> | |||||
| <li><a href="<?php echo site_url() ?>admin">Admin</a></li> | |||||
| <li><a href="<?php echo site_url() ?>admin/posts">Posts</a></li> | |||||
| <li><a href="<?php echo site_url() ?>add/post">Add post</a></li> | |||||
| <li><a href="<?php echo site_url() ?>add/page">Add page</a></li> | |||||
| <li><a href="<?php echo site_url() ?>edit/profile">Edit profile</a></li> | |||||
| <li><a href="<?php echo site_url() ?>logout">Logout</a></li> | |||||
| </ul> | |||||
| </div> | |||||
| <?php } ?> | |||||
| <div id="outer-wrapper"> | |||||
| <div id="menu-wrapper"> | |||||
| <div class="container"> | |||||
| <nav id="menu"> | |||||
| <?php echo menu() ?> | |||||
| <?php echo search() ?> | |||||
| </nav> | |||||
| </div> | |||||
| </div> | |||||
| <div id="header-wrapper"> | |||||
| <div class="container"> | |||||
| <header id="header"> | |||||
| <section id="branding"> | |||||
| <h1 class="blog-title"><a href="<?php echo site_url() ?>"><?php echo config('blog.title') ?></a></h1> | |||||
| <div class="blog-tagline"><p><?php echo config('blog.tagline')?></p></div> | |||||
| </section> | |||||
| </header> | |||||
| </div> | |||||
| </div> | |||||
| <div id="content-wrapper"> | |||||
| <div class="container"> | |||||
| <section id="content"> | |||||
| <?php echo content()?> | |||||
| </section> | |||||
| </div> | |||||
| </div> | |||||
| <div id="footer-wrapper"> | |||||
| <div class="container"> | |||||
| <footer id="footer"> | |||||
| <div class="copyright"><?php echo copyright() ?></div> | |||||
| </footer> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <?php if (analytics() == true):?><?php echo analytics() ?><?php endif;?> | |||||
| </body> | |||||
| </html> | |||||
| @ -0,0 +1,11 @@ | |||||
| <?php if(!login()) {?> | |||||
| <?php login_message(null);?> | |||||
| <h1>Login</h1> | |||||
| <form method="POST" action="login"> | |||||
| User:<br> | |||||
| <input type="text" name="user"/><br><br> | |||||
| Pass:<br> | |||||
| <input type="password" name="password"/><br><br> | |||||
| <input type="submit" name="submit" value="Login"/> | |||||
| </form> | |||||
| <?php } else {header('location: admin');} ?> | |||||
| @ -0,0 +1,7 @@ | |||||
| <?php | |||||
| session_destroy(); | |||||
| header('location: login'); | |||||
| ?> | |||||
| @ -0,0 +1,5 @@ | |||||
| <?php | |||||
| echo '<h2>Your recent posts</h2>'; | |||||
| get_recent_posts(); | |||||
| echo '<h2>Static pages</h2>'; | |||||
| get_recent_pages(); ?> | |||||
| @ -0,0 +1,37 @@ | |||||
| <h2 class="post-index">Your posts</h2> | |||||
| <?php if(!empty($posts)) {?> | |||||
| <table class="post-list"> | |||||
| <tr><th>Title</th><th>Published</th><th>Tag</th><th>Operations</th></tr> | |||||
| <?php $i = 0; $len = count($posts);?> | |||||
| <?php foreach($posts as $p):?> | |||||
| <?php | |||||
| if ($i == 0) { | |||||
| $class = 'first'; | |||||
| } | |||||
| elseif ($i == $len - 1) { | |||||
| $class = 'last'; | |||||
| } | |||||
| else { | |||||
| $class = ''; | |||||
| } | |||||
| $i++; | |||||
| ?> | |||||
| <tr> | |||||
| <td><?php echo $p->title ?></td> | |||||
| <td><?php echo date('d F Y', $p->date) ?></td> | |||||
| <td><?php echo $p->tag ?></td> | |||||
| <td><a href="<?php echo $p->url ?>/edit">Edit</a> <a href="<?php echo $p->url ?>/delete">Delete</a></td> | |||||
| </tr> | |||||
| <?php endforeach;?> | |||||
| </table> | |||||
| <?php if (!empty($pagination['prev']) || !empty($pagination['next'])):?> | |||||
| <div class="pager"> | |||||
| <?php if (!empty($pagination['prev'])):?> | |||||
| <span><a href="?page=<?php echo $page-1?>" class="pagination-arrow newer" rel="prev">Newer</a></span> | |||||
| <?php endif;?> | |||||
| <?php if (!empty($pagination['next'])):?> | |||||
| <span><a href="?page=<?php echo $page+1?>" class="pagination-arrow older" rel="next">Older</a></span> | |||||
| <?php endif;?> | |||||
| </div> | |||||
| <?php endif;?> | |||||
| <?php } else { echo 'No posts found!'; }?> | |||||