1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Help page redirection/browsing.
|
5
|
*
|
6
|
* $Id: help.php,v 1.2 2005/10/18 03:45:16 chriskl Exp $
|
7
|
*/
|
8
|
|
9
|
# TODO: Localize messages, improve (or remove) help browser
|
10
|
|
11
|
|
12
|
// Include application functions
|
13
|
include_once('./libraries/lib.inc.php');
|
14
|
|
15
|
$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
|
16
|
|
17
|
function doDefault() {
|
18
|
global $data;
|
19
|
|
20
|
if (isset($_REQUEST['help'])) {
|
21
|
$url = $data->getHelp($_REQUEST['help']);
|
22
|
|
23
|
if (is_array($url)) {
|
24
|
doChoosePage($url);
|
25
|
return;
|
26
|
}
|
27
|
|
28
|
if ($url) {
|
29
|
header("Location: $url");
|
30
|
exit;
|
31
|
}
|
32
|
}
|
33
|
|
34
|
doBrowse('Invalid help page');
|
35
|
}
|
36
|
|
37
|
function doBrowse($msg = '') {
|
38
|
global $misc, $data;
|
39
|
|
40
|
$misc->printHeader('Help page browser');
|
41
|
$misc->printBody();
|
42
|
|
43
|
$misc->printTitle('PostgreSQL and phpPgAdmin Help');
|
44
|
|
45
|
echo $misc->printVal($msg);
|
46
|
|
47
|
echo "<dl>\n";
|
48
|
|
49
|
$pages = $data->getHelpPages();
|
50
|
foreach ($pages as $page => $dummy) {
|
51
|
echo "<dt>{$page}</dt>\n";
|
52
|
|
53
|
$urls = $data->getHelp($page);
|
54
|
if (!is_array($urls)) $urls = array($urls);
|
55
|
foreach ($urls as $url) {
|
56
|
echo "<dd><a href=\"{$url}\">{$url}</a></dd>\n";
|
57
|
}
|
58
|
}
|
59
|
|
60
|
echo "</dl>\n";
|
61
|
|
62
|
$misc->printFooter();
|
63
|
}
|
64
|
|
65
|
function doChoosePage($urls) {
|
66
|
global $misc;
|
67
|
|
68
|
$misc->printHeader('Help page browser');
|
69
|
$misc->printBody();
|
70
|
|
71
|
$misc->printTitle('Please select a help page');
|
72
|
|
73
|
echo "<ul>\n";
|
74
|
foreach($urls as $url) {
|
75
|
echo "<li><a href=\"{$url}\">{$url}</a></li>\n";
|
76
|
}
|
77
|
echo "</ul>\n";
|
78
|
|
79
|
$misc->printFooter();
|
80
|
}
|
81
|
|
82
|
switch ($action) {
|
83
|
case 'browse':
|
84
|
doBrowse();
|
85
|
break;
|
86
|
default:
|
87
|
doDefault();
|
88
|
break;
|
89
|
}
|
90
|
?>
|