This blob has been accessed 351 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
- header("Location: login.php");
- }
- 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']) and isset($_POST['new_title']) and !empty($_POST['new_title']) and isset($_POST['new_content']) and !empty($_POST['new_content']) and !file_exists("data/panels/{$_POST['new_id']}")) {
- if (!file_exists("data/panels")) {
- mkdir("data/panels");
- }
- $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_POST['new_id']))));
- if (!file_exists("data/panels/$new_id")) {
- mkdir("data/panels/$new_id");
- }
- $new_title = ucfirst(strip_tags(trim($_POST['new_title'])));
- $panel_content = ucfirst(trim($_POST['new_content']));
- }
- if ((!isset($_POST['panel_hide']) or !empty($_POST['panel_hide'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/private.txt");
- }
- }
- if (isset($_POST['panel_hide']) and !empty($_POST['panel_hide']) and ($_POST['panel_hide'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
- touch("data/panels/{$_POST['panel_id']}/private.txt");
- }
- }
- if ((!isset($_POST['panel_free']) or !empty($_POST['panel_free'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/free.txt");
- }
- }
- if (isset($_POST['panel_free']) and !empty($_POST['panel_free']) and ($_POST['panel_free'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- touch("data/panels/{$_POST['panel_id']}/free.txt");
- }
- }
- if ((!isset($_POST['panel_right']) or !empty($_POST['panel_right'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
- }
- }
- if (isset($_POST['panel_right']) and !empty($_POST['panel_right']) and ($_POST['panel_right'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- touch("data/panels/{$_POST['panel_id']}/right.txt");
- }
- }
- if ((!isset($_POST['panel_center']) or !empty($_POST['panel_center'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
- }
- }
- if (isset($_POST['panel_center']) and !empty($_POST['panel_center']) and ($_POST['panel_center'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- touch("data/panels/{$_POST['panel_id']}/center.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
- }
- }
- if ((!isset($_POST['panel_top']) or !empty($_POST['panel_top'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
- }
- }
- if (isset($_POST['panel_top']) and !empty($_POST['panel_top']) and ($_POST['panel_top'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- touch("data/panels/{$_POST['panel_id']}/top.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
- }
- }
- if ((!isset($_POST['panel_entry']) or !empty($_POST['panel_entry'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
- }
- }
- if (isset($_POST['panel_entry']) and !empty($_POST['panel_entry']) and ($_POST['panel_entry'] == "on")) {
- if (!file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- touch("data/panels/{$_POST['panel_id']}/entry.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
- }
- }
- if ((!isset($_POST['panel_header']) or !empty($_POST['panel_header'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
- unlink("data/header.txt");
- }
- }
- if (isset($_POST['panel_header']) and !empty($_POST['panel_header']) and ($_POST['panel_header'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/free.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
- }
- }
- if ((!isset($_POST['panel_footer']) or !empty($_POST['panel_footer'])) and ($_POST['panel_edit'] == "on")) {
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
- unlink("data/footer.txt");
- }
- }
- if (isset($_POST['panel_footer']) and !empty($_POST['panel_footer']) and ($_POST['panel_footer'] == "on")) {
- if (file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/free.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/right.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/center.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/top.txt");
- }
- if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
- unlink("data/panels/{$_POST['panel_id']}/entry.txt");
- }
- }
- if (isset($_POST['panel_title']) and !empty($_POST['panel_title'])) {
- $panel_title = ucfirst(strip_tags(trim($_POST['panel_title'])));
- if ($panel_title != file_get_contents("data/panels/{$_POST['panel_id']}/title.txt")) {
- }
- }
- if (isset($_POST['panel_content']) and !empty($_POST['panel_content'])) {
- $panel_content = ucfirst(trim($_POST['panel_content']));
- if ($panel_content != file_get_contents("data/panels/{$_POST['panel_id']}/panel.php")) {
- }
- }
- if (isset($_POST['move_id']) and !empty($_POST['move_id']) and isset($_POST['old_id']) and !empty($_POST['old_id']) and isset($_POST['panel_edit']) and !empty($_POST['panel_edit']) and ($_POST['panel_edit'] == "on")) {
- $move_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_POST['move_id']))));
- $move_id = str_replace(",","_",$move_id);
- if (!file_exists("data/panels/$move_id")) {
- }
- }
- if (isset($_POST['panel_del']) and !empty($_POST['panel_del']) and ($_POST['panel_del'] == "on")) {
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
- unlink("data/header.txt");
- }
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
- unlink("data/footer.txt");
- }
- rmdirr("data/panels/{$_POST['panel_id']}");
- }
- ?>
- <title>Panels</title>
- <style>
- body {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-size: 11px;
- 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: 350px;
- 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 Panel</b><br>Enter a unique panel ID, the panel title, and panel contents. Use <a href=http://php.net target=_maj>PHP</a> and <a href=http://www.w3.org/MarkUp/ target=_maj>HTML</a> with care!</p>
- <table border="0" cellspacing="1" cellpadding="1">
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <tr><td><input type="text" class="input" name="new_id" autocomplete="off" maxlength="30"></td><td>panel id*</td></tr>
- <tr><td><input type="text" class="input" name="new_title" autocomplete="off" maxlength="90"></td><td>panel title*</td></tr>
- <tr><td><textarea class="input" name="new_content" rows="15"></textarea></td><td valign="top">content*</td></tr>
- <tr><td><input type="submit" class="input" value="click here to add new panel"></td><td></td></tr>
- </form>
- <form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
- <tr><td><input class="input" type="submit" value="click here to go to the index page"></td><td></td></tr>
- </form>
- </table>
- <?php
- if (file_exists("data/panels")) {
- if ($dh_panel = opendir("data/panels")) {
- while (($entry_panel = readdir($dh_panel)) !== false) {
- if ($entry_panel != "." && $entry_panel != ".." && fnmatch("*", $entry_panel)) {
- $show_panel[] = $entry_panel;
- }
- }
- closedir($dh_panel);
- }
- sort($show_panel);
- reset($show_panel);
- $count_panel = count($show_panel);
- if ($count_panel > 0) {
- echo "<br><p><b>Panel Management</b><br>Hiding a panel will make it invisible to visitors. Deleting a panel will remove all its contents.</p>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">";
- foreach ($show_panel as $panel) {
- echo "<form enctype=\"multipart/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
- echo "<tr><td colspan=\"2\"><a name=\"";
- echo strtolower(str_replace("_", " ", $panel));
- echo "\"></a></td></tr>";
- echo "<tr><td><input type=\"text\" class=\"input\" name=\"move_id\" value=\"$panel\" autocomplete=\"off\" maxlength=\"30\"></td>";
- echo "<input type=\"hidden\" name=\"old_id\" value=\"$panel\">";
- echo "<td valign=\"top\" rowspan=\"5\"><input type=\"checkbox\" name=\"panel_hide\"";
- if (file_exists("data/panels/$panel/private.txt")) {
- echo " checked";
- }
- echo "> hide<br><input type=\"checkbox\" name=\"panel_free\"";
- if (file_exists("data/panels/$panel/free.txt")) {
- echo " checked";
- }
- echo "> free<br><input type=\"checkbox\" name=\"panel_header\"";
- if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $panel)) {
- echo " checked";
- }
- echo "> header<br><input type=\"checkbox\" name=\"panel_footer\"";
- if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $panel)) {
- echo " checked";
- }
- echo "> footer<br><input type=\"checkbox\" name=\"panel_right\"";
- if (file_exists("data/panels/$panel/right.txt")) {
- echo " checked";
- }
- echo "> right<br><input type=\"checkbox\" name=\"panel_center\"";
- if (file_exists("data/panels/$panel/center.txt")) {
- echo " checked";
- }
- echo "> center<br><input type=\"checkbox\" name=\"panel_top\"";
- if (file_exists("data/panels/$panel/top.txt")) {
- echo " checked";
- }
- echo "> top<br><input type=\"checkbox\" name=\"panel_entry\"";
- if (file_exists("data/panels/$panel/entry.txt")) {
- echo " checked";
- }
- echo "> entry<br><input type=\"checkbox\" name=\"panel_del\"";
- echo "> delete </td></tr>";
- echo "<tr></td><td><input type=\"text\" class=\"input\" name=\"panel_title\" value=\"";
- readfile("data/panels/$panel/title.txt");
- echo "\" autocomplete=\"off\" maxlength=\"90\"></td></tr>";
- echo "<tr><td><textarea class=\"input\" name=\"panel_content\" rows=\"10\">";
- readfile("data/panels/$panel/panel.php");
- echo "</textarea></td></tr>";
- echo "<tr><td>";
- echo "<input type=\"hidden\" name=\"panel_id\" value=\"$panel\">";
- echo "<input type=\"hidden\" name=\"panel_edit\" value=\"on\">";
- echo "<input type=\"submit\" class=\"input\" value=\"click here to update panel\">";
- echo "</td></tr>";
- echo "<tr><td> </td></tr>";
- echo "</form>";
- }
- echo "</table>";
- }
- }
- ?>