HuasoFoundries /
phpPgAdmin6
| 1 | <?php |
||
| 2 | |||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 3 | /* |
||
| 4 | * PHPPgAdmin v6.0.0-beta.30 |
||
| 5 | */ |
||
| 6 | |||
| 7 | namespace PHPPgAdmin\Controller; |
||
| 8 | |||
| 9 | use PHPPgAdmin\Decorators\Decorator; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Base controller class. |
||
| 13 | */ |
||
| 14 | class TblpropertiesController extends BaseController |
||
| 15 | { |
||
| 16 | public $controller_name = 'TblpropertiesController'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Default method to render the controller according to the action parameter. |
||
| 20 | */ |
||
| 21 | public function render() |
||
| 22 | { |
||
| 23 | $misc = $this->misc; |
||
| 24 | $lang = $this->lang; |
||
| 25 | |||
| 26 | $action = $this->action; |
||
| 27 | if ('tree' == $action) { |
||
| 28 | return $this->doTree(); |
||
| 29 | } |
||
| 30 | $data = $misc->getDatabaseAccessor(); |
||
| 31 | |||
| 32 | $footer_template = 'footer.twig'; |
||
| 33 | $header_template = 'header.twig'; |
||
| 34 | |||
| 35 | ob_start(); |
||
| 36 | switch ($action) { |
||
| 37 | case 'alter': |
||
| 38 | if (isset($_POST['alter'])) { |
||
| 39 | $this->doSaveAlter(); |
||
| 40 | } else { |
||
| 41 | $this->doDefault(); |
||
| 42 | } |
||
| 43 | |||
| 44 | break; |
||
| 45 | case 'confirm_alter': |
||
| 46 | $this->doAlter(); |
||
| 47 | |||
| 48 | break; |
||
| 49 | case 'import': |
||
| 50 | $this->doImport(); |
||
| 51 | |||
| 52 | break; |
||
| 53 | case 'export': |
||
| 54 | $this->doExport(); |
||
| 55 | |||
| 56 | break; |
||
| 57 | case 'add_column': |
||
| 58 | if (isset($_POST['cancel'])) { |
||
| 59 | $this->doDefault(); |
||
| 60 | } else { |
||
| 61 | $header_template = 'header_select2.twig'; |
||
| 62 | $this->doAddColumn(); |
||
| 63 | } |
||
| 64 | |||
| 65 | break; |
||
| 66 | case 'properties': |
||
| 67 | if (isset($_POST['cancel'])) { |
||
| 68 | $this->doDefault(); |
||
| 69 | } else { |
||
| 70 | $this->doProperties(); |
||
| 71 | } |
||
| 72 | |||
| 73 | break; |
||
| 74 | case 'drop': |
||
| 75 | if (isset($_POST['drop'])) { |
||
| 76 | $this->doDrop(false); |
||
| 77 | } else { |
||
| 78 | $this->doDefault(); |
||
| 79 | } |
||
| 80 | |||
| 81 | break; |
||
| 82 | case 'confirm_drop': |
||
| 83 | $this->doDrop(true); |
||
| 84 | |||
| 85 | break; |
||
| 86 | default: |
||
| 87 | $this->doDefault(); |
||
| 88 | |||
| 89 | break; |
||
| 90 | } |
||
| 91 | |||
| 92 | $output = ob_get_clean(); |
||
| 93 | |||
| 94 | $this->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table'], null, true, $header_template); |
||
| 95 | $this->printBody(); |
||
| 96 | |||
| 97 | echo $output; |
||
| 98 | |||
| 99 | return $this->printFooter(); |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Show default list of columns in the table. |
||
| 104 | * |
||
| 105 | * @param mixed $msg |
||
|
1 ignored issue
–
show
|
|||
| 106 | */ |
||
| 107 | public function doDefault($msg = '') |
||
| 108 | { |
||
| 109 | $misc = $this->misc; |
||
| 110 | $lang = $this->lang; |
||
| 111 | $data = $misc->getDatabaseAccessor(); |
||
| 112 | |||
| 113 | $attPre = function (&$rowdata, $actions) use ($data) { |
||
| 114 | $rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']); |
||
| 115 | $attname = $rowdata->fields['attname']; |
||
| 116 | $table = $_REQUEST['table']; |
||
| 117 | $data->fieldClean($attname); |
||
| 118 | $data->fieldClean($table); |
||
| 119 | |||
| 120 | $actions['browse']['attr']['href']['urlvars']['query'] = "SELECT \"{$attname}\", count(*) AS \"count\" |
||
| 121 | FROM \"{$table}\" GROUP BY \"{$attname}\" ORDER BY \"{$attname}\""; |
||
| 122 | |||
| 123 | return $actions; |
||
| 124 | }; |
||
| 125 | |||
| 126 | $cstrRender = function ($s, $p) use ($misc, $data) { |
||
| 127 | $str = ''; |
||
| 128 | foreach ($p['keys'] as $k => $c) { |
||
| 129 | if (is_null($p['keys'][$k]['consrc'])) { |
||
| 130 | $atts = $data->getAttributeNames($_REQUEST['table'], explode(' ', $p['keys'][$k]['indkey'])); |
||
| 131 | $c['consrc'] = ('u' == $c['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (') . join(',', $atts) . ')'; |
||
| 132 | } |
||
| 133 | |||
| 134 | if ($c['p_field'] == $s) { |
||
| 135 | switch ($c['contype']) { |
||
| 136 | case 'p': |
||
| 137 | $str .= '<a href="constraints.php?' . $misc->href . '&table=' . urlencode($c['p_table']) . '&schema=' . urlencode($c['p_schema']) . '"><img src="' . |
||
| 138 | $misc->icon('PrimaryKey') . '" alt="[pk]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; |
||
| 139 | |||
| 140 | break; |
||
| 141 | case 'f': |
||
| 142 | $str .= '<a href="tblproperties.php?' . $misc->href . '&table=' . urlencode($c['f_table']) . '&schema=' . urlencode($c['f_schema']) . '"><img src="' . |
||
| 143 | $misc->icon('ForeignKey') . '" alt="[fk]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; |
||
| 144 | |||
| 145 | break; |
||
| 146 | case 'u': |
||
| 147 | $str .= '<a href="constraints.php?' . $misc->href . '&table=' . urlencode($c['p_table']) . '&schema=' . urlencode($c['p_schema']) . '"><img src="' . |
||
| 148 | $misc->icon('UniqueConstraint') . '" alt="[uniq]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; |
||
| 149 | |||
| 150 | break; |
||
| 151 | case 'c': |
||
| 152 | $str .= '<a href="constraints.php?' . $misc->href . '&table=' . urlencode($c['p_table']) . '&schema=' . urlencode($c['p_schema']) . '"><img src="' . |
||
| 153 | $misc->icon('CheckConstraint') . '" alt="[check]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; |
||
| 154 | } |
||
| 155 | } |
||
| 156 | } |
||
| 157 | |||
| 158 | return $str; |
||
| 159 | }; |
||
| 160 | |||
| 161 | $this->printTrail('table'); |
||
| 162 | $this->printTabs('table', 'columns'); |
||
| 163 | $this->printMsg($msg); |
||
| 164 | |||
| 165 | // Get table |
||
| 166 | $tdata = $data->getTable($_REQUEST['table']); |
||
| 167 | // Get columns |
||
| 168 | $attrs = $data->getTableAttributes($_REQUEST['table']); |
||
| 169 | // Get constraints keys |
||
| 170 | $ck = $data->getConstraintsWithFields($_REQUEST['table']); |
||
| 171 | |||
| 172 | // Show comment if any |
||
| 173 | if (null !== $tdata->fields['relcomment']) { |
||
| 174 | echo '<p class="comment">', $misc->printVal($tdata->fields['relcomment']), "</p>\n"; |
||
| 175 | } |
||
| 176 | |||
| 177 | $columns = [ |
||
| 178 | 'column' => [ |
||
| 179 | 'title' => $lang['strcolumn'], |
||
| 180 | 'field' => Decorator::field('attname'), |
||
| 181 | 'url' => "colproperties.php?subject=column&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', |
||
| 182 | 'vars' => ['column' => 'attname'], |
||
| 183 | ], |
||
| 184 | 'type' => [ |
||
| 185 | 'title' => $lang['strtype'], |
||
| 186 | 'field' => Decorator::field('+type'), |
||
| 187 | ], |
||
| 188 | 'notnull' => [ |
||
| 189 | 'title' => $lang['strnotnull'], |
||
| 190 | 'field' => Decorator::field('attnotnull'), |
||
| 191 | 'type' => 'bool', |
||
| 192 | 'params' => ['true' => 'NOT NULL', 'false' => ''], |
||
| 193 | ], |
||
| 194 | 'default' => [ |
||
| 195 | 'title' => $lang['strdefault'], |
||
| 196 | 'field' => Decorator::field('adsrc'), |
||
| 197 | ], |
||
| 198 | 'keyprop' => [ |
||
| 199 | 'title' => $lang['strconstraints'], |
||
| 200 | 'class' => 'constraint_cell', |
||
| 201 | 'field' => Decorator::field('attname'), |
||
| 202 | 'type' => 'callback', |
||
| 203 | 'params' => [ |
||
| 204 | 'function' => $cstrRender, |
||
| 205 | 'keys' => $ck->getArray(), |
||
| 206 | ], |
||
| 207 | ], |
||
| 208 | 'actions' => [ |
||
| 209 | 'title' => $lang['stractions'], |
||
| 210 | ], |
||
| 211 | 'comment' => [ |
||
| 212 | 'title' => $lang['strcomment'], |
||
| 213 | 'field' => Decorator::field('comment'), |
||
| 214 | ], |
||
| 215 | ]; |
||
| 216 | |||
| 217 | $actions = [ |
||
| 218 | 'browse' => [ |
||
| 219 | 'title' => $lang['strbrowse'], |
||
| 220 | 'url' => "display.php?{$misc->href}&subject=column&return=table&table=" . urlencode($_REQUEST['table']) . '&', |
||
| 221 | 'vars' => ['column' => 'attname'], |
||
| 222 | ], |
||
| 223 | 'alter' => [ |
||
| 224 | 'title' => $lang['stralter'], |
||
| 225 | 'url' => "colproperties.php?action=properties&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', |
||
| 226 | 'vars' => ['column' => 'attname'], |
||
| 227 | ], |
||
| 228 | 'privileges' => [ |
||
| 229 | 'title' => $lang['strprivileges'], |
||
| 230 | 'url' => "privileges.php?subject=column&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', |
||
| 231 | 'vars' => ['column' => 'attname'], |
||
| 232 | ], |
||
| 233 | 'drop' => [ |
||
| 234 | 'title' => $lang['strdrop'], |
||
| 235 | 'url' => "tblproperties.php?action=confirm_drop&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', |
||
| 236 | 'vars' => ['column' => 'attname'], |
||
| 237 | ], |
||
| 238 | ]; |
||
| 239 | |||
| 240 | $actions = [ |
||
| 241 | 'browse' => [ |
||
| 242 | 'content' => $lang['strbrowse'], |
||
| 243 | 'attr' => [ |
||
| 244 | 'href' => [ |
||
| 245 | 'url' => 'display.php', |
||
| 246 | 'urlvars' => [ |
||
| 247 | 'table' => $_REQUEST['table'], |
||
| 248 | 'subject' => 'column', |
||
| 249 | 'return' => 'table', |
||
| 250 | 'column' => Decorator::field('attname'), |
||
| 251 | ], |
||
| 252 | ], |
||
| 253 | ], |
||
| 254 | ], |
||
| 255 | 'alter' => [ |
||
| 256 | 'content' => $lang['stralter'], |
||
| 257 | 'attr' => [ |
||
| 258 | 'href' => [ |
||
| 259 | 'url' => 'colproperties.php', |
||
| 260 | 'urlvars' => [ |
||
| 261 | 'subject' => 'column', |
||
| 262 | 'action' => 'properties', |
||
| 263 | 'table' => $_REQUEST['table'], |
||
| 264 | 'column' => Decorator::field('attname'), |
||
| 265 | ], |
||
| 266 | ], |
||
| 267 | ], |
||
| 268 | ], |
||
| 269 | 'privileges' => [ |
||
| 270 | 'content' => $lang['strprivileges'], |
||
| 271 | 'attr' => [ |
||
| 272 | 'href' => [ |
||
| 273 | 'url' => 'privileges.php', |
||
| 274 | 'urlvars' => [ |
||
| 275 | 'subject' => 'column', |
||
| 276 | 'table' => $_REQUEST['table'], |
||
| 277 | 'column' => Decorator::field('attname'), |
||
| 278 | ], |
||
| 279 | ], |
||
| 280 | ], |
||
| 281 | ], |
||
| 282 | 'drop' => [ |
||
| 283 | 'content' => $lang['strdrop'], |
||
| 284 | 'attr' => [ |
||
| 285 | 'href' => [ |
||
| 286 | 'url' => 'tblproperties.php', |
||
| 287 | 'urlvars' => [ |
||
| 288 | 'subject' => 'column', |
||
| 289 | 'action' => 'confirm_drop', |
||
| 290 | 'table' => $_REQUEST['table'], |
||
| 291 | 'column' => Decorator::field('attname'), |
||
| 292 | ], |
||
| 293 | ], |
||
| 294 | ], |
||
| 295 | ], |
||
| 296 | ]; |
||
| 297 | |||
| 298 | echo $this->printTable($attrs, $columns, $actions, 'tblproperties-tblproperties', null, $attPre); |
||
| 299 | |||
| 300 | $navlinks = [ |
||
| 301 | 'browse' => [ |
||
| 302 | 'attr' => [ |
||
| 303 | 'href' => [ |
||
| 304 | 'url' => 'display.php', |
||
| 305 | 'urlvars' => [ |
||
| 306 | 'server' => $_REQUEST['server'], |
||
| 307 | 'database' => $_REQUEST['database'], |
||
| 308 | 'schema' => $_REQUEST['schema'], |
||
| 309 | 'table' => $_REQUEST['table'], |
||
| 310 | 'subject' => 'table', |
||
| 311 | 'return' => 'table', |
||
| 312 | ], |
||
| 313 | ], |
||
| 314 | ], |
||
| 315 | 'content' => $lang['strbrowse'], |
||
| 316 | ], |
||
| 317 | 'select' => [ |
||
| 318 | 'attr' => [ |
||
| 319 | 'href' => [ |
||
| 320 | 'url' => 'tables.php', |
||
| 321 | 'urlvars' => [ |
||
| 322 | 'action' => 'confselectrows', |
||
| 323 | 'server' => $_REQUEST['server'], |
||
| 324 | 'database' => $_REQUEST['database'], |
||
| 325 | 'schema' => $_REQUEST['schema'], |
||
| 326 | 'table' => $_REQUEST['table'], |
||
| 327 | ], |
||
| 328 | ], |
||
| 329 | ], |
||
| 330 | 'content' => $lang['strselect'], |
||
| 331 | ], |
||
| 332 | 'insert' => [ |
||
| 333 | 'attr' => [ |
||
| 334 | 'href' => [ |
||
| 335 | 'url' => 'tables.php', |
||
| 336 | 'urlvars' => [ |
||
| 337 | 'action' => 'confinsertrow', |
||
| 338 | 'server' => $_REQUEST['server'], |
||
| 339 | 'database' => $_REQUEST['database'], |
||
| 340 | 'schema' => $_REQUEST['schema'], |
||
| 341 | 'table' => $_REQUEST['table'], |
||
| 342 | ], |
||
| 343 | ], |
||
| 344 | ], |
||
| 345 | 'content' => $lang['strinsert'], |
||
| 346 | ], |
||
| 347 | 'empty' => [ |
||
| 348 | 'attr' => [ |
||
| 349 | 'href' => [ |
||
| 350 | 'url' => 'tables.php', |
||
| 351 | 'urlvars' => [ |
||
| 352 | 'action' => 'confirm_empty', |
||
| 353 | 'server' => $_REQUEST['server'], |
||
| 354 | 'database' => $_REQUEST['database'], |
||
| 355 | 'schema' => $_REQUEST['schema'], |
||
| 356 | 'table' => $_REQUEST['table'], |
||
| 357 | ], |
||
| 358 | ], |
||
| 359 | ], |
||
| 360 | 'content' => $lang['strempty'], |
||
| 361 | ], |
||
| 362 | 'drop' => [ |
||
| 363 | 'attr' => [ |
||
| 364 | 'href' => [ |
||
| 365 | 'url' => 'tables.php', |
||
| 366 | 'urlvars' => [ |
||
| 367 | 'action' => 'confirm_drop', |
||
| 368 | 'server' => $_REQUEST['server'], |
||
| 369 | 'database' => $_REQUEST['database'], |
||
| 370 | 'schema' => $_REQUEST['schema'], |
||
| 371 | 'table' => $_REQUEST['table'], |
||
| 372 | ], |
||
| 373 | ], |
||
| 374 | ], |
||
| 375 | 'content' => $lang['strdrop'], |
||
| 376 | ], |
||
| 377 | 'addcolumn' => [ |
||
| 378 | 'attr' => [ |
||
| 379 | 'href' => [ |
||
| 380 | 'url' => 'tblproperties.php', |
||
| 381 | 'urlvars' => [ |
||
| 382 | 'action' => 'add_column', |
||
| 383 | 'server' => $_REQUEST['server'], |
||
| 384 | 'database' => $_REQUEST['database'], |
||
| 385 | 'schema' => $_REQUEST['schema'], |
||
| 386 | 'table' => $_REQUEST['table'], |
||
| 387 | ], |
||
| 388 | ], |
||
| 389 | ], |
||
| 390 | 'content' => $lang['straddcolumn'], |
||
| 391 | ], |
||
| 392 | 'alter' => [ |
||
| 393 | 'attr' => [ |
||
| 394 | 'href' => [ |
||
| 395 | 'url' => 'tblproperties.php', |
||
| 396 | 'urlvars' => [ |
||
| 397 | 'action' => 'confirm_alter', |
||
| 398 | 'server' => $_REQUEST['server'], |
||
| 399 | 'database' => $_REQUEST['database'], |
||
| 400 | 'schema' => $_REQUEST['schema'], |
||
| 401 | 'table' => $_REQUEST['table'], |
||
| 402 | ], |
||
| 403 | ], |
||
| 404 | ], |
||
| 405 | 'content' => $lang['stralter'], |
||
| 406 | ], |
||
| 407 | ]; |
||
| 408 | $this->printNavLinks($navlinks, 'tblproperties-tblproperties', get_defined_vars()); |
||
| 409 | } |
||
| 410 | |||
| 411 | public function doTree() |
||
| 412 | { |
||
| 413 | $misc = $this->misc; |
||
| 414 | $lang = $this->lang; |
||
| 415 | $data = $misc->getDatabaseAccessor(); |
||
| 416 | |||
| 417 | $columns = $data->getTableAttributes($_REQUEST['table']); |
||
| 418 | $reqvars = $misc->getRequestVars('column'); |
||
| 419 | |||
| 420 | $attrs = [ |
||
| 421 | 'text' => Decorator::field('attname'), |
||
| 422 | 'action' => Decorator::actionurl( |
||
| 423 | 'colproperties.php', |
||
| 424 | $reqvars, |
||
| 425 | [ |
||
| 426 | 'table' => $_REQUEST['table'], |
||
| 427 | 'column' => Decorator::field('attname'), |
||
| 428 | ] |
||
| 429 | ), |
||
| 430 | 'icon' => 'Column', |
||
| 431 | 'iconAction' => Decorator::url( |
||
| 432 | 'display.php', |
||
| 433 | $reqvars, |
||
| 434 | [ |
||
| 435 | 'table' => $_REQUEST['table'], |
||
| 436 | 'column' => Decorator::field('attname'), |
||
| 437 | 'query' => Decorator::replace( |
||
| 438 | 'SELECT "%column%", count(*) AS "count" FROM "%table%" GROUP BY "%column%" ORDER BY "%column%"', |
||
| 439 | [ |
||
| 440 | '%column%' => Decorator::field('attname'), |
||
| 441 | '%table%' => $_REQUEST['table'], |
||
| 442 | ] |
||
| 443 | ), |
||
| 444 | ] |
||
| 445 | ), |
||
| 446 | 'toolTip' => Decorator::field('comment'), |
||
| 447 | ]; |
||
| 448 | |||
| 449 | return $this->printTree($columns, $attrs, 'tblcolumns'); |
||
| 450 | } |
||
| 451 | |||
| 452 | public function doSaveAlter() |
||
| 453 | { |
||
| 454 | $misc = $this->misc; |
||
| 455 | $lang = $this->lang; |
||
| 456 | $data = $misc->getDatabaseAccessor(); |
||
| 457 | |||
| 458 | // For databases that don't allow owner change |
||
| 459 | if (!isset($_POST['owner'])) { |
||
| 460 | $_POST['owner'] = ''; |
||
| 461 | } |
||
| 462 | |||
| 463 | // Default tablespace to null if it isn't set |
||
| 464 | if (!isset($_POST['tablespace'])) { |
||
| 465 | $_POST['tablespace'] = null; |
||
| 466 | } |
||
| 467 | |||
| 468 | if (!isset($_POST['newschema'])) { |
||
| 469 | $_POST['newschema'] = null; |
||
| 470 | } |
||
| 471 | |||
| 472 | $status = $data->alterTable($_POST['table'], $_POST['name'], $_POST['owner'], $_POST['newschema'], $_POST['comment'], $_POST['tablespace']); |
||
| 473 | if (0 == $status) { |
||
| 474 | // If table has been renamed, need to change to the new name and |
||
| 475 | // reload the browser frame. |
||
| 476 | if ($_POST['table'] != $_POST['name']) { |
||
| 477 | // Jump them to the new table name |
||
| 478 | $_REQUEST['table'] = $_POST['name']; |
||
| 479 | // Force a browser reload |
||
| 480 | $misc->setReloadBrowser(true); |
||
| 481 | } |
||
| 482 | // If schema has changed, need to change to the new schema and reload the browser |
||
| 483 | if (!empty($_POST['newschema']) && ($_POST['newschema'] != $data->_schema)) { |
||
| 484 | // Jump them to the new sequence schema |
||
| 485 | $misc->setCurrentSchema($_POST['newschema']); |
||
| 486 | $misc->setReloadBrowser(true); |
||
| 487 | } |
||
| 488 | $this->doDefault($lang['strtablealtered']); |
||
| 489 | } else { |
||
| 490 | $this->doAlter($lang['strtablealteredbad']); |
||
| 491 | } |
||
| 492 | } |
||
| 493 | |||
| 494 | /** |
||
| 495 | * Function to allow altering of a table. |
||
| 496 | * |
||
| 497 | * @param mixed $msg |
||
|
1 ignored issue
–
show
|
|||
| 498 | */ |
||
| 499 | public function doAlter($msg = '') |
||
| 500 | { |
||
| 501 | $misc = $this->misc; |
||
| 502 | $lang = $this->lang; |
||
| 503 | $data = $misc->getDatabaseAccessor(); |
||
| 504 | |||
| 505 | $this->printTrail('table'); |
||
| 506 | $this->printTitle($lang['stralter'], 'pg.table.alter'); |
||
| 507 | $this->printMsg($msg); |
||
| 508 | |||
| 509 | // Fetch table info |
||
| 510 | $table = $data->getTable($_REQUEST['table']); |
||
| 511 | // Fetch all users |
||
| 512 | $users = $data->getUsers(); |
||
| 513 | // Fetch all tablespaces from the database |
||
| 514 | if ($data->hasTablespaces()) { |
||
| 515 | $tablespaces = $data->getTablespaces(true); |
||
| 516 | } |
||
| 517 | |||
| 518 | if ($table->recordCount() > 0) { |
||
| 519 | if (!isset($_POST['name'])) { |
||
| 520 | $_POST['name'] = $table->fields['relname']; |
||
| 521 | } |
||
| 522 | |||
| 523 | if (!isset($_POST['owner'])) { |
||
| 524 | $_POST['owner'] = $table->fields['relowner']; |
||
| 525 | } |
||
| 526 | |||
| 527 | if (!isset($_POST['newschema'])) { |
||
| 528 | $_POST['newschema'] = $table->fields['nspname']; |
||
| 529 | } |
||
| 530 | |||
| 531 | if (!isset($_POST['comment'])) { |
||
| 532 | $_POST['comment'] = $table->fields['relcomment']; |
||
| 533 | } |
||
| 534 | |||
| 535 | if ($data->hasTablespaces() && !isset($_POST['tablespace'])) { |
||
| 536 | $_POST['tablespace'] = $table->fields['tablespace']; |
||
| 537 | } |
||
| 538 | |||
| 539 | echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; |
||
| 540 | echo "<table>\n"; |
||
| 541 | echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; |
||
| 542 | echo '<td class="data1">'; |
||
| 543 | echo "<input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", |
||
| 544 | htmlspecialchars($_POST['name'], ENT_QUOTES), "\" /></td></tr>\n"; |
||
| 545 | |||
| 546 | if ($data->isSuperUser()) { |
||
| 547 | echo "<tr><th class=\"data left required\">{$lang['strowner']}</th>\n"; |
||
| 548 | echo '<td class="data1"><select name="owner">'; |
||
| 549 | while (!$users->EOF) { |
||
| 550 | $uname = $users->fields['usename']; |
||
| 551 | echo '<option value="', htmlspecialchars($uname), '"', |
||
| 552 | ($uname == $_POST['owner']) ? ' selected="selected"' : '', '>', htmlspecialchars($uname), "</option>\n"; |
||
| 553 | $users->moveNext(); |
||
| 554 | } |
||
| 555 | echo "</select></td></tr>\n"; |
||
| 556 | } |
||
| 557 | |||
| 558 | if ($data->hasAlterTableSchema()) { |
||
| 559 | $schemas = $data->getSchemas(); |
||
| 560 | echo "<tr><th class=\"data left required\">{$lang['strschema']}</th>\n"; |
||
| 561 | echo '<td class="data1"><select name="newschema">'; |
||
| 562 | while (!$schemas->EOF) { |
||
| 563 | $schema = $schemas->fields['nspname']; |
||
| 564 | echo '<option value="', htmlspecialchars($schema), '"', |
||
| 565 | ($schema == $_POST['newschema']) ? ' selected="selected"' : '', '>', htmlspecialchars($schema), "</option>\n"; |
||
| 566 | $schemas->moveNext(); |
||
| 567 | } |
||
| 568 | echo "</select></td></tr>\n"; |
||
| 569 | } |
||
| 570 | |||
| 571 | // Tablespace (if there are any) |
||
| 572 | if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) { |
||
| 573 | echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strtablespace']}</th>\n"; |
||
| 574 | echo "\t\t<td class=\"data1\">\n\t\t\t<select name=\"tablespace\">\n"; |
||
| 575 | // Always offer the default (empty) option |
||
| 576 | echo "\t\t\t\t<option value=\"\"", |
||
| 577 | ('' == $_POST['tablespace']) ? ' selected="selected"' : '', "></option>\n"; |
||
| 578 | // Display all other tablespaces |
||
| 579 | while (!$tablespaces->EOF) { |
||
| 580 | $spcname = htmlspecialchars($tablespaces->fields['spcname']); |
||
| 581 | echo "\t\t\t\t<option value=\"{$spcname}\"", |
||
| 582 | ($spcname == $_POST['tablespace']) ? ' selected="selected"' : '', ">{$spcname}</option>\n"; |
||
| 583 | $tablespaces->moveNext(); |
||
| 584 | } |
||
| 585 | echo "\t\t\t</select>\n\t\t</td>\n\t</tr>\n"; |
||
| 586 | } |
||
| 587 | |||
| 588 | echo "<tr><th class=\"data left\">{$lang['strcomment']}</th>\n"; |
||
| 589 | echo '<td class="data1">'; |
||
| 590 | echo '<textarea rows="3" cols="32" name="comment">', |
||
| 591 | htmlspecialchars($_POST['comment']), "</textarea></td></tr>\n"; |
||
| 592 | echo "</table>\n"; |
||
| 593 | echo "<p><input type=\"hidden\" name=\"action\" value=\"alter\" />\n"; |
||
| 594 | echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; |
||
| 595 | echo $misc->form; |
||
| 596 | echo "<input type=\"submit\" name=\"alter\" value=\"{$lang['stralter']}\" />\n"; |
||
| 597 | echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n"; |
||
| 598 | echo "</form>\n"; |
||
| 599 | } else { |
||
| 600 | echo "<p>{$lang['strnodata']}</p>\n"; |
||
| 601 | } |
||
| 602 | } |
||
| 603 | |||
| 604 | public function doExport($msg = '') |
||
| 605 | { |
||
| 606 | $misc = $this->misc; |
||
| 607 | $lang = $this->lang; |
||
| 608 | $data = $misc->getDatabaseAccessor(); |
||
| 609 | |||
| 610 | // Determine whether or not the table has an object ID |
||
| 611 | $hasID = $data->hasObjectID($_REQUEST['table']); |
||
| 612 | |||
| 613 | $this->printTrail('table'); |
||
| 614 | $this->printTabs('table', 'export'); |
||
| 615 | $this->printMsg($msg); |
||
| 616 | |||
| 617 | echo '<form action="' . \SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; |
||
| 618 | echo "<table>\n"; |
||
| 619 | echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; |
||
| 620 | // Data only |
||
| 621 | echo '<tr><th class="data left" rowspan="', ($hasID) ? 2 : 1, '">'; |
||
| 622 | echo "<input type=\"radio\" id=\"what1\" name=\"what\" value=\"dataonly\" checked=\"checked\" /><label for=\"what1\">{$lang['strdataonly']}</label></th>\n"; |
||
| 623 | echo "<td>{$lang['strformat']}</td>\n"; |
||
| 624 | echo "<td><select name=\"d_format\">\n"; |
||
| 625 | echo "<option value=\"copy\">COPY</option>\n"; |
||
| 626 | echo "<option value=\"sql\">SQL</option>\n"; |
||
| 627 | echo "<option value=\"csv\">CSV</option>\n"; |
||
| 628 | echo "<option value=\"tab\">{$lang['strtabbed']}</option>\n"; |
||
| 629 | echo "<option value=\"html\">XHTML</option>\n"; |
||
| 630 | echo "<option value=\"xml\">XML</option>\n"; |
||
| 631 | echo "</select>\n</td>\n</tr>\n"; |
||
| 632 | if ($hasID) { |
||
| 633 | echo "<tr><td><label for=\"d_oids\">{$lang['stroids']}</td><td><input type=\"checkbox\" id=\"d_oids\" name=\"d_oids\" /></td>\n</tr>\n"; |
||
| 634 | } |
||
| 635 | // Structure only |
||
| 636 | echo "<tr><th class=\"data left\"><input type=\"radio\" id=\"what2\" name=\"what\" value=\"structureonly\" /><label for=\"what2\">{$lang['strstructureonly']}</label></th>\n"; |
||
| 637 | echo "<td><label for=\"s_clean\">{$lang['strdrop']}</label></td><td><input type=\"checkbox\" id=\"s_clean\" name=\"s_clean\" /></td>\n</tr>\n"; |
||
| 638 | // Structure and data |
||
| 639 | echo '<tr><th class="data left" rowspan="', ($hasID) ? 3 : 2, '">'; |
||
| 640 | echo "<input type=\"radio\" id=\"what3\" name=\"what\" value=\"structureanddata\" /><label for=\"what3\">{$lang['strstructureanddata']}</label></th>\n"; |
||
| 641 | echo "<td>{$lang['strformat']}</td>\n"; |
||
| 642 | echo "<td><select name=\"sd_format\">\n"; |
||
| 643 | echo "<option value=\"copy\">COPY</option>\n"; |
||
| 644 | echo "<option value=\"sql\">SQL</option>\n"; |
||
| 645 | echo "</select>\n</td>\n</tr>\n"; |
||
| 646 | 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"; |
||
| 647 | if ($hasID) { |
||
| 648 | 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"; |
||
| 649 | } |
||
| 650 | echo "</table>\n"; |
||
| 651 | |||
| 652 | echo "<h3>{$lang['stroptions']}</h3>\n"; |
||
| 653 | echo "<p><input type=\"radio\" id=\"output1\" name=\"output\" value=\"show\" checked=\"checked\" /><label for=\"output1\">{$lang['strshow']}</label>\n"; |
||
| 654 | echo "<br/><input type=\"radio\" id=\"output2\" name=\"output\" value=\"download\" /><label for=\"output2\">{$lang['strdownload']}</label></p>\n"; |
||
| 655 | |||
| 656 | echo "<p><input type=\"hidden\" name=\"action\" value=\"export\" />\n"; |
||
| 657 | echo $misc->form; |
||
| 658 | echo "<input type=\"hidden\" name=\"subject\" value=\"table\" />\n"; |
||
| 659 | echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; |
||
| 660 | echo "<input type=\"submit\" value=\"{$lang['strexport']}\" /></p>\n"; |
||
| 661 | echo "</form>\n"; |
||
| 662 | } |
||
| 663 | |||
| 664 | public function doImport($msg = '') |
||
| 665 | { |
||
| 666 | $misc = $this->misc; |
||
| 667 | $lang = $this->lang; |
||
| 668 | $data = $misc->getDatabaseAccessor(); |
||
| 669 | |||
| 670 | $this->printTrail('table'); |
||
| 671 | $this->printTabs('table', 'import'); |
||
| 672 | $this->printMsg($msg); |
||
| 673 | |||
| 674 | // Check that file uploads are enabled |
||
| 675 | if (ini_get('file_uploads')) { |
||
| 676 | // Don't show upload option if max size of uploads is zero |
||
| 677 | $max_size = $misc->inisizeToBytes(ini_get('upload_max_filesize')); |
||
| 678 | if (is_double($max_size) && $max_size > 0) { |
||
| 679 | echo '<form action="' . \SUBFOLDER . "/src/views/dataimport.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; |
||
| 680 | echo "<table>\n"; |
||
| 681 | echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strformat']}</th>\n"; |
||
| 682 | echo "\t\t<td><select name=\"format\">\n"; |
||
| 683 | echo "\t\t\t<option value=\"auto\">{$lang['strauto']}</option>\n"; |
||
| 684 | echo "\t\t\t<option value=\"csv\">CSV</option>\n"; |
||
| 685 | echo "\t\t\t<option value=\"tab\">{$lang['strtabbed']}</option>\n"; |
||
| 686 | if (function_exists('xml_parser_create')) { |
||
| 687 | echo "\t\t\t<option value=\"xml\">XML</option>\n"; |
||
| 688 | } |
||
| 689 | echo "\t\t</select></td>\n\t</tr>\n"; |
||
| 690 | echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strallowednulls']}</th>\n"; |
||
| 691 | echo "\t\t<td><label><input type=\"checkbox\" name=\"allowednulls[0]\" value=\"\\N\" checked=\"checked\" />{$lang['strbackslashn']}</label><br />\n"; |
||
| 692 | echo "\t\t<label><input type=\"checkbox\" name=\"allowednulls[1]\" value=\"NULL\" />NULL</label><br />\n"; |
||
| 693 | echo "\t\t<label><input type=\"checkbox\" name=\"allowednulls[2]\" value=\"\" />{$lang['stremptystring']}</label></td>\n\t</tr>\n"; |
||
| 694 | echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strfile']}</th>\n"; |
||
| 695 | echo "\t\t<td><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$max_size}\" />"; |
||
| 696 | echo "<input type=\"file\" name=\"source\" /></td>\n\t</tr>\n"; |
||
| 697 | echo "</table>\n"; |
||
| 698 | echo "<p><input type=\"hidden\" name=\"action\" value=\"import\" />\n"; |
||
| 699 | echo $misc->form; |
||
| 700 | echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; |
||
| 701 | echo "<input type=\"submit\" value=\"{$lang['strimport']}\" /></p>\n"; |
||
| 702 | echo "</form>\n"; |
||
| 703 | } |
||
| 704 | } else { |
||
| 705 | echo "<p>{$lang['strnouploads']}</p>\n"; |
||
| 706 | } |
||
| 707 | } |
||
| 708 | |||
| 709 | /** |
||
| 710 | * Displays a screen where they can add a column. |
||
| 711 | * |
||
| 712 | * @param mixed $msg |
||
|
1 ignored issue
–
show
|
|||
| 713 | */ |
||
| 714 | public function doAddColumn($msg = '') |
||
| 715 | { |
||
| 716 | $misc = $this->misc; |
||
| 717 | $lang = $this->lang; |
||
| 718 | $data = $misc->getDatabaseAccessor(); |
||
| 719 | |||
| 720 | if (!isset($_REQUEST['stage'])) { |
||
| 721 | $_REQUEST['stage'] = 1; |
||
| 722 | } |
||
| 723 | |||
| 724 | switch ($_REQUEST['stage']) { |
||
| 725 | case 1: |
||
| 726 | // Set variable defaults |
||
| 727 | if (!isset($_POST['field'])) { |
||
| 728 | $_POST['field'] = ''; |
||
| 729 | } |
||
| 730 | |||
| 731 | if (!isset($_POST['type'])) { |
||
| 732 | $_POST['type'] = ''; |
||
| 733 | } |
||
| 734 | |||
| 735 | if (!isset($_POST['array'])) { |
||
| 736 | $_POST['array'] = ''; |
||
| 737 | } |
||
| 738 | |||
| 739 | if (!isset($_POST['length'])) { |
||
| 740 | $_POST['length'] = ''; |
||
| 741 | } |
||
| 742 | |||
| 743 | if (!isset($_POST['default'])) { |
||
| 744 | $_POST['default'] = ''; |
||
| 745 | } |
||
| 746 | |||
| 747 | if (!isset($_POST['comment'])) { |
||
| 748 | $_POST['comment'] = ''; |
||
| 749 | } |
||
| 750 | |||
| 751 | // Fetch all available types |
||
| 752 | $types = $data->getTypes(true, false, true); |
||
| 753 | $types_for_js = []; |
||
| 754 | |||
| 755 | $this->printTrail('table'); |
||
| 756 | $this->printTitle($lang['straddcolumn'], 'pg.column.add'); |
||
| 757 | $this->printMsg($msg); |
||
| 758 | |||
| 759 | echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; |
||
| 760 | echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; |
||
| 761 | |||
| 762 | // Output table header |
||
| 763 | echo "<table>\n"; |
||
| 764 | echo "<tr><th class=\"data required\">{$lang['strname']}</th>\n<th colspan=\"2\" class=\"data required\">{$lang['strtype']}</th>\n"; |
||
| 765 | echo "<th class=\"data\">{$lang['strlength']}</th>\n"; |
||
| 766 | if ($data->hasCreateFieldWithConstraints()) { |
||
| 767 | echo "<th class=\"data\">{$lang['strnotnull']}</th>\n<th class=\"data\">{$lang['strdefault']}</th>\n"; |
||
| 768 | } |
||
| 769 | |||
| 770 | echo "<th class=\"data\">{$lang['strcomment']}</th></tr>\n"; |
||
| 771 | |||
| 772 | echo "<tr><td><input name=\"field\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"", |
||
| 773 | htmlspecialchars($_POST['field']), "\" /></td>\n"; |
||
| 774 | echo "<td><select class=\"select2\" name=\"type\" id=\"type\" onchange=\"checkLengths(document.getElementById('type').value,'');\">\n"; |
||
| 775 | // Output any "magic" types. This came in with the alter column type so we'll check that |
||
| 776 | if ($data->hasMagicTypes()) { |
||
| 777 | foreach ($data->extraTypes as $v) { |
||
| 778 | $types_for_js[] = strtolower($v); |
||
| 779 | echo "\t<option value=\"", htmlspecialchars($v), '"', |
||
| 780 | ($v == $_POST['type']) ? ' selected="selected"' : '', '>', |
||
| 781 | $misc->printVal($v), "</option>\n"; |
||
| 782 | } |
||
| 783 | } |
||
| 784 | while (!$types->EOF) { |
||
| 785 | $typname = $types->fields['typname']; |
||
| 786 | $types_for_js[] = $typname; |
||
| 787 | echo "\t<option value=\"", htmlspecialchars($typname), '"', ($typname == $_POST['type']) ? ' selected="selected"' : '', '>', |
||
| 788 | $misc->printVal($typname), "</option>\n"; |
||
| 789 | $types->moveNext(); |
||
| 790 | } |
||
| 791 | echo "</select></td>\n"; |
||
| 792 | |||
| 793 | // Output array type selector |
||
| 794 | echo "<td><select name=\"array\">\n"; |
||
| 795 | echo "\t<option value=\"\"", ('' == $_POST['array']) ? ' selected="selected"' : '', "></option>\n"; |
||
| 796 | echo "\t<option value=\"[]\"", ('[]' == $_POST['array']) ? ' selected="selected"' : '', ">[ ]</option>\n"; |
||
| 797 | echo "</select></td>\n"; |
||
| 798 | $predefined_size_types = array_intersect($data->predefined_size_types, $types_for_js); |
||
| 799 | $escaped_predef_types = []; // the JS escaped array elements |
||
| 800 | foreach ($predefined_size_types as $value) { |
||
| 801 | $escaped_predef_types[] = "'{$value}'"; |
||
| 802 | } |
||
| 803 | |||
| 804 | echo '<td><input name="length" id="lengths" size="8" value="', |
||
| 805 | htmlspecialchars($_POST['length']), "\" /></td>\n"; |
||
| 806 | // Support for adding column with not null and default |
||
| 807 | if ($data->hasCreateFieldWithConstraints()) { |
||
| 808 | echo '<td><input type="checkbox" name="notnull"', |
||
| 809 | (isset($_REQUEST['notnull'])) ? ' checked="checked"' : '', " /></td>\n"; |
||
| 810 | echo '<td><input name="default" size="20" value="', |
||
| 811 | htmlspecialchars($_POST['default']), "\" /></td>\n"; |
||
| 812 | } |
||
| 813 | echo '<td><input name="comment" size="40" value="', |
||
| 814 | htmlspecialchars($_POST['comment']), "\" /></td></tr>\n"; |
||
| 815 | echo "</table>\n"; |
||
| 816 | echo "<p><input type=\"hidden\" name=\"action\" value=\"add_column\" />\n"; |
||
| 817 | echo "<input type=\"hidden\" name=\"stage\" value=\"2\" />\n"; |
||
| 818 | echo $misc->form; |
||
| 819 | echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; |
||
| 820 | if (!$data->hasCreateFieldWithConstraints()) { |
||
| 821 | echo "<input type=\"hidden\" name=\"default\" value=\"\" />\n"; |
||
| 822 | } |
||
| 823 | echo "<input type=\"submit\" value=\"{$lang['stradd']}\" />\n"; |
||
| 824 | echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n"; |
||
| 825 | echo "</form>\n"; |
||
| 826 | echo '<script type="text/javascript">predefined_lengths = new Array(' . implode(',', $escaped_predef_types) . ");checkLengths(document.getElementById('type').value,'');</script>\n"; |
||
| 827 | |||
| 828 | break; |
||
| 829 | case 2: |
||
| 830 | // Check inputs |
||
| 831 | if ('' == trim($_POST['field'])) { |
||
| 832 | $_REQUEST['stage'] = 1; |
||
| 833 | $this->doAddColumn($lang['strcolneedsname']); |
||
| 834 | |||
| 835 | return; |
||
| 836 | } |
||
| 837 | if (!isset($_POST['length'])) { |
||
| 838 | $_POST['length'] = ''; |
||
| 839 | } |
||
| 840 | |||
| 841 | $status = $data->addColumn( |
||
| 842 | $_POST['table'], |
||
| 843 | $_POST['field'], |
||
| 844 | $_POST['type'], |
||
| 845 | '' != $_POST['array'], |
||
| 846 | $_POST['length'], |
||
| 847 | isset($_POST['notnull']), |
||
| 848 | $_POST['default'], |
||
| 849 | $_POST['comment'] |
||
| 850 | ); |
||
| 851 | if (0 == $status) { |
||
| 852 | $misc->setReloadBrowser(true); |
||
| 853 | $this->doDefault($lang['strcolumnadded']); |
||
| 854 | } else { |
||
| 855 | $_REQUEST['stage'] = 1; |
||
| 856 | $this->doAddColumn($lang['strcolumnaddedbad']); |
||
| 857 | |||
| 858 | return; |
||
| 859 | } |
||
| 860 | |||
| 861 | break; |
||
| 862 | default: |
||
| 863 | echo "<p>{$lang['strinvalidparam']}</p>\n"; |
||
| 864 | } |
||
| 865 | } |
||
| 866 | |||
| 867 | /** |
||
| 868 | * Show confirmation of drop column and perform actual drop. |
||
| 869 | * |
||
| 870 | * @param mixed $confirm |
||
|
1 ignored issue
–
show
|
|||
| 871 | */ |
||
| 872 | public function doDrop($confirm) |
||
| 873 | { |
||
| 874 | $misc = $this->misc; |
||
| 875 | $lang = $this->lang; |
||
| 876 | $data = $misc->getDatabaseAccessor(); |
||
| 877 | |||
| 878 | if ($confirm) { |
||
| 879 | $this->printTrail('column'); |
||
| 880 | $this->printTitle($lang['strdrop'], 'pg.column.drop'); |
||
| 881 | |||
| 882 | echo '<p>', sprintf( |
||
| 883 | $lang['strconfdropcolumn'], |
||
| 884 | $misc->printVal($_REQUEST['column']), |
||
| 885 | $misc->printVal($_REQUEST['table']) |
||
| 886 | ), "</p>\n"; |
||
| 887 | |||
| 888 | echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; |
||
| 889 | echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; |
||
| 890 | echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; |
||
| 891 | echo '<input type="hidden" name="column" value="', htmlspecialchars($_REQUEST['column']), "\" />\n"; |
||
| 892 | echo $misc->form; |
||
| 893 | echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\"> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n"; |
||
| 894 | echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n"; |
||
| 895 | echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n"; |
||
| 896 | echo "</form>\n"; |
||
| 897 | } else { |
||
| 898 | $status = $data->dropColumn($_POST['table'], $_POST['column'], isset($_POST['cascade'])); |
||
| 899 | if (0 == $status) { |
||
| 900 | $misc->setReloadBrowser(true); |
||
| 901 | $this->doDefault($lang['strcolumndropped']); |
||
| 902 | } else { |
||
| 903 | $this->doDefault($lang['strcolumndroppedbad']); |
||
| 904 | } |
||
| 905 | } |
||
| 906 | } |
||
| 907 | } |
||
| 908 |