选择文件名文件大小最后修改时间操作
[📄] 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
printTrail('table'); $misc->printTitle($lang['straddfk'],'pg.constraint.foreign_key'); $misc->printMsg($msg); // Unserialize target and fetch appropriate table. This is a bit messy // because the table could be in another schema. if ($data->hasSchemas()) $data->setSchema($_REQUEST['target']['schemaname']); $attrs = $data->getTableAttributes($_REQUEST['target']['tablename']); if ($data->hasSchemas()) $data->setSchema($_REQUEST['schema']); $selColumns = new XHTML_select('TableColumnList', true, 10); $selColumns->set_style('width: 10em;'); if ($attrs->recordCount() > 0) { while (!$attrs->EOF) { $selColumns->add(new XHTML_Option($attrs->f['attname'])); $attrs->moveNext(); } } $selIndex = new XHTML_select('IndexColumnList[]', true, 10); $selIndex->set_style('width: 10em;'); $selIndex->set_attribute('id', 'IndexColumnList'); $buttonAdd = new XHTML_Button('add', '>>'); $buttonAdd->set_attribute('onclick', 'buttonPressed(this);'); $buttonAdd->set_attribute('type', 'button'); $buttonRemove = new XHTML_Button('remove', '<<'); $buttonRemove->set_attribute('onclick', 'buttonPressed(this);'); $buttonRemove->set_attribute('type', 'button'); echo "
\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo ""; echo "\n"; echo ""; echo ""; echo "\n"; echo "
{$lang['strfktarget']}
{$lang['strtablecolumnlist']} {$lang['strfkcolumnlist']}
" . $selColumns->fetch() . "" . $buttonRemove->fetch() . $buttonAdd->fetch() . "" . $selIndex->fetch() . "
{$lang['stractions']}
\n"; // ON SELECT actions echo "{$lang['stronupdate']}
\n"; // ON DELETE actions echo "{$lang['strondelete']}
\n"; // MATCH options echo "
\n"; // DEFERRABLE options echo "
\n"; // INITIALLY options echo "\n"; echo "
\n"; echo "

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

\n"; echo "
\n"; } break; case 3: // Unserialize target $_POST['target'] = unserialize($_POST['target']); // Check that they've given at least one column if (isset($_POST['SourceColumnList'])) $temp = unserialize($_POST['SourceColumnList']); if (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) || sizeof($_POST['IndexColumnList']) == 0 || !isset($temp) || !is_array($temp) || sizeof($temp) == 0) addForeignKey(2, $lang['strfkneedscols']); else { $status = $data->addForeignKey($_POST['table'], $_POST['target']['schemaname'], $_POST['target']['tablename'], unserialize($_POST['SourceColumnList']), $_POST['IndexColumnList'], $_POST['upd_action'], $_POST['del_action'], $_POST['match'], $_POST['deferrable'], $_POST['initially'], $_POST['name']); if ($status == 0) doDefault($lang['strfkadded']); else addForeignKey(2, $lang['strfkaddedbad']); } break; default: $misc->printTrail('table'); $misc->printTitle($lang['straddfk'],'pg.constraint.foreign_key'); $misc->printMsg($msg); $attrs = $data->getTableAttributes($_REQUEST['table']); $tables = $data->getTables(true); $selColumns = new XHTML_select('TableColumnList', true, 10); $selColumns->set_style('width: 10em;'); if ($attrs->recordCount() > 0) { while (!$attrs->EOF) { $selColumns->add(new XHTML_Option($attrs->f['attname'])); $attrs->moveNext(); } } $selIndex = new XHTML_select('IndexColumnList[]', true, 10); $selIndex->set_style('width: 10em;'); $selIndex->set_attribute('id', 'IndexColumnList'); $buttonAdd = new XHTML_Button('add', '>>'); $buttonAdd->set_attribute('onclick', 'buttonPressed(this);'); $buttonAdd->set_attribute('type', 'button'); $buttonRemove = new XHTML_Button('remove', '<<'); $buttonRemove->set_attribute('onclick', 'buttonPressed(this);'); $buttonRemove->set_attribute('type', 'button'); echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo ""; echo ""; echo "
{$lang['strname']}
_maxNameLen}\" />
{$lang['strtablecolumnlist']} {$lang['strfkcolumnlist']}
" . $selColumns->fetch() . "" . $buttonRemove->fetch() . $buttonAdd->fetch() . "" . $selIndex->fetch() . "
{$lang['strfktarget']}
\n"; echo "
\n"; echo "

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

\n"; echo "
\n"; break; } } /** * Confirm and then actually add a PRIMARY KEY or UNIQUE constraint */ function addPrimaryOrUniqueKey($type, $confirm, $msg = '') { global $PHP_SELF, $data, $data, $misc; global $lang; if (!isset($_POST['name'])) $_POST['name'] = ''; if ($confirm) { if (!isset($_POST['name'])) $_POST['name'] = ''; if (!isset($_POST['tablespace'])) $_POST['tablespace'] = ''; $misc->printTrail('table'); switch ($type) { case 'primary': $misc->printTitle($lang['straddpk'],'pg.constraint.primary_key'); break; case 'unique': $misc->printTitle($lang['stradduniq'],'pg.constraint.unique_key'); break; default: doDefault($lang['strinvalidparam']); return; } $misc->printMsg($msg); $attrs = $data->getTableAttributes($_REQUEST['table']); // Fetch all tablespaces from the database if ($data->hasTablespaces()) $tablespaces = $data->getTablespaces(); $selColumns = new XHTML_select('TableColumnList', true, 10); $selColumns->set_style('width: 10em;'); if ($attrs->recordCount() > 0) { while (!$attrs->EOF) { $selColumns->add(new XHTML_Option($attrs->f['attname'])); $attrs->moveNext(); } } $selIndex = new XHTML_select('IndexColumnList[]', true, 10); $selIndex->set_style('width: 10em;'); $selIndex->set_attribute('id', 'IndexColumnList'); $buttonAdd = new XHTML_Button('add', '>>'); $buttonAdd->set_attribute('onclick', 'buttonPressed(this);'); $buttonAdd->set_attribute('type', 'button'); $buttonRemove = new XHTML_Button('remove', '<<'); $buttonRemove->set_attribute('onclick', 'buttonPressed(this);'); $buttonRemove->set_attribute('type', 'button'); echo "
\n"; echo "\n"; echo ""; echo ""; echo ""; echo "\n"; echo "\n"; echo ""; echo "\n"; // Tablespace (if there are any) if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) { echo ""; echo "\n"; } echo "
{$lang['strname']}
_maxNameLen}\" />
{$lang['strtablecolumnlist']} {$lang['strindexcolumnlist']}
" . $selColumns->fetch() . "" . $buttonRemove->fetch() . $buttonAdd->fetch() . "" . $selIndex->fetch() . "
{$lang['strtablespace']}
\n"; echo "

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

\n"; echo "
\n"; } else { // Default tablespace to empty if it isn't set if (!isset($_POST['tablespace'])) $_POST['tablespace'] = ''; if ($_POST['type'] == 'primary') { // Check that they've given at least one column if (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) || sizeof($_POST['IndexColumnList']) == 0) addPrimaryOrUniqueKey($_POST['type'], true, $lang['strpkneedscols']); else { $status = $data->addPrimaryKey($_POST['table'], $_POST['IndexColumnList'], $_POST['name'], $_POST['tablespace']); if ($status == 0) doDefault($lang['strpkadded']); else addPrimaryOrUniqueKey($_POST['type'], true, $lang['strpkaddedbad']); } } elseif ($_POST['type'] == 'unique') { // Check that they've given at least one column if (!isset($_POST['IndexColumnList']) || !is_array($_POST['IndexColumnList']) || sizeof($_POST['IndexColumnList']) == 0) addPrimaryOrUniqueKey($_POST['type'], true, $lang['struniqneedscols']); else { $status = $data->addUniqueKey($_POST['table'], $_POST['IndexColumnList'], $_POST['name'], $_POST['tablespace']); if ($status == 0) doDefault($lang['struniqadded']); else addPrimaryOrUniqueKey($_POST['type'], true, $lang['struniqaddedbad']); } } else doDefault($lang['strinvalidparam']); } } /** * Confirm and then actually add a CHECK constraint */ function addCheck($confirm, $msg = '') { global $PHP_SELF, $data, $data, $misc; global $lang; if (!isset($_POST['name'])) $_POST['name'] = ''; if (!isset($_POST['definition'])) $_POST['definition'] = ''; if ($confirm) { $misc->printTrail('table'); $misc->printTitle($lang['straddcheck'],'pg.constraint.check'); $misc->printMsg($msg); echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
{$lang['strname']}{$lang['strdefinition']}
_maxNameLen}\" value=\"", htmlspecialchars($_POST['name']), "\" />()
\n"; echo "\n"; echo "\n"; echo $misc->form; echo "

\n"; echo "

\n"; echo "
\n"; } else { if (trim($_POST['definition']) == '') addCheck(true, $lang['strcheckneedsdefinition']); else { $status = $data->addCheckConstraint($_POST['table'], $_POST['definition'], $_POST['name']); if ($status == 0) doDefault($lang['strcheckadded']); else addCheck(true, $lang['strcheckaddedbad']); } } } /** * Show confirmation of drop and perform actual drop */ function doDrop($confirm) { global $data, $misc; global $PHP_SELF, $lang; if ($confirm) { $misc->printTrail('constraint'); $misc->printTitle($lang['strdrop'],'pg.constraint.drop'); echo "

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

\n"; echo "
\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->dropConstraint($_POST['constraint'], $_POST['table'], $_POST['type'], isset($_POST['cascade'])); if ($status == 0) doDefault($lang['strconstraintdropped']); else doDefault($lang['strconstraintdroppedbad']); } } /** * List all the constraints on the table */ function doDefault($msg = '') { global $data, $misc; global $PHP_SELF; global $lang; function cnPre(&$rowdata) { global $data, $lang; if (is_null($rowdata->f['consrc'])) { $atts = $data->getAttributeNames($_REQUEST['table'], explode(' ', $rowdata->f['indkey'])); $rowdata->f['+definition'] = ($rowdata->f['contype'] == 'u' ? "UNIQUE (" : "PRIMARY KEY (") . join(',', $atts) . ')'; } else { $rowdata->f['+definition'] = $rowdata->f['consrc']; } } $misc->printTrail('table'); $misc->printTabs('table','constraints'); $misc->printMsg($msg); $constraints = $data->getConstraints($_REQUEST['table']); $columns = array( 'constraint' => array( 'title' => $lang['strname'], 'field' => 'conname', ), 'definition' => array( 'title' => $lang['strdefinition'], 'field' => '+definition', 'type' => 'pre', ), 'actions' => array( 'title' => $lang['stractions'], ), ); $actions = array( 'drop' => array( 'title' => $lang['strdrop'], 'url' => "{$PHP_SELF}?action=confirm_drop&{$misc->href}&table=".urlencode($_REQUEST['table'])."&", 'vars' => array('constraint' => 'conname', 'type' => 'contype'), ), ); if (!$data->hasIsClustered()) unset($columns['clustered']); $misc->printTable($constraints, $columns, $actions, $lang['strnoconstraints'], 'cnPre'); echo "

href}&table=", urlencode($_REQUEST['table']), "\">{$lang['straddcheck']} |\n"; echo "href}&table=", urlencode($_REQUEST['table']), "\">{$lang['stradduniq']} |\n"; echo "href}&table=", urlencode($_REQUEST['table']), "\">{$lang['straddpk']} |\n"; echo "href}&table=", urlencode($_REQUEST['table']), "\">{$lang['straddfk']}

\n"; } $misc->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table'] . ' - ' . $lang['strconstraints'], ""); if ($action == 'add_unique_key' || $action == 'save_add_unique_key' || $action == 'add_primary_key' || $action == 'save_add_primary_key' || $action == 'add_foreign_key' || $action == 'save_add_foreign_key') echo ""; else $misc->printBody(); switch ($action) { case 'add_foreign_key': addForeignKey(1); break; case 'save_add_foreign_key': if (isset($_POST['cancel'])) doDefault(); else addForeignKey($_REQUEST['stage']); break; case 'add_unique_key': addPrimaryOrUniqueKey('unique', true); break; case 'save_add_unique_key': if (isset($_POST['cancel'])) doDefault(); else addPrimaryOrUniqueKey('unique', false); break; case 'add_primary_key': addPrimaryOrUniqueKey('primary', true); break; case 'save_add_primary_key': if (isset($_POST['cancel'])) doDefault(); else addPrimaryOrUniqueKey('primary', false); break; case 'add_check': addCheck(true); break; case 'save_add_check': if (isset($_POST['cancel'])) doDefault(); else addCheck(false); break; case 'save_create': doSaveCreate(); break; case 'create': doCreate(); break; case 'drop': if (isset($_POST['drop'])) doDrop(false); else doDefault(); break; case 'confirm_drop': doDrop(true); break; default: doDefault(); break; } $misc->printFooter(); ?>