This blob has been accessed 268 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- $login_username = file_get_contents("data/username.txt");
- 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($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['target']) and !empty($_REQUEST['target'])) {
- if ($_REQUEST['target'] == "album") {
- $album_dir = 'images/' . $_REQUEST['entry'] . '/album';
- $album_data_dir = 'data/items/' . $_REQUEST['entry'] . '/album';
- $album_sem = 'data/albums/' . $_REQUEST['entry'];
- rmdirr($album_dir);
- rmdirr($album_data_dir);
- rmdirr($album_sem);
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
- }
- if ($_REQUEST['target'] == "filedrop") {
- $filedrop_data_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop';
- rmdirr($filedrop_data_dir);
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
- }
- if ($_REQUEST['target'] == "pdf") {
- $pdf_data_dir = 'data/items/' . $_REQUEST['entry'] . '/pdf/file';
- rmdirr($pdf_data_dir);
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
- }
- }
- if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['type']) and !empty($_REQUEST['type'])) {
- $comment_dir = 'data/items/' . $_REQUEST['entry'] .'/comments/' . $_REQUEST['type'] . '/' . $_REQUEST['comment'];
- rmdirr($comment_dir);
- $pending_comment_flag_dir = 'data/comments/pending/' . $_REQUEST['entry'];
- if (file_exists($pending_comment_flag_dir) and ($_REQUEST['type'] == "pending")) {
- $comment_count_value = fread($fp_comment_count_txt,filesize("$pending_comment_flag_dir/count.txt"));
- if ($comment_count_value <= 1) {
- rmdirr($pending_comment_flag_dir);
- }
- else {
- $comment_count_value = fread($fp_comment_count_txt,filesize("$pending_comment_flag_dir/count.txt"));
- $comment_count_value = $comment_count_value - 1;
- }
- }
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry'] . '&show=comments');
- }
- if ($_REQUEST['action'] == delete) {
- $entry_dir = 'data/items/' . $_REQUEST['entry'];
- $image_dir = 'images/' . $_REQUEST['entry'];
- $album_sem_dir = 'data/albums/' . $_REQUEST['entry'];
- $sticky_sem = 'data/sticky/' . $_REQUEST['entry'];
- $pending_comment_flag_dir = 'data/comments/pending/' . $_REQUEST['entry'];
- if (file_exists($entry_dir)) {
- rmdirr($entry_dir);
- }
- if (file_exists($image_dir)) {
- rmdirr($image_dir);
- }
- if (file_exists($album_sem_dir)) {
- rmdirr($album_sem_dir);
- }
- if (file_exists($sticky_sem)) {
- unlink($sticky_sem);
- }
- if (file_exists($pending_comment_flag_dir)) {
- rmdirr($pending_comment_flag_dir);
- }
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
- }
- if ($_REQUEST['action'] == edit) {
- $edit_url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/edit.php?entry=" . $_REQUEST['entry'];
- $edit_url = str_replace("//edit.php", "/edit.php", $edit_url);
- header("Location: $edit_url");
- }
- if ($_REQUEST['action'] == home) {
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
- }
- }
- if (!isset($_REQUEST['entry'])) {
- }
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- }
- $entry_dir = 'data/items/' . $_REQUEST['entry'];
- $title_file = 'data/items/' . $_REQUEST['entry'] . '/title.txt';
- $body_file = 'data/items/' . $_REQUEST['entry'] . '/body.txt';
- $date_file = 'data/items/' . $_REQUEST['entry'] . '/date.txt';
- $img_file = 'data/items/' . $_REQUEST['entry'] . '/img.txt';
- ?>
- <style>
- body
- {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: verdana, 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_title {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 525px;
- font-family: verdana,helvetica,sans-serif;
- font-size: 11px;
- font-weight: bold
- }
- .input_body {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 525px;
- font-family: verdana,helvetica,sans-serif;
- font-size: 11px
- }
- .input_submit {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 125px;
- font-family: verdana,helvetica,sans-serif;
- font-size: 11px
- }
- #panel_title
- {
- font-family: verdana, helvetica, sans-serif;
- font-size: 12px;
- font-weight: bold;
- color: #666666;
- padding: 5px 5px 5px 5px;
- background-color: #FFFFFF;
- margin: 0px;
- border-color: #CCCCCC;
- border-width: 1px 1px 0px 1px;
- border-style: solid solid none solid;
- }
- #panel_body
- {
- font-family: verdana, helvetica, sans-serif;
- font-size: 11px;
- color: #666666;
- padding: 5px 5px 5px 5px;
- background-color: #FFFFFF;
- margin: 0px;
- border-color: #CCCCCC;
- border-width: 1px 1px 1px 1px;
- border-style: solid solid solid solid;
- }
- #panel_footer
- {
- font-family: verdana, helvetica, sans-serif;
- font-size: 11px;
- color: #666666;
- padding: 5px 5px 5px 5px;
- background-color: #FFFFFF;
- margin: 0px;
- border-color: #CCCCCC;
- border-width: 0px 1px 1px 1px;
- border-style: none solid solid solid;
- }
- </style>
- <p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC><tr><td width=525>
- <div id=panel_footer><font style="font-size: 10px; color: #999999;"><?php readfile($date_file); ?></font></div>
- </td></tr></table></p>
- <p><table border=0 cellspacing=2 cellpadding=0>
- <tr><td>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
- <input type=hidden name=action value=delete>
- <input class=input_submit type=submit value=delete>
- </form>
- </td><td>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
- <input type=hidden name=action value=edit>
- <input class=input_submit type=submit value=edit>
- </form>
- </td><td>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
- <input type=hidden name=action value=home>
- <input class=input_submit type=submit value=home>
- </form>
- </td></tr>
- </table>