This blob has been accessed 310 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);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
- }
- $login_username = file_get_contents("data/username.txt");
- if (!isset($_REQUEST['entry'])) {
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}")) {
- }
- if (!isset($_SESSION['logged_in'])) {
- }
- $do = 0;
- if ($_SESSION['logged_in'] == $login_username) {
- $do = 1;
- }
- if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/wiki.txt") and (file_exists("data/items/{$_REQUEST['entry']}/edit.txt") or (file_get_contents("data/items/{$_REQUEST['entry']}/author.txt") == $_SESSION['logged_in']))) {
- $do = 1;
- }
- if ($do == 0) {
- }
- 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);
- }
- ?>
- <title>Wiki</title>
- <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_title {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 525px;
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$font_panel_title},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px;
- font-weight: bold
- }
- .input_body {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 525px;
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$font_panel_body},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px
- }
- #panel_title {
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$font_panel_title},";
- }
- ?> arial, 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: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$font_panel_body},";
- }
- ?> arial, 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: <?php
- if (file_exists("data/fonts/panel-footer.txt")) {
- $font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
- echo "{$font_panel_footer},";
- }
- ?> arial, 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;
- }
- ins {
- background-color: #ccffcc;
- }
- del {
- background-color: #ffbbbb;
- }
- </style>
- <?php
- $entry = $_REQUEST['entry'];
- if (isset($_REQUEST['del']) and !empty($_REQUEST['del']) and file_exists("data/items/$entry/wiki/delta/{$_REQUEST['del']}") and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
- rmdirr("data/items/$entry/wiki/delta/{$_REQUEST['del']}");
- }
- if (file_exists("data/items/$entry/wiki/delta")) {
- if ($dh_delta = opendir("data/items/$entry/wiki/delta")) {
- while (($entry_delta = readdir($dh_delta)) !== false) {
- if ($entry_delta != "." && $entry_delta != "..") {
- $show_delta[] = $entry_delta;
- }
- }
- closedir($dh_delta);
- }
- rsort($show_delta);
- reset($show_delta);
- $count_delta = count($show_delta);
- if ($count_delta > 0) {
- foreach ($show_delta as $item) {
- $title = file_get_contents("data/items/$entry/wiki/delta/$item/title.txt");
- $body = file_get_contents("data/items/$entry/wiki/delta/$item/body.txt");
- $date = file_get_contents("data/items/$entry/wiki/delta/$item/date.txt");
- $author = file_get_contents("data/items/$entry/author.txt");
- $editor = file_get_contents("data/items/$entry/wiki/delta/$item/editor.txt");
- $itemYear = substr($item,0,4);
- $itemMonth = substr($item,4,2);
- $itemDay = substr($item,6,2);
- $itemHour = substr($item,8,2);
- $itemMinute = substr($item,10,2);
- $itemSecond = substr($item,12,2);
- $mod = date("l, M j, g:i A", mktime($itemHour,$itemMinute,$itemSecond,$itemMonth,$itemDay,$itemYear));
- $prev = file_get_contents("data/items/$entry/wiki/delta/$item/prev.txt");
- $prev = str_replace("<br />","<br>",$prev);
- $prev = str_replace("\n"," ",$prev);
- $prev = str_replace("\r"," ",$prev);
- $prev = preg_replace("/<img[^>]+src[\s='\"]+([^\"'>\s]+)[^>]*>/is","[\\1]",$prev);
- $prev = htmlentities($prev,ENT_QUOTES);
- $body = str_replace("<br />","<br>",$body);
- $body = str_replace("\n"," ",$body);
- $body = str_replace("\r"," ",$body);
- $body = preg_replace("/<img[^>]+src[\s='\"]+([^\"'>\s]+)[^>]*>/is","[\\1]",$body);
- $body = htmlentities($body,ENT_QUOTES);
- $prev_array = explode(" ",$prev);
- $body_array = explode(" ",$body);
- if (count($prev_array) <= count($body_array)) {
- $elements = count($body_array);
- }
- else {
- $elements = count($prev_array);
- }
- $count = "0";
- $elements = $elements - 1;
- $diff = "";
- while ($count <= $elements) {
- if ($prev_array[$count] == $body_array[$count]) {
- $diff .= $prev_array[$count] . " ";
- }
- else {
- $diff .= "<del>" . $prev_array[$count] . "</del> <ins>" . $body_array[$count] . " </ins> ";
- }
- $count = $count + 1;
- }
- $diff = str_replace("<br>","<br>",$diff);
- $diff = trim($diff);
- echo "<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCCC\"><tr><td width=\"525\">";
- echo "<div id=\"panel_title\">$title";
- if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
- echo "<a href=\"wiki.php?entry=$entry&del=$item\"><img src=\"images/widget.del.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"delete\"></a>";
- }
- echo "<img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"restore\">";
- echo "</div><div id=\"panel_body\"><font style=\"font-size: 10px; color: #999999;\">$author - $date<br><br></font>$diff</div>";
- echo "<div id=\"panel_footer\">Edited by $editor last $mod</div>";
- echo "</td></tr></table></p>";
- unset($diff);
- unset($body);
- unset($prev);
- }
- }
- }
- ?>