HuasoFoundries /
phpPgAdmin6
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace PHPPgAdmin\XHtml; |
||||||
| 4 | |||||||
| 5 | /** |
||||||
| 6 | * Class to render tables. Formerly part of Misc.php |
||||||
| 7 | * |
||||||
| 8 | */ |
||||||
| 9 | class HTMLNavbarController extends HTMLController |
||||||
| 10 | { |
||||||
| 11 | public $_name = 'HTMLNavbarController'; |
||||||
| 12 | |||||||
| 13 | /** |
||||||
| 14 | * Display a bread crumb trail. |
||||||
| 15 | * @param $do_print true to echo, false to return html |
||||||
| 16 | */ |
||||||
| 17 | public function printTrail($trail = [], $do_print = true, $from = null) |
||||||
| 18 | { |
||||||
| 19 | if ($from === null) { |
||||||
| 20 | $from = __METHOD__; |
||||||
| 21 | } |
||||||
| 22 | $lang = $this->lang; |
||||||
| 23 | $misc = $this->misc; |
||||||
| 24 | |||||||
| 25 | $trail_html = $this->printTopbar(false, $from); |
||||||
| 26 | |||||||
| 27 | if (is_string($trail)) { |
||||||
| 28 | $trail = $this->getTrail($trail); |
||||||
| 29 | } |
||||||
| 30 | |||||||
| 31 | //$this->prtrace($trail); |
||||||
| 32 | |||||||
| 33 | $trail_html .= '<div class="trail" data-controller="' . $this->controller_name . '"><table><tr>'; |
||||||
| 34 | |||||||
| 35 | foreach ($trail as $crumb) { |
||||||
| 36 | $trail_html .= '<td class="crumb">'; |
||||||
| 37 | $crumblink = '<a'; |
||||||
| 38 | |||||||
| 39 | if (isset($crumb['url'])) { |
||||||
| 40 | $crumblink .= " href=\"{$crumb['url']}\""; |
||||||
| 41 | //$this->prtrace('crumb_url', $crumb['url']); |
||||||
| 42 | } |
||||||
| 43 | |||||||
| 44 | if (isset($crumb['title'])) { |
||||||
| 45 | $crumblink .= " title=\"{$crumb['title']}\""; |
||||||
| 46 | } |
||||||
| 47 | |||||||
| 48 | $crumblink .= '>'; |
||||||
| 49 | |||||||
| 50 | if (isset($crumb['title'])) { |
||||||
| 51 | $iconalt = $crumb['title']; |
||||||
| 52 | } else { |
||||||
| 53 | $iconalt = 'Database Root'; |
||||||
| 54 | } |
||||||
| 55 | |||||||
| 56 | if (isset($crumb['icon']) && $icon = $misc->icon($crumb['icon'])) { |
||||||
| 57 | $crumblink .= "<span class=\"icon\"><img src=\"{$icon}\" alt=\"{$iconalt}\" /></span>"; |
||||||
| 58 | } |
||||||
| 59 | |||||||
| 60 | $crumblink .= '<span class="label">' . htmlspecialchars($crumb['text']) . '</span></a>'; |
||||||
| 61 | |||||||
| 62 | if (isset($crumb['help'])) { |
||||||
| 63 | $trail_html .= $this->misc->printHelp($crumblink, $crumb['help'], false); |
||||||
| 64 | } else { |
||||||
| 65 | $trail_html .= $crumblink; |
||||||
| 66 | } |
||||||
| 67 | |||||||
| 68 | $trail_html .= "{$lang['strseparator']}"; |
||||||
| 69 | $trail_html .= '</td>'; |
||||||
| 70 | } |
||||||
| 71 | |||||||
| 72 | $trail_html .= "</tr></table></div>\n"; |
||||||
| 73 | if ($do_print) { |
||||||
| 74 | echo $trail_html; |
||||||
| 75 | } else { |
||||||
| 76 | return $trail_html; |
||||||
| 77 | } |
||||||
| 78 | } |
||||||
| 79 | |||||||
| 80 | /** |
||||||
| 81 | * Display the navlinks |
||||||
| 82 | * |
||||||
| 83 | * @param $navlinks - An array with the the attributes and values that will be shown. See printLinksList for array format. |
||||||
| 84 | * @param $place - Place where the $navlinks are displayed. Like 'display-browse', where 'display' is the file (display.php) |
||||||
| 85 | * @param $env - Associative array of defined variables in the scope of the caller. |
||||||
| 86 | * Allows to give some environnement details to plugins. |
||||||
| 87 | * and 'browse' is the place inside that code (doBrowse). |
||||||
| 88 | * @param bool $do_print if true, print html, if false, return html |
||||||
| 89 | */ |
||||||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||||||
| 90 | public function printNavLinks($navlinks, $place, $env = [], $do_print = true, $from) |
||||||
| 91 | { |
||||||
| 92 | if ($from === null || $from === false) { |
||||||
| 93 | $from = __METHOD__; |
||||||
| 94 | } |
||||||
| 95 | //$this->prtrace($navlinks); |
||||||
| 96 | $plugin_manager = $this->plugin_manager; |
||||||
| 97 | |||||||
| 98 | // Navlinks hook's place |
||||||
| 99 | $plugin_functions_parameters = [ |
||||||
| 100 | 'navlinks' => &$navlinks, |
||||||
| 101 | 'place' => $place, |
||||||
| 102 | 'env' => $env, |
||||||
| 103 | ]; |
||||||
| 104 | $plugin_manager->do_hook('navlinks', $plugin_functions_parameters); |
||||||
| 105 | |||||||
| 106 | if (count($navlinks) > 0) { |
||||||
| 107 | if ($do_print) { |
||||||
| 108 | $this->printLinksList($navlinks, 'navlink', true, $from); |
||||||
| 109 | } else { |
||||||
| 110 | return $this->printLinksList($navlinks, 'navlink', false, $from); |
||||||
| 111 | } |
||||||
| 112 | } |
||||||
| 113 | } |
||||||
| 114 | |||||||
| 115 | /** |
||||||
| 116 | * Display navigation tabs |
||||||
| 117 | * @param $tabs The name of current section (Ex: intro, server, ...), or an array with tabs (Ex: sqledit.php doFind function) |
||||||
|
0 ignored issues
–
show
The type
PHPPgAdmin\XHtml\The was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 118 | * @param $activetab The name of the tab to be highlighted. |
||||||
| 119 | * @param $print if false, return html |
||||||
|
0 ignored issues
–
show
The type
PHPPgAdmin\XHtml\if was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 120 | */ |
||||||
| 121 | public function printTabs($alltabs, $activetab, $do_print = true, $from = null) |
||||||
| 122 | { |
||||||
| 123 | if ($from === null || $from === false) { |
||||||
| 124 | $from = __METHOD__; |
||||||
| 125 | } |
||||||
| 126 | |||||||
| 127 | $lang = $this->lang; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 128 | $misc = $this->misc; |
||||||
| 129 | $data = $misc->getDatabaseAccessor(); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 130 | |||||||
| 131 | if (is_string($alltabs)) { |
||||||
| 132 | $_SESSION['webdbLastTab'][$alltabs] = $activetab; |
||||||
| 133 | $alltabs = $misc->getNavTabs($alltabs); |
||||||
| 134 | } |
||||||
| 135 | //$this->prtrace($tabs); |
||||||
| 136 | $tabs_html = ''; |
||||||
| 137 | |||||||
| 138 | //Getting only visible tabs |
||||||
| 139 | $tabs = []; |
||||||
| 140 | if (count($alltabs) > 0) { |
||||||
| 141 | foreach ($alltabs as $tab_id => $tab) { |
||||||
| 142 | if (!isset($tab['hide']) || $tab['hide'] !== true) { |
||||||
| 143 | $tabs[$tab_id] = $tab; |
||||||
| 144 | $tabs[$tab_id]['active'] = $active = ($tab_id == $activetab) ? ' active' : ''; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 145 | $tabs[$tab_id]['tablink'] = str_replace(['&', '.php'], ['&', ''], htmlentities($this->getActionUrl($tab, $_REQUEST, $from))); |
||||||
| 146 | if (isset($tab['icon']) && $icon = $misc->icon($tab['icon'])) { |
||||||
| 147 | $tabs[$tab_id]['iconurl'] = $icon; |
||||||
| 148 | } |
||||||
| 149 | if (isset($tab['help'])) { |
||||||
| 150 | $tabs[$tab_id]['helpurl'] = str_replace('&', '&', $this->misc->getHelpLink($tab['help'])); |
||||||
| 151 | } |
||||||
| 152 | } |
||||||
| 153 | } |
||||||
| 154 | } |
||||||
| 155 | |||||||
| 156 | //$this->prtrace($tabs); |
||||||
| 157 | |||||||
| 158 | if (count($tabs) > 0) { |
||||||
| 159 | $width = (int) (100 / count($tabs)) . '%'; |
||||||
| 160 | |||||||
| 161 | $viewVars = [ |
||||||
| 162 | 'width' => $width, |
||||||
| 163 | 'tabs' => $tabs, |
||||||
| 164 | 'controller_name' => $this->controller_name, |
||||||
| 165 | ]; |
||||||
| 166 | |||||||
| 167 | $tabs_html = $this->getContainer()->view->fetch('components/tabs.twig', $viewVars); |
||||||
| 168 | } |
||||||
| 169 | |||||||
| 170 | if ($do_print) { |
||||||
| 171 | echo $tabs_html; |
||||||
| 172 | } else { |
||||||
| 173 | return $tabs_html; |
||||||
| 174 | } |
||||||
| 175 | } |
||||||
| 176 | |||||||
| 177 | /** |
||||||
| 178 | * Get the URL for the last active tab of a particular tab bar. |
||||||
| 179 | */ |
||||||
| 180 | public function getLastTabURL($section) |
||||||
| 181 | { |
||||||
| 182 | $lang = $this->lang; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 183 | $misc = $this->misc; |
||||||
| 184 | |||||||
| 185 | $tabs = $misc->getNavTabs($section); |
||||||
| 186 | |||||||
| 187 | if (isset($_SESSION['webdbLastTab'][$section]) && isset($tabs[$_SESSION['webdbLastTab'][$section]])) { |
||||||
| 188 | $tab = $tabs[$_SESSION['webdbLastTab'][$section]]; |
||||||
| 189 | } else { |
||||||
| 190 | $tab = reset($tabs); |
||||||
| 191 | } |
||||||
| 192 | $this->prtrace(['section' => $section, 'tabs' => $tabs, 'tab' => $tab], 'getLastTabURL'); |
||||||
| 193 | return isset($tab['url']) ? $tab : null; |
||||||
| 194 | } |
||||||
| 195 | |||||||
| 196 | /** |
||||||
| 197 | * [printTopbar description] |
||||||
| 198 | * @param bool $do_print true to print, false to return html |
||||||
| 199 | * @return string |
||||||
| 200 | */ |
||||||
| 201 | private function printTopbar($do_print = true, $from = null) |
||||||
| 202 | { |
||||||
| 203 | if ($from === null || $from === false) { |
||||||
| 204 | $from = __METHOD__; |
||||||
| 205 | } |
||||||
| 206 | |||||||
| 207 | $lang = $this->lang; |
||||||
| 208 | $plugin_manager = $this->plugin_manager; |
||||||
| 209 | $misc = $this->misc; |
||||||
| 210 | $appName = $misc->appName; |
||||||
| 211 | $appVersion = $misc->appVersion; |
||||||
| 212 | $appLangFiles = $misc->appLangFiles; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 213 | |||||||
| 214 | $server_info = $misc->getServerInfo(); |
||||||
| 215 | $server_id = $misc->getServerId(); |
||||||
| 216 | $reqvars = $misc->getRequestVars('table'); |
||||||
| 217 | |||||||
| 218 | $topbar_html = '<div class="topbar" data-controller="' . $this->controller_name . '"><table style="width: 100%"><tr><td>'; |
||||||
| 219 | |||||||
| 220 | if ($server_info && isset($server_info['platform']) && isset($server_info['username'])) { |
||||||
| 221 | /* top left informations when connected */ |
||||||
| 222 | $topbar_html .= sprintf($lang['strtopbar'], |
||||||
| 223 | '<span class="platform">' . htmlspecialchars($server_info['platform']) . '</span>', |
||||||
| 224 | '<span class="host">' . htmlspecialchars((empty($server_info['host'])) ? 'localhost' : $server_info['host']) . '</span>', |
||||||
| 225 | '<span class="port">' . htmlspecialchars($server_info['port']) . '</span>', |
||||||
| 226 | '<span class="username">' . htmlspecialchars($server_info['username']) . '</span>'); |
||||||
| 227 | |||||||
| 228 | $topbar_html .= '</td>'; |
||||||
| 229 | |||||||
| 230 | /* top right informations when connected */ |
||||||
| 231 | |||||||
| 232 | $toplinks = [ |
||||||
| 233 | 'sql' => [ |
||||||
| 234 | 'attr' => [ |
||||||
| 235 | 'href' => [ |
||||||
| 236 | 'url' => SUBFOLDER . '/src/views/sqledit', |
||||||
| 237 | 'urlvars' => array_merge($reqvars, [ |
||||||
| 238 | 'action' => 'sql', |
||||||
| 239 | ]), |
||||||
| 240 | ], |
||||||
| 241 | 'target' => 'sqledit', |
||||||
| 242 | 'id' => 'toplink_sql', |
||||||
| 243 | ], |
||||||
| 244 | 'content' => $lang['strsql'], |
||||||
| 245 | ], |
||||||
| 246 | 'history' => [ |
||||||
| 247 | 'attr' => [ |
||||||
| 248 | 'href' => [ |
||||||
| 249 | 'url' => SUBFOLDER . '/src/views/history', |
||||||
| 250 | 'urlvars' => array_merge($reqvars, [ |
||||||
| 251 | 'action' => 'pophistory', |
||||||
| 252 | ]), |
||||||
| 253 | ], |
||||||
| 254 | 'id' => 'toplink_history', |
||||||
| 255 | ], |
||||||
| 256 | 'content' => $lang['strhistory'], |
||||||
| 257 | ], |
||||||
| 258 | 'find' => [ |
||||||
| 259 | 'attr' => [ |
||||||
| 260 | 'href' => [ |
||||||
| 261 | 'url' => SUBFOLDER . '/src/views/sqledit', |
||||||
| 262 | 'urlvars' => array_merge($reqvars, [ |
||||||
| 263 | 'action' => 'find', |
||||||
| 264 | ]), |
||||||
| 265 | ], |
||||||
| 266 | 'target' => 'sqledit', |
||||||
| 267 | 'id' => 'toplink_find', |
||||||
| 268 | ], |
||||||
| 269 | 'content' => $lang['strfind'], |
||||||
| 270 | ], |
||||||
| 271 | 'logout' => [ |
||||||
| 272 | 'attr' => [ |
||||||
| 273 | 'href' => [ |
||||||
| 274 | 'url' => SUBFOLDER . '/src/views/servers', |
||||||
| 275 | 'urlvars' => [ |
||||||
| 276 | 'action' => 'logout', |
||||||
| 277 | 'logoutServer' => "{$server_info['host']}:{$server_info['port']}:{$server_info['sslmode']}", |
||||||
| 278 | ], |
||||||
| 279 | ], |
||||||
| 280 | 'id' => 'toplink_logout', |
||||||
| 281 | ], |
||||||
| 282 | 'content' => $lang['strlogout'], |
||||||
| 283 | ], |
||||||
| 284 | ]; |
||||||
| 285 | |||||||
| 286 | // Toplink hook's place |
||||||
| 287 | $plugin_functions_parameters = [ |
||||||
| 288 | 'toplinks' => &$toplinks, |
||||||
| 289 | ]; |
||||||
| 290 | |||||||
| 291 | $plugin_manager->do_hook('toplinks', $plugin_functions_parameters); |
||||||
| 292 | |||||||
| 293 | $topbar_html .= '<td style="text-align: right">'; |
||||||
| 294 | |||||||
| 295 | $topbar_html .= $this->printLinksList($toplinks, 'toplink', [], false, $from); |
||||||
|
0 ignored issues
–
show
array() of type array is incompatible with the type boolean expected by parameter $do_print of PHPPgAdmin\XHtml\HTMLNav...oller::printLinksList().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The call to
PHPPgAdmin\XHtml\HTMLNav...oller::printLinksList() has too many arguments starting with $from.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. Loading history...
|
|||||||
| 296 | |||||||
| 297 | $topbar_html .= '</td>'; |
||||||
| 298 | |||||||
| 299 | $sql_window_id = htmlentities('sqledit:' . $server_id); |
||||||
| 300 | $history_window_id = htmlentities('history:' . $server_id); |
||||||
| 301 | |||||||
| 302 | $topbar_html .= "<script type=\"text/javascript\"> |
||||||
| 303 | $('#toplink_sql').click(function() { |
||||||
| 304 | window.open($(this).attr('href'),'{$sql_window_id}','toolbar=no,width=750,height=520,resizable=yes,scrollbars=yes').focus(); |
||||||
| 305 | return false; |
||||||
| 306 | }); |
||||||
| 307 | |||||||
| 308 | $('#toplink_history').click(function() { |
||||||
| 309 | window.open($(this).attr('href'),'{$history_window_id}','toolbar=no,width=700,height=500,resizable=yes,scrollbars=yes').focus(); |
||||||
| 310 | return false; |
||||||
| 311 | }); |
||||||
| 312 | |||||||
| 313 | $('#toplink_find').click(function() { |
||||||
| 314 | window.open($(this).attr('href'),'{$sql_window_id}','toolbar=no,width=750,height=520,resizable=yes,scrollbars=yes').focus(); |
||||||
| 315 | return false; |
||||||
| 316 | }); |
||||||
| 317 | "; |
||||||
| 318 | |||||||
| 319 | if (isset($_SESSION['sharedUsername'])) { |
||||||
| 320 | $topbar_html .= sprintf(" |
||||||
| 321 | $('#toplink_logout').click(function() { |
||||||
| 322 | return confirm('%s'); |
||||||
| 323 | });", str_replace("'", "\'", $lang['strconfdropcred'])); |
||||||
| 324 | } |
||||||
| 325 | |||||||
| 326 | $topbar_html .= ' |
||||||
| 327 | </script>'; |
||||||
| 328 | } else { |
||||||
| 329 | $topbar_html .= "<span class=\"appname\">{$appName}</span> <span class=\"version\">{$appVersion}</span>"; |
||||||
| 330 | } |
||||||
| 331 | /* |
||||||
| 332 | echo "<td style=\"text-align: right; width: 1%\">"; |
||||||
| 333 | |||||||
| 334 | echo "<form method=\"get\"><select name=\"language\" onchange=\"this.form.submit()\">\n"; |
||||||
| 335 | $language = isset($_SESSION['webdbLanguage']) ? $_SESSION['webdbLanguage'] : 'english'; |
||||||
| 336 | foreach ($appLangFiles as $k => $v) { |
||||||
| 337 | echo "<option value=\"{$k}\"", |
||||||
| 338 | ($k == $language) ? ' selected="selected"' : '', |
||||||
| 339 | ">{$v}</option>\n"; |
||||||
| 340 | } |
||||||
| 341 | echo "</select>\n"; |
||||||
| 342 | echo "<noscript><input type=\"submit\" value=\"Set Language\"></noscript>\n"; |
||||||
| 343 | foreach ($_GET as $key => $val) { |
||||||
| 344 | if ($key == 'language') continue; |
||||||
| 345 | echo "<input type=\"hidden\" name=\"$key\" value=\"", htmlspecialchars($val), "\" />\n"; |
||||||
| 346 | } |
||||||
| 347 | echo "</form>\n"; |
||||||
| 348 | |||||||
| 349 | echo "</td>"; |
||||||
| 350 | */ |
||||||
| 351 | $topbar_html .= "</tr></table></div>\n"; |
||||||
| 352 | |||||||
| 353 | if ($do_print) { |
||||||
| 354 | echo $topbar_html; |
||||||
| 355 | } else { |
||||||
| 356 | return $topbar_html; |
||||||
| 357 | } |
||||||
| 358 | } |
||||||
| 359 | |||||||
| 360 | private function getHREFSubject($subject) |
||||||
| 361 | { |
||||||
| 362 | $vars = $this->misc->getSubjectParams($subject); |
||||||
| 363 | ksort($vars['params']); |
||||||
| 364 | return "{$vars['url']}?" . http_build_query($vars['params'], '', '&'); |
||||||
| 365 | } |
||||||
| 366 | |||||||
| 367 | /** |
||||||
| 368 | * Create a bread crumb trail of the object hierarchy. |
||||||
| 369 | * @param $object The type of object at the end of the trail. |
||||||
| 370 | */ |
||||||
| 371 | private function getTrail($subject = null) |
||||||
| 372 | { |
||||||
| 373 | $lang = $this->lang; |
||||||
| 374 | $plugin_manager = $this->plugin_manager; |
||||||
| 375 | $misc = $this->misc; |
||||||
| 376 | $appName = $misc->appName; |
||||||
| 377 | |||||||
| 378 | $data = $misc->getDatabaseAccessor(); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 379 | |||||||
| 380 | $trail = []; |
||||||
| 381 | $vars = ''; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 382 | $done = false; |
||||||
| 383 | |||||||
| 384 | $trail['root'] = [ |
||||||
| 385 | 'text' => $appName, |
||||||
| 386 | 'url' => SUBFOLDER . '/src/views/servers', |
||||||
| 387 | 'icon' => 'Introduction', |
||||||
| 388 | ]; |
||||||
| 389 | |||||||
| 390 | if ($subject == 'root') { |
||||||
| 391 | $done = true; |
||||||
| 392 | } |
||||||
| 393 | |||||||
| 394 | if (!$done) { |
||||||
| 395 | $server_info = $misc->getServerInfo(); |
||||||
| 396 | $trail['server'] = [ |
||||||
| 397 | 'title' => $lang['strserver'], |
||||||
| 398 | 'text' => $server_info['desc'], |
||||||
| 399 | 'url' => $this->getHREFSubject('server'), |
||||||
| 400 | 'help' => 'pg.server', |
||||||
| 401 | 'icon' => 'Server', |
||||||
| 402 | ]; |
||||||
| 403 | } |
||||||
| 404 | if ($subject == 'server') { |
||||||
| 405 | $done = true; |
||||||
| 406 | } |
||||||
| 407 | |||||||
| 408 | if (isset($_REQUEST['database']) && !$done) { |
||||||
| 409 | $trail['database'] = [ |
||||||
| 410 | 'title' => $lang['strdatabase'], |
||||||
| 411 | 'text' => $_REQUEST['database'], |
||||||
| 412 | 'url' => $this->getHREFSubject('database'), |
||||||
| 413 | 'help' => 'pg.database', |
||||||
| 414 | 'icon' => 'Database', |
||||||
| 415 | ]; |
||||||
| 416 | } elseif (isset($_REQUEST['rolename']) && !$done) { |
||||||
| 417 | $trail['role'] = [ |
||||||
| 418 | 'title' => $lang['strrole'], |
||||||
| 419 | 'text' => $_REQUEST['rolename'], |
||||||
| 420 | 'url' => $this->getHREFSubject('role'), |
||||||
| 421 | 'help' => 'pg.role', |
||||||
| 422 | 'icon' => 'Roles', |
||||||
| 423 | ]; |
||||||
| 424 | } |
||||||
| 425 | if ($subject == 'database' || $subject == 'role') { |
||||||
| 426 | $done = true; |
||||||
| 427 | } |
||||||
| 428 | |||||||
| 429 | if (isset($_REQUEST['schema']) && !$done) { |
||||||
| 430 | $trail['schema'] = [ |
||||||
| 431 | 'title' => $lang['strschema'], |
||||||
| 432 | 'text' => $_REQUEST['schema'], |
||||||
| 433 | 'url' => $this->getHREFSubject('schema'), |
||||||
| 434 | 'help' => 'pg.schema', |
||||||
| 435 | 'icon' => 'Schema', |
||||||
| 436 | ]; |
||||||
| 437 | } |
||||||
| 438 | if ($subject == 'schema') { |
||||||
| 439 | $done = true; |
||||||
| 440 | } |
||||||
| 441 | |||||||
| 442 | if (isset($_REQUEST['table']) && !$done) { |
||||||
| 443 | $trail['table'] = [ |
||||||
| 444 | 'title' => $lang['strtable'], |
||||||
| 445 | 'text' => $_REQUEST['table'], |
||||||
| 446 | 'url' => $this->getHREFSubject('table'), |
||||||
| 447 | 'help' => 'pg.table', |
||||||
| 448 | 'icon' => 'Table', |
||||||
| 449 | ]; |
||||||
| 450 | } elseif (isset($_REQUEST['view']) && !$done) { |
||||||
| 451 | $trail['view'] = [ |
||||||
| 452 | 'title' => $lang['strview'], |
||||||
| 453 | 'text' => $_REQUEST['view'], |
||||||
| 454 | 'url' => $this->getHREFSubject('view'), |
||||||
| 455 | 'help' => 'pg.view', |
||||||
| 456 | 'icon' => 'View', |
||||||
| 457 | ]; |
||||||
| 458 | } elseif (isset($_REQUEST['matview']) && !$done) { |
||||||
| 459 | $trail['matview'] = [ |
||||||
| 460 | 'title' => 'M' . $lang['strview'], |
||||||
| 461 | 'text' => $_REQUEST['matview'], |
||||||
| 462 | 'url' => $this->getHREFSubject('matview'), |
||||||
| 463 | 'help' => 'pg.matview', |
||||||
| 464 | 'icon' => 'MViews', |
||||||
| 465 | ]; |
||||||
| 466 | } elseif (isset($_REQUEST['ftscfg']) && !$done) { |
||||||
| 467 | $trail['ftscfg'] = [ |
||||||
| 468 | 'title' => $lang['strftsconfig'], |
||||||
| 469 | 'text' => $_REQUEST['ftscfg'], |
||||||
| 470 | 'url' => $this->getHREFSubject('ftscfg'), |
||||||
| 471 | 'help' => 'pg.ftscfg.example', |
||||||
| 472 | 'icon' => 'Fts', |
||||||
| 473 | ]; |
||||||
| 474 | } |
||||||
| 475 | if ($subject == 'table' || $subject == 'view' || $subject == 'matview' || $subject == 'ftscfg') { |
||||||
| 476 | $done = true; |
||||||
| 477 | } |
||||||
| 478 | |||||||
| 479 | if (!$done && !is_null($subject)) { |
||||||
| 480 | switch ($subject) { |
||||||
| 481 | case 'function': |
||||||
| 482 | $trail[$subject] = [ |
||||||
| 483 | 'title' => $lang['str' . $subject], |
||||||
| 484 | 'text' => $_REQUEST[$subject], |
||||||
| 485 | 'url' => $this->getHREFSubject('function'), |
||||||
| 486 | 'help' => 'pg.function', |
||||||
| 487 | 'icon' => 'Function', |
||||||
| 488 | ]; |
||||||
| 489 | break; |
||||||
| 490 | case 'aggregate': |
||||||
| 491 | $trail[$subject] = [ |
||||||
| 492 | 'title' => $lang['straggregate'], |
||||||
| 493 | 'text' => $_REQUEST['aggrname'], |
||||||
| 494 | 'url' => $this->getHREFSubject('aggregate'), |
||||||
| 495 | 'help' => 'pg.aggregate', |
||||||
| 496 | 'icon' => 'Aggregate', |
||||||
| 497 | ]; |
||||||
| 498 | break; |
||||||
| 499 | case 'column': |
||||||
| 500 | $trail['column'] = [ |
||||||
| 501 | 'title' => $lang['strcolumn'], |
||||||
| 502 | 'text' => $_REQUEST['column'], |
||||||
| 503 | 'icon' => 'Column', |
||||||
| 504 | 'url' => $this->getHREFSubject('column'), |
||||||
| 505 | ]; |
||||||
| 506 | break; |
||||||
| 507 | default: |
||||||
| 508 | if (isset($_REQUEST[$subject])) { |
||||||
| 509 | switch ($subject) { |
||||||
| 510 | case 'domain':$icon = 'Domain'; |
||||||
| 511 | break; |
||||||
| 512 | case 'sequence':$icon = 'Sequence'; |
||||||
| 513 | break; |
||||||
| 514 | case 'type':$icon = 'Type'; |
||||||
| 515 | break; |
||||||
| 516 | case 'operator':$icon = 'Operator'; |
||||||
| 517 | break; |
||||||
| 518 | default:$icon = null; |
||||||
| 519 | break; |
||||||
| 520 | } |
||||||
| 521 | $trail[$subject] = [ |
||||||
| 522 | 'title' => array_key_exists('str' . $subject, $lang) ? $lang['str' . $subject] : $subject, |
||||||
| 523 | 'text' => $_REQUEST[$subject], |
||||||
| 524 | 'help' => 'pg.' . $subject, |
||||||
| 525 | 'icon' => $icon, |
||||||
| 526 | ]; |
||||||
| 527 | } |
||||||
| 528 | } |
||||||
| 529 | } |
||||||
| 530 | |||||||
| 531 | // Trail hook's place |
||||||
| 532 | $plugin_functions_parameters = [ |
||||||
| 533 | 'trail' => &$trail, |
||||||
| 534 | 'section' => $subject, |
||||||
| 535 | ]; |
||||||
| 536 | |||||||
| 537 | $plugin_manager->do_hook('trail', $plugin_functions_parameters); |
||||||
| 538 | |||||||
| 539 | //$this->prtrace($trail); |
||||||
| 540 | |||||||
| 541 | return $trail; |
||||||
| 542 | } |
||||||
| 543 | |||||||
| 544 | /** |
||||||
| 545 | * Display a list of links |
||||||
| 546 | * @param $links An associative array of links to print. See printLink function for |
||||||
|
0 ignored issues
–
show
The type
PHPPgAdmin\XHtml\An was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 547 | * the links array format. |
||||||
| 548 | * @param $class An optional class or list of classes seprated by a space |
||||||
| 549 | * WARNING: This field is NOT escaped! No user should be able to inject something here, use with care. |
||||||
| 550 | * @param boolean $do_print true to echo, false to return |
||||||
| 551 | */ |
||||||
| 552 | private function printLinksList($links, $class = '', $do_print = true, $from = null) |
||||||
| 553 | { |
||||||
| 554 | if ($from === null || $from === false) { |
||||||
| 555 | $from = __METHOD__; |
||||||
| 556 | } |
||||||
| 557 | $misc = $this->misc; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 558 | $list_html = "<ul class=\"{$class}\">\n"; |
||||||
| 559 | foreach ($links as $link) { |
||||||
| 560 | $list_html .= "\t<li>"; |
||||||
| 561 | $list_html .= str_replace('.php', '', $this->printLink($link, false, $from)); |
||||||
| 562 | $list_html .= "</li>\n"; |
||||||
| 563 | } |
||||||
| 564 | $list_html .= "</ul>\n"; |
||||||
| 565 | if ($do_print) { |
||||||
| 566 | echo $list_html; |
||||||
| 567 | } else { |
||||||
| 568 | return $list_html; |
||||||
| 569 | } |
||||||
| 570 | } |
||||||
| 571 | } |
||||||
| 572 |