|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* PHPPgAdmin 6.1.3 |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\Controller; |
|
8
|
|
|
|
|
9
|
|
|
use PHPPgAdmin\Decorators\Decorator; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Base controller class. |
|
13
|
|
|
*/ |
|
14
|
|
|
class DatabaseController extends BaseController |
|
15
|
|
|
{ |
|
16
|
|
|
use \PHPPgAdmin\Traits\AdminTrait; |
|
|
|
|
|
|
17
|
|
|
use \PHPPgAdmin\Traits\ExportTrait; |
|
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
public $table_place = 'database-variables'; |
|
20
|
|
|
|
|
21
|
|
|
public $fields; |
|
22
|
|
|
|
|
23
|
|
|
public $controller_title = 'strdatabase'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Default method to render the controller according to the action parameter. |
|
27
|
|
|
*/ |
|
28
|
|
|
public function render() |
|
29
|
|
|
{ |
|
30
|
|
|
if ('tree' === $this->action) { |
|
31
|
|
|
return $this->doTree(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
if ('refresh_locks' === $this->action) { |
|
35
|
|
|
return $this->currentLocks(true); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if ('refresh_processes' === $this->action) { |
|
39
|
|
|
return $this->currentProcesses(true); |
|
40
|
|
|
} |
|
41
|
|
|
$scripts = ''; |
|
42
|
|
|
// normal flow |
|
43
|
|
|
if ('locks' === $this->action || 'processes' === $this->action) { |
|
44
|
|
|
$scripts .= '<script src="' . \containerInstance()->subFolder . '/assets/js/database.js" type="text/javascript"></script>'; |
|
45
|
|
|
|
|
46
|
|
|
$refreshTime = $this->conf['ajax_refresh'] * 1500; |
|
47
|
|
|
|
|
48
|
|
|
$scripts .= '<script type="text/javascript">' . \PHP_EOL; |
|
49
|
|
|
$scripts .= "var Database = {\n"; |
|
50
|
|
|
$scripts .= "ajax_time_refresh: {$refreshTime},\n"; |
|
51
|
|
|
$scripts .= "str_start: {text:'{$this->lang['strstart']}',icon: '" . $this->view->icon('Execute') . "'},\n"; |
|
52
|
|
|
$scripts .= "str_stop: {text:'{$this->lang['strstop']}',icon: '" . $this->view->icon('Stop') . "'},\n"; |
|
53
|
|
|
$scripts .= "load_icon: '" . $this->view->icon('Loading') . "',\n"; |
|
54
|
|
|
$scripts .= "server:'{$_REQUEST['server']}',\n"; |
|
55
|
|
|
$scripts .= "dbname:'{$_REQUEST['database']}',\n"; |
|
56
|
|
|
$scripts .= "action:'refresh_{$this->action}',\n"; |
|
57
|
|
|
$scripts .= "errmsg: '" . \str_replace("'", "\\'", $this->lang['strconnectionfail']) . "'\n"; |
|
58
|
|
|
$scripts .= "};\n"; |
|
59
|
|
|
$scripts .= '</script>' . \PHP_EOL; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
$header_template = 'header.twig'; |
|
63
|
|
|
$footer_template = 'footer.twig'; |
|
64
|
|
|
// @todo convert all these methods to return text instead of print text |
|
65
|
|
|
\ob_start(); |
|
66
|
|
|
|
|
67
|
|
|
switch ($this->action) { |
|
68
|
|
|
case 'find': |
|
69
|
|
|
if (isset($_REQUEST['term'])) { |
|
70
|
|
|
$this->printFindForm(false); |
|
71
|
|
|
} else { |
|
72
|
|
|
$this->printFindForm(true); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
break; |
|
76
|
|
|
case 'sql': |
|
77
|
|
|
$this->doSQL(); |
|
78
|
|
|
$header_template = 'header_sqledit.twig'; |
|
79
|
|
|
$footer_template = 'footer_sqledit.twig'; |
|
80
|
|
|
|
|
81
|
|
|
break; |
|
82
|
|
|
case 'variables': |
|
83
|
|
|
$this->doVariables(); |
|
84
|
|
|
|
|
85
|
|
|
break; |
|
86
|
|
|
case 'processes': |
|
87
|
|
|
$this->doProcesses(); |
|
88
|
|
|
|
|
89
|
|
|
break; |
|
90
|
|
|
case 'locks': |
|
91
|
|
|
$this->doLocks(); |
|
92
|
|
|
|
|
93
|
|
|
break; |
|
94
|
|
|
case 'export': |
|
95
|
|
|
$this->doExport(); |
|
96
|
|
|
|
|
97
|
|
|
break; |
|
98
|
|
|
case 'signal': |
|
99
|
|
|
$this->doSignal(); |
|
100
|
|
|
|
|
101
|
|
|
break; |
|
102
|
|
|
|
|
103
|
|
|
default: |
|
104
|
|
|
if (false === $this->adminActions($this->action, 'database')) { |
|
105
|
|
|
$header_template = 'header_sqledit.twig'; |
|
106
|
|
|
$footer_template = 'footer_sqledit.twig'; |
|
107
|
|
|
$this->doSQL(); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
break; |
|
111
|
|
|
} |
|
112
|
|
|
$output = \ob_get_clean(); |
|
113
|
|
|
|
|
114
|
|
|
$this->printHeader($this->headerTitle(), $scripts, true, $header_template); |
|
115
|
|
|
$this->printBody(); |
|
116
|
|
|
|
|
117
|
|
|
echo $output; |
|
118
|
|
|
|
|
119
|
|
|
$this->printFooter(true, $footer_template); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
public function doTree($print = true) |
|
123
|
|
|
{ |
|
124
|
|
|
$reqvars = $this->misc->getRequestVars('database'); |
|
125
|
|
|
$tabs = $this->misc->getNavTabs('database'); |
|
126
|
|
|
$items = $this->adjustTabsForTree($tabs); |
|
127
|
|
|
|
|
128
|
|
|
$attrs = [ |
|
129
|
|
|
'text' => Decorator::field('title'), |
|
130
|
|
|
'icon' => Decorator::field('icon'), |
|
131
|
|
|
'action' => Decorator::actionurl( |
|
132
|
|
|
Decorator::field('url'), |
|
133
|
|
|
$reqvars, |
|
134
|
|
|
Decorator::field('urlvars'), |
|
135
|
|
|
[ |
|
136
|
|
|
'database' => $this->misc->getDatabase(), |
|
137
|
|
|
] |
|
138
|
|
|
), |
|
139
|
|
|
'branch' => Decorator::branchurl( |
|
140
|
|
|
Decorator::field('url'), |
|
141
|
|
|
$reqvars, |
|
142
|
|
|
Decorator::field('urlvars'), |
|
143
|
|
|
[ |
|
144
|
|
|
'action' => 'tree', |
|
145
|
|
|
'database' => $this->misc->getDatabase(), |
|
146
|
|
|
] |
|
147
|
|
|
), |
|
148
|
|
|
]; |
|
149
|
|
|
|
|
150
|
|
|
return $this->printTree($items, $attrs, 'database', $print); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* Sends a signal to a process. |
|
155
|
|
|
*/ |
|
156
|
|
|
public function doSignal(): void |
|
157
|
|
|
{ |
|
158
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
|
159
|
|
|
|
|
160
|
|
|
$status = $data->sendSignal($_REQUEST['pid'], $_REQUEST['signal']); |
|
161
|
|
|
|
|
162
|
|
|
if (0 === $status) { |
|
163
|
|
|
$this->doProcesses($this->lang['strsignalsent']); |
|
164
|
|
|
} else { |
|
165
|
|
|
$this->doProcesses($this->lang['strsignalsentbad']); |
|
166
|
|
|
} |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* Searches for a named database object. |
|
171
|
|
|
* |
|
172
|
|
|
* @param mixed $confirm |
|
173
|
|
|
* @param mixed $msg |
|
174
|
|
|
*/ |
|
175
|
|
|
public function printFindForm($confirm = true, $msg = '') |
|
176
|
|
|
{ |
|
177
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
|
178
|
|
|
|
|
179
|
|
|
$this->coalesceArr($_REQUEST, 'term', ''); |
|
180
|
|
|
|
|
181
|
|
|
$this->coalesceArr($_REQUEST, 'filter', ''); |
|
182
|
|
|
|
|
183
|
|
|
$this->printTrail('database'); |
|
184
|
|
|
$this->printTabs('database', 'find'); |
|
185
|
|
|
$this->printMsg($msg); |
|
186
|
|
|
|
|
187
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/database" method="post">' . \PHP_EOL; |
|
188
|
|
|
echo '<p><input name="term" value="', \htmlspecialchars($_REQUEST['term']), |
|
189
|
|
|
"\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />" . \PHP_EOL; |
|
190
|
|
|
// Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities |
|
191
|
|
|
echo '<select name="filter">' . \PHP_EOL; |
|
192
|
|
|
|
|
193
|
|
|
echo $this->_printTypeOption(''); |
|
194
|
|
|
echo $this->_printTypeOption('COLUMN'); |
|
195
|
|
|
echo $this->_printTypeOption('CONSTRAINT'); |
|
196
|
|
|
echo $this->_printTypeOption('DOMAIN'); |
|
197
|
|
|
echo $this->_printTypeOption('FUNCTION'); |
|
198
|
|
|
echo $this->_printTypeOption('INDEX'); |
|
199
|
|
|
echo $this->_printTypeOption('RULE'); |
|
200
|
|
|
echo $this->_printTypeOption('SCHEMA'); |
|
201
|
|
|
echo $this->_printTypeOption('SEQUENCE'); |
|
202
|
|
|
echo $this->_printTypeOption('TABLE'); |
|
203
|
|
|
echo $this->_printTypeOption('TRIGGER'); |
|
204
|
|
|
echo $this->_printTypeOption('VIEW'); |
|
205
|
|
|
|
|
206
|
|
|
if ($this->conf['show_advanced']) { |
|
207
|
|
|
echo $this->_printTypeOption('AGGREGATE'); |
|
208
|
|
|
echo $this->_printTypeOption('TYPE'); |
|
209
|
|
|
echo $this->_printTypeOption('OPERATOR'); |
|
210
|
|
|
echo $this->_printTypeOption('OPCLASS'); |
|
211
|
|
|
echo $this->_printTypeOption('CONVERSION'); |
|
212
|
|
|
echo $this->_printTypeOption('LANGUAGE'); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
echo '</select>' . \PHP_EOL; |
|
216
|
|
|
echo "<input type=\"submit\" value=\"{$this->lang['strfind']}\" />" . \PHP_EOL; |
|
217
|
|
|
echo $this->view->form; |
|
218
|
|
|
echo '<input type="hidden" name="action" value="find" /></p>' . \PHP_EOL; |
|
219
|
|
|
echo '<input type="hidden" name="confirm" value="true" /></p>' . \PHP_EOL; |
|
220
|
|
|
echo '</form>' . \PHP_EOL; |
|
221
|
|
|
|
|
222
|
|
|
// Default focus |
|
223
|
|
|
$this->setFocus('forms[0].term'); |
|
224
|
|
|
|
|
225
|
|
|
// If a search term has been specified, then perform the search |
|
226
|
|
|
// and display the results, grouped by object type |
|
227
|
|
|
if (!$confirm && '' !== $_REQUEST['term']) { |
|
228
|
|
|
return $this->doFind(); |
|
229
|
|
|
} |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
public function doFind(): void |
|
233
|
|
|
{ |
|
234
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
|
235
|
|
|
$rs = $data->findObject($_REQUEST['term'], $_REQUEST['filter']); |
|
236
|
|
|
|
|
237
|
|
|
if (0 < $rs->recordCount()) { |
|
238
|
|
|
$curr = ''; |
|
239
|
|
|
|
|
240
|
|
|
while (!$rs->EOF) { |
|
241
|
|
|
// Output a new header if the current type has changed, but not if it's just changed the rule type |
|
242
|
|
|
if ($rs->fields['type'] !== $curr) { |
|
243
|
|
|
// Short-circuit in the case of changing from table rules to view rules; table cols to view cols; |
|
244
|
|
|
// table constraints to domain constraints |
|
245
|
|
|
if ('RULEVIEW' === $rs->fields['type'] && 'RULETABLE' === $curr) { |
|
246
|
|
|
$curr = $rs->fields['type']; |
|
247
|
|
|
} elseif ('COLUMNVIEW' === $rs->fields['type'] && 'COLUMNTABLE' === $curr) { |
|
248
|
|
|
$curr = $rs->fields['type']; |
|
249
|
|
|
} elseif ('CONSTRAINTTABLE' === $rs->fields['type'] && 'CONSTRAINTDOMAIN' === $curr) { |
|
250
|
|
|
$curr = $rs->fields['type']; |
|
251
|
|
|
} else { |
|
252
|
|
|
if ('' !== $curr) { |
|
253
|
|
|
echo '</ul>' . \PHP_EOL; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
$curr = $rs->fields['type']; |
|
257
|
|
|
echo '<h3>'; |
|
258
|
|
|
echo $this->_translatedType($curr); |
|
259
|
|
|
echo '</h3>'; |
|
260
|
|
|
echo '<ul>' . \PHP_EOL; |
|
261
|
|
|
} |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
|
|
$this->_printHtmlForType($curr, $rs); |
|
265
|
|
|
$rs->moveNext(); |
|
266
|
|
|
} |
|
267
|
|
|
echo '</ul>' . \PHP_EOL; |
|
268
|
|
|
|
|
269
|
|
|
echo '<p>', $rs->recordCount(), ' ', $this->lang['strobjects'], '</p>' . \PHP_EOL; |
|
270
|
|
|
} else { |
|
271
|
|
|
echo "<p>{$this->lang['strnoobjects']}</p>" . \PHP_EOL; |
|
272
|
|
|
} |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* Displays options for database download. |
|
277
|
|
|
* |
|
278
|
|
|
* @param mixed $msg |
|
279
|
|
|
*/ |
|
280
|
|
|
public function doExport($msg = ''): void |
|
281
|
|
|
{ |
|
282
|
|
|
$this->printTrail('database'); |
|
283
|
|
|
$this->printTabs('database', 'export'); |
|
284
|
|
|
$this->printMsg($msg); |
|
285
|
|
|
|
|
286
|
|
|
$subject = 'database'; |
|
287
|
|
|
$object = $_REQUEST['database']; |
|
288
|
|
|
|
|
289
|
|
|
echo $this->formHeader('dbexport'); |
|
290
|
|
|
|
|
291
|
|
|
echo $this->dataOnly(true, true); |
|
292
|
|
|
|
|
293
|
|
|
echo $this->structureOnly(); |
|
294
|
|
|
|
|
295
|
|
|
echo $this->structureAndData(true); |
|
296
|
|
|
|
|
297
|
|
|
// $server_info = $this->misc->getServerInfo(); |
|
298
|
|
|
// echo $this->offerNoRoleExport(isset($server_info['pgVersion']) && floatval(substr($server_info['pgVersion'], 0, 3)) >= 10); |
|
299
|
|
|
|
|
300
|
|
|
echo $this->displayOrDownload(!(\mb_strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && isset($_SERVER['HTTPS']))); |
|
301
|
|
|
|
|
302
|
|
|
echo $this->formFooter($subject, $object); |
|
303
|
|
|
} |
|
304
|
|
|
|
|
305
|
|
|
/** |
|
306
|
|
|
* Show the current status of all database variables. |
|
307
|
|
|
*/ |
|
308
|
|
|
public function doVariables(): void |
|
309
|
|
|
{ |
|
310
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
|
311
|
|
|
|
|
312
|
|
|
// Fetch the variables from the database |
|
313
|
|
|
$variables = $data->getVariables(); |
|
314
|
|
|
$this->printTrail('database'); |
|
315
|
|
|
$this->printTabs('database', 'variables'); |
|
316
|
|
|
|
|
317
|
|
|
$columns = [ |
|
318
|
|
|
'variable' => [ |
|
319
|
|
|
'title' => $this->lang['strname'], |
|
320
|
|
|
'field' => Decorator::field('name'), |
|
321
|
|
|
], |
|
322
|
|
|
'value' => [ |
|
323
|
|
|
'title' => $this->lang['strsetting'], |
|
324
|
|
|
'field' => Decorator::field('setting'), |
|
325
|
|
|
], |
|
326
|
|
|
]; |
|
327
|
|
|
|
|
328
|
|
|
$actions = []; |
|
329
|
|
|
|
|
330
|
|
|
echo $this->printTable($variables, $columns, $actions, $this->table_place, $this->lang['strnodata']); |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
/** |
|
334
|
|
|
* Show all current database connections and any queries they |
|
335
|
|
|
* are running. |
|
336
|
|
|
* |
|
337
|
|
|
* @param mixed $msg |
|
338
|
|
|
*/ |
|
339
|
|
|
public function doProcesses($msg = ''): void |
|
340
|
|
|
{ |
|
341
|
|
|
$this->printTrail('database'); |
|
342
|
|
|
$this->printTabs('database', 'processes'); |
|
343
|
|
|
$this->printMsg($msg); |
|
344
|
|
|
|
|
345
|
|
|
if (0 === \mb_strlen($msg)) { |
|
346
|
|
|
echo '<br /><a id="control" href=""><img src="' . $this->view->icon('Refresh') . "\" alt=\"{$this->lang['strrefresh']}\" title=\"{$this->lang['strrefresh']}\"/> {$this->lang['strrefresh']}</a>"; |
|
|
|
|
|
|
347
|
|
|
} |
|
348
|
|
|
|
|
349
|
|
|
echo '<div id="data_block">'; |
|
350
|
|
|
$this->currentProcesses(); |
|
351
|
|
|
echo '</div>'; |
|
352
|
|
|
} |
|
353
|
|
|
|
|
354
|
|
|
public function currentProcesses(bool $isAjax = false): void |
|
355
|
|
|
{ |
|
356
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
|
357
|
|
|
|
|
358
|
|
|
// Display prepared transactions |
|
359
|
|
|
if ($data->hasPreparedXacts()) { |
|
360
|
|
|
echo "<h3>{$this->lang['strpreparedxacts']}</h3>" . \PHP_EOL; |
|
361
|
|
|
$prep_xacts = $data->getPreparedXacts($_REQUEST['database']); |
|
362
|
|
|
|
|
363
|
|
|
$columns = [ |
|
364
|
|
|
'transaction' => [ |
|
365
|
|
|
'title' => $this->lang['strxactid'], |
|
366
|
|
|
'field' => Decorator::field('transaction'), |
|
367
|
|
|
], |
|
368
|
|
|
'gid' => [ |
|
369
|
|
|
'title' => $this->lang['strgid'], |
|
370
|
|
|
'field' => Decorator::field('gid'), |
|
371
|
|
|
], |
|
372
|
|
|
'prepared' => [ |
|
373
|
|
|
'title' => $this->lang['strstarttime'], |
|
374
|
|
|
'field' => Decorator::field('prepared'), |
|
375
|
|
|
], |
|
376
|
|
|
'owner' => [ |
|
377
|
|
|
'title' => $this->lang['strowner'], |
|
378
|
|
|
'field' => Decorator::field('owner'), |
|
379
|
|
|
], |
|
380
|
|
|
]; |
|
381
|
|
|
|
|
382
|
|
|
$actions = []; |
|
383
|
|
|
|
|
384
|
|
|
echo $this->printTable($prep_xacts, $columns, $actions, 'database-processes-preparedxacts', $this->lang['strnodata']); |
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
// Fetch the processes from the database |
|
388
|
|
|
echo "<h3>{$this->lang['strprocesses']}</h3>" . \PHP_EOL; |
|
389
|
|
|
$processes = $data->getProcesses($_REQUEST['database']); |
|
390
|
|
|
|
|
391
|
|
|
$columns = [ |
|
392
|
|
|
'user' => [ |
|
393
|
|
|
'title' => $this->lang['strusername'], |
|
394
|
|
|
'field' => Decorator::field('usename'), |
|
395
|
|
|
], |
|
396
|
|
|
'process' => [ |
|
397
|
|
|
'title' => $this->lang['strprocess'], |
|
398
|
|
|
'field' => Decorator::field('pid'), |
|
399
|
|
|
], |
|
400
|
|
|
'application_name' => [ |
|
401
|
|
|
'title' => 'application', |
|
402
|
|
|
'field' => Decorator::field('application_name'), |
|
403
|
|
|
], |
|
404
|
|
|
'client_addr' => [ |
|
405
|
|
|
'title' => 'address', |
|
406
|
|
|
'field' => Decorator::field('client_addr'), |
|
407
|
|
|
], |
|
408
|
|
|
'blocked' => [ |
|
409
|
|
|
'title' => $this->lang['strblocked'], |
|
410
|
|
|
'field' => Decorator::field('waiting'), |
|
411
|
|
|
], |
|
412
|
|
|
'query' => [ |
|
413
|
|
|
'title' => $this->lang['strsql'], |
|
414
|
|
|
'field' => Decorator::field('query'), |
|
415
|
|
|
], |
|
416
|
|
|
'start_time' => [ |
|
417
|
|
|
'title' => $this->lang['strstarttime'], |
|
418
|
|
|
'field' => Decorator::field('query_start'), |
|
419
|
|
|
], |
|
420
|
|
|
]; |
|
421
|
|
|
|
|
422
|
|
|
// Build possible actions for our process list |
|
423
|
|
|
$columns['actions'] = ['title' => $this->lang['stractions']]; |
|
424
|
|
|
|
|
425
|
|
|
$actions = []; |
|
426
|
|
|
|
|
427
|
|
|
if ($data->hasUserSignals() || $data->isSuperUser()) { |
|
428
|
|
|
$actions = [ |
|
429
|
|
|
'cancel' => [ |
|
430
|
|
|
'content' => $this->lang['strcancel'], |
|
431
|
|
|
'attr' => [ |
|
432
|
|
|
'href' => [ |
|
433
|
|
|
'url' => 'database', |
|
434
|
|
|
'urlvars' => [ |
|
435
|
|
|
'action' => 'signal', |
|
436
|
|
|
'signal' => 'CANCEL', |
|
437
|
|
|
'pid' => Decorator::field('pid'), |
|
438
|
|
|
], |
|
439
|
|
|
], |
|
440
|
|
|
], |
|
441
|
|
|
], |
|
442
|
|
|
'kill' => [ |
|
443
|
|
|
'content' => $this->lang['strkill'], |
|
444
|
|
|
'attr' => [ |
|
445
|
|
|
'href' => [ |
|
446
|
|
|
'url' => 'database', |
|
447
|
|
|
'urlvars' => [ |
|
448
|
|
|
'action' => 'signal', |
|
449
|
|
|
'signal' => 'KILL', |
|
450
|
|
|
'pid' => Decorator::field('pid'), |
|
451
|
|
|
], |
|
452
|
|
|
], |
|
453
|
|
|
], |
|
454
|
|
|
], |
|
455
|
|
|
]; |
|
456
|
|
|
|
|
457
|
|
|
// Remove actions where not supported |
|
458
|
|
|
if (!$data->hasQueryKill()) { |
|
459
|
|
|
unset($actions['kill']); |
|
460
|
|
|
} |
|
461
|
|
|
|
|
462
|
|
|
if (!$data->hasQueryCancel()) { |
|
463
|
|
|
unset($actions['cancel']); |
|
464
|
|
|
} |
|
465
|
|
|
} |
|
466
|
|
|
|
|
467
|
|
|
if (0 === \count($actions)) { |
|
468
|
|
|
unset($columns['actions']); |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
echo $this->printTable($processes, $columns, $actions, 'database-processes', $this->lang['strnodata']); |
|
472
|
|
|
} |
|
473
|
|
|
|
|
474
|
|
|
public function currentLocks(bool $isAjax = false): void |
|
475
|
|
|
{ |
|
476
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
|
477
|
|
|
|
|
478
|
|
|
// Get the info from the pg_locks view |
|
479
|
|
|
$variables = $data->getLocks(); |
|
480
|
|
|
|
|
481
|
|
|
$columns = [ |
|
482
|
|
|
'namespace' => [ |
|
483
|
|
|
'title' => $this->lang['strschema'], |
|
484
|
|
|
'field' => Decorator::field('nspname'), |
|
485
|
|
|
], |
|
486
|
|
|
'tablename' => [ |
|
487
|
|
|
'title' => $this->lang['strtablename'], |
|
488
|
|
|
'field' => Decorator::field('tablename'), |
|
489
|
|
|
], |
|
490
|
|
|
'vxid' => [ |
|
491
|
|
|
'title' => $this->lang['strvirtualtransaction'], |
|
492
|
|
|
'field' => Decorator::field('virtualtransaction'), |
|
493
|
|
|
], |
|
494
|
|
|
'transactionid' => [ |
|
495
|
|
|
'title' => $this->lang['strtransaction'], |
|
496
|
|
|
'field' => Decorator::field('transaction'), |
|
497
|
|
|
], |
|
498
|
|
|
'processid' => [ |
|
499
|
|
|
'title' => $this->lang['strprocessid'], |
|
500
|
|
|
'field' => Decorator::field('pid'), |
|
501
|
|
|
], |
|
502
|
|
|
'mode' => [ |
|
503
|
|
|
'title' => $this->lang['strmode'], |
|
504
|
|
|
'field' => Decorator::field('mode'), |
|
505
|
|
|
], |
|
506
|
|
|
'granted' => [ |
|
507
|
|
|
'title' => $this->lang['strislockheld'], |
|
508
|
|
|
'field' => Decorator::field('granted'), |
|
509
|
|
|
'type' => 'yesno', |
|
510
|
|
|
], |
|
511
|
|
|
]; |
|
512
|
|
|
|
|
513
|
|
|
if (!$data->hasVirtualTransactionId()) { |
|
514
|
|
|
unset($columns['vxid']); |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
$actions = []; |
|
518
|
|
|
echo $this->printTable($variables, $columns, $actions, 'database-locks', $this->lang['strnodata']); |
|
519
|
|
|
} |
|
520
|
|
|
|
|
521
|
|
|
/** |
|
522
|
|
|
* Show the existing table locks in the current database. |
|
523
|
|
|
*/ |
|
524
|
|
|
public function doLocks(): void |
|
525
|
|
|
{ |
|
526
|
|
|
$this->printTrail('database'); |
|
527
|
|
|
$this->printTabs('database', 'locks'); |
|
528
|
|
|
|
|
529
|
|
|
echo '<br /><a id="control" href=""><img src="' . $this->view->icon('Refresh') . "\" alt=\"{$this->lang['strrefresh']}\" title=\"{$this->lang['strrefresh']}\"/> {$this->lang['strrefresh']}</a>"; |
|
|
|
|
|
|
530
|
|
|
|
|
531
|
|
|
echo '<div id="data_block">'; |
|
532
|
|
|
$this->currentLocks(); |
|
533
|
|
|
echo '</div>'; |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
/** |
|
537
|
|
|
* Allow execution of arbitrary SQL statements on a database. |
|
538
|
|
|
*/ |
|
539
|
|
|
public function doSQL(): void |
|
540
|
|
|
{ |
|
541
|
|
|
if ((!isset($_SESSION['sqlquery'])) || isset($_REQUEST['new'])) { |
|
542
|
|
|
$_SESSION['sqlquery'] = ''; |
|
543
|
|
|
$_REQUEST['paginate'] = 'on'; |
|
544
|
|
|
} |
|
545
|
|
|
|
|
546
|
|
|
$this->printTrail('database'); |
|
547
|
|
|
$this->printTabs('database', 'sql'); |
|
548
|
|
|
echo "<p>{$this->lang['strentersql']}</p>" . \PHP_EOL; |
|
549
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/sql" method="post" enctype="multipart/form-data" id="sqlform">' . \PHP_EOL; |
|
550
|
|
|
echo "<p>{$this->lang['strsql']}<br />" . \PHP_EOL; |
|
551
|
|
|
echo '<textarea style="width:95%;" rows="15" cols="50" name="query" id="query">', |
|
552
|
|
|
\htmlspecialchars($_SESSION['sqlquery']), '</textarea></p>' . \PHP_EOL; |
|
553
|
|
|
|
|
554
|
|
|
// Check that file uploads are enabled |
|
555
|
|
|
if (\ini_get('file_uploads')) { |
|
556
|
|
|
// Don't show upload option if max size of uploads is zero |
|
557
|
|
|
$max_size = $this->misc->inisizeToBytes(\ini_get('upload_max_filesize')); |
|
558
|
|
|
|
|
559
|
|
|
if (\is_float($max_size) && 0 < $max_size) { |
|
560
|
|
|
echo "<p><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$max_size}\" />" . \PHP_EOL; |
|
561
|
|
|
echo "<label for=\"script\">{$this->lang['struploadscript']}</label> <input id=\"script\" name=\"script\" type=\"file\" /></p>" . \PHP_EOL; |
|
562
|
|
|
} |
|
563
|
|
|
} |
|
564
|
|
|
|
|
565
|
|
|
echo '<p><input type="checkbox" id="paginate" name="paginate"', (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''), " /><label for=\"paginate\">{$this->lang['strpaginate']}</label></p>" . \PHP_EOL; |
|
|
|
|
|
|
566
|
|
|
echo "<p><input type=\"submit\" name=\"execute\" accesskey=\"r\" value=\"{$this->lang['strexecute']}\" />" . \PHP_EOL; |
|
567
|
|
|
echo $this->view->form; |
|
568
|
|
|
echo "<input type=\"reset\" accesskey=\"q\" value=\"{$this->lang['strreset']}\" /></p>" . \PHP_EOL; |
|
569
|
|
|
echo '</form>' . \PHP_EOL; |
|
570
|
|
|
|
|
571
|
|
|
// Default focus |
|
572
|
|
|
$this->setFocus('forms[0].query'); |
|
573
|
|
|
} |
|
574
|
|
|
|
|
575
|
|
|
/** |
|
576
|
|
|
* This functions does pretty much nothing. It's meant to implement |
|
577
|
|
|
* an abstract method of AdminTrait. |
|
578
|
|
|
* |
|
579
|
|
|
* @param string $msg The message |
|
580
|
|
|
* |
|
581
|
|
|
* @return string The message |
|
582
|
|
|
*/ |
|
583
|
|
|
public function doDefault($msg = '') |
|
584
|
|
|
{ |
|
585
|
|
|
return $msg; |
|
586
|
|
|
} |
|
587
|
|
|
|
|
588
|
|
|
private function _highlight($string, $term) |
|
589
|
|
|
{ |
|
590
|
|
|
return \str_replace($term, "<b>{$term}</b>", $string); |
|
591
|
|
|
} |
|
592
|
|
|
|
|
593
|
|
|
private function _printTypeOption(string $curr) |
|
594
|
|
|
{ |
|
595
|
|
|
$filter = $_REQUEST['filter']; |
|
596
|
|
|
$optionhtml = \sprintf('%s<option value="%s" %s>', "\t", $curr, ($curr === $filter) ? ' selected="selected"' : ''); |
|
597
|
|
|
$optionhtml .= $this->_translatedType($curr); |
|
598
|
|
|
$optionhtml .= '</option>' . \PHP_EOL; |
|
599
|
|
|
|
|
600
|
|
|
return $optionhtml; |
|
601
|
|
|
} |
|
602
|
|
|
|
|
603
|
|
|
private function _translatedType(string $curr) |
|
604
|
|
|
{ |
|
605
|
|
|
$types = [ |
|
606
|
|
|
'COLUMN' => $this->lang['strcolumns'], |
|
607
|
|
|
'CONSTRAINT' => $this->lang['strconstraints'], |
|
608
|
|
|
'COLUMNTABLE' => $this->lang['strcolumns'], |
|
609
|
|
|
'COLUMNVIEW' => $this->lang['strcolumns'], |
|
610
|
|
|
'CONSTRAINTDOMAIN' => $this->lang['strconstraints'], |
|
611
|
|
|
'CONSTRAINTTABLE' => $this->lang['strconstraints'], |
|
612
|
|
|
'DOMAIN' => $this->lang['strdomains'], |
|
613
|
|
|
'FUNCTION' => $this->lang['strfunctions'], |
|
614
|
|
|
'INDEX' => $this->lang['strindexes'], |
|
615
|
|
|
'RULE' => $this->lang['strrules'], |
|
616
|
|
|
'RULETABLE' => $this->lang['strrules'], |
|
617
|
|
|
'RULEVIEW' => $this->lang['strrules'], |
|
618
|
|
|
'SCHEMA' => $this->lang['strschemas'], |
|
619
|
|
|
'SEQUENCE' => $this->lang['strsequences'], |
|
620
|
|
|
'TABLE' => $this->lang['strtables'], |
|
621
|
|
|
'TRIGGER' => $this->lang['strtriggers'], |
|
622
|
|
|
'VIEW' => $this->lang['strviews'], |
|
623
|
|
|
|
|
624
|
|
|
'AGGREGATE' => $this->lang['straggregates'], |
|
625
|
|
|
'CONVERSION' => $this->lang['strconversions'], |
|
626
|
|
|
'LANGUAGE' => $this->lang['strlanguages'], |
|
627
|
|
|
'OPCLASS' => $this->lang['stropclasses'], |
|
628
|
|
|
'OPERATOR' => $this->lang['stroperators'], |
|
629
|
|
|
'TYPE' => $this->lang['strtypes'], |
|
630
|
|
|
]; |
|
631
|
|
|
|
|
632
|
|
|
if (\array_key_exists($curr, $types)) { |
|
633
|
|
|
return $types[$curr]; |
|
634
|
|
|
} |
|
635
|
|
|
|
|
636
|
|
|
return $this->lang['strallobjects']; |
|
637
|
|
|
} |
|
638
|
|
|
|
|
639
|
|
|
private function _printHtmlForType($curr, $rs): void |
|
640
|
|
|
{ |
|
641
|
|
|
$destination = null; |
|
642
|
|
|
|
|
643
|
|
|
switch ($curr) { |
|
644
|
|
|
case 'SCHEMA': |
|
645
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
646
|
|
|
echo '<li><a href="' . \containerInstance()->subFolder . "{$destination}"; |
|
647
|
|
|
echo $this->misc->printVal($rs->fields['name']), '">'; |
|
648
|
|
|
echo $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']); |
|
649
|
|
|
echo '</a></li>' . \PHP_EOL; |
|
650
|
|
|
|
|
651
|
|
|
break; |
|
652
|
|
|
case 'TABLE': |
|
653
|
|
|
echo '<li>'; |
|
654
|
|
|
echo "<a href=\"tables?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
655
|
|
|
$destination = $this->container->getDestinationWithLastTab('table'); |
|
656
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&table=', |
|
657
|
|
|
\urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
658
|
|
|
|
|
659
|
|
|
break; |
|
660
|
|
|
case 'VIEW': |
|
661
|
|
|
echo '<li>'; |
|
662
|
|
|
echo "<a href=\"views?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
663
|
|
|
$destination = $this->container->getDestinationWithLastTab('view'); |
|
664
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&view=', |
|
665
|
|
|
\urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
666
|
|
|
|
|
667
|
|
|
break; |
|
668
|
|
|
case 'SEQUENCE': |
|
669
|
|
|
echo '<li>'; |
|
670
|
|
|
echo "<a href=\"sequences?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
671
|
|
|
echo "<a href=\"sequences?subject=sequence&action=properties&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), |
|
672
|
|
|
'&sequence=', \urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
673
|
|
|
|
|
674
|
|
|
break; |
|
675
|
|
|
case 'COLUMNTABLE': |
|
676
|
|
|
echo '<li>'; |
|
677
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
678
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
679
|
|
|
echo "<a href=\"tblproperties?subject=table&{$this->misc->href}&table=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
680
|
|
|
echo "<a href=\"colproperties?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&table=', |
|
681
|
|
|
\urlencode($rs->fields['relname']), '&column=', \urlencode($rs->fields['name']), '">', |
|
682
|
|
|
$this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
683
|
|
|
|
|
684
|
|
|
break; |
|
685
|
|
|
case 'COLUMNVIEW': |
|
686
|
|
|
echo '<li>'; |
|
687
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
688
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
689
|
|
|
echo "<a href=\"viewproperties?subject=view&{$this->misc->href}&view=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
690
|
|
|
echo "<a href=\"colproperties?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&view=', |
|
691
|
|
|
\urlencode($rs->fields['relname']), '&column=', \urlencode($rs->fields['name']), '">', |
|
692
|
|
|
$this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
693
|
|
|
|
|
694
|
|
|
break; |
|
695
|
|
|
case 'INDEX': |
|
696
|
|
|
echo '<li>'; |
|
697
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
698
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
699
|
|
|
$destination = $this->container->getDestinationWithLastTab('table'); |
|
700
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&table=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
701
|
|
|
echo "<a href=\"indexes?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&table=', \urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
|
|
|
|
|
702
|
|
|
|
|
703
|
|
|
break; |
|
704
|
|
|
case 'CONSTRAINTTABLE': |
|
705
|
|
|
echo '<li>'; |
|
706
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
707
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
708
|
|
|
$destination = $this->container->getDestinationWithLastTab('table'); |
|
709
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&table=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
710
|
|
|
echo "<a href=\"constraints?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&table=', |
|
711
|
|
|
\urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
712
|
|
|
|
|
713
|
|
|
break; |
|
714
|
|
|
case 'CONSTRAINTDOMAIN': |
|
715
|
|
|
echo '<li>'; |
|
716
|
|
|
echo "<a href=\"domains?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
717
|
|
|
echo "<a href=\"domains?action=properties&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&domain=', \urlencode($rs->fields['relname']), '">', |
|
718
|
|
|
$this->misc->printVal($rs->fields['relname']), '.', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
719
|
|
|
|
|
720
|
|
|
break; |
|
721
|
|
|
case 'TRIGGER': |
|
722
|
|
|
echo '<li>'; |
|
723
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
724
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
725
|
|
|
$destination = $this->container->getDestinationWithLastTab('table'); |
|
726
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&table=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
727
|
|
|
echo "<a href=\"triggers?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&table=', \urlencode($rs->fields['relname']), '">', |
|
728
|
|
|
$this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
729
|
|
|
|
|
730
|
|
|
break; |
|
731
|
|
|
case 'RULETABLE': |
|
732
|
|
|
echo '<li>'; |
|
733
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
734
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
735
|
|
|
$destination = $this->container->getDestinationWithLastTab('table'); |
|
736
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&table=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
737
|
|
|
echo "<a href=\"rules?subject=table&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&reltype=table&table=', |
|
738
|
|
|
\urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
739
|
|
|
|
|
740
|
|
|
break; |
|
741
|
|
|
case 'RULEVIEW': |
|
742
|
|
|
echo '<li>'; |
|
743
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
744
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
745
|
|
|
$destination = $this->container->getDestinationWithLastTab('view'); |
|
746
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&view=", \urlencode($rs->fields['relname']), '&schema=', \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; |
|
|
|
|
|
|
747
|
|
|
echo "<a href=\"rules?subject=view&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&reltype=view&view=', |
|
748
|
|
|
\urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
749
|
|
|
|
|
750
|
|
|
break; |
|
751
|
|
|
case 'FUNCTION': |
|
752
|
|
|
echo '<li>'; |
|
753
|
|
|
echo "<a href=\"functions?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
754
|
|
|
echo "<a href=\"functions?action=properties&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&function=', |
|
755
|
|
|
\urlencode($rs->fields['name']), '&function_oid=', \urlencode($rs->fields['oid']), '">', |
|
756
|
|
|
$this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
757
|
|
|
|
|
758
|
|
|
break; |
|
759
|
|
|
case 'TYPE': |
|
760
|
|
|
echo '<li>'; |
|
761
|
|
|
echo "<a href=\"types?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
762
|
|
|
echo "<a href=\"types?action=properties&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&type=', |
|
763
|
|
|
\urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
764
|
|
|
|
|
765
|
|
|
break; |
|
766
|
|
|
case 'DOMAIN': |
|
767
|
|
|
echo '<li>'; |
|
768
|
|
|
echo "<a href=\"domains?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
769
|
|
|
echo "<a href=\"domains?action=properties&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&domain=', |
|
770
|
|
|
\urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
771
|
|
|
|
|
772
|
|
|
break; |
|
773
|
|
|
case 'OPERATOR': |
|
774
|
|
|
echo '<li>'; |
|
775
|
|
|
echo "<a href=\"operators?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
776
|
|
|
echo "<a href=\"operators?action=properties&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '&operator=', |
|
777
|
|
|
\urlencode($rs->fields['name']), '&operator_oid=', \urlencode($rs->fields['oid']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
|
|
|
|
|
778
|
|
|
|
|
779
|
|
|
break; |
|
780
|
|
|
case 'CONVERSION': |
|
781
|
|
|
echo '<li>'; |
|
782
|
|
|
echo "<a href=\"conversions?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
783
|
|
|
echo "<a href=\"conversions?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), |
|
784
|
|
|
'">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
785
|
|
|
|
|
786
|
|
|
break; |
|
787
|
|
|
case 'LANGUAGE': |
|
788
|
|
|
echo "<li><a href=\"languages?{$this->misc->href}\">", $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
789
|
|
|
|
|
790
|
|
|
break; |
|
791
|
|
|
case 'AGGREGATE': |
|
792
|
|
|
echo '<li>'; |
|
793
|
|
|
echo "<a href=\"aggregates?subject=schema&{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
794
|
|
|
echo "<a href=\"aggregates?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', |
|
795
|
|
|
$this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
796
|
|
|
|
|
797
|
|
|
break; |
|
798
|
|
|
case 'OPCLASS': |
|
799
|
|
|
echo '<li>'; |
|
800
|
|
|
$destination = $this->container->getDestinationWithLastTab('schema'); |
|
801
|
|
|
echo '<a href="' . \containerInstance()->subFolder . "{$destination}?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; |
|
|
|
|
|
|
802
|
|
|
echo "<a href=\"opclasses?{$this->misc->href}&schema=", \urlencode($rs->fields['schemaname']), '">', |
|
803
|
|
|
$this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), '</a></li>' . \PHP_EOL; |
|
804
|
|
|
|
|
805
|
|
|
break; |
|
806
|
|
|
} |
|
807
|
|
|
//$this->dump(['curr' => $curr, 'destination' => $destination]); |
|
808
|
|
|
} |
|
809
|
|
|
} |
|
810
|
|
|
|