blob: b9114f4d988b04ba39bc0230bacd0ac1b9f3d945 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
<?php
/**
* PHPPgAdmin6
*/
namespace PHPPgAdmin\Controller;
/**
* Base controller class.
*/
class HelpController extends BaseController
{
public $controller_title = 'strhelppagebrowser';
/**
* Default method to render the controller according to the action parameter.
*/
public function render()
{
switch ($this->action) {
case 'browse':
$this->doBrowse();
break;
default:
$this->doDefault();
break;
}
}
public function doDefault()
{
$data = $this->misc->getDatabaseAccessor();
if (isset($_REQUEST['help'])) {
$url = $data->getHelp($_REQUEST['help']);
if (\is_array($url)) {
$this->doChoosePage($url);
return '';
}
if ($url) {
\header(\sprintf(
'Location: %s',
$url
));
return '';
}
}
return $this->doBrowse($this->lang['strinvalidhelppage']);
}
public function doBrowse($msg = '')
{
$data = $this->misc->getDatabaseAccessor();
$this->printHeader();
$this->printBody();
$this->printTitle($this->lang['strselecthelppage']);
echo $this->printMsg($msg);
echo '<dl>' . \PHP_EOL;
$pages = $data->getHelpPages();
foreach (\array_keys($pages) as $page) {
echo \sprintf(
'<dt>%s</dt>',
$page
) . \PHP_EOL;
$urls = $data->getHelp($page);
if (!\is_array($urls)) {
$urls = [$urls];
}
foreach ($urls as $url) {
echo \sprintf(
'<dd><a href="%s">%s</a></dd>',
$url,
$url
) . \PHP_EOL;
}
}
echo '</dl>' . \PHP_EOL;
return $this->printFooter();
}
public function doChoosePage(array $urls)
{
$this->printHeader();
$this->printBody();
$this->printTitle($this->lang['strselecthelppage']);
echo '<ul>' . \PHP_EOL;
foreach ($urls as $url) {
echo \sprintf(
'<li><a href="%s">%s</a></li>',
$url,
$url
) . \PHP_EOL;
}
echo '</ul>' . \PHP_EOL;
return $this->printFooter();
}
}
|