选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
alterTable($_POST['table'], $_POST['name'], $_POST['owner'], $_POST['comment'], $_POST['tablespace']); if ($status == 0) { // If table has been renamed, need to change to the new name and // reload the browser frame. if ($_POST['table'] != $_POST['name']) { // Jump them to the new table name $_REQUEST['table'] = $_POST['name']; // Force a browser reload $_reload_browser = true; } doDefault($lang['strtablealtered']); } else doAlter($lang['strtablealteredbad']); } /** * Function to allow altering of a table */ function doAlter($msg = '') { global $data, $misc; global $PHP_SELF, $lang; $misc->printTrail('table'); $misc->printTitle($lang['stralter'], 'pg.table.alter'); $misc->printMsg($msg); // Fetch table info $table = $data->getTable($_REQUEST['table']); // Fetch all users $users = $data->getUsers(); // Fetch all tablespaces from the database if ($data->hasTablespaces()) $tablespaces = $data->getTablespaces(true); if ($table->recordCount() > 0) { if (!isset($_POST['name'])) $_POST['name'] = $table->f['relname']; if (!isset($_POST['owner'])) $_POST['owner'] = $table->f['relowner']; if (!isset($_POST['comment'])) $_POST['comment'] = $table->f['relcomment']; if ($data->hasTablespaces() && !isset($_POST['tablespace'])) $_POST['tablespace'] = $table->f['tablespace']; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; $server_info = $misc->getServerInfo(); if ($data->hasAlterTableOwner() && $data->isSuperUser($server_info['username'])) { echo "\n"; echo "\n"; } // Tablespace (if there are any) if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) { echo "\t\n\t\t\n"; echo "\t\t\n\t\n"; } echo "\n"; echo "\n"; echo "
{$lang['strname']}"; echo "_maxNameLen}\" value=\"", htmlspecialchars($_POST['name']), "\" />
{$lang['strowner']}
{$lang['strtablespace']}\n\t\t\t\n\t\t
{$lang['strcomment']}"; echo "
\n"; echo "

\n"; echo "\n"; echo $misc->form; echo "\n"; echo "

\n"; echo "
\n"; } else echo "

{$lang['strnodata']}

\n"; } function doExport($msg = '') { global $data, $misc; global $PHP_SELF, $lang; // Determine whether or not the table has an object ID $hasID = $data->hasObjectID($_REQUEST['table']); $misc->printTrail('table'); $misc->printTabs('table','export'); $misc->printMsg($msg); echo "
\n"; echo "\n"; echo "\n"; // Data only echo "\n"; echo "\n"; echo "\n\n"; if ($hasID) { echo "\n\n"; } // Structure only echo "\n"; echo "\n\n"; // Structure and data echo "\n"; echo "\n"; echo "\n\n"; echo "\n\n"; if ($hasID) { echo "\n\n"; } echo "
{$lang['strformat']}{$lang['stroptions']}
"; echo "{$lang['strformat']}\n
"; echo "{$lang['strformat']}\n
\n"; echo "

{$lang['stroptions']}

\n"; echo "

\n"; echo "

\n"; echo "

\n"; echo $misc->form; echo "\n"; echo "\n"; echo "

\n"; echo "
\n"; } function doImport($msg = '') { global $data, $misc; global $PHP_SELF, $lang; $misc->printTrail('table'); $misc->printTabs('table','import'); $misc->printMsg($msg); // Check that file uploads are enabled if (ini_get('file_uploads')) { // Don't show upload option if max size of uploads is zero $max_size = $misc->inisizeToBytes(ini_get('upload_max_filesize')); if (is_double($max_size) && $max_size > 0) { echo "
\n"; echo "\n"; echo ""; echo "\n\n"; echo ""; echo "\n\n"; echo ""; echo "
{$lang['strformat']}\n
{$lang['strallowednulls']}\n
{$lang['strfile']}\n"; echo "\n"; echo "
\n"; echo "

\n"; echo $misc->form; echo "\n"; echo "

\n"; echo "
\n"; } } else echo "

{$lang['strnouploads']}

\n"; } /** * Displays a screen where they can add a column */ function doAddColumn($msg = '') { global $data, $misc, $_reload_browser; global $PHP_SELF, $lang; if (!isset($_REQUEST['stage'])) $_REQUEST['stage'] = 1; switch ($_REQUEST['stage']) { case 1: global $lang; // Set variable defaults if (!isset($_POST['field'])) $_POST['field'] = ''; if (!isset($_POST['type'])) $_POST['type'] = ''; if (!isset($_POST['array'])) $_POST['array'] = ''; if (!isset($_POST['length'])) $_POST['length'] = ''; if (!isset($_POST['default'])) $_POST['default'] = ''; if (!isset($_POST['comment'])) $_POST['comment'] = ''; // Fetch all available types $types = $data->getTypes(true, false, true); $types_for_js = array(); $misc->printTrail('table'); $misc->printTitle($lang['straddcolumn'], 'pg.column.add'); $misc->printMsg($msg); echo ""; echo "
\n"; // Output table header echo "\n"; echo ""; echo ""; if ($data->hasAlterColumnType()) echo ""; echo ""; echo ""; echo ""; // Output array type selector echo "\n"; echo ""; // Support for adding column with not null and default if ($data->hasAlterColumnType()) { echo "\n"; echo ""; } else { echo "\n"; } echo ""; echo "
{$lang['strcolumn']}{$lang['strtype']}{$lang['strlength']}{$lang['strnotnull']}{$lang['strdefault']}{$lang['strcomment']}
_maxNameLen}\" value=\"", htmlspecialchars($_POST['field']), "\" />"; $predefined_size_types = array_intersect($data->predefined_size_types,array_keys($types_for_js)); $escaped_predef_types = array(); // the JS escaped array elements foreach($predefined_size_types as $value) { $escaped_predef_types[] = "'{$value}'"; } echo "\t
\n"; echo "\n"; echo "\n"; echo $misc->form; echo "\n"; echo "

\n"; echo "

\n"; echo "
\n"; echo "\n"; break; case 2: global $data, $lang; // Check inputs if (trim($_POST['field']) == '') { $_REQUEST['stage'] = 1; doAddColumn($lang['strcolneedsname']); return; } $status = $data->addColumn($_POST['table'], $_POST['field'], $_POST['type'], $_POST['array'] != '', $_POST['length'], isset($_POST['notnull']), $_POST['default'], $_POST['comment']); if ($status == 0) { $_reload_browser = true; doDefault($lang['strcolumnadded']); } else { $_REQUEST['stage'] = 1; doAddColumn($lang['strcolumnaddedbad']); return; } break; default: echo "

{$lang['strinvalidparam']}

\n"; } } /** * Displays a screen where they can alter a column */ function doProperties($msg = '') { global $data, $misc, $_reload_browser; global $PHP_SELF, $lang; if (!isset($_REQUEST['stage'])) $_REQUEST['stage'] = 1; switch ($_REQUEST['stage']) { case 1: global $lang; $misc->printTrail('column'); $misc->printTitle($lang['straltercolumn'], 'pg.column.alter'); $misc->printMsg($msg); echo ""; echo "
\n"; // Output table header echo "\n"; echo ""; if ($data->hasAlterColumnType()) { echo ""; echo ""; } else { echo ""; } echo ""; $column = $data->getTableAttributes($_REQUEST['table'], $_REQUEST['column']); $column->f['attnotnull'] = $data->phpBool($column->f['attnotnull']); // Upon first drawing the screen, load the existing column information // from the database. if (!isset($_REQUEST['default'])) { $_REQUEST['field'] = $column->f['attname']; $_REQUEST['type'] = $column->f['base_type']; // Check to see if its' an array type... // XXX: HACKY if (substr($column->f['base_type'], strlen($column->f['base_type']) - 2) == '[]') { $_REQUEST['type'] = substr($column->f['base_type'], 0, strlen($column->f['base_type']) - 2); $_REQUEST['array'] = '[]'; } else { $_REQUEST['type'] = $column->f['base_type']; $_REQUEST['array'] = ''; } // To figure out the length, look in the brackets :( // XXX: HACKY if ($column->f['type'] != $column->f['base_type'] && ereg('\\(([0-9, ]*)\\)', $column->f['type'], $bits)) { $_REQUEST['length'] = $bits[1]; } else $_REQUEST['length'] = ''; $_REQUEST['default'] = $_REQUEST['olddefault'] = $column->f['adsrc']; if ($column->f['attnotnull']) $_REQUEST['notnull'] = 'YES'; $_REQUEST['comment'] = $column->f['comment']; } // Column name echo ""; // Column type if ($data->hasAlterColumnType()) { // Fetch all available types $types = $data->getTypes(true, false, true); $types_for_js = array(); echo ""; // Output array type selector echo "\n"; echo ""; } else { // Otherwise draw the read-only type name echo ""; } echo "\n"; echo ""; echo ""; echo "
{$lang['strname']}{$lang['strtype']}{$lang['strlength']}{$lang['strtype']}{$lang['strnotnull']}{$lang['strdefault']}{$lang['strcomment']}
"; $predefined_size_types = array_intersect($data->predefined_size_types,array_keys($types_for_js)); $escaped_predef_types = array(); // the JS escaped array elements foreach($predefined_size_types as $value) { $escaped_predef_types[] = "'{$value}'"; } echo "\t", $misc->printVal($data->formatType($column->f['type'], $column->f['atttypmod'])), "
\n"; echo "

\n"; echo "\n"; echo $misc->form; echo "\n"; echo "\n"; echo "\n"; if ($column->f['attnotnull']) echo "\n"; echo "formatType($column->f['type'], $column->f['atttypmod'])), "\" />\n"; // Add hidden variables to suppress error notices if we don't support altering column type if (!$data->hasAlterColumnType()) { echo "\n"; echo "\n"; echo "\n"; } echo "\n"; echo "

\n"; echo "
\n"; echo "\n"; break; case 2: global $data, $lang; // Check inputs if (trim($_REQUEST['field']) == '') { $_REQUEST['stage'] = 1; doProperties($lang['strcolneedsname']); return; } $status = $data->alterColumn($_REQUEST['table'], $_REQUEST['column'], $_REQUEST['field'], isset($_REQUEST['notnull']), isset($_REQUEST['oldnotnull']), $_REQUEST['default'], $_REQUEST['olddefault'], $_REQUEST['type'], $_REQUEST['length'], $_REQUEST['array'], $_REQUEST['oldtype'], $_REQUEST['comment']); if ($status == 0) { if ($_REQUEST['column'] != $_REQUEST['field']) { $_reload_browser = true; $_REQUEST['column'] = $_REQUEST['field']; } doDefault($lang['strcolumnaltered']); } else { $_REQUEST['stage'] = 1; doProperties($lang['strcolumnalteredbad']); return; } break; default: echo "

{$lang['strinvalidparam']}

\n"; } } /** * Show confirmation of drop column and perform actual drop */ function doDrop($confirm) { global $data, $database, $misc, $_reload_browser; global $PHP_SELF, $lang; if ($confirm) { $misc->printTrail('column'); $misc->printTitle($lang['strdrop'], 'pg.column.drop'); echo "

", sprintf($lang['strconfdropcolumn'], $misc->printVal($_REQUEST['column']), $misc->printVal($_REQUEST['table'])), "

\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo $misc->form; // Show cascade drop option if supportd if ($data->hasDropBehavior()) { echo "

\n"; } echo "\n"; echo "\n"; echo "
\n"; } else { $status = $data->dropColumn($_POST['table'], $_POST['column'], isset($_POST['cascade'])); if ($status == 0) { $_reload_browser = true; doDefault($lang['strcolumndropped']); } else doDefault($lang['strcolumndroppedbad']); } } function doTree() { global $misc, $data; $columns = $data->getTableAttributes($_REQUEST['table']); $reqvars = $misc->getRequestVars('column'); $attrs = array ( 'text' => field('attname'), 'action' => url('colproperties.php', $reqvars, array( 'table' => $_REQUEST['table'], 'column' => field('attname') ) ), 'icon' => 'Column', 'iconAction' => url('display.php', $reqvars, array( 'table' => $_REQUEST['table'], 'column' => field('attname'), 'query' => prepareSQL( "SELECT %column%, count(*) AS \"count\" FROM %table% GROUP BY %column% ORDER BY %column%", array ( '%column%' => field('attname'), '%table%' => $_REQUEST['table'] ) ) ) ), 'toolTip'=> field('comment') ); $misc->printTreeXML($columns, $attrs); exit; } if ($action == 'tree') doTree(); /** * Show default list of columns in the table */ function doDefault($msg = '') { global $data, $conf, $misc; global $PHP_SELF, $lang; function attPre(&$rowdata) { global $data; $rowdata->f['+type'] = $data->formatType($rowdata->f['type'], $rowdata->f['atttypmod']); } $misc->printTrail('table'); $misc->printTabs('table','columns'); $misc->printMsg($msg); // Get table $tdata = $data->getTable($_REQUEST['table']); // Get columns $attrs = $data->getTableAttributes($_REQUEST['table']); // Show comment if any if ($tdata->f['relcomment'] !== null) echo "

", $misc->printVal($tdata->f['relcomment']), "

\n"; $columns = array( 'column' => array( 'title' => $lang['strcolumn'], 'field' => 'attname', ), 'type' => array( 'title' => $lang['strtype'], 'field' => '+type', ), 'notnull' => array( 'title' => $lang['strnotnull'], 'field' => 'attnotnull', 'type' => 'bool', 'params'=> array('true' => 'NOT NULL', 'false' => ''), ), 'default' => array( 'title' => $lang['strdefault'], 'field' => 'adsrc', ), 'actions' => array( 'title' => $lang['stractions'], ), 'comment' => array( 'title' => $lang['strcomment'], 'field' => 'comment', ), ); $actions = array( 'properties' => array( 'title' => $lang['strproperties'], 'url' => "colproperties.php?subject=column&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", 'vars' => array('column' => 'attname'), ), 'alter' => array( 'title' => $lang['stralter'], 'url' => "{$PHP_SELF}?action=properties&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", 'vars' => array('column' => 'attname'), ), 'drop' => array( 'title' => $lang['strdrop'], 'url' => "{$PHP_SELF}?action=confirm_drop&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", 'vars' => array('column' => 'attname'), ), ); if (!$data->hasDropColumn()) unset($actions['drop']); $misc->printTable($attrs, $columns, $actions, null, 'attPre'); echo "
\n"; echo "\n"; } $misc->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table']); $misc->printBody(); switch ($action) { case 'alter': if (isset($_POST['alter'])) doSaveAlter(); else doDefault(); break; case 'confirm_alter': doAlter(); break; case 'import': doImport(); break; case 'export': doExport(); break; case 'add_column': if (isset($_POST['cancel'])) doDefault(); else doAddColumn(); break; case 'properties': if (isset($_POST['cancel'])) doDefault(); else doProperties(); break; case 'drop': if (isset($_POST['drop'])) doDrop(false); else doDefault(); break; case 'confirm_drop': doDrop(true); break; default: doDefault(); break; } $misc->printFooter(); ?>