blob: 23690e869c326dc00a707f781b566c3f7f2eecd3 (
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
|
<?php
/**
* PHPPgAdmin v6.0.0-RC8
*/
namespace PHPPgAdmin\Controller;
/**
* Base controller class.
*
* @package PHPPgAdmin
*/
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("Location: ${url}");
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 ($pages as $page => $dummy) {
echo "<dt>{$page}</dt>".PHP_EOL;
$urls = $data->getHelp($page);
if (!is_array($urls)) {
$urls = [$urls];
}
foreach ($urls as $url) {
echo "<dd><a href=\"{$url}\">{$url}</a></dd>".PHP_EOL;
}
}
echo '</dl>'.PHP_EOL;
$this->printFooter();
}
public function doChoosePage($urls)
{
$this->printHeader();
$this->printBody();
$this->printTitle($this->lang['strselecthelppage']);
echo '<ul>'.PHP_EOL;
foreach ($urls as $url) {
echo "<li><a href=\"{$url}\">{$url}</a></li>".PHP_EOL;
}
echo '</ul>'.PHP_EOL;
$this->printFooter();
}
}
|