This blob has been accessed 292 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($_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);
- }
- /*
- start of diff mod (20071219)
- Simple Diff Algorithm v 0.1
- (C) Paul Butler 2007 <http://www.paulbutler.org/>
- */
- function diff($old, $new){
- foreach($old as $oindex => $ovalue){
- $nkeys = array_keys($new, $ovalue);
- foreach($nkeys as $nindex){
- $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ?
- $matrix[$oindex - 1][$nindex - 1] + 1 : 1;
- if($matrix[$oindex][$nindex] > $maxlen){
- $maxlen = $matrix[$oindex][$nindex];
- $omax = $oindex + 1 - $maxlen;
- $nmax = $nindex + 1 - $maxlen;
- }
- }
- }
- if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new));
- return array_merge(
- diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)),
- array_slice($new, $nmax, $maxlen),
- diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen)));
- }
- function htmlDiff($old, $new){
- $diff = diff(explode(' ', $old), explode(' ', $new));
- foreach($diff as $k){
- if(is_array($k))
- $ret .= (!empty($k['d'])?"<del>".implode(' ',$k['d'])."</del> ":'').
- (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":'');
- else $ret .= $k . ' ';
- }
- return $ret;
- }
- // end of diff mod (20071219)
- ?>
- <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;
- }
- </style>
- <?php
- $entry = $_REQUEST['entry'];
- 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");
- $diff = htmlDiff($prev,$body);
- echo "<p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC><tr><td width=525>";
- echo "<div id=panel_title>$title</div>";
- echo "<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>";
- }
- }
- }
- ?>