本文整理汇总了PHP中doDefault函数的典型用法代码示例。如果您正苦于以下问题:PHP doDefault函数的具体用法?PHP doDefault怎么用?PHP doDefault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doDefault函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doLogout
function doLogout()
{
global $misc, $lang, $_reload_browser;
$server_info = $misc->getServerInfo($_REQUEST['logoutServer']);
$misc->setServerInfo(null, null, $_REQUEST['logoutServer']);
unset($_SESSION['sharedUsername'], $_SESSION['sharedPassword']);
doDefault(sprintf($lang['strlogoutmsg'], $server_info['desc']));
$_reload_browser = true;
}
示例2: doDrop
/**
* Show confirmation of drop and perform actual drop
*/
function doDrop($confirm)
{
global $data, $misc;
global $lang;
if ($confirm) {
$misc->printTrail($_REQUEST['subject']);
$misc->printTitle($lang['strdrop'], 'pg.rule.drop');
echo "<p>", sprintf($lang['strconfdroprule'], $misc->printVal($_REQUEST['rule']), $misc->printVal($_REQUEST[$_REQUEST['reltype']])), "</p>\n";
echo "<form action=\"rules.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
echo "<input type=\"hidden\" name=\"subject\" value=\"", htmlspecialchars($_REQUEST['reltype']), "\" />\n";
echo "<input type=\"hidden\" name=\"", htmlspecialchars($_REQUEST['reltype']), "\" value=\"", htmlspecialchars($_REQUEST[$_REQUEST['reltype']]), "\" />\n";
echo "<input type=\"hidden\" name=\"rule\" value=\"", htmlspecialchars($_REQUEST['rule']), "\" />\n";
echo $misc->form;
echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n";
echo "<input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\" />\n";
echo "</form>\n";
} else {
$status = $data->dropRule($_POST['rule'], $_POST[$_POST['subject']], isset($_POST['cascade']));
if ($status == 0) {
doDefault($lang['strruledropped']);
} else {
doDefault($lang['strruledroppedbad']);
}
}
}
示例3: doSaveCreateSequence
/**
* Actually creates the new sequence in the database
*/
function doSaveCreateSequence()
{
global $data;
global $lang;
// Check that they've given a name and at least one column
if ($_POST['formSequenceName'] == '') {
doCreateSequence($lang['strsequenceneedsname']);
} else {
$status = $data->createSequence($_POST['formSequenceName'], $_POST['formIncrement'], $_POST['formMinValue'], $_POST['formMaxValue'], $_POST['formStartValue'], $_POST['formCacheValue'], isset($_POST['formCycledValue']));
if ($status == 0) {
doDefault($lang['strsequencecreated']);
} else {
doCreateSequence($lang['strsequencecreatedbad']);
}
}
}
示例4: adminActions
function adminActions($action, $type)
{
global $script;
if ($type == 'database') {
$_REQUEST['object'] = $_REQUEST['database'];
$script = 'database.php';
} else {
// $_REQUEST['table'] is no set if we are in the schema page
$_REQUEST['object'] = isset($_REQUEST['table']) ? $_REQUEST['table'] : '';
$script = 'tables.php';
}
switch ($action) {
case 'confirm_cluster':
doCluster($type, true);
break;
case 'confirm_reindex':
doReindex($type, true);
break;
case 'confirm_analyze':
doAnalyze($type, true);
break;
case 'confirm_vacuum':
doVacuum($type, true);
break;
case 'cluster':
if (isset($_POST['cluster'])) {
doCluster($type);
} else {
if ($type == 'table' && is_array($_REQUEST['object'])) {
doDefault();
} else {
doAdmin($type);
}
}
break;
case 'reindex':
if (isset($_POST['reindex'])) {
doReindex($type);
} else {
if ($type == 'table' && is_array($_REQUEST['object'])) {
doDefault();
} else {
doAdmin($type);
}
}
break;
case 'analyze':
if (isset($_POST['analyze'])) {
doAnalyze($type);
} else {
if ($type == 'table' && is_array($_REQUEST['object'])) {
doDefault();
} else {
doAdmin($type);
}
}
break;
case 'vacuum':
if (isset($_POST['vacuum'])) {
doVacuum($type);
} else {
if ($type == 'table' && is_array($_REQUEST['object'])) {
doDefault();
} else {
doAdmin($type);
}
}
break;
case 'admin':
doAdmin($type);
break;
case 'confeditautovac':
doEditAutovacuum($type, true);
break;
case 'confdelautovac':
doDropAutovacuum($type, true);
break;
case 'confaddautovac':
doAddAutovacuum(true);
break;
case 'editautovac':
if (isset($_POST['save'])) {
doEditAutovacuum($type, false);
} else {
doAdmin($type);
}
break;
case 'delautovac':
doDropAutovacuum($type, false);
break;
default:
return false;
}
return true;
}
示例5: doDrop
/**
* Show confirmation of drop a role and perform actual drop
*/
function doDrop($confirm)
{
global $data, $misc;
global $lang;
if ($confirm) {
$misc->printTrail('role');
$misc->printTitle($lang['strdroprole'], 'pg.role.drop');
echo "<p>", sprintf($lang['strconfdroprole'], $misc->printVal($_REQUEST['rolename'])), "</p>\n";
echo "<form action=\"roles.php\" method=\"post\">\n";
echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
echo "<input type=\"hidden\" name=\"rolename\" value=\"", htmlspecialchars($_REQUEST['rolename']), "\" />\n";
echo $misc->form;
echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
echo "</form>\n";
} else {
$status = $data->dropRole($_REQUEST['rolename']);
if ($status == 0) {
doDefault($lang['strroledropped']);
} else {
doDefault($lang['strroledroppedbad']);
}
}
}
示例6: doSaveCreate
/**
* Actually creates the new function in the database
*/
function doSaveCreate()
{
global $data, $lang;
$fnlang = strtolower($_POST['formLanguage']);
if ($fnlang == 'c') {
$def = array($_POST['formObjectFile'], $_POST['formLinkSymbol']);
} else {
if ($fnlang == 'internal') {
$def = $_POST['formLinkSymbol'];
} else {
$def = $_POST['formDefinition'];
}
}
$szJS = '';
echo "<script src=\"functions.js\" type=\"text/javascript\"></script>";
echo "<script type=\"text/javascript\">" . buildJSData() . '</script>';
if (!empty($_POST['formArgName'])) {
$szJS = buildJSRows(buildFunctionArguments($_POST));
} else {
$szJS = "<script type=\"text/javascript\" src=\"functions.js\">noArgsRebuild(addArg());</script>";
}
$cost = isset($_POST['formCost']) ? $_POST['formCost'] : null;
if ($cost == '' || !is_numeric($cost) || $cost != (int) $cost || $cost < 0) {
$cost = null;
}
$rows = isset($_POST['formRows']) ? $_POST['formRows'] : null;
if ($rows == '' || !is_numeric($rows) || $rows != (int) $rows) {
$rows = null;
}
// Check that they've given a name and a definition
if ($_POST['formFunction'] == '') {
doCreate($lang['strfunctionneedsname'], $szJS);
} elseif ($fnlang != 'internal' && !$def) {
doCreate($lang['strfunctionneedsdef'], $szJS);
} else {
// Append array symbol to type if chosen
$status = $data->createFunction($_POST['formFunction'], empty($_POST['nojs']) ? buildFunctionArguments($_POST) : $_POST['formArguments'], $_POST['formReturns'] . $_POST['formArray'], $def, $_POST['formLanguage'], $_POST['formProperties'], $_POST['formSetOf'] == 'SETOF', $cost, $rows, $_POST['formComment'], false);
if ($status == 0) {
doDefault($lang['strfunctioncreated']);
} else {
doCreate($lang['strfunctioncreatedbad'], $szJS);
}
}
}
示例7: doSaveCreate
/**
* Actually creates the new view in the database
*/
function doSaveCreate()
{
global $data, $lang, $_reload_browser;
// Default tablespace to null if it isn't set
if (!isset($_POST['formSpc'])) {
$_POST['formSpc'] = null;
}
// Default comment to blank if it isn't set
if (!isset($_POST['formComment'])) {
$_POST['formComment'] = null;
}
// Default collate to blank if it isn't set
if (!isset($_POST['formCollate'])) {
$_POST['formCollate'] = null;
}
// Default ctype to blank if it isn't set
if (!isset($_POST['formCType'])) {
$_POST['formCType'] = null;
}
// Check that they've given a name and a definition
if ($_POST['formName'] == '') {
doCreate($lang['strdatabaseneedsname']);
} else {
$status = $data->createDatabase($_POST['formName'], $_POST['formEncoding'], $_POST['formSpc'], $_POST['formComment'], $_POST['formTemplate'], $_POST['formCollate'], $_POST['formCType']);
if ($status == 0) {
$_reload_browser = true;
doDefault($lang['strdatabasecreated']);
} else {
doCreate($lang['strdatabasecreatedbad']);
}
}
}
示例8: doDrop
/**
* Show confirmation of drop and perform actual drop
*/
function doDrop($confirm)
{
global $data, $misc;
global $lang;
if ($confirm) {
$misc->printTrail('constraint');
$misc->printTitle($lang['strdrop'], 'pg.constraint.drop');
echo "<p>", sprintf($lang['strconfdropconstraint'], $misc->printVal($_REQUEST['constraint']), $misc->printVal($_REQUEST['table'])), "</p>\n";
echo "<form action=\"constraints.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
echo "<input type=\"hidden\" name=\"constraint\" value=\"", htmlspecialchars($_REQUEST['constraint']), "\" />\n";
echo "<input type=\"hidden\" name=\"type\" value=\"", htmlspecialchars($_REQUEST['type']), "\" />\n";
echo $misc->form;
echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
echo "</form>\n";
} else {
$status = $data->dropConstraint($_POST['constraint'], $_POST['table'], $_POST['type'], isset($_POST['cascade']));
if ($status == 0) {
doDefault($lang['strconstraintdropped']);
} else {
doDefault($lang['strconstraintdroppedbad']);
}
}
}
示例9: doSaveCreate
/**
* Actually creates the new type in the database
*/
function doSaveCreate()
{
global $data;
global $lang;
// Check that they've given a name and a length.
// Note: We're assuming they've given in and out functions here
// which might be unwise...
if ($_POST['typname'] == '') {
doCreate($lang['strtypeneedsname']);
} elseif ($_POST['typlen'] == '') {
doCreate($lang['strtypeneedslen']);
} else {
$status = $data->createType($_POST['typname'], $_POST['typin'], $_POST['typout'], $_POST['typlen'], $_POST['typdef'], $_POST['typelem'], $_POST['typdelim'], isset($_POST['typbyval']), $_POST['typalign'], $_POST['typstorage']);
if ($status == 0) {
doDefault($lang['strtypecreated']);
} else {
doCreate($lang['strtypecreatedbad']);
}
}
}
示例10: doDropMapping
/**
* Show confirmation of drop and perform actual drop of FTS mapping
*/
function doDropMapping($confirm)
{
global $data, $misc;
global $lang, $_reload_drop_database;
if (empty($_REQUEST['mapping']) && empty($_REQUEST['ma'])) {
doDefault($lang['strftsspecifymappingtodrop']);
return;
}
if (empty($_REQUEST['ftscfg'])) {
doDefault($lang['strftsspecifyconfigtoalter']);
return;
}
if ($confirm) {
$misc->printTrail('ftscfg');
// TODO: proper breadcrumbs
$misc->printTitle($lang['strdrop'], 'pg.ftscfg.alter');
echo "<form action=\"fulltext.php\" method=\"post\">\n";
// Case of multiaction drop
if (isset($_REQUEST['ma'])) {
foreach ($_REQUEST['ma'] as $v) {
$a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
echo "<p>", sprintf($lang['strconfdropftsmapping'], $misc->printVal($a['mapping']), $misc->printVal($_REQUEST['ftscfg'])), "</p>\n";
printf('<input type="hidden" name="mapping[]" value="%s" />', htmlspecialchars($a['mapping']));
}
} else {
echo "<p>", sprintf($lang['strconfdropftsmapping'], $misc->printVal($_REQUEST['mapping']), $misc->printVal($_REQUEST['ftscfg'])), "</p>\n";
echo "<input type=\"hidden\" name=\"mapping\" value=\"", htmlspecialchars($_REQUEST['mapping']), "\" />\n";
}
echo "<input type=\"hidden\" name=\"ftscfg\" value=\"{$_REQUEST['ftscfg']}\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"dropmapping\" />\n";
echo "<input type=\"hidden\" name=\"prev_action\" value=\"viewconfig\" /></p>\n";
echo $misc->form;
echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
echo "</form>\n";
} else {
// Case of multiaction drop
if (is_array($_REQUEST['mapping'])) {
$status = $data->changeFtsMapping($_REQUEST['ftscfg'], $_REQUEST['mapping'], 'drop');
if ($status != 0) {
doViewConfig($_REQUEST['ftscfg'], $lang['strftsmappingdroppedbad']);
return;
}
doViewConfig($_REQUEST['ftscfg'], $lang['strftsmappingdropped']);
} else {
$status = $data->changeFtsMapping($_REQUEST['ftscfg'], array($_REQUEST['mapping']), 'drop');
if ($status == 0) {
doViewConfig($_REQUEST['ftscfg'], $lang['strftsmappingdropped']);
} else {
doViewConfig($_REQUEST['ftscfg'], $lang['strftsmappingdroppedbad']);
}
}
}
}
示例11: doAlter
//.........这里部分代码省略.........
} else {
$_REQUEST['type'] = $column->fields['base_type'];
$_REQUEST['array'] = '';
}
// To figure out the length, look in the brackets :(
// XXX: HACKY
if ($column->fields['type'] != $column->fields['base_type'] && preg_match('/\\(([0-9, ]*)\\)/', $column->fields['type'], $bits)) {
$_REQUEST['length'] = $bits[1];
} else {
$_REQUEST['length'] = '';
}
$_REQUEST['default'] = $_REQUEST['olddefault'] = $column->fields['adsrc'];
if ($column->fields['attnotnull']) {
$_REQUEST['notnull'] = 'YES';
}
$_REQUEST['comment'] = $column->fields['comment'];
}
// Column name
echo "<tr><td><input name=\"field\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['field']), "\" /></td>\n";
// Column type
$escaped_predef_types = array();
// the JS escaped array elements
if ($data->hasAlterColumnType()) {
// Fetch all available types
$types = $data->getTypes(true, false, true);
$types_for_js = array();
echo "<td><select name=\"type\" id=\"type\" onchange=\"checkLengths(document.getElementById('type').value,'');\">\n";
while (!$types->EOF) {
$typname = $types->fields['typname'];
$types_for_js[] = $typname;
echo "\t<option value=\"", htmlspecialchars($typname), "\"", $typname == $_REQUEST['type'] ? ' selected="selected"' : '', ">", $misc->printVal($typname), "</option>\n";
$types->moveNext();
}
echo "</select></td>\n";
// Output array type selector
echo "<td><select name=\"array\">\n";
echo "\t<option value=\"\"", $_REQUEST['array'] == '' ? ' selected="selected"' : '', "></option>\n";
echo "\t<option value=\"[]\"", $_REQUEST['array'] == '[]' ? ' selected="selected"' : '', ">[ ]</option>\n";
echo "</select></td>\n";
$predefined_size_types = array_intersect($data->predefined_size_types, $types_for_js);
foreach ($predefined_size_types as $value) {
$escaped_predef_types[] = "'{$value}'";
}
echo "<td><input name=\"length\" id=\"lengths\" size=\"8\" value=\"", htmlspecialchars($_REQUEST['length']), "\" /></td>\n";
} else {
// Otherwise draw the read-only type name
echo "<td>", $misc->printVal($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "</td>\n";
}
echo "<td><input type=\"checkbox\" name=\"notnull\"", isset($_REQUEST['notnull']) ? ' checked="checked"' : '', " /></td>\n";
echo "<td><input name=\"default\" size=\"20\" value=\"", htmlspecialchars($_REQUEST['default']), "\" /></td>\n";
echo "<td><input name=\"comment\" size=\"40\" value=\"", htmlspecialchars($_REQUEST['comment']), "\" /></td></tr>\n";
echo "</table>\n";
echo "<p><input type=\"hidden\" name=\"action\" value=\"properties\" />\n";
echo "<input type=\"hidden\" name=\"stage\" value=\"2\" />\n";
echo $misc->form;
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
echo "<input type=\"hidden\" name=\"column\" value=\"", htmlspecialchars($_REQUEST['column']), "\" />\n";
echo "<input type=\"hidden\" name=\"olddefault\" value=\"", htmlspecialchars($_REQUEST['olddefault']), "\" />\n";
if ($column->fields['attnotnull']) {
echo "<input type=\"hidden\" name=\"oldnotnull\" value=\"on\" />\n";
}
echo "<input type=\"hidden\" name=\"oldtype\" value=\"", htmlspecialchars($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "\" />\n";
// Add hidden variables to suppress error notices if we don't support altering column type
if (!$data->hasAlterColumnType()) {
echo "<input type=\"hidden\" name=\"type\" value=\"", htmlspecialchars($_REQUEST['type']), "\" />\n";
echo "<input type=\"hidden\" name=\"length\" value=\"", htmlspecialchars($_REQUEST['length']), "\" />\n";
echo "<input type=\"hidden\" name=\"array\" value=\"", htmlspecialchars($_REQUEST['array']), "\" />\n";
}
echo "<input type=\"submit\" value=\"{$lang['stralter']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
echo "</form>\n";
echo "<script type=\"text/javascript\">predefined_lengths = new Array(" . implode(",", $escaped_predef_types) . ");checkLengths(document.getElementById('type').value,'');</script>\n";
break;
case 2:
// Check inputs
if (trim($_REQUEST['field']) == '') {
$_REQUEST['stage'] = 1;
doAlter($lang['strcolneedsname']);
return;
}
if (!isset($_REQUEST['length'])) {
$_REQUEST['length'] = '';
}
$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']) {
$_REQUEST['column'] = $_REQUEST['field'];
$_reload_browser = true;
}
doDefault($lang['strcolumnaltered']);
} else {
$_REQUEST['stage'] = 1;
doAlter($lang['strcolumnalteredbad']);
return;
}
break;
default:
echo "<p>{$lang['strinvalidparam']}</p>\n";
}
}
示例12: doSaveCreate
/**
* Actually creates the new group in the database
*/
function doSaveCreate()
{
global $data;
global $lang;
if (!isset($_POST['members'])) {
$_POST['members'] = array();
}
// Check form vars
if (trim($_POST['name']) == '') {
doCreate($lang['strgroupneedsname']);
} else {
$status = $data->createGroup($_POST['name'], $_POST['members']);
if ($status == 0) {
doDefault($lang['strgroupcreated']);
} else {
doCreate($lang['strgroupcreatedbad']);
}
}
}
示例13: doAlter
//.........这里部分代码省略.........
}
if ($confirm) {
// Get users from the database
$users = $data->getUsers();
// Get groups from the database
$groups = $data->getGroups();
$misc->printTrail($_REQUEST['subject']);
switch ($mode) {
case 'grant':
$misc->printTitle($lang['strgrant'], 'pg.privilege.grant');
break;
case 'revoke':
$misc->printTitle($lang['strrevoke'], 'pg.privilege.revoke');
break;
}
$misc->printMsg($msg);
echo "<form action=\"privileges.php\" method=\"post\">\n";
echo "<table>\n";
echo "<tr><th class=\"data left\">{$lang['strusers']}</th>\n";
echo "<td class=\"data1\"><select name=\"username[]\" multiple=\"multiple\" size=\"", min(6, $users->recordCount()), "\">\n";
while (!$users->EOF) {
$uname = htmlspecialchars($users->fields['usename']);
echo "<option value=\"{$uname}\"", in_array($users->fields['usename'], $_REQUEST['username']) ? ' selected="selected"' : '', ">{$uname}</option>\n";
$users->moveNext();
}
echo "</select></td></tr>\n";
echo "<tr><th class=\"data left\">{$lang['strgroups']}</th>\n";
echo "<td class=\"data1\">\n";
echo "<input type=\"checkbox\" id=\"public\" name=\"public\"", isset($_REQUEST['public']) ? ' checked="checked"' : '', " /><label for=\"public\">PUBLIC</label>\n";
// Only show groups if there are groups!
if ($groups->recordCount() > 0) {
echo "<br /><select name=\"groupname[]\" multiple=\"multiple\" size=\"", min(6, $groups->recordCount()), "\">\n";
while (!$groups->EOF) {
$gname = htmlspecialchars($groups->fields['groname']);
echo "<option value=\"{$gname}\"", in_array($groups->fields['groname'], $_REQUEST['groupname']) ? ' selected="selected"' : '', ">{$gname}</option>\n";
$groups->moveNext();
}
echo "</select>\n";
}
echo "</td></tr>\n";
echo "<tr><th class=\"data left required\">{$lang['strprivileges']}</th>\n";
echo "<td class=\"data1\">\n";
foreach ($data->privlist[$_REQUEST['subject']] as $v) {
$v = htmlspecialchars($v);
echo "<input type=\"checkbox\" id=\"privilege[{$v}]\" name=\"privilege[{$v}]\"", isset($_REQUEST['privilege'][$v]) ? ' checked="checked"' : '', " /><label for=\"privilege[{$v}]\">{$v}</label><br />\n";
}
echo "</td></tr>\n";
// Grant option
if ($data->hasGrantOption()) {
echo "<tr><th class=\"data left\">{$lang['stroptions']}</th>\n";
echo "<td class=\"data1\">\n";
if ($mode == 'grant') {
echo "<input type=\"checkbox\" id=\"grantoption\" name=\"grantoption\"", isset($_REQUEST['grantoption']) ? ' checked="checked"' : '', " /><label for=\"grantoption\">GRANT OPTION</label>\n";
} elseif ($mode == 'revoke') {
echo "<input type=\"checkbox\" id=\"grantoption\" name=\"grantoption\"", isset($_REQUEST['grantoption']) ? ' checked="checked"' : '', " /><label for=\"grantoption\">GRANT OPTION FOR</label><br />\n";
echo "<input type=\"checkbox\" id=\"cascade\" name=\"cascade\"", isset($_REQUEST['cascade']) ? ' checked="checked"' : '', " /><label for=\"cascade\">CASCADE</label><br />\n";
}
echo "</td></tr>\n";
}
echo "</table>\n";
echo "<p><input type=\"hidden\" name=\"action\" value=\"save\" />\n";
echo "<input type=\"hidden\" name=\"mode\" value=\"", htmlspecialchars($mode), "\" />\n";
echo "<input type=\"hidden\" name=\"subject\" value=\"", htmlspecialchars($_REQUEST['subject']), "\" />\n";
if (isset($_REQUEST[$_REQUEST['subject'] . '_oid'])) {
echo "<input type=\"hidden\" name=\"", htmlspecialchars($_REQUEST['subject'] . '_oid'), "\" value=\"", htmlspecialchars($_REQUEST[$_REQUEST['subject'] . '_oid']), "\" />\n";
}
echo "<input type=\"hidden\" name=\"", htmlspecialchars($_REQUEST['subject']), "\" value=\"", htmlspecialchars($_REQUEST[$_REQUEST['subject']]), "\" />\n";
if ($_REQUEST['subject'] == 'column') {
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\" />\n";
}
echo $misc->form;
if ($mode == 'grant') {
echo "<input type=\"submit\" name=\"grant\" value=\"{$lang['strgrant']}\" />\n";
} elseif ($mode == 'revoke') {
echo "<input type=\"submit\" name=\"revoke\" value=\"{$lang['strrevoke']}\" />\n";
}
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>";
echo "</form>\n";
} else {
// Determine whether object should be ref'd by name or oid.
if (isset($_REQUEST[$_REQUEST['subject'] . '_oid'])) {
$object = $_REQUEST[$_REQUEST['subject'] . '_oid'];
} else {
$object = $_REQUEST[$_REQUEST['subject']];
}
if (isset($_REQUEST['table'])) {
$table = $_REQUEST['table'];
} else {
$table = null;
}
$status = $data->setPrivileges($mode == 'grant' ? 'GRANT' : 'REVOKE', $_REQUEST['subject'], $object, isset($_REQUEST['public']), $_REQUEST['username'], $_REQUEST['groupname'], array_keys($_REQUEST['privilege']), isset($_REQUEST['grantoption']), isset($_REQUEST['cascade']), $table);
if ($status == 0) {
doDefault($lang['strgranted']);
} elseif ($status == -3 || $status == -4) {
doAlter(true, $_REQUEST['mode'], $lang['strgrantbad']);
} else {
doAlter(true, $_REQUEST['mode'], $lang['strgrantfailed']);
}
}
}
示例14: doDrop
/**
* Show confirmation of drop and perform actual drop of the aggregate function selected
*/
function doDrop($confirm)
{
global $data, $misc;
global $lang, $_reload_browser;
if ($confirm) {
$misc->printTrail('aggregate');
$misc->printTitle($lang['strdrop'], 'pg.aggregate.drop');
echo "<p>", sprintf($lang['strconfdropaggregate'], htmlspecialchars($_REQUEST['aggrname'])), "</p>\n";
echo "<form action=\"aggregates.php\" method=\"post\">\n";
echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
echo "<input type=\"hidden\" name=\"aggrname\" value=\"", htmlspecialchars($_REQUEST['aggrname']), "\" />\n";
echo "<input type=\"hidden\" name=\"aggrtype\" value=\"", htmlspecialchars($_REQUEST['aggrtype']), "\" />\n";
echo $misc->form;
echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
echo "</form>\n";
} else {
$status = $data->dropAggregate($_POST['aggrname'], $_POST['aggrtype'], isset($_POST['cascade']));
if ($status == 0) {
$_reload_browser = true;
doDefault($lang['straggregatedropped']);
} else {
doDefault($lang['straggregatedroppedbad']);
}
}
}
示例15: doSaveCreateWiz
//.........这里部分代码省略.........
$arrTmp = unserialize($curField);
$data->fieldArrayClean($arrTmp);
if (!empty($_POST['dblFldMeth'])) {
// doublon control
if (empty($tmpHsh[$arrTmp['fieldname']])) {
// field does not exist
$selFields .= "\"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\", ";
$tmpHsh[$arrTmp['fieldname']] = 1;
} else {
if ($_POST['dblFldMeth'] == 'rename') {
// field exist and must be renamed
$tmpHsh[$arrTmp['fieldname']]++;
$selFields .= "\"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\" AS \"{$arrTmp['schemaname']}_{$arrTmp['tablename']}_{$arrTmp['fieldname']}{$tmpHsh[$arrTmp['fieldname']]}\", ";
}
}
/* field already exist, just ignore this one */
} else {
// no doublon control
$selFields .= "\"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\", ";
}
}
$selFields = substr($selFields, 0, -2);
unset($arrTmp, $tmpHsh);
$linkFields = '';
// If we have links, out put the JOIN ... ON statements
if (is_array($_POST['formLink'])) {
// Filter out invalid/blank entries for our links
$arrLinks = array();
foreach ($_POST['formLink'] as $curLink) {
if (strlen($curLink['leftlink']) && strlen($curLink['rightlink']) && strlen($curLink['operator'])) {
$arrLinks[] = $curLink;
}
}
// We must perform some magic to make sure that we have a valid join order
$count = sizeof($arrLinks);
$arrJoined = array();
$arrUsedTbls = array();
// If we have at least one join condition, output it
if ($count > 0) {
$j = 0;
while ($j < $count) {
foreach ($arrLinks as $curLink) {
$arrLeftLink = unserialize($curLink['leftlink']);
$arrRightLink = unserialize($curLink['rightlink']);
$data->fieldArrayClean($arrLeftLink);
$data->fieldArrayClean($arrRightLink);
$tbl1 = "\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\"";
$tbl2 = "\"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\"";
if (!in_array($curLink, $arrJoined) && in_array($tbl1, $arrUsedTbls) || !count($arrJoined)) {
// Make sure for multi-column foreign keys that we use a table alias tables joined to more than once
// This can (and should be) more optimized for multi-column foreign keys
$adj_tbl2 = in_array($tbl2, $arrUsedTbls) ? "{$tbl2} AS alias_ppa_" . mktime() : $tbl2;
$linkFields .= strlen($linkFields) ? "{$curLink['operator']} {$adj_tbl2} ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") " : "{$tbl1} {$curLink['operator']} {$adj_tbl2} ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") ";
$arrJoined[] = $curLink;
if (!in_array($tbl1, $arrUsedTbls)) {
$arrUsedTbls[] = $tbl1;
}
if (!in_array($tbl2, $arrUsedTbls)) {
$arrUsedTbls[] = $tbl2;
}
}
}
$j++;
}
}
}
//if linkfields has no length then either _POST['formLink'] was not set, or there were no join conditions
//just select from all seleted tables - a cartesian join do a
if (!strlen($linkFields)) {
foreach ($_POST['formTables'] as $curTable) {
$arrTmp = unserialize($curTable);
$data->fieldArrayClean($arrTmp);
$linkFields .= strlen($linkFields) ? ", \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\"" : "\"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\"";
}
}
$addConditions = '';
if (is_array($_POST['formCondition'])) {
foreach ($_POST['formCondition'] as $curCondition) {
if (strlen($curCondition['field']) && strlen($curCondition['txt'])) {
$arrTmp = unserialize($curCondition['field']);
$data->fieldArrayClean($arrTmp);
$addConditions .= strlen($addConditions) ? " AND \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\" {$curCondition['operator']} '{$curCondition['txt']}' " : " \"{$arrTmp['schemaname']}\".\"{$arrTmp['tablename']}\".\"{$arrTmp['fieldname']}\" {$curCondition['operator']} '{$curCondition['txt']}' ";
}
}
}
$viewQuery = "SELECT {$selFields} FROM {$linkFields} ";
//add where from additional conditions
if (strlen($addConditions)) {
$viewQuery .= ' WHERE ' . $addConditions;
}
$status = $data->createView($_POST['formView'], $viewQuery, false, $_POST['formComment']);
if ($status == 0) {
$_reload_browser = true;
doDefault($lang['strviewcreated']);
} else {
doSetParamsCreate($lang['strviewcreatedbad']);
}
}
}
}