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