选择文件名文件大小最后修改时间操作
[📄] 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
getDefaultWithOid(); if ($default_with_oids == 'off') $_REQUEST['withoutoids'] = 'on'; } if (!isset($_REQUEST['name'])) $_REQUEST['name'] = ''; if (!isset($_REQUEST['fields'])) $_REQUEST['fields'] = ''; if (!isset($_REQUEST['tblcomment'])) $_REQUEST['tblcomment'] = ''; if (!isset($_REQUEST['spcname'])) $_REQUEST['spcname'] = ''; switch ($_REQUEST['stage']) { case 1: // Fetch all tablespaces from the database if ($data->hasTablespaces()) $tablespaces = $data->getTablespaces(); $misc->printTrail('schema'); $misc->printTitle($lang['strcreatetable'], 'pg.table.create'); $misc->printMsg($msg); echo "
\n"; echo "\n"; echo "\t\n\t\t\n"; echo "\t\t\n\t\n"; echo "\t\n\t\t\n"; echo "\t\t\n\t\n"; if ($data->hasWithoutOIDs()) { echo "\t\n\t\t\n"; echo "\t\t\n\t\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 "\t\n\t\t\n"; echo "\t\t\n\t\n"; echo "
{$lang['strname']}_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" />
{$lang['strnumcols']}_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['fields']), "\" />
{$lang['stroptions']}
{$lang['strtablespace']}\n\t\t\t\n\t\t
{$lang['strcomment']}
\n"; echo "

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

\n"; echo "
\n"; break; case 2: global $lang; // Check inputs $fields = trim($_REQUEST['fields']); if (trim($_REQUEST['name']) == '') { $_REQUEST['stage'] = 1; doCreate($lang['strtableneedsname']); return; } elseif ($fields == '' || !is_numeric($fields) || $fields != (int)$fields || $fields < 1) { $_REQUEST['stage'] = 1; doCreate($lang['strtableneedscols']); return; } $types = $data->getTypes(true, false, true); $types_for_js = array(); $misc->printTrail('schema'); $misc->printTitle($lang['strcreatetable'], 'pg.table.create'); $misc->printMsg($msg); echo ""; echo "
\n"; // Output table header echo "\n"; echo "\t"; echo ""; echo ""; echo "\n"; for ($i = 0; $i < $_REQUEST['fields']; $i++) { if (!isset($_REQUEST['field'][$i])) $_REQUEST['field'][$i] = ''; if (!isset($_REQUEST['length'][$i])) $_REQUEST['length'][$i] = ''; if (!isset($_REQUEST['default'][$i])) $_REQUEST['default'][$i] = ''; if (!isset($_REQUEST['colcomment'][$i])) $_REQUEST['colcomment'][$i] = ''; echo "\t\n\t\t\n"; echo "\t\t\n"; echo "\t\t"; } // Output array type selector echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n\t\n"; } echo "
{$lang['strcolumn']}{$lang['strtype']}{$lang['strlength']}{$lang['strnotnull']}{$lang['struniquekey']}{$lang['strprimarykey']}{$lang['strdefault']}{$lang['strcomment']}
", $i + 1, ". _maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['field'][$i]), "\" />\n\t\t\t\n\t\t\n"; if($i==0) { // only define js types array once $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 "\n\t\n\t\t\t\n\t\t
\n"; echo "

\n"; echo "\n"; echo $misc->form; echo "\n"; echo "\n"; if (isset($_REQUEST['withoutoids'])) { echo "\n"; } echo "\n"; if (isset($_REQUEST['spcname'])) { echo "\n"; } echo "\n"; echo "

\n"; echo "
\n"; break; case 3: global $data, $lang, $_reload_browser; if (!isset($_REQUEST['notnull'])) $_REQUEST['notnull'] = array(); if (!isset($_REQUEST['uniquekey'])) $_REQUEST['uniquekey'] = array(); if (!isset($_REQUEST['primarykey'])) $_REQUEST['primarykey'] = array(); // Default tablespace to null if it isn't set if (!isset($_REQUEST['spcname'])) $_REQUEST['spcname'] = null; // Check inputs $fields = trim($_REQUEST['fields']); if (trim($_REQUEST['name']) == '') { $_REQUEST['stage'] = 1; doCreate($lang['strtableneedsname']); return; } elseif ($fields == '' || !is_numeric($fields) || $fields != (int)$fields || $fields <= 0) { $_REQUEST['stage'] = 1; doCreate($lang['strtableneedscols']); return; } $status = $data->createTable($_REQUEST['name'], $_REQUEST['fields'], $_REQUEST['field'], $_REQUEST['type'], $_REQUEST['array'], $_REQUEST['length'], $_REQUEST['notnull'], $_REQUEST['default'], isset($_REQUEST['withoutoids']), $_REQUEST['colcomment'], $_REQUEST['tblcomment'], $_REQUEST['spcname'], $_REQUEST['uniquekey'], $_REQUEST['primarykey']); if ($status == 0) { $_reload_browser = true; doDefault($lang['strtablecreated']); } elseif ($status == -1) { $_REQUEST['stage'] = 2; doCreate($lang['strtableneedsfield']); return; } else { $_REQUEST['stage'] = 2; doCreate($lang['strtablecreatedbad']); return; } break; default: echo "

{$lang['strinvalidparam']}

\n"; } } /** * Ask for select parameters and perform select */ function doSelectRows($confirm, $msg = '') { global $data, $misc, $_no_output; global $lang; global $PHP_SELF; if ($confirm) { $misc->printTrail('table'); $misc->printTitle($lang['strselect'], 'pg.sql.select'); $misc->printMsg($msg); $attrs = $data->getTableAttributes($_REQUEST['table']); echo "
\n"; if ($attrs->recordCount() > 0) { // JavaScript for select all feature echo "\n"; echo "\n"; // Output table header echo ""; echo ""; echo ""; $i = 0; while (!$attrs->EOF) { $attrs->f['attnotnull'] = $data->phpBool($attrs->f['attnotnull']); // Set up default value if there isn't one already if (!isset($_REQUEST['values'][$attrs->f['attname']])) $_REQUEST['values'][$attrs->f['attname']] = null; if (!isset($_REQUEST['ops'][$attrs->f['attname']])) $_REQUEST['ops'][$attrs->f['attname']] = null; // Continue drawing row $id = (($i % 2) == 0 ? '1' : '2'); echo "\n"; echo ""; echo ""; echo ""; echo ""; echo "\n"; $i++; $attrs->moveNext(); } // Select all checkbox echo ""; echo "
{$lang['strshow']}{$lang['strcolumn']}{$lang['strtype']}{$lang['stroperator']}{$lang['strvalue']}
"; echo "f['attname']), "]\"", isset($_REQUEST['show'][$attrs->f['attname']]) ? ' checked="checked"' : '', " />", $misc->printVal($attrs->f['attname']), "", $misc->printVal($data->formatType($attrs->f['type'], $attrs->f['atttypmod'])), ""; echo "\n"; echo "", $data->printField("values[{$attrs->f['attname']}]", $_REQUEST['values'][$attrs->f['attname']], $attrs->f['type']), "

\n"; } else echo "

{$lang['strinvalidparam']}

\n"; echo "

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

\n"; echo "
\n"; } else { if (!isset($_POST['show'])) $_POST['show'] = array(); if (!isset($_POST['values'])) $_POST['values'] = array(); if (!isset($_POST['nulls'])) $_POST['nulls'] = array(); // Verify that they haven't supplied a value for unary operators foreach ($_POST['ops'] as $k => $v) { if ($data->selectOps[$v] == 'p' && $_POST['values'][$k] != '') { doSelectRows(true, $lang['strselectunary']); return; } } if (sizeof($_POST['show']) == 0) doSelectRows(true, $lang['strselectneedscol']); else { // Generate query SQL $query = $data->getSelectSQL($_REQUEST['table'], array_keys($_POST['show']), $_POST['values'], $_POST['ops']); $_REQUEST['query'] = $query; $_REQUEST['return_url'] = "tables.php?action=confselectrows&{$misc->href}&table={$_REQUEST['table']}"; $_REQUEST['return_desc'] = $lang['strback']; $_no_output = true; include('./display.php'); exit; } } } /** * Ask for insert parameters and then actually insert row */ function doInsertRow($confirm, $msg = '') { global $data, $misc, $conf; global $lang; global $PHP_SELF; $bAllowAC = ($conf["autocomplete"]!='disable') ? TRUE : FALSE ; if ($confirm) { $misc->printTrail('table'); $misc->printTitle($lang['strinsertrow'], 'pg.sql.insert'); $misc->printMsg($msg); $attrs = $data->getTableAttributes($_REQUEST['table']); if($bAllowAC) { $constraints = $data->getConstraints($_REQUEST['table']); $arrayLocals = array(); $arrayRefs = array(); $nC = 0; // A word of caution, the following does not support multicolumn FK's at the moment while(!$constraints->EOF) { preg_match('/foreign key \((\w+)\) references ([\w]+)\((\w+)\)/i',$constraints->fields["consrc"],$matches); if(!empty($matches)) { $arrayLocals[$nC] = $matches[1]; $arrayRefs[$nC] = array($matches[2],$matches[3]); $nC++; } $constraints->moveNext(); } } echo "
\n"; if ($attrs->recordCount() > 0) { echo "\n"; // Output table header echo ""; echo ""; echo ""; $i = 0; while (!$attrs->EOF) { $szValueName = "values[{$attrs->f['attname']}]"; $szEvents = ""; $szDivPH = ""; if($bAllowAC) { if(($idxFound = array_search($attrs->f['attname'],$arrayLocals))!==false) { $szEvent = "makeAC('{$szValueName}',{$i},'{$arrayRefs[$idxFound][0]}','{$arrayRefs[$idxFound][1]}','{$_REQUEST["server"]}','{$_REQUEST["database"]}');"; $szEvents = "onfocus=\"{$szEvent}\" onblur=\"hideAC();document.getElementById('ac_form').onsubmit=function(){return true;};\" onchange=\"{$szEvent}\" id=\"{$szValueName}\" onkeyup=\"{$szEvent}\" autocomplete=\"off\" class='ac_field'"; $szDivPH = "
"; } } $attrs->f['attnotnull'] = $data->phpBool($attrs->f['attnotnull']); // Set up default value if there isn't one already if (!isset($_REQUEST['values'][$attrs->f['attname']])) $_REQUEST['values'][$attrs->f['attname']] = $attrs->f['adsrc']; // Default format to 'VALUE' if there is no default, // otherwise default to 'EXPRESSION' if (!isset($_REQUEST['format'][$attrs->f['attname']])) $_REQUEST['format'][$attrs->f['attname']] = ($attrs->f['adsrc'] === null) ? 'VALUE' : 'EXPRESSION'; // Continue drawing row $id = (($i % 2) == 0 ? '1' : '2'); echo "\n"; echo ""; echo ""; echo "\n"; echo ""; } else { echo " "; } echo ""; echo "\n"; $i++; $attrs->moveNext(); } echo "
{$lang['strcolumn']}{$lang['strtype']}{$lang['strformat']}{$lang['strnull']}{$lang['strvalue']}
", $misc->printVal($attrs->f['attname']), "\n"; echo $misc->printVal($data->formatType($attrs->f['type'], $attrs->f['atttypmod'])); echo "f['attname']), "]\" value=\"", htmlspecialchars($attrs->f['type']), "\" />\n"; echo "\n"; // Output null box if the column allows nulls (doesn't look at CHECKs or ASSERTIONS) if (!$attrs->f['attnotnull']) { echo "f['attname']), "]\"", isset($_REQUEST['nulls'][$attrs->f['attname']]) ? ' checked="checked"' : '', " />", $data->printField($szValueName, $_REQUEST['values'][$attrs->f['attname']], $attrs->f['type'],array(),$szEvents),$szDivPH ,"
\n"; if($bAllowAC) { echo ''; echo "
"; } } else echo "

{$lang['strnodata']}

\n"; if (!isset($_SESSION['counter'])) { $_SESSION['counter'] = 0; } echo "\n"; echo "\n"; echo "\n"; echo $misc->form; echo "

\n"; echo "\n"; echo "\n"; if($bAllowAC) { $szChecked = $conf["autocomplete"]!='default off' ? "checked=\"checked\"" : ""; echo "\n"; } echo "

\n"; echo "
\n"; echo ""; } else { if (!isset($_POST['values'])) $_POST['values'] = array(); if (!isset($_POST['nulls'])) $_POST['nulls'] = array(); if ($_SESSION['counter']++ == $_POST['protection_counter']) { $status = $data->insertRow($_POST['table'], $_POST['values'], $_POST['nulls'], $_POST['format'], $_POST['types']); if ($status == 0) { if (isset($_POST['insert'])) doDefault($lang['strrowinserted']); else { $_REQUEST['values'] = array(); $_REQUEST['nulls'] = array(); doInsertRow(true, $lang['strrowinserted']); } } else doInsertRow(true, $lang['strrowinsertedbad']); } else doInsertRow(true, $lang['strrowduplicate']); } } /** * Show confirmation of empty and perform actual empty */ function doEmpty($confirm) { global $data, $misc; global $lang; global $PHP_SELF; if ($confirm) { $misc->printTrail('table'); $misc->printTitle($lang['strempty'],'pg.table.empty'); echo "

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

\n"; echo "
\n"; echo "\n"; echo "\n"; echo $misc->form; echo " \n"; echo "
\n"; } else { $status = $data->emptyTable($_POST['table']); if ($status == 0) doDefault($lang['strtableemptied']); else doDefault($lang['strtableemptiedbad']); } } /** * Show confirmation of drop and perform actual drop */ function doDrop($confirm) { global $data, $misc; global $lang, $_reload_browser; global $PHP_SELF; if ($confirm) { $misc->printTrail('table'); $misc->printTitle($lang['strdrop'], 'pg.table.drop'); echo "

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

\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->dropTable($_POST['table'], isset($_POST['cascade'])); if ($status == 0) { $_reload_browser = true; doDefault($lang['strtabledropped']); } else doDefault($lang['strtabledroppedbad']); } } /** * Show confirmation of vacuum and perform actual vacuum */ function doVacuum($confirm) { global $data, $misc; global $lang, $_reload_browser; global $PHP_SELF; if ($confirm) { $misc->printTrail('table'); $misc->printTitle($lang['strvacuum'], 'pg.vacuum'); echo "

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

\n"; echo "
\n"; echo "\n"; echo "\n"; echo $misc->form; // Show vacuum full option if supportd if ($data->hasFullVacuum()) { echo "

\n"; echo "

\n"; } echo "\n"; echo "\n"; echo "
\n"; } else { $status = $data->vacuumDB($_POST['table'], isset($_REQUEST['vacuum_analyze']), isset($_REQUEST['vacuum_full']), ''); if ($status == 0) { $_reload_browser = true; doDefault($lang['strvacuumgood']); } else doDefault($lang['strvacuumbad']); } } /** * Show default list of tables in the database */ function doDefault($msg = '') { global $data, $conf, $misc, $data; global $PHP_SELF, $lang; $misc->printTrail('schema'); $misc->printTabs('schema','tables'); $misc->printMsg($msg); $tables = $data->getTables(); $columns = array( 'table' => array( 'title' => $lang['strtable'], 'field' => 'relname', ), 'owner' => array( 'title' => $lang['strowner'], 'field' => 'relowner', ), 'tablespace' => array( 'title' => $lang['strtablespace'], 'field' => 'tablespace' ), 'tuples' => array( 'title' => $lang['strestimatedrowcount'], 'field' => 'reltuples', 'type' => 'numeric' ), 'actions' => array( 'title' => $lang['stractions'], ), 'comment' => array( 'title' => $lang['strcomment'], 'field' => 'relcomment', ), ); $actions = array( 'properties' => array( 'title' => $lang['strproperties'], 'url' => "redirect.php?subject=table&{$misc->href}&", 'vars' => array('table' => 'relname'), ), 'browse' => array( 'title' => $lang['strbrowse'], 'url' => "display.php?{$misc->href}&subject=table&return_url=".urlencode("tables.php?{$misc->href}")."&return_desc=".urlencode($lang['strback'])."&", 'vars' => array('table' => 'relname'), ), 'select' => array( 'title' => $lang['strselect'], 'url' => "{$PHP_SELF}?action=confselectrows&{$misc->href}&", 'vars' => array('table' => 'relname'), ), 'insert' => array( 'title' => $lang['strinsert'], 'url' => "{$PHP_SELF}?action=confinsertrow&{$misc->href}&", 'vars' => array('table' => 'relname'), ), 'empty' => array( 'title' => $lang['strempty'], 'url' => "{$PHP_SELF}?action=confirm_empty&{$misc->href}&", 'vars' => array('table' => 'relname'), ), 'drop' => array( 'title' => $lang['strdrop'], 'url' => "{$PHP_SELF}?action=confirm_drop&{$misc->href}&", 'vars' => array('table' => 'relname'), ), 'vacuum' => array( 'title' => $lang['strvacuum'], 'url' => "{$PHP_SELF}?action=confirm_vacuum&{$misc->href}&", 'vars' => array('table' => 'relname'), ), ); if (!$data->hasTablespaces()) unset($columns['tablespace']); $misc->printTable($tables, $columns, $actions, $lang['strnotables']); echo "

href}\">{$lang['strcreatetable']}

\n"; } /** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $tables = $data->getTables(); $reqvars = $misc->getRequestVars('table'); $attrs = array( 'text' => field('relname'), 'icon' => 'Table', 'iconAction' => url('display.php', $reqvars, array('table' => field('relname')) ), 'toolTip'=> field('relcomment'), 'action' => url('redirect.php', $reqvars, array('table' => field('relname')) ), 'branch' => url('tblproperties.php', $reqvars, array ( 'action' => 'tree', 'table' => field('relname') ) ) ); $misc->printTreeXML($tables, $attrs); exit; } if ($action == 'tree') doTree(); $misc->printHeader($lang['strtables']); $misc->printBody(); switch ($action) { case 'create': if (isset($_POST['cancel'])) doDefault(); else doCreate(); break; case 'selectrows': if (!isset($_POST['cancel'])) doSelectRows(false); else doDefault(); break; case 'confselectrows': doSelectRows(true); break; case 'insertrow': if (!isset($_POST['cancel'])) doInsertRow(false); else doDefault(); break; case 'confinsertrow': doInsertRow(true); break; case 'empty': if (isset($_POST['empty'])) doEmpty(false); else doDefault(); break; case 'confirm_empty': doEmpty(true); break; case 'drop': if (isset($_POST['drop'])) doDrop(false); else doDefault(); break; case 'confirm_drop': doDrop(true); break; case 'vacuum': if (isset($_POST['vacuum'])) doVacuum(false); else doDefault(); break; case 'confirm_vacuum': doVacuum(true); break; default: doDefault(); break; } $misc->printFooter(); ?>