]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wiki_pageinfo.php3
fixed magic_quotes_gpc=1 bug
[SourceForge/phpwiki.git] / wiki_pageinfo.php3
1 <!-- $Id: wiki_pageinfo.php3,v 1.4 2000-07-15 21:00:38 ahollosi Exp $ -->
2 <!-- Display the internal structure of a page. Steve Wainstead, June 2000 -->
3 <?
4    if (get_magic_quotes_gpc()) {
5       $info = stripslashes($info);
6    }
7
8    $encname = htmlspecialchars($info);
9    $html = "<form action=\"$ScriptUrl\" METHOD=GET>\n" .
10            "<input name=\"info\" value=\"$encname\">" .
11            " Enter a page name\n" .
12            "<input type=submit value=Go><br>\n" .
13            "<input type=checkbox name=showpagesource";
14
15    if ($showpagesource == "on") {
16       $html .= " checked";
17    }
18    $html .= "> Show the page source and references\n</form>\n";
19
20    // don't bother unless we were asked
21    if (! $info) {
22       GeneratePage('MESSAGE', $html, "PageInfo", 0);
23       exit;
24    }
25
26    function ViewpageProps($name)
27    {
28       global $dbi, $showpagesource, $datetimeformat;
29
30       $pagehash = RetrievePage($dbi, $name);
31       if ($pagehash == -1) {
32          $table = "Page name '$name' is not in the database<br>\n";
33       }
34       else {
35          $table = "<table border=1 bgcolor=white>\n";
36
37          while (list($key, $val) = each($pagehash)) {
38             if ($key > 0 || !$key) #key is an array index
39                continue;
40             if ((gettype($val) == "array") && ($showpagesource == "on")) {
41                $val = implode($val, "$FieldSeparator#BR#$FieldSeparator\n");
42                $val = htmlspecialchars($val);
43                $val = str_replace("$FieldSeparator#BR#$FieldSeparator", "<br>", $val);
44             }
45             elseif (($key == 'lastmodified') || ($key == 'created'))
46                $val = date($datetimeformat, $val);
47             else
48                $val = htmlspecialchars($val);
49
50             $table .= "<tr><td>$key</td><td>$val</td></tr>\n";
51          }
52
53          $table .= "</table>";
54       }
55       return $table;
56    }
57
58    $html .= "<P><B>Current version</B></p>";
59    // $dbi = OpenDataBase($WikiDataBase);   --- done by index.php3
60    $html .= ViewPageProps($info);
61
62    $html .= "<P><B>Archived version</B></p>";
63    $dbi = OpenDataBase($ArchiveDataBase);
64    $html .= ViewPageProps($info);
65
66    GeneratePage('MESSAGE', $html, "PageInfo: '$info'", 0);
67 ?>