This blob has been accessed 350 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)){
- foreach ($data as $key => $value){
- $data[$key] = stripslashes_array($value);
- }
- return $data;
- }
- else{
- return stripslashes($data);
- }
- }
- $_POST = stripslashes_array($_POST);
- }
- $login_username = file_get_contents("data/username.txt");
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- }
- function rmdirr($recurse_dirname)
- {
- if (!file_exists($recurse_dirname)) {
- return false;
- }
- if (is_file($recurse_dirname)) {
- return unlink($recurse_dirname);
- }
- $recurse_dir = dir($recurse_dirname);
- while (false !== $recurse_entry = $recurse_dir->read()) {
- if ($recurse_entry == '.' || $recurse_entry == '..') {
- continue;
- }
- rmdirr("$recurse_dirname/$recurse_entry");
- }
- $recurse_dir->close();
- return rmdir($recurse_dirname);
- }
- if (isset($_POST['new_id']) and !empty($_POST['new_id'])) {
- if (!file_exists("data/categories")) {
- mkdir("data/categories");
- }
- $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_POST['new_id']))));
- if (!file_exists("data/categories/$new_id")) {
- mkdir("data/categories/$new_id");
- }
- if (isset($_POST['new_title']) and !empty($_POST['new_title'])) {
- $new_title = ucfirst(strip_tags(trim($_POST['new_title'])));
- }
- }
- if (isset($_POST['cat_del']) and !empty($_POST['cat_del']) and ($_POST['cat_del'] == "on")) {
- rmdirr("data/categories/{$_POST['cat_id']}");
- }
- if ((!isset($_POST['cat_hide']) or !empty($_POST['cat_hide'])) and ($_POST['cat_edit'] == "on")) {
- if (file_exists("data/categories/{$_POST['cat_id']}/private.txt")) {
- unlink("data/categories/{$_POST['cat_id']}/private.txt");
- }
- }
- if (isset($_POST['cat_hide']) and !empty($_POST['cat_hide']) and ($_POST['cat_hide'] == "on")) {
- if (!file_exists("data/categories/{$_POST['cat_id']}/private.txt")) {
- touch("data/categories/{$_POST['cat_id']}/private.txt");
- }
- }
- if ((!isset($_POST['cat_book']) or !empty($_POST['cat_book'])) and ($_POST['cat_edit'] == "on")) {
- if (file_exists("data/categories/{$_POST['cat_id']}/book.txt")) {
- unlink("data/categories/{$_POST['cat_id']}/book.txt");
- }
- }
- if (isset($_POST['cat_book']) and !empty($_POST['cat_book']) and ($_POST['cat_book'] == "on")) {
- if (!file_exists("data/categories/{$_POST['cat_id']}/book.txt")) {
- touch("data/categories/{$_POST['cat_id']}/book.txt");
- }
- }
- if (isset($_POST['cat_title']) and !empty($_POST['cat_title'])) {
- $cat_title = ucfirst(strip_tags(trim($_POST['cat_title'])));
- if ($cat_title != file_get_contents("data/categories/{$_POST['cat_id']}/title.txt")) {
- }
- }
- if (empty($_POST['cat_title']) and file_exists("data/categories/{$_POST['cat_id']}/title.txt")) {
- unlink("data/categories/{$_POST['cat_id']}/title.txt");
- }
- ?>
- <style>
- body {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $font_body = file_get_contents("data/fonts/body.txt");
- echo "{$font_body},";
- }
- ?> arial, helvetica, sans-serif;
- background-color: #FFFFFF;
- }
- p {
- font-size: 11px;
- }
- a {
- font-weight: bold;
- text-decoration: none;
- }
- a:link, a:visited {
- color: #666666;
- }
- a:hover {
- color: #336699;
- }
- a:active {
- color: #336699;
- }
- .input {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 300px;
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $font_input = file_get_contents("data/fonts/input.txt");
- echo "{$font_input},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px
- }
- .submit {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 100px;
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $font_input = file_get_contents("data/fonts/input.txt");
- echo "{$font_input},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px
- }
- </style>
- <p><b>Add Category</b></p><p>Enter a unique category ID and optional title or description.</p>
- <table border=0 cellspacing=1 cellpadding=2>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <tr><td><p>category id*</p></td><td><input type=text class=input name=new_id autocomplete=off maxlength=30></td></tr>
- <tr><td><p>title or description</p></td><td><input type=text class=input name=new_title autocomplete=off maxlength=90></td></tr>
- <tr><td><p></p></td><td><input type=submit class=input value="click here to add a new category"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
- <tr><td><p></p></td><td><input class=input type=submit value="click here to go to the index page"></td></tr>
- </form>
- </table>
- <?php
- if (file_exists("data/categories")) {
- if ($dh_cat = opendir("data/categories")) {
- while (($entry_cat = readdir($dh_cat)) !== false) {
- if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
- $show_cat[] = $entry_cat;
- }
- }
- closedir($dh_cat);
- }
- sort($show_cat);
- reset($show_cat);
- $count_cat = count($show_cat);
- if ($count_cat > 0) {
- echo "<p><br><b>Category Management</b></p><p>Hiding a category will make it, and all associated entries, invisible to visitors. Override per entry if needed.<br>Booking a category, for lack of a better term, will unconditionally display all associated entries from oldest to newest.<br>Deleting a category will unfile all its associated entries.</p>";
- echo "<table border=0 cellspacing=1 cellpadding=2>";
- echo "<tr><td><p>category id</p></td><td><p align=center>title or description</p></td><td><p align=center>hide</p></td><td><p align=center>book</p></td><td><p align=center>delete</p></td><td><p></p></td></tr>";
- foreach ($show_cat as $category) {
- echo '<form enctype="multipart/form-data" action="';
- echo $_SERVER['PHP_SELF'];
- echo '" method="post">';
- echo "<tr><td><p><b>";
- echo strtolower(str_replace("_", " ", $category));
- echo '</b></p></td><td><p><input type=text class=input name=cat_title value="';
- readfile("data/categories/$category/title.txt");
- echo '" autocomplete=off maxlength=90></p></td><td><p align=center><input type=checkbox name=cat_hide';
- if (file_exists("data/categories/$category/private.txt")) {
- echo " checked";
- }
- echo "></p></td>";
- echo "<td><p align=center><input type=checkbox name=cat_book";
- if (file_exists("data/categories/$category/book.txt")) {
- echo " checked";
- }
- echo "></p></td>";
- echo "<td><p align=center><input type=checkbox name=cat_del></p></td><td><p><input type=hidden name=cat_id value=$category><input type=hidden name=cat_edit value=on><input type=submit class=submit value=submit></p></td>";
- echo "</tr></form>";
- }
- echo "</table>";
- }
- }
- ?>