]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wiki_pageinfo.php3
First cut at a schema for a mSQL-based PhpWiki.
[SourceForge/phpwiki.git] / wiki_pageinfo.php3
1 <!-- $Id: wiki_pageinfo.php3,v 1.2 2000-06-21 22:57:17 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, "<br>\n");
38             }
39             if (($key == 'lastmodified') || ($key == 'created'))
40                $val = date($datetimeformat, $val);
41             $table .= "<tr><td>$key</td><td>$val</td></tr>\n";
42          }
43
44          $table .= "</table>";
45       }
46       return $table;
47    }
48
49    $html .= "<P><B>Current version</B></p>";
50    // $dbi = OpenDataBase($WikiDataBase);   --- done by index.php3
51    $html .= ViewPageProps($info);
52
53    $html .= "<P><B>Archived version</B></p>";
54    $dbi = OpenDataBase($ArchiveDataBase);
55    $html .= ViewPageProps($info);
56
57    GeneratePage('MESSAGE', $html, "PageInfo: '$info'", 0);
58 ?>