1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHPPgAdmin v6.0.0-beta.48 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\Traits; |
8
|
|
|
|
9
|
|
|
use PHPPgAdmin\Decorators\Decorator; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @file |
13
|
|
|
* A trait to deal with nav tabs |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* A trait to deal with nav tabs. |
18
|
|
|
* |
19
|
|
|
* @package PHPPgAdmin |
20
|
|
|
*/ |
21
|
|
|
trait MiscTrait |
22
|
|
|
{ |
23
|
|
|
public function getSubjectParams($subject) |
24
|
|
|
{ |
25
|
|
|
$plugin_manager = $this->plugin_manager; |
26
|
|
|
|
27
|
|
|
$vars = []; |
28
|
|
|
|
29
|
|
|
switch ($subject) { |
30
|
|
|
case 'root': |
31
|
|
|
$vars = [ |
32
|
|
|
'params' => [ |
33
|
|
|
'subject' => 'root', |
34
|
|
|
], |
35
|
|
|
]; |
36
|
|
|
|
37
|
|
|
break; |
38
|
|
|
case 'server': |
39
|
|
|
$vars = ['params' => [ |
40
|
|
|
'server' => $_REQUEST['server'], |
41
|
|
|
'subject' => 'server', |
42
|
|
|
]]; |
43
|
|
|
|
44
|
|
|
break; |
45
|
|
|
case 'role': |
46
|
|
|
$vars = ['params' => [ |
47
|
|
|
'server' => $_REQUEST['server'], |
48
|
|
|
'subject' => 'role', |
49
|
|
|
'action' => 'properties', |
50
|
|
|
'rolename' => $_REQUEST['rolename'], |
51
|
|
|
]]; |
52
|
|
|
|
53
|
|
|
break; |
54
|
|
|
case 'database': |
55
|
|
|
$vars = ['params' => [ |
56
|
|
|
'server' => $_REQUEST['server'], |
57
|
|
|
'subject' => 'database', |
58
|
|
|
'database' => $_REQUEST['database'], |
59
|
|
|
]]; |
60
|
|
|
|
61
|
|
|
break; |
62
|
|
|
case 'schema': |
63
|
|
|
$vars = ['params' => [ |
64
|
|
|
'server' => $_REQUEST['server'], |
65
|
|
|
'subject' => 'schema', |
66
|
|
|
'database' => $_REQUEST['database'], |
67
|
|
|
'schema' => $_REQUEST['schema'], |
68
|
|
|
]]; |
69
|
|
|
|
70
|
|
|
break; |
71
|
|
|
case 'table': |
72
|
|
|
$vars = ['params' => [ |
73
|
|
|
'server' => $_REQUEST['server'], |
74
|
|
|
'subject' => 'table', |
75
|
|
|
'database' => $_REQUEST['database'], |
76
|
|
|
'schema' => $_REQUEST['schema'], |
77
|
|
|
'table' => $_REQUEST['table'], |
78
|
|
|
]]; |
79
|
|
|
|
80
|
|
|
break; |
81
|
|
|
case 'selectrows': |
82
|
|
|
$vars = [ |
83
|
|
|
'url' => 'tables', |
84
|
|
|
'params' => [ |
85
|
|
|
'server' => $_REQUEST['server'], |
86
|
|
|
'subject' => 'table', |
87
|
|
|
'database' => $_REQUEST['database'], |
88
|
|
|
'schema' => $_REQUEST['schema'], |
89
|
|
|
'table' => $_REQUEST['table'], |
90
|
|
|
'action' => 'confselectrows', |
91
|
|
|
], ]; |
92
|
|
|
|
93
|
|
|
break; |
94
|
|
|
case 'view': |
95
|
|
|
$vars = ['params' => [ |
96
|
|
|
'server' => $_REQUEST['server'], |
97
|
|
|
'subject' => 'view', |
98
|
|
|
'database' => $_REQUEST['database'], |
99
|
|
|
'schema' => $_REQUEST['schema'], |
100
|
|
|
'view' => $_REQUEST['view'], |
101
|
|
|
]]; |
102
|
|
|
|
103
|
|
|
break; |
104
|
|
|
case 'matview': |
105
|
|
|
$vars = ['params' => [ |
106
|
|
|
'server' => $_REQUEST['server'], |
107
|
|
|
'subject' => 'matview', |
108
|
|
|
'database' => $_REQUEST['database'], |
109
|
|
|
'schema' => $_REQUEST['schema'], |
110
|
|
|
'matview' => $_REQUEST['matview'], |
111
|
|
|
]]; |
112
|
|
|
|
113
|
|
|
break; |
114
|
|
|
case 'fulltext': |
115
|
|
|
case 'ftscfg': |
116
|
|
|
$vars = ['params' => [ |
117
|
|
|
'server' => $_REQUEST['server'], |
118
|
|
|
'subject' => 'fulltext', |
119
|
|
|
'database' => $_REQUEST['database'], |
120
|
|
|
'schema' => $_REQUEST['schema'], |
121
|
|
|
'action' => 'viewconfig', |
122
|
|
|
'ftscfg' => $_REQUEST['ftscfg'], |
123
|
|
|
]]; |
124
|
|
|
|
125
|
|
|
break; |
126
|
|
|
case 'function': |
127
|
|
|
$vars = ['params' => [ |
128
|
|
|
'server' => $_REQUEST['server'], |
129
|
|
|
'subject' => 'function', |
130
|
|
|
'database' => $_REQUEST['database'], |
131
|
|
|
'schema' => $_REQUEST['schema'], |
132
|
|
|
'function' => $_REQUEST['function'], |
133
|
|
|
'function_oid' => $_REQUEST['function_oid'], |
134
|
|
|
]]; |
135
|
|
|
|
136
|
|
|
break; |
137
|
|
|
case 'aggregate': |
138
|
|
|
$vars = ['params' => [ |
139
|
|
|
'server' => $_REQUEST['server'], |
140
|
|
|
'subject' => 'aggregate', |
141
|
|
|
'action' => 'properties', |
142
|
|
|
'database' => $_REQUEST['database'], |
143
|
|
|
'schema' => $_REQUEST['schema'], |
144
|
|
|
'aggrname' => $_REQUEST['aggrname'], |
145
|
|
|
'aggrtype' => $_REQUEST['aggrtype'], |
146
|
|
|
]]; |
147
|
|
|
|
148
|
|
|
break; |
149
|
|
|
case 'column': |
150
|
|
|
if (isset($_REQUEST['table'])) { |
151
|
|
|
$vars = ['params' => [ |
152
|
|
|
'server' => $_REQUEST['server'], |
153
|
|
|
'subject' => 'column', |
154
|
|
|
'database' => $_REQUEST['database'], |
155
|
|
|
'schema' => $_REQUEST['schema'], |
156
|
|
|
'table' => $_REQUEST['table'], |
157
|
|
|
'column' => $_REQUEST['column'], |
158
|
|
|
]]; |
159
|
|
|
} elseif (isset($_REQUEST['view'])) { |
160
|
|
|
$vars = ['params' => [ |
161
|
|
|
'server' => $_REQUEST['server'], |
162
|
|
|
'subject' => 'column', |
163
|
|
|
'database' => $_REQUEST['database'], |
164
|
|
|
'schema' => $_REQUEST['schema'], |
165
|
|
|
'view' => $_REQUEST['view'], |
166
|
|
|
'column' => $_REQUEST['column'], |
167
|
|
|
]]; |
168
|
|
|
} elseif (isset($_REQUEST['matview'])) { |
169
|
|
|
$vars = ['params' => [ |
170
|
|
|
'server' => $_REQUEST['server'], |
171
|
|
|
'subject' => 'column', |
172
|
|
|
'database' => $_REQUEST['database'], |
173
|
|
|
'schema' => $_REQUEST['schema'], |
174
|
|
|
'matview' => $_REQUEST['matview'], |
175
|
|
|
'column' => $_REQUEST['column'], |
176
|
|
|
]]; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
break; |
180
|
|
|
case 'plugin': |
181
|
|
|
$vars = [ |
182
|
|
|
'url' => 'plugin', |
183
|
|
|
'params' => [ |
184
|
|
|
'server' => $_REQUEST['server'], |
185
|
|
|
'subject' => 'plugin', |
186
|
|
|
'plugin' => $_REQUEST['plugin'], |
187
|
|
|
], ]; |
188
|
|
|
|
189
|
|
|
if (!is_null($plugin_manager->getPlugin($_REQUEST['plugin']))) { |
190
|
|
|
$vars['params'] = array_merge($vars['params'], $plugin_manager->getPlugin($_REQUEST['plugin'])->get_subject_params()); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
break; |
194
|
|
|
default: |
195
|
|
|
return false; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
if (!isset($vars['url'])) { |
199
|
|
|
$vars['url'] = SUBFOLDER.'/redirect'; |
200
|
|
|
} |
201
|
|
|
if ($vars['url'] == SUBFOLDER.'/redirect' && isset($vars['params']['subject'])) { |
202
|
|
|
$vars['url'] = SUBFOLDER.'/redirect/'.$vars['params']['subject']; |
203
|
|
|
unset($vars['params']['subject']); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
return $vars; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
public function maybeClipStr($str, $params) |
210
|
|
|
{ |
211
|
|
|
if (isset($params['map'], $params['map'][$str])) { |
212
|
|
|
$str = $params['map'][$str]; |
213
|
|
|
} |
214
|
|
|
// Clip the value if the 'clip' parameter is true. |
215
|
|
|
if (!isset($params['clip']) || $params['clip'] !== true) { |
216
|
|
|
return $str; |
217
|
|
|
} |
218
|
|
|
$maxlen = isset($params['cliplen']) && is_integer($params['cliplen']) ? $params['cliplen'] : $this->conf['max_chars']; |
219
|
|
|
$ellipsis = isset($params['ellipsis']) ? $params['ellipsis'] : $this->lang['strellipsis']; |
220
|
|
|
if (strlen($str) > $maxlen) { |
221
|
|
|
$str = substr($str, 0, $maxlen - 1).$ellipsis; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
return $str; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
public function printBoolean($type, &$str, $params, $lang) |
228
|
|
|
{ |
229
|
|
|
if ($type === 'yesno') { |
230
|
|
|
$this->coalesceArr($params, 'true', $lang['stryes']); |
|
|
|
|
231
|
|
|
$this->coalesceArr($params, 'false', $lang['strno']); |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
if (is_bool($str)) { |
235
|
|
|
$str = $str ? 't' : 'f'; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
switch ($str) { |
239
|
|
|
case 't': |
240
|
|
|
$out = (isset($params['true']) ? $params['true'] : $lang['strtrue']); |
241
|
|
|
$align = 'center'; |
242
|
|
|
|
243
|
|
|
break; |
244
|
|
|
case 'f': |
245
|
|
|
$out = (isset($params['false']) ? $params['false'] : $lang['strfalse']); |
246
|
|
|
$align = 'center'; |
247
|
|
|
|
248
|
|
|
break; |
249
|
|
|
default: |
250
|
|
|
$align = null; |
251
|
|
|
$out = htmlspecialchars($str); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
return [$str, $align, $out]; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Render a value into HTML using formatting rules specified |
259
|
|
|
* by a type name and parameters. |
260
|
|
|
* |
261
|
|
|
* @param null|string $str The string to change |
262
|
|
|
* @param string $type Field type (optional), this may be an internal PostgreSQL type, or: |
263
|
|
|
* yesno - same as bool, but renders as 'Yes' or 'No'. |
264
|
|
|
* pre - render in a <pre> block. |
265
|
|
|
* nbsp - replace all spaces with 's |
266
|
|
|
* verbatim - render exactly as supplied, no escaping what-so-ever. |
267
|
|
|
* callback - render using a callback function supplied in the 'function' param. |
268
|
|
|
* @param array $params Type parameters (optional), known parameters: |
269
|
|
|
* null - string to display if $str is null, or set to TRUE to use a default 'NULL' string, |
270
|
|
|
* otherwise nothing is rendered. |
271
|
|
|
* clip - if true, clip the value to a fixed length, and append an ellipsis... |
272
|
|
|
* cliplen - the maximum length when clip is enabled (defaults to $conf['max_chars']) |
273
|
|
|
* ellipsis - the string to append to a clipped value (defaults to $lang['strellipsis']) |
274
|
|
|
* tag - an HTML element name to surround the value. |
275
|
|
|
* class - a class attribute to apply to any surrounding HTML element. |
276
|
|
|
* align - an align attribute ('left','right','center' etc.) |
277
|
|
|
* true - (type='bool') the representation of true. |
278
|
|
|
* false - (type='bool') the representation of false. |
279
|
|
|
* function - (type='callback') a function name, accepts args ($str, $params) and returns a rendering. |
280
|
|
|
* lineno - prefix each line with a line number. |
281
|
|
|
* map - an associative array. |
282
|
|
|
* |
283
|
|
|
* @return string The HTML rendered value |
284
|
|
|
*/ |
285
|
|
|
public function printVal($str, $type = null, $params = []) |
286
|
|
|
{ |
287
|
|
|
$lang = $this->lang; |
288
|
|
|
if ($this->_data === null) { |
289
|
|
|
$data = $this->getDatabaseAccessor(); |
290
|
|
|
} else { |
291
|
|
|
$data = $this->_data; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
// Shortcircuit for a NULL value |
295
|
|
|
if (is_null($str)) { |
296
|
|
|
return isset($params['null']) |
297
|
|
|
? ($params['null'] === true ? '<i>NULL</i>' : $params['null']) |
298
|
|
|
: ''; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
$str = $this->maybeClipStr($str, $params); |
302
|
|
|
|
303
|
|
|
$out = ''; |
304
|
|
|
$class = ''; |
305
|
|
|
|
306
|
|
|
switch ($type) { |
307
|
|
|
case 'int2': |
308
|
|
|
case 'int4': |
309
|
|
|
case 'int8': |
310
|
|
|
case 'float4': |
311
|
|
|
case 'float8': |
312
|
|
|
case 'money': |
313
|
|
|
case 'numeric': |
314
|
|
|
case 'oid': |
315
|
|
|
case 'xid': |
316
|
|
|
case 'cid': |
317
|
|
|
case 'tid': |
318
|
|
|
$align = 'right'; |
319
|
|
|
$out = nl2br(htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($str))); |
320
|
|
|
|
321
|
|
|
break; |
322
|
|
|
case 'yesno': |
323
|
|
|
case 'bool': |
324
|
|
|
case 'boolean': |
325
|
|
|
list($str, $align, $out) = $this->printBoolean($type, $str, $params, $lang); |
326
|
|
|
|
327
|
|
|
break; |
328
|
|
|
case 'bytea': |
329
|
|
|
$tag = 'div'; |
330
|
|
|
$class = 'pre'; |
331
|
|
|
$out = $data->escapeBytea($str); |
332
|
|
|
|
333
|
|
|
break; |
334
|
|
|
case 'errormsg': |
335
|
|
|
$tag = 'pre'; |
336
|
|
|
$class = 'error'; |
337
|
|
|
$out = htmlspecialchars($str); |
338
|
|
|
|
339
|
|
|
break; |
340
|
|
|
case 'pre': |
341
|
|
|
$tag = 'pre'; |
342
|
|
|
$out = htmlspecialchars($str); |
343
|
|
|
|
344
|
|
|
break; |
345
|
|
|
case 'prenoescape': |
346
|
|
|
$tag = 'pre'; |
347
|
|
|
$out = $str; |
348
|
|
|
|
349
|
|
|
break; |
350
|
|
|
case 'nbsp': |
351
|
|
|
$out = nl2br(str_replace(' ', ' ', \PHPPgAdmin\Traits\HelperTrait::br2ln($str))); |
352
|
|
|
|
353
|
|
|
break; |
354
|
|
|
case 'verbatim': |
355
|
|
|
$out = $str; |
356
|
|
|
|
357
|
|
|
break; |
358
|
|
|
case 'callback': |
359
|
|
|
$out = $params['function']($str, $params); |
360
|
|
|
|
361
|
|
|
break; |
362
|
|
|
case 'prettysize': |
363
|
|
|
$out = \PHPPgAdmin\Traits\HelperTrait::formatSizeUnits($str, $lang); |
364
|
|
|
|
365
|
|
|
break; |
366
|
|
|
default: |
367
|
|
|
// If the string contains at least one instance of >1 space in a row, a tab |
368
|
|
|
// character, a space at the start of a line, or a space at the start of |
369
|
|
|
// the whole string then render within a pre-formatted element (<pre>). |
370
|
|
|
if (preg_match('/(^ | |\t|\n )/m', $str)) { |
371
|
|
|
$tag = 'pre'; |
372
|
|
|
$class = 'data'; |
373
|
|
|
$out = htmlspecialchars($str); |
374
|
|
|
} else { |
375
|
|
|
//$tag = 'span'; |
376
|
|
|
$out = nl2br(htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($str))); |
377
|
|
|
} |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
$this->adjustClassAlignTag($class, $align, $tag, $out, $params); |
381
|
|
|
|
382
|
|
|
// Add line numbers if 'lineno' param is true |
383
|
|
|
/*if (isset($params['lineno']) && $params['lineno'] === true) { |
384
|
|
|
$lines = explode("\n", $str); |
385
|
|
|
$num = count($lines); |
386
|
|
|
if ($num > 0) { |
387
|
|
|
$temp = "<table>\n<tr><td class=\"{$class}\" style=\"vertical-align: top; padding-right: 10px;\"><pre class=\"{$class}\">"; |
388
|
|
|
for ($i = 1; $i <= $num; ++$i) { |
389
|
|
|
$temp .= $i . "\n"; |
390
|
|
|
} |
391
|
|
|
$temp .= "</pre></td><td class=\"{$class}\" style=\"vertical-align: top;\">{$out}</td></tr></table>\n"; |
392
|
|
|
$out = $temp; |
393
|
|
|
} |
394
|
|
|
unset($lines); |
395
|
|
|
}*/ |
396
|
|
|
|
397
|
|
|
return $out; |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
public function adjustClassAlignTag(&$class, &$align, &$tag, &$out, $params) |
401
|
|
|
{ |
402
|
|
|
if (isset($params['class'])) { |
403
|
|
|
$class = $params['class']; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
if (isset($params['align'])) { |
407
|
|
|
$align = $params['align']; |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
if (!isset($tag) && (!empty($class) || isset($align))) { |
411
|
|
|
$tag = 'div'; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
if (isset($tag)) { |
415
|
|
|
$alignattr = isset($align) ? " style=\"text-align: {$align}\"" : ''; |
416
|
|
|
$classattr = !empty($class) ? " class=\"{$class}\"" : ''; |
417
|
|
|
$out = "<{$tag}{$alignattr}{$classattr}>{$out}</{$tag}>"; |
418
|
|
|
} |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* Retrieve the tab info for a specific tab bar. |
423
|
|
|
* |
424
|
|
|
* @param string $section the name of the tab bar |
425
|
|
|
* |
426
|
|
|
* @return array array of tabs |
427
|
|
|
*/ |
428
|
|
|
public function getNavTabs($section) |
429
|
|
|
{ |
430
|
|
|
$data = $this->getDatabaseAccessor(); |
431
|
|
|
$lang = $this->lang; |
432
|
|
|
$plugin_manager = $this->plugin_manager; |
433
|
|
|
|
434
|
|
|
$hide_advanced = ($this->conf['show_advanced'] === false); |
435
|
|
|
$tabs = []; |
436
|
|
|
|
437
|
|
|
switch ($section) { |
438
|
|
|
case 'root': |
439
|
|
|
$tabs = [ |
440
|
|
|
'intro' => [ |
441
|
|
|
'title' => $lang['strintroduction'], |
442
|
|
|
'url' => 'intro', |
443
|
|
|
'icon' => 'Introduction', |
444
|
|
|
], |
445
|
|
|
'servers' => [ |
446
|
|
|
'title' => $lang['strservers'], |
447
|
|
|
'url' => 'servers', |
448
|
|
|
'icon' => 'Servers', |
449
|
|
|
], |
450
|
|
|
]; |
451
|
|
|
|
452
|
|
|
break; |
453
|
|
|
case 'server': |
454
|
|
|
$hide_users = true; |
455
|
|
|
$hide_roles = false; |
456
|
|
|
if ($data) { |
457
|
|
|
$hide_users = !$data->isSuperUser(); |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
$tabs = [ |
461
|
|
|
'databases' => [ |
462
|
|
|
'title' => $lang['strdatabases'], |
463
|
|
|
'url' => 'alldb', |
464
|
|
|
'urlvars' => ['subject' => 'server'], |
465
|
|
|
'help' => 'pg.database', |
466
|
|
|
'icon' => 'Databases', |
467
|
|
|
], |
468
|
|
|
]; |
469
|
|
|
if ($data && $data->hasRoles()) { |
470
|
|
|
$tabs = array_merge($tabs, [ |
471
|
|
|
'users' => [ |
472
|
|
|
'title' => $lang['strusers'], |
473
|
|
|
'url' => 'users', |
474
|
|
|
'urlvars' => ['subject' => 'server'], |
475
|
|
|
'hide' => $hide_roles, |
476
|
|
|
'help' => 'pg.user', |
477
|
|
|
'icon' => 'Users', |
478
|
|
|
], |
479
|
|
|
'roles' => [ |
480
|
|
|
'title' => $lang['strroles'], |
481
|
|
|
'url' => 'roles', |
482
|
|
|
'urlvars' => ['subject' => 'server'], |
483
|
|
|
'hide' => $hide_roles, |
484
|
|
|
'help' => 'pg.role', |
485
|
|
|
'icon' => 'Roles', |
486
|
|
|
], |
487
|
|
|
]); |
488
|
|
|
} else { |
489
|
|
|
$tabs = array_merge($tabs, [ |
490
|
|
|
'users' => [ |
491
|
|
|
'title' => $lang['strusers'], |
492
|
|
|
'url' => 'users', |
493
|
|
|
'urlvars' => ['subject' => 'server'], |
494
|
|
|
'hide' => $hide_users, |
495
|
|
|
'help' => 'pg.user', |
496
|
|
|
'icon' => 'Users', |
497
|
|
|
], |
498
|
|
|
'groups' => [ |
499
|
|
|
'title' => $lang['strgroups'], |
500
|
|
|
'url' => 'groups', |
501
|
|
|
'urlvars' => ['subject' => 'server'], |
502
|
|
|
'hide' => $hide_users, |
503
|
|
|
'help' => 'pg.group', |
504
|
|
|
'icon' => 'UserGroups', |
505
|
|
|
], |
506
|
|
|
]); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
$tabs = array_merge($tabs, [ |
510
|
|
|
'account' => [ |
511
|
|
|
'title' => $lang['straccount'], |
512
|
|
|
'url' => ($data && $data->hasRoles()) ? 'roles' : 'users', |
513
|
|
|
'urlvars' => ['subject' => 'server', 'action' => 'account'], |
514
|
|
|
'hide' => !$hide_users, |
515
|
|
|
'help' => 'pg.role', |
516
|
|
|
'icon' => 'User', |
517
|
|
|
], |
518
|
|
|
'tablespaces' => [ |
519
|
|
|
'title' => $lang['strtablespaces'], |
520
|
|
|
'url' => 'tablespaces', |
521
|
|
|
'urlvars' => ['subject' => 'server'], |
522
|
|
|
'hide' => !$data || !$data->hasTablespaces(), |
523
|
|
|
'help' => 'pg.tablespace', |
524
|
|
|
'icon' => 'Tablespaces', |
525
|
|
|
], |
526
|
|
|
'export' => [ |
527
|
|
|
'title' => $lang['strexport'], |
528
|
|
|
'url' => 'alldb', |
529
|
|
|
'urlvars' => ['subject' => 'server', 'action' => 'export'], |
530
|
|
|
'hide' => !$this->isDumpEnabled(), |
531
|
|
|
'icon' => 'Export', |
532
|
|
|
], |
533
|
|
|
]); |
534
|
|
|
|
535
|
|
|
break; |
536
|
|
|
case 'database': |
537
|
|
|
$tabs = [ |
538
|
|
|
'schemas' => [ |
539
|
|
|
'title' => $lang['strschemas'], |
540
|
|
|
'url' => 'schemas', |
541
|
|
|
'urlvars' => ['subject' => 'database'], |
542
|
|
|
'help' => 'pg.schema', |
543
|
|
|
'icon' => 'Schemas', |
544
|
|
|
], |
545
|
|
|
'sql' => [ |
546
|
|
|
'title' => $lang['strsql'], |
547
|
|
|
'url' => 'database', |
548
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'sql', 'new' => 1], |
549
|
|
|
'help' => 'pg.sql', |
550
|
|
|
'tree' => false, |
551
|
|
|
'icon' => 'SqlEditor', |
552
|
|
|
], |
553
|
|
|
'find' => [ |
554
|
|
|
'title' => $lang['strfind'], |
555
|
|
|
'url' => 'database', |
556
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'find'], |
557
|
|
|
'tree' => false, |
558
|
|
|
'icon' => 'Search', |
559
|
|
|
], |
560
|
|
|
'variables' => [ |
561
|
|
|
'title' => $lang['strvariables'], |
562
|
|
|
'url' => 'database', |
563
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'variables'], |
564
|
|
|
'help' => 'pg.variable', |
565
|
|
|
'tree' => false, |
566
|
|
|
'icon' => 'Variables', |
567
|
|
|
], |
568
|
|
|
'processes' => [ |
569
|
|
|
'title' => $lang['strprocesses'], |
570
|
|
|
'url' => 'database', |
571
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'processes'], |
572
|
|
|
'help' => 'pg.process', |
573
|
|
|
'tree' => false, |
574
|
|
|
'icon' => 'Processes', |
575
|
|
|
], |
576
|
|
|
'locks' => [ |
577
|
|
|
'title' => $lang['strlocks'], |
578
|
|
|
'url' => 'database', |
579
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'locks'], |
580
|
|
|
'help' => 'pg.locks', |
581
|
|
|
'tree' => false, |
582
|
|
|
'icon' => 'Key', |
583
|
|
|
], |
584
|
|
|
'admin' => [ |
585
|
|
|
'title' => $lang['stradmin'], |
586
|
|
|
'url' => 'database', |
587
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'admin'], |
588
|
|
|
'tree' => false, |
589
|
|
|
'icon' => 'Admin', |
590
|
|
|
], |
591
|
|
|
'privileges' => [ |
592
|
|
|
'title' => $lang['strprivileges'], |
593
|
|
|
'url' => 'privileges', |
594
|
|
|
'urlvars' => ['subject' => 'database'], |
595
|
|
|
'hide' => !isset($data->privlist['database']), |
596
|
|
|
'help' => 'pg.privilege', |
597
|
|
|
'tree' => false, |
598
|
|
|
'icon' => 'Privileges', |
599
|
|
|
], |
600
|
|
|
'languages' => [ |
601
|
|
|
'title' => $lang['strlanguages'], |
602
|
|
|
'url' => 'languages', |
603
|
|
|
'urlvars' => ['subject' => 'database'], |
604
|
|
|
'hide' => $hide_advanced, |
605
|
|
|
'help' => 'pg.language', |
606
|
|
|
'icon' => 'Languages', |
607
|
|
|
], |
608
|
|
|
'casts' => [ |
609
|
|
|
'title' => $lang['strcasts'], |
610
|
|
|
'url' => 'casts', |
611
|
|
|
'urlvars' => ['subject' => 'database'], |
612
|
|
|
'hide' => $hide_advanced, |
613
|
|
|
'help' => 'pg.cast', |
614
|
|
|
'icon' => 'Casts', |
615
|
|
|
], |
616
|
|
|
'export' => [ |
617
|
|
|
'title' => $lang['strexport'], |
618
|
|
|
'url' => 'database', |
619
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'export'], |
620
|
|
|
'hide' => !$this->isDumpEnabled(), |
621
|
|
|
'tree' => false, |
622
|
|
|
'icon' => 'Export', |
623
|
|
|
], |
624
|
|
|
]; |
625
|
|
|
|
626
|
|
|
break; |
627
|
|
|
case 'schema': |
628
|
|
|
$tabs = [ |
629
|
|
|
'tables' => [ |
630
|
|
|
'title' => $lang['strtables'], |
631
|
|
|
'url' => 'tables', |
632
|
|
|
'urlvars' => ['subject' => 'schema'], |
633
|
|
|
'help' => 'pg.table', |
634
|
|
|
'icon' => 'Tables', |
635
|
|
|
], |
636
|
|
|
'views' => [ |
637
|
|
|
'title' => $lang['strviews'], |
638
|
|
|
'url' => 'views', |
639
|
|
|
'urlvars' => ['subject' => 'schema'], |
640
|
|
|
'help' => 'pg.view', |
641
|
|
|
'icon' => 'Views', |
642
|
|
|
], |
643
|
|
|
'matviews' => [ |
644
|
|
|
'title' => 'M '.$lang['strviews'], |
645
|
|
|
'url' => 'materializedviews', |
646
|
|
|
'urlvars' => ['subject' => 'schema'], |
647
|
|
|
'help' => 'pg.matview', |
648
|
|
|
'icon' => 'MViews', |
649
|
|
|
], |
650
|
|
|
'sequences' => [ |
651
|
|
|
'title' => $lang['strsequences'], |
652
|
|
|
'url' => 'sequences', |
653
|
|
|
'urlvars' => ['subject' => 'schema'], |
654
|
|
|
'help' => 'pg.sequence', |
655
|
|
|
'icon' => 'Sequences', |
656
|
|
|
], |
657
|
|
|
'functions' => [ |
658
|
|
|
'title' => $lang['strfunctions'], |
659
|
|
|
'url' => 'functions', |
660
|
|
|
'urlvars' => ['subject' => 'schema'], |
661
|
|
|
'help' => 'pg.function', |
662
|
|
|
'icon' => 'Functions', |
663
|
|
|
], |
664
|
|
|
'fulltext' => [ |
665
|
|
|
'title' => $lang['strfulltext'], |
666
|
|
|
'url' => 'fulltext', |
667
|
|
|
'urlvars' => ['subject' => 'schema'], |
668
|
|
|
'help' => 'pg.fts', |
669
|
|
|
'tree' => true, |
670
|
|
|
'icon' => 'Fts', |
671
|
|
|
], |
672
|
|
|
'domains' => [ |
673
|
|
|
'title' => $lang['strdomains'], |
674
|
|
|
'url' => 'domains', |
675
|
|
|
'urlvars' => ['subject' => 'schema'], |
676
|
|
|
'help' => 'pg.domain', |
677
|
|
|
'icon' => 'Domains', |
678
|
|
|
], |
679
|
|
|
'aggregates' => [ |
680
|
|
|
'title' => $lang['straggregates'], |
681
|
|
|
'url' => 'aggregates', |
682
|
|
|
'urlvars' => ['subject' => 'schema'], |
683
|
|
|
'hide' => $hide_advanced, |
684
|
|
|
'help' => 'pg.aggregate', |
685
|
|
|
'icon' => 'Aggregates', |
686
|
|
|
], |
687
|
|
|
'types' => [ |
688
|
|
|
'title' => $lang['strtypes'], |
689
|
|
|
'url' => 'types', |
690
|
|
|
'urlvars' => ['subject' => 'schema'], |
691
|
|
|
'hide' => $hide_advanced, |
692
|
|
|
'help' => 'pg.type', |
693
|
|
|
'icon' => 'Types', |
694
|
|
|
], |
695
|
|
|
'operators' => [ |
696
|
|
|
'title' => $lang['stroperators'], |
697
|
|
|
'url' => 'operators', |
698
|
|
|
'urlvars' => ['subject' => 'schema'], |
699
|
|
|
'hide' => $hide_advanced, |
700
|
|
|
'help' => 'pg.operator', |
701
|
|
|
'icon' => 'Operators', |
702
|
|
|
], |
703
|
|
|
'opclasses' => [ |
704
|
|
|
'title' => $lang['stropclasses'], |
705
|
|
|
'url' => 'opclasses', |
706
|
|
|
'urlvars' => ['subject' => 'schema'], |
707
|
|
|
'hide' => $hide_advanced, |
708
|
|
|
'help' => 'pg.opclass', |
709
|
|
|
'icon' => 'OperatorClasses', |
710
|
|
|
], |
711
|
|
|
'conversions' => [ |
712
|
|
|
'title' => $lang['strconversions'], |
713
|
|
|
'url' => 'conversions', |
714
|
|
|
'urlvars' => ['subject' => 'schema'], |
715
|
|
|
'hide' => $hide_advanced, |
716
|
|
|
'help' => 'pg.conversion', |
717
|
|
|
'icon' => 'Conversions', |
718
|
|
|
], |
719
|
|
|
'privileges' => [ |
720
|
|
|
'title' => $lang['strprivileges'], |
721
|
|
|
'url' => 'privileges', |
722
|
|
|
'urlvars' => ['subject' => 'schema'], |
723
|
|
|
'help' => 'pg.privilege', |
724
|
|
|
'tree' => false, |
725
|
|
|
'icon' => 'Privileges', |
726
|
|
|
], |
727
|
|
|
'export' => [ |
728
|
|
|
'title' => $lang['strexport'], |
729
|
|
|
'url' => 'schemas', |
730
|
|
|
'urlvars' => ['subject' => 'schema', 'action' => 'export'], |
731
|
|
|
'hide' => !$this->isDumpEnabled(), |
732
|
|
|
'tree' => false, |
733
|
|
|
'icon' => 'Export', |
734
|
|
|
], |
735
|
|
|
]; |
736
|
|
|
if (!$data->hasFTS()) { |
737
|
|
|
unset($tabs['fulltext']); |
738
|
|
|
} |
739
|
|
|
|
740
|
|
|
break; |
741
|
|
|
case 'table': |
742
|
|
|
$tabs = [ |
743
|
|
|
'columns' => [ |
744
|
|
|
'title' => $lang['strcolumns'], |
745
|
|
|
'url' => 'tblproperties', |
746
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
747
|
|
|
'icon' => 'Columns', |
748
|
|
|
'branch' => true, |
749
|
|
|
], |
750
|
|
|
'browse' => [ |
751
|
|
|
'title' => $lang['strbrowse'], |
752
|
|
|
'icon' => 'Columns', |
753
|
|
|
'url' => 'display', |
754
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
755
|
|
|
'return' => 'table', |
756
|
|
|
'branch' => true, |
757
|
|
|
], |
758
|
|
|
'select' => [ |
759
|
|
|
'title' => $lang['strselect'], |
760
|
|
|
'icon' => 'Search', |
761
|
|
|
'url' => 'tables', |
762
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'confselectrows'], |
763
|
|
|
'help' => 'pg.sql.select', |
764
|
|
|
], |
765
|
|
|
'insert' => [ |
766
|
|
|
'title' => $lang['strinsert'], |
767
|
|
|
'url' => 'tables', |
768
|
|
|
'urlvars' => [ |
769
|
|
|
'action' => 'confinsertrow', |
770
|
|
|
'table' => Decorator::field('table'), |
771
|
|
|
], |
772
|
|
|
'help' => 'pg.sql.insert', |
773
|
|
|
'icon' => 'Operator', |
774
|
|
|
], |
775
|
|
|
'indexes' => [ |
776
|
|
|
'title' => $lang['strindexes'], |
777
|
|
|
'url' => 'indexes', |
778
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
779
|
|
|
'help' => 'pg.index', |
780
|
|
|
'icon' => 'Indexes', |
781
|
|
|
'branch' => true, |
782
|
|
|
], |
783
|
|
|
'constraints' => [ |
784
|
|
|
'title' => $lang['strconstraints'], |
785
|
|
|
'url' => 'constraints', |
786
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
787
|
|
|
'help' => 'pg.constraint', |
788
|
|
|
'icon' => 'Constraints', |
789
|
|
|
'branch' => true, |
790
|
|
|
], |
791
|
|
|
'triggers' => [ |
792
|
|
|
'title' => $lang['strtriggers'], |
793
|
|
|
'url' => 'triggers', |
794
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
795
|
|
|
'help' => 'pg.trigger', |
796
|
|
|
'icon' => 'Triggers', |
797
|
|
|
'branch' => true, |
798
|
|
|
], |
799
|
|
|
'rules' => [ |
800
|
|
|
'title' => $lang['strrules'], |
801
|
|
|
'url' => 'rules', |
802
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
803
|
|
|
'help' => 'pg.rule', |
804
|
|
|
'icon' => 'Rules', |
805
|
|
|
'branch' => true, |
806
|
|
|
], |
807
|
|
|
'admin' => [ |
808
|
|
|
'title' => $lang['stradmin'], |
809
|
|
|
'url' => 'tables', |
810
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'admin'], |
811
|
|
|
'icon' => 'Admin', |
812
|
|
|
], |
813
|
|
|
'info' => [ |
814
|
|
|
'title' => $lang['strinfo'], |
815
|
|
|
'url' => 'info', |
816
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
817
|
|
|
'icon' => 'Statistics', |
818
|
|
|
], |
819
|
|
|
'privileges' => [ |
820
|
|
|
'title' => $lang['strprivileges'], |
821
|
|
|
'url' => 'privileges', |
822
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
823
|
|
|
'help' => 'pg.privilege', |
824
|
|
|
'icon' => 'Privileges', |
825
|
|
|
], |
826
|
|
|
'import' => [ |
827
|
|
|
'title' => $lang['strimport'], |
828
|
|
|
'url' => 'tblproperties', |
829
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'import'], |
830
|
|
|
'icon' => 'Import', |
831
|
|
|
'hide' => false, |
832
|
|
|
], |
833
|
|
|
'export' => [ |
834
|
|
|
'title' => $lang['strexport'], |
835
|
|
|
'url' => 'tblproperties', |
836
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'export'], |
837
|
|
|
'icon' => 'Export', |
838
|
|
|
'hide' => false, |
839
|
|
|
], |
840
|
|
|
]; |
841
|
|
|
|
842
|
|
|
break; |
843
|
|
|
case 'view': |
844
|
|
|
$tabs = [ |
845
|
|
|
'columns' => [ |
846
|
|
|
'title' => $lang['strcolumns'], |
847
|
|
|
'url' => 'viewproperties', |
848
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
849
|
|
|
'icon' => 'Columns', |
850
|
|
|
'branch' => true, |
851
|
|
|
], |
852
|
|
|
'browse' => [ |
853
|
|
|
'title' => $lang['strbrowse'], |
854
|
|
|
'icon' => 'Columns', |
855
|
|
|
'url' => 'display', |
856
|
|
|
'urlvars' => [ |
857
|
|
|
'action' => 'confselectrows', |
858
|
|
|
'return' => 'schema', |
859
|
|
|
'subject' => 'view', |
860
|
|
|
'view' => Decorator::field('view'), |
861
|
|
|
], |
862
|
|
|
'branch' => true, |
863
|
|
|
], |
864
|
|
|
'select' => [ |
865
|
|
|
'title' => $lang['strselect'], |
866
|
|
|
'icon' => 'Search', |
867
|
|
|
'url' => 'views', |
868
|
|
|
'urlvars' => ['action' => 'confselectrows', 'view' => Decorator::field('view')], |
869
|
|
|
'help' => 'pg.sql.select', |
870
|
|
|
], |
871
|
|
|
'definition' => [ |
872
|
|
|
'title' => $lang['strdefinition'], |
873
|
|
|
'url' => 'viewproperties', |
874
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'definition'], |
875
|
|
|
'icon' => 'Definition', |
876
|
|
|
], |
877
|
|
|
'rules' => [ |
878
|
|
|
'title' => $lang['strrules'], |
879
|
|
|
'url' => 'rules', |
880
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
881
|
|
|
'help' => 'pg.rule', |
882
|
|
|
'icon' => 'Rules', |
883
|
|
|
'branch' => true, |
884
|
|
|
], |
885
|
|
|
'privileges' => [ |
886
|
|
|
'title' => $lang['strprivileges'], |
887
|
|
|
'url' => 'privileges', |
888
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
889
|
|
|
'help' => 'pg.privilege', |
890
|
|
|
'icon' => 'Privileges', |
891
|
|
|
], |
892
|
|
|
'export' => [ |
893
|
|
|
'title' => $lang['strexport'], |
894
|
|
|
'url' => 'viewproperties', |
895
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'export'], |
896
|
|
|
'icon' => 'Export', |
897
|
|
|
'hide' => false, |
898
|
|
|
], |
899
|
|
|
]; |
900
|
|
|
|
901
|
|
|
break; |
902
|
|
|
case 'matview': |
903
|
|
|
$tabs = [ |
904
|
|
|
'columns' => [ |
905
|
|
|
'title' => $lang['strcolumns'], |
906
|
|
|
'url' => 'materializedviewproperties', |
907
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
908
|
|
|
'icon' => 'Columns', |
909
|
|
|
'branch' => true, |
910
|
|
|
], |
911
|
|
|
'browse' => [ |
912
|
|
|
'title' => $lang['strbrowse'], |
913
|
|
|
'icon' => 'Columns', |
914
|
|
|
'url' => 'display', |
915
|
|
|
'urlvars' => [ |
916
|
|
|
'action' => 'confselectrows', |
917
|
|
|
'return' => 'schema', |
918
|
|
|
'subject' => 'matview', |
919
|
|
|
'matview' => Decorator::field('matview'), |
920
|
|
|
], |
921
|
|
|
'branch' => true, |
922
|
|
|
], |
923
|
|
|
'select' => [ |
924
|
|
|
'title' => $lang['strselect'], |
925
|
|
|
'icon' => 'Search', |
926
|
|
|
'url' => 'materializedviews', |
927
|
|
|
'urlvars' => ['action' => 'confselectrows', 'matview' => Decorator::field('matview')], |
928
|
|
|
'help' => 'pg.sql.select', |
929
|
|
|
], |
930
|
|
|
'definition' => [ |
931
|
|
|
'title' => $lang['strdefinition'], |
932
|
|
|
'url' => 'materializedviewproperties', |
933
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'definition'], |
934
|
|
|
'icon' => 'Definition', |
935
|
|
|
], |
936
|
|
|
'indexes' => [ |
937
|
|
|
'title' => $lang['strindexes'], |
938
|
|
|
'url' => 'indexes', |
939
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
940
|
|
|
'help' => 'pg.index', |
941
|
|
|
'icon' => 'Indexes', |
942
|
|
|
'branch' => true, |
943
|
|
|
], |
944
|
|
|
/*'constraints' => [ |
945
|
|
|
'title' => $lang['strconstraints'], |
946
|
|
|
'url' => 'constraints', |
947
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
948
|
|
|
'help' => 'pg.constraint', |
949
|
|
|
'icon' => 'Constraints', |
950
|
|
|
'branch' => true, |
951
|
|
|
*/ |
952
|
|
|
|
953
|
|
|
'rules' => [ |
954
|
|
|
'title' => $lang['strrules'], |
955
|
|
|
'url' => 'rules', |
956
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
957
|
|
|
'help' => 'pg.rule', |
958
|
|
|
'icon' => 'Rules', |
959
|
|
|
'branch' => true, |
960
|
|
|
], |
961
|
|
|
'privileges' => [ |
962
|
|
|
'title' => $lang['strprivileges'], |
963
|
|
|
'url' => 'privileges', |
964
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
965
|
|
|
'help' => 'pg.privilege', |
966
|
|
|
'icon' => 'Privileges', |
967
|
|
|
], |
968
|
|
|
'export' => [ |
969
|
|
|
'title' => $lang['strexport'], |
970
|
|
|
'url' => 'materializedviewproperties', |
971
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'export'], |
972
|
|
|
'icon' => 'Export', |
973
|
|
|
'hide' => false, |
974
|
|
|
], |
975
|
|
|
]; |
976
|
|
|
|
977
|
|
|
break; |
978
|
|
|
case 'function': |
979
|
|
|
$tabs = [ |
980
|
|
|
'definition' => [ |
981
|
|
|
'title' => $lang['strdefinition'], |
982
|
|
|
'url' => 'functions', |
983
|
|
|
'urlvars' => [ |
984
|
|
|
'subject' => 'function', |
985
|
|
|
'function' => Decorator::field('function'), |
986
|
|
|
'function_oid' => Decorator::field('function_oid'), |
987
|
|
|
'action' => 'properties', |
988
|
|
|
], |
989
|
|
|
'icon' => 'Definition', |
990
|
|
|
], |
991
|
|
|
'privileges' => [ |
992
|
|
|
'title' => $lang['strprivileges'], |
993
|
|
|
'url' => 'privileges', |
994
|
|
|
'urlvars' => [ |
995
|
|
|
'subject' => 'function', |
996
|
|
|
'function' => Decorator::field('function'), |
997
|
|
|
'function_oid' => Decorator::field('function_oid'), |
998
|
|
|
], |
999
|
|
|
'icon' => 'Privileges', |
1000
|
|
|
], |
1001
|
|
|
]; |
1002
|
|
|
|
1003
|
|
|
break; |
1004
|
|
|
case 'aggregate': |
1005
|
|
|
$tabs = [ |
1006
|
|
|
'definition' => [ |
1007
|
|
|
'title' => $lang['strdefinition'], |
1008
|
|
|
'url' => 'aggregates', |
1009
|
|
|
'urlvars' => [ |
1010
|
|
|
'subject' => 'aggregate', |
1011
|
|
|
'aggrname' => Decorator::field('aggrname'), |
1012
|
|
|
'aggrtype' => Decorator::field('aggrtype'), |
1013
|
|
|
'action' => 'properties', |
1014
|
|
|
], |
1015
|
|
|
'icon' => 'Definition', |
1016
|
|
|
], |
1017
|
|
|
]; |
1018
|
|
|
|
1019
|
|
|
break; |
1020
|
|
|
case 'role': |
1021
|
|
|
$tabs = [ |
1022
|
|
|
'definition' => [ |
1023
|
|
|
'title' => $lang['strdefinition'], |
1024
|
|
|
'url' => 'roles', |
1025
|
|
|
'urlvars' => [ |
1026
|
|
|
'subject' => 'role', |
1027
|
|
|
'rolename' => Decorator::field('rolename'), |
1028
|
|
|
'action' => 'properties', |
1029
|
|
|
], |
1030
|
|
|
'icon' => 'Definition', |
1031
|
|
|
], |
1032
|
|
|
]; |
1033
|
|
|
|
1034
|
|
|
break; |
1035
|
|
|
case 'popup': |
1036
|
|
|
$tabs = [ |
1037
|
|
|
'sql' => [ |
1038
|
|
|
'title' => $lang['strsql'], |
1039
|
|
|
'url' => \SUBFOLDER.'/src/views/sqledit', |
1040
|
|
|
'urlvars' => ['action' => 'sql', 'subject' => 'schema'], |
1041
|
|
|
'help' => 'pg.sql', |
1042
|
|
|
'icon' => 'SqlEditor', |
1043
|
|
|
], |
1044
|
|
|
'find' => [ |
1045
|
|
|
'title' => $lang['strfind'], |
1046
|
|
|
'url' => \SUBFOLDER.'/src/views/sqledit', |
1047
|
|
|
'urlvars' => ['action' => 'find', 'subject' => 'schema'], |
1048
|
|
|
'icon' => 'Search', |
1049
|
|
|
], |
1050
|
|
|
]; |
1051
|
|
|
|
1052
|
|
|
break; |
1053
|
|
|
case 'column': |
1054
|
|
|
$tabs = [ |
1055
|
|
|
'properties' => [ |
1056
|
|
|
'title' => $lang['strcolprop'], |
1057
|
|
|
'url' => 'colproperties', |
1058
|
|
|
'urlvars' => [ |
1059
|
|
|
'subject' => 'column', |
1060
|
|
|
'table' => Decorator::field('table'), |
1061
|
|
|
'view' => Decorator::field('view'), |
1062
|
|
|
'column' => Decorator::field('column'), |
1063
|
|
|
], |
1064
|
|
|
'icon' => 'Column', |
1065
|
|
|
], |
1066
|
|
|
'privileges' => [ |
1067
|
|
|
'title' => $lang['strprivileges'], |
1068
|
|
|
'url' => 'privileges', |
1069
|
|
|
'urlvars' => [ |
1070
|
|
|
'subject' => 'column', |
1071
|
|
|
'table' => Decorator::field('table'), |
1072
|
|
|
'view' => Decorator::field('view'), |
1073
|
|
|
'column' => Decorator::field('column'), |
1074
|
|
|
], |
1075
|
|
|
'help' => 'pg.privilege', |
1076
|
|
|
'icon' => 'Privileges', |
1077
|
|
|
], |
1078
|
|
|
]; |
1079
|
|
|
if (empty($tabs['properties']['urlvars']['table'])) { |
1080
|
|
|
unset($tabs['properties']['urlvars']['table']); |
1081
|
|
|
} |
1082
|
|
|
if (empty($tabs['privileges']['urlvars']['table'])) { |
1083
|
|
|
unset($tabs['privileges']['urlvars']['table']); |
1084
|
|
|
} |
1085
|
|
|
|
1086
|
|
|
break; |
1087
|
|
|
case 'fulltext': |
1088
|
|
|
$tabs = [ |
1089
|
|
|
'ftsconfigs' => [ |
1090
|
|
|
'title' => $lang['strftstabconfigs'], |
1091
|
|
|
'url' => 'fulltext', |
1092
|
|
|
'urlvars' => ['subject' => 'schema'], |
1093
|
|
|
'hide' => !$data->hasFTS(), |
1094
|
|
|
'help' => 'pg.ftscfg', |
1095
|
|
|
'tree' => true, |
1096
|
|
|
'icon' => 'FtsCfg', |
1097
|
|
|
], |
1098
|
|
|
'ftsdicts' => [ |
1099
|
|
|
'title' => $lang['strftstabdicts'], |
1100
|
|
|
'url' => 'fulltext', |
1101
|
|
|
'urlvars' => ['subject' => 'schema', 'action' => 'viewdicts'], |
1102
|
|
|
'hide' => !$data->hasFTS(), |
1103
|
|
|
'help' => 'pg.ftsdict', |
1104
|
|
|
'tree' => true, |
1105
|
|
|
'icon' => 'FtsDict', |
1106
|
|
|
], |
1107
|
|
|
'ftsparsers' => [ |
1108
|
|
|
'title' => $lang['strftstabparsers'], |
1109
|
|
|
'url' => 'fulltext', |
1110
|
|
|
'urlvars' => ['subject' => 'schema', 'action' => 'viewparsers'], |
1111
|
|
|
'hide' => !$data->hasFTS(), |
1112
|
|
|
'help' => 'pg.ftsparser', |
1113
|
|
|
'tree' => true, |
1114
|
|
|
'icon' => 'FtsParser', |
1115
|
|
|
], |
1116
|
|
|
]; |
1117
|
|
|
|
1118
|
|
|
break; |
1119
|
|
|
} |
1120
|
|
|
|
1121
|
|
|
// Tabs hook's place |
1122
|
|
|
$plugin_functions_parameters = [ |
1123
|
|
|
'tabs' => &$tabs, |
1124
|
|
|
'section' => $section, |
1125
|
|
|
]; |
1126
|
|
|
$plugin_manager->doHook('tabs', $plugin_functions_parameters); |
1127
|
|
|
|
1128
|
|
|
return $tabs; |
1129
|
|
|
} |
1130
|
|
|
|
1131
|
|
|
/** |
1132
|
|
|
* Get the URL for the last active tab of a particular tab bar. |
1133
|
|
|
* |
1134
|
|
|
* @param string $section |
1135
|
|
|
* |
1136
|
|
|
* @return null|mixed |
1137
|
|
|
*/ |
1138
|
|
|
public function getLastTabURL($section) |
1139
|
|
|
{ |
1140
|
|
|
//$data = $this->getDatabaseAccessor(); |
1141
|
|
|
|
1142
|
|
|
$tabs = $this->getNavTabs($section); |
1143
|
|
|
if (isset($_SESSION['webdbLastTab'][$section], $tabs[$_SESSION['webdbLastTab'][$section]])) { |
1144
|
|
|
$tab = $tabs[$_SESSION['webdbLastTab'][$section]]; |
1145
|
|
|
} else { |
1146
|
|
|
$tab = reset($tabs); |
1147
|
|
|
} |
1148
|
|
|
$this->prtrace(['section' => $section, 'tabs' => $tabs, 'tab' => $tab]); |
1149
|
|
|
|
1150
|
|
|
return isset($tab['url']) ? $tab : null; |
1151
|
|
|
} |
1152
|
|
|
|
1153
|
|
|
abstract public function getDatabaseAccessor($database = '', $server_id = null); |
1154
|
|
|
|
1155
|
|
|
abstract public function isDumpEnabled($all = false); |
1156
|
|
|
|
1157
|
|
|
abstract public function prtrace(); |
1158
|
|
|
} |
1159
|
|
|
|