This blob has been accessed 339 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- require("core.php");
- if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT']))
- {
- header("Location: login.php");
- }
- $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 (file_exists("data/members/active/{$_SESSION['logged_in']}/bb-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 (file_exists("data/items/{$_REQUEST['entry']}/lock.txt")) {
- $do = 0;
- }
- if ($_SESSION['logged_in'] == $login_username)
- {
- $do = 1;
- }
- if ($do == 0)
- {
- }
- ?>
- <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: 10px;
- color: #999999;
- 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 (isset($_REQUEST['restore']) and !empty($_REQUEST['restore']) and file_exists("data/items/$entry/wiki/delta/{$_REQUEST['restore']}"))
- {
- if (file_exists("data/offset.txt"))
- {
- $offset = file_get_contents("data/offset.txt");
- }
- else
- {
- $offset = 0;
- }
- if (!file_exists("data/items/$entry/wiki/delta/$ddate"))
- {
- mkdir("data/items/$entry/wiki/delta/$ddate");
- copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/ptitle.txt");
- copy("data/items/$entry/body.txt","data/items/$entry/wiki/delta/$ddate/prev.txt");
- copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/title.txt","data/items/$entry/title.txt");
- copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/prev.txt","data/items/$entry/body.txt");
- copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/title.txt");
- copy("data/items/$entry/body.txt","data/items/$entry/wiki/delta/$ddate/body.txt");
- if (file_exists("data/items/$entry/contrib.txt"))
- {
- copy("data/items/$entry/contrib.txt","data/items/$entry/wiki/delta/$ddate/contrib.txt");
- }
- }
- }
- 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");
- $ptitle = file_get_contents("data/items/$entry/wiki/delta/$item/ptitle.txt");
- $body = file_get_contents("data/items/$entry/wiki/delta/$item/body.txt");
- $author = file_get_contents("data/items/$entry/author.txt");
- $editor = file_get_contents("data/items/$entry/wiki/delta/$item/editor.txt");
- $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);
- $ptitle_array = explode(" ", $ptitle);
- $title_array = explode(" ", $title);
- if (count($ptitle_array) <= count($title_array))
- {
- $telements = count($title_array);
- }
- else
- {
- $telements = count($ptitle_array);
- }
- $tcount = "0";
- $telements = $telements - 1;
- $tdiff = "";
- while ($tcount <= $telements)
- {
- if ($ptitle_array[$tcount] == $title_array[$tcount])
- {
- $tdiff .= $ptitle_array[$tcount] . " ";
- }
- else
- {
- $tdiff .= "<del>" . $ptitle_array[$tcount] . "</del> <ins>" . $title_array[$tcount] . " </ins> ";
- }
- $tcount = $tcount + 1;
- }
- //$tdiff = str_replace("<br>", "<br>", $tdiff);
- $tdiff = trim($tdiff);
- echo "<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCCC\"><tr><td width=\"525\">";
- echo "<div id=\"panel_title\">$tdiff";
- 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 "<a href=\"wiki.php?entry=$entry&restore=$item\"><img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"restore\"></a>";
- echo "<a href=\"index.php?entry=$entry\"><img src=\"images/widget.orig.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"home\"></a>";
- echo "</div><div id=\"panel_body\"><font style=\"font-size: 10px; color: #999999;\">$author - ";
- entry2date($entry);
- echo "<br><br></font>$diff</div>";
- echo "<div id=\"panel_footer\">Edited by $editor last ";
- entry2date($item);
- echo "</div></td></tr></table></p>";
- unset($diff);
- unset($body);
- unset($prev);
- }
- }
- else
- {
- header("Location: index.php?entry=$entry");
- }
- }
- ?>