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