]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/pageinfo.php
Jeff hacks again: LOT's of changes.
[SourceForge/phpwiki.git] / lib / pageinfo.php
1 <!-- $Id: pageinfo.php,v 1.6 2001-02-10 22:15:08 dairiki Exp $ -->
2 <!-- Display the internal structure of a page. Steve Wainstead, June 2000 -->
3 <?php
4
5
6
7 function ViewpageProps($name, $pagestore)
8 {
9    global $dbi, $showpagesource, $datetimeformat, $FieldSeparator;
10
11    $pagehash = RetrievePage($dbi, $name, $pagestore);
12    if ($pagehash == -1) {
13       return QElement('p',
14                       sprintf (gettext ("Page name '%s' is not in the database"),
15                                $name));
16    }
17
18    $rows = '';
19    while (list($key, $val) = each($pagehash)) {
20       if ($key > 0 || !$key)
21          continue; //key is an array index
22       $cols = QElement('td', array('align' => 'right'), $key);
23
24       if (is_array($val))
25       {
26          if (empty($showpagesource))
27             continue;
28          $cols .= Element('td',
29                           nl2br(htmlspecialchars(join("\n", $val))));
30       }
31       elseif (($key == 'lastmodified') || ($key == 'created'))
32          $cols .= QElement('td',
33                            date($datetimeformat, $val));
34       else
35          $cols .= QElement('td', $val);
36       
37       $rows .= Element('tr', $cols);
38    }
39
40    return Element('table', array('border' => 1, 'bgcolor' => 'white'), $rows);
41 }
42
43
44 $html = '';
45
46 if (empty($showpagesource))
47 {
48    $text = gettext ("Show the page source");
49    $url = WikiURL($pagename, array('action' => 'info',
50                                    'showpagesource' => 'on'));
51    $html .= QElement('a', array('href' => $url), $text);
52 }
53
54 $html .= Element('p', QElement('b', gettext ("Current version")));
55 $html .= ViewPageProps($pagename, $WikiPageStore);
56
57 $html .= Element('p', QElement('b', gettext ("Archived version")));
58 $html .= ViewPageProps($pagename, $ArchivePageStore);
59
60 GeneratePage('MESSAGE', $html, gettext("PageInfo").": '$pagename'", 0);
61 ?>