This blob has been accessed 253 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);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
- }
- $login_username = file_get_contents("data/username.txt");
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- }
- if (!isset($_REQUEST['entry']) or empty($_REQUEST['entry'])) {
- }
- else {
- $entry = trim($_REQUEST['entry']);
- }
- 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['target']) and !empty($_POST['target'])) {
- $target = trim($_POST['target']);
- if (isset($_POST['comment']) and !empty($_POST['comment']) and isset($_POST['type']) and !empty($_POST['type'])) {
- $comment = trim($_POST['comment']);
- $type = trim($_POST['type']);
- if (file_exists("data/items/$entry/comments/$type/$comment") and file_exists("data/items/$target")) {
- if (!file_exists("data/items/$target/comments")) {
- mkdir("data/items/$target/comments");
- }
- if (!file_exists("data/items/$target/comments/$type")) {
- mkdir("data/items/$target/comments/$type");
- }
- if ($type == "pending") {
- if (file_exists("data/comments/pending/$entry/count.txt")) {
- $count = file_get_contents("data/comments/pending/$entry/count.txt");
- if ($count <= 1) {
- rmdirr("data/comments/pending/$entry");
- }
- else {
- $count = $count - 1;
- }
- }
- if (file_exists("data/comments/pending/$target/count.txt")) {
- $count = file_get_contents("data/comments/pending/$target/count.txt");
- $count = $count + 1;
- }
- else {
- $count = 1;
- }
- if (!file_exists("data/comments/pending/$target")) {
- mkdir("data/comments/pending/$target");
- }
- }
- }
- }
- else {
- if (!file_exists("data/items/$target/comments/live/$entry")) {
- if (!file_exists("data/items/$target/comments")) {
- mkdir("data/items/$target/comments");
- }
- if (!file_exists("data/items/$target/comments/live")) {
- mkdir("data/items/$target/comments/live");
- }
- rename("data/items/$target/comments/live/$entry/body.txt","data/items/$target/comments/live/$entry/comment.txt");
- rename("data/items/$target/comments/live/$entry/date.txt","data/items/$target/comments/live/$entry/timestamp.txt");
- if (file_exists("data/items/$target/comments/live/$entry/author.txt")) {
- $author = file_get_contents("data/items/$target/comments/live/$entry/author.txt");
- if ($author != file_get_contents("data/username.txt") and file_exists("data/members/active/$author")) {
- copy("data/members/active/$author/firstname.txt","data/items/$target/comments/live/$entry/firstname.txt");
- copy("data/members/active/$author/lastname.txt","data/items/$target/comments/live/$entry/lastname.txt");
- copy("data/members/active/$author/email.txt","data/items/$target/comments/live/$entry/email.txt");
- if (file_exists("data/members/active/$author/url.txt")) {
- copy("data/members/active/$author/url.txt","data/items/$target/comments/live/$entry/url.txt");
- }
- }
- else {
- $author_name = explode(" ", file_get_contents("data/author.txt"));
- $author_fname = ucfirst(trim(str_replace(",","",$author_name[0])));
- $author_lname = ucfirst(trim(str_replace(",","",$author_name[1])));
- copy("data/email.txt","data/items/$target/comments/live/$entry/email.txt");
- }
- }
- }
- }
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $target . '&show=comments');
- }
- ?>
- <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, td {
- 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: 400px;
- 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>
- <table border="0" cellspacing="1" cellpadding="1">
- <form action="move.php" method="post">
- <tr><td>current entry</td><td width="5"></td><td><b>
- <?php echo file_get_contents("data/items/{$_REQUEST['entry']}/title.txt"); ?>
- <input type="hidden" name="entry" value="<?php echo trim($_REQUEST['entry']); ?>">
- <?php
- if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['type']) and !empty($_REQUEST['type'])) {
- echo "<input type=\"hidden\" name=\"comment\" value=\"{$_REQUEST['comment']}\">";
- echo "<input type=\"hidden\" name=\"type\" value=\"{$_REQUEST['type']}\">";
- }
- ?>
- </b></td></tr>
- <tr><td>target entry</td><td width="5"></td><td>
- <select class="input" name="target">
- <?php
- if ($dh_items = opendir("data/items")) {
- while (($entry_item = readdir($dh_items)) !== false) {
- if ($entry_item != "." && $entry_item != ".." && ($_REQUEST['entry'] != $entry_item)) {
- $target_items[] = $entry_item;
- }
- }
- closedir($dh_items);
- }
- rsort($target_items);
- reset($target_items);
- foreach ($target_items as $target_entry) {
- echo "<option value=\"$target_entry\">";
- readfile("data/items/$target_entry/title.txt");
- echo "</option>";
- }
- ?>
- </select>
- </td></tr>
- <tr><td></td><td width="5"></td><td><input type="submit" class="input" value="click here to move <?php
- if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment'])) {
- echo "comment";
- }
- else {
- echo "entry";
- }
- ?>"></td></tr>
- </form>
- <form action="index.php" method="get">
- <tr><td></td><td width="5"></td><td>
- <input type="hidden" name="entry" value="<?php echo trim($_REQUEST['entry']); ?>">
- <input type="hidden" name="show" value="comments">
- <input type="submit" class="input" value="click here to go back to the current entry">
- </td></tr>
- </form>
- <form action="index.php" method="post">
- <tr><td></td><td width="5"></td><td><input type="submit" class="input" value="click here to go to the index page"></td></tr>
- </form>
- </table>