예제 #1
0
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
0
파일: rules.php 프로젝트: hardikk/HNH
/**
 * 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
0
파일: sequences.php 프로젝트: hardikk/HNH
/**
 * 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
0
파일: admin.php 프로젝트: hardikk/HNH
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
0
파일: roles.php 프로젝트: hardikk/HNH
/**
 * 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
0
/**
 * 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
0
/**
 * 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
0
/**
 * 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
0
/**
 * 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
0
/**
 * 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
0
/**
 * Displays a screen where they can alter a column
 */
function doAlter($msg = '')
{
    global $data, $misc, $_reload_browser;
    global $lang;
    if (!isset($_REQUEST['stage'])) {
        $_REQUEST['stage'] = 1;
    }
    switch ($_REQUEST['stage']) {
        case 1:
            $misc->printTrail('column');
            $misc->printTitle($lang['stralter'], 'pg.column.alter');
            $misc->printMsg($msg);
            echo "<script src=\"tables.js\" type=\"text/javascript\"></script>";
            echo "<form action=\"colproperties.php\" method=\"post\">\n";
            // Output table header
            echo "<table>\n";
            echo "<tr><th class=\"data required\">{$lang['strname']}</th>\n";
            if ($data->hasAlterColumnType()) {
                echo "<th class=\"data required\" colspan=\"2\">{$lang['strtype']}</th>\n";
                echo "<th class=\"data\">{$lang['strlength']}</th>\n";
            } else {
                echo "<th class=\"data required\">{$lang['strtype']}</th>\n";
            }
            echo "<th class=\"data\">{$lang['strnotnull']}</th>\n<th class=\"data\">{$lang['strdefault']}</th>\n<th class=\"data\">{$lang['strcomment']}</th></tr>\n";
            $column = $data->getTableAttributes($_REQUEST['table'], $_REQUEST['column']);
            $column->fields['attnotnull'] = $data->phpBool($column->fields['attnotnull']);
            // Upon first drawing the screen, load the existing column information
            // from the database.
            if (!isset($_REQUEST['default'])) {
                $_REQUEST['field'] = $column->fields['attname'];
                $_REQUEST['type'] = $column->fields['base_type'];
                // Check to see if its' an array type...
                // XXX: HACKY
                if (substr($column->fields['base_type'], strlen($column->fields['base_type']) - 2) == '[]') {
                    $_REQUEST['type'] = substr($column->fields['base_type'], 0, strlen($column->fields['base_type']) - 2);
                    $_REQUEST['array'] = '[]';
                } 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
0
/**
 * 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
0
파일: privileges.php 프로젝트: hardikk/HNH
/**
 * Grant permissions on an object to a user
 * @param $confirm To show entry screen
 * @param $mode 'grant' or 'revoke'
 * @param $msg (optional) A message to show
 */
function doAlter($confirm, $mode, $msg = '')
{
    global $data, $misc;
    global $lang;
    if (!isset($_REQUEST['username'])) {
        $_REQUEST['username'] = array();
    }
    if (!isset($_REQUEST['groupname'])) {
        $_REQUEST['groupname'] = array();
    }
    if (!isset($_REQUEST['privilege'])) {
        $_REQUEST['privilege'] = array();
    }
    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
0
/**
 * 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
0
/**
 * Actually creates the new wizard view in the database
 */
function doSaveCreateWiz()
{
    global $data, $lang, $_reload_browser;
    // Check that they've given a name and fields they want to select
    if (!strlen($_POST['formView'])) {
        doSetParamsCreate($lang['strviewneedsname']);
    } else {
        if (!isset($_POST['formFields']) || !count($_POST['formFields'])) {
            doSetParamsCreate($lang['strviewneedsfields']);
        } else {
            $selFields = '';
            if (!empty($_POST['dblFldMeth'])) {
                $tmpHsh = array();
            }
            foreach ($_POST['formFields'] as $curField) {
                $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']);
            }
        }
    }
}
예제 #16
0
/**
 * Show confirmation of drop and perform actual drop
 */
function doDrop($confirm)
{
    global $data, $misc;
    global $lang, $_reload_browser;
    if (empty($_REQUEST['nsp']) && empty($_REQUEST['ma'])) {
        doDefault($lang['strspecifyschematodrop']);
        exit;
    }
    if ($confirm) {
        $misc->printTrail('schema');
        $misc->printTitle($lang['strdrop'], 'pg.schema.drop');
        echo "<form action=\"schemas.php\" method=\"post\">\n";
        //If multi drop
        if (isset($_REQUEST['ma'])) {
            foreach ($_REQUEST['ma'] as $v) {
                $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
                echo '<p>', sprintf($lang['strconfdropschema'], $misc->printVal($a['nsp'])), "</p>\n";
                echo '<input type="hidden" name="nsp[]" value="', htmlspecialchars($a['nsp']), "\" />\n";
            }
        } else {
            echo "<p>", sprintf($lang['strconfdropschema'], $misc->printVal($_REQUEST['nsp'])), "</p>\n";
            echo "<input type=\"hidden\" name=\"nsp\" value=\"", htmlspecialchars($_REQUEST['nsp']), "\" />\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=\"database\" value=\"", htmlspecialchars($_REQUEST['database']), "\" />\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 {
        if (is_array($_POST['nsp'])) {
            $msg = '';
            $status = $data->beginTransaction();
            if ($status == 0) {
                foreach ($_POST['nsp'] as $s) {
                    $status = $data->dropSchema($s, isset($_POST['cascade']));
                    if ($status == 0) {
                        $msg .= sprintf('%s: %s<br />', htmlentities($s, ENT_QUOTES, 'UTF-8'), $lang['strschemadropped']);
                    } else {
                        $data->endTransaction();
                        doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($s, ENT_QUOTES, 'UTF-8'), $lang['strschemadroppedbad']));
                        return;
                    }
                }
            }
            if ($data->endTransaction() == 0) {
                // Everything went fine, back to the Default page....
                $_reload_browser = true;
                doDefault($msg);
            } else {
                doDefault($lang['strschemadroppedbad']);
            }
        } else {
            $status = $data->dropSchema($_POST['nsp'], isset($_POST['cascade']));
            if ($status == 0) {
                $_reload_browser = true;
                doDefault($lang['strschemadropped']);
            } else {
                doDefault($lang['strschemadroppedbad']);
            }
        }
    }
}
예제 #17
0
파일: reports.php 프로젝트: hardikk/HNH
/**
 * Show confirmation of drop and perform actual drop
 */
function doDrop($confirm)
{
    global $reportsdb, $misc;
    global $lang;
    if ($confirm) {
        // Fetch report from the database
        $report = $reportsdb->getReport($_REQUEST['report_id']);
        $_REQUEST['report'] = $report->fields['report_name'];
        $misc->printTrail('report');
        $misc->printTitle($lang['strdrop']);
        echo "<p>", sprintf($lang['strconfdropreport'], $misc->printVal($report->fields['report_name'])), "</p>\n";
        echo "<form action=\"reports.php\" method=\"post\">\n";
        echo $misc->form;
        echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
        echo "<input type=\"hidden\" name=\"report_id\" value=\"", htmlspecialchars($_REQUEST['report_id']), "\" />\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 = $reportsdb->dropReport($_POST['report_id']);
        if ($status == 0) {
            doDefault($lang['strreportdropped']);
        } else {
            doDefault($lang['strreportdroppedbad']);
        }
    }
}
예제 #18
0
/**
 * Actually creates the new trigger in the database
 */
function doSaveCreate()
{
    global $data;
    global $lang;
    // Check that they've given a name and a definition
    if ($_POST['formFunction'] == '') {
        doCreate($lang['strtriggerneedsfunc']);
    } elseif ($_POST['formTriggerName'] == '') {
        doCreate($lang['strtriggerneedsname']);
    } elseif ($_POST['formEvent'] == '') {
        doCreate();
    } else {
        $status = $data->createTrigger($_POST['formTriggerName'], $_POST['table'], $_POST['formFunction'], $_POST['formExecTime'], $_POST['formEvent'], $_POST['formFrequency'], $_POST['formTriggerArgs']);
        if ($status == 0) {
            doDefault($lang['strtriggercreated']);
        } else {
            doCreate($lang['strtriggercreatedbad']);
        }
    }
}
예제 #19
0
function doAlter($confirm = false, $msg = '')
{
    if ($confirm) {
        global $data, $misc, $lang;
        $misc->printTrail('view');
        $misc->printTitle($lang['stralter'], 'pg.view.alter');
        $misc->printMsg($msg);
        // Fetch view info
        $view = $data->getView($_REQUEST['view']);
        if ($view->recordCount() > 0) {
            if (!isset($_POST['name'])) {
                $_POST['name'] = $view->fields['relname'];
            }
            if (!isset($_POST['owner'])) {
                $_POST['owner'] = $view->fields['relowner'];
            }
            if (!isset($_POST['newschema'])) {
                $_POST['newschema'] = $view->fields['nspname'];
            }
            if (!isset($_POST['comment'])) {
                $_POST['comment'] = $view->fields['relcomment'];
            }
            echo "<form action=\"viewproperties.php\" method=\"post\">\n";
            echo "<table>\n";
            echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n";
            echo "<td class=\"data1\">";
            echo "<input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_POST['name']), "\" /></td></tr>\n";
            if ($data->isSuperUser()) {
                // Fetch all users
                $users = $data->getUsers();
                echo "<tr><th class=\"data left required\">{$lang['strowner']}</th>\n";
                echo "<td class=\"data1\"><select name=\"owner\">";
                while (!$users->EOF) {
                    $uname = $users->fields['usename'];
                    echo "<option value=\"", htmlspecialchars($uname), "\"", $uname == $_POST['owner'] ? ' selected="selected"' : '', ">", htmlspecialchars($uname), "</option>\n";
                    $users->moveNext();
                }
                echo "</select></td></tr>\n";
            }
            if ($data->hasAlterTableSchema()) {
                $schemas = $data->getSchemas();
                echo "<tr><th class=\"data left required\">{$lang['strschema']}</th>\n";
                echo "<td class=\"data1\"><select name=\"newschema\">";
                while (!$schemas->EOF) {
                    $schema = $schemas->fields['nspname'];
                    echo "<option value=\"", htmlspecialchars($schema), "\"", $schema == $_POST['newschema'] ? ' selected="selected"' : '', ">", htmlspecialchars($schema), "</option>\n";
                    $schemas->moveNext();
                }
                echo "</select></td></tr>\n";
            }
            echo "<tr><th class=\"data left\">{$lang['strcomment']}</th>\n";
            echo "<td class=\"data1\">";
            echo "<textarea rows=\"3\" cols=\"32\" name=\"comment\">", htmlspecialchars($_POST['comment']), "</textarea></td></tr>\n";
            echo "</table>\n";
            echo "<input type=\"hidden\" name=\"action\" value=\"alter\" />\n";
            echo "<input type=\"hidden\" name=\"view\" value=\"", htmlspecialchars($_REQUEST['view']), "\" />\n";
            echo $misc->form;
            echo "<p><input type=\"submit\" name=\"alter\" value=\"{$lang['stralter']}\" />\n";
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
            echo "</form>\n";
        } else {
            echo "<p>{$lang['strnodata']}</p>\n";
        }
    } else {
        global $data, $lang, $_reload_browser, $misc;
        // For databases that don't allow owner change
        if (!isset($_POST['owner'])) {
            $_POST['owner'] = '';
        }
        if (!isset($_POST['newschema'])) {
            $_POST['newschema'] = null;
        }
        $status = $data->alterView($_POST['view'], $_POST['name'], $_POST['owner'], $_POST['newschema'], $_POST['comment']);
        if ($status == 0) {
            // If view has been renamed, need to change to the new name and
            // reload the browser frame.
            if ($_POST['view'] != $_POST['name']) {
                // Jump them to the new view name
                $_REQUEST['view'] = $_POST['name'];
                // Force a browser reload
                $_reload_browser = true;
            }
            // If schema has changed, need to change to the new schema and reload the browser
            if (!empty($_POST['newschema']) && $_POST['newschema'] != $data->_schema) {
                // Jump them to the new sequence schema
                $misc->setCurrentSchema($_POST['newschema']);
                $_reload_browser = true;
            }
            doDefault($lang['strviewaltered']);
        } else {
            doAlter(true, $lang['strviewalteredbad']);
        }
    }
}
예제 #20
0
/**
 * Actually creates the new domain in the database
 */
function doSaveCreate()
{
    global $data, $lang;
    if (!isset($_POST['domcheck'])) {
        $_POST['domcheck'] = '';
    }
    // Check that they've given a name and a definition
    if ($_POST['domname'] == '') {
        doCreate($lang['strdomainneedsname']);
    } else {
        $status = $data->createDomain($_POST['domname'], $_POST['domtype'], $_POST['domlength'], $_POST['domarray'] != '', isset($_POST['domnotnull']), $_POST['domdefault'], $_POST['domcheck']);
        if ($status == 0) {
            doDefault($lang['strdomaincreated']);
        } else {
            doCreate($lang['strdomaincreatedbad']);
        }
    }
}
예제 #21
0
파일: users.php 프로젝트: hardikk/HNH
/**
 * Actually creates the new user in the database
 */
function doSaveCreate()
{
    global $data;
    global $lang;
    // Check data
    if ($_POST['formUsername'] == '') {
        doCreate($lang['struserneedsname']);
    } else {
        if ($_POST['formPassword'] != $_POST['formConfirm']) {
            doCreate($lang['strpasswordconfirm']);
        } else {
            $status = $data->createUser($_POST['formUsername'], $_POST['formPassword'], isset($_POST['formCreateDB']), isset($_POST['formSuper']), $_POST['formExpires'], array());
            if ($status == 0) {
                doDefault($lang['strusercreated']);
            } else {
                doCreate($lang['strusercreatedbad']);
            }
        }
    }
}
예제 #22
0
파일: languages.php 프로젝트: hardikk/HNH
    global $lang;
    $misc->printTrail('database');
    $misc->printTabs('database', 'languages');
    $misc->printMsg($msg);
    $languages = $data->getLanguages();
    $columns = array('language' => array('title' => $lang['strname'], 'field' => field('lanname')), 'trusted' => array('title' => $lang['strtrusted'], 'field' => field('lanpltrusted'), 'type' => 'yesno'), 'function' => array('title' => $lang['strfunction'], 'field' => field('lanplcallf')));
    $actions = array();
    $misc->printTable($languages, $columns, $actions, $lang['strnolanguages']);
}
/**
 * Generate XML for the browser tree.
 */
function doTree()
{
    global $misc, $data;
    $languages = $data->getLanguages();
    $attrs = array('text' => field('lanname'), 'icon' => 'Language');
    $misc->printTreeXML($languages, $attrs);
    exit;
}
if ($action == 'tree') {
    doTree();
}
$misc->printHeader($lang['strlanguages']);
$misc->printBody();
switch ($action) {
    default:
        doDefault();
        break;
}
$misc->printFooter();
예제 #23
0
파일: tablespaces.php 프로젝트: hardikk/HNH
/**
 * Actually creates the new tablespace in the cluster
 */
function doSaveCreate()
{
    global $data;
    global $lang;
    // Check data
    if (trim($_POST['formSpcname']) == '') {
        doCreate($lang['strtablespaceneedsname']);
    } elseif (trim($_POST['formLoc']) == '') {
        doCreate($lang['strtablespaceneedsloc']);
    } else {
        // Default comment to blank if it isn't set
        if (!isset($_POST['formComment'])) {
            $_POST['formComment'] = null;
        }
        $status = $data->createTablespace($_POST['formSpcname'], $_POST['formOwner'], $_POST['formLoc'], $_POST['formComment']);
        if ($status == 0) {
            doDefault($lang['strtablespacecreated']);
        } else {
            doCreate($lang['strtablespacecreatedbad']);
        }
    }
}