Esempio n. 1
0
/**
 * Function to save after editing a function
 */
function doSaveEdit()
{
    global $data, $lang, $misc, $_reload_browser;
    $fnlang = strtolower($_POST['original_lang']);
    if ($fnlang == 'c') {
        $def = array($_POST['formObjectFile'], $_POST['formLinkSymbol']);
    } else {
        if ($fnlang == 'internal') {
            $def = $_POST['formLinkSymbol'];
        } else {
            $def = $_POST['formDefinition'];
        }
    }
    if (!$data->hasFunctionAlterSchema()) {
        $_POST['formFuncSchema'] = '';
    }
    $status = $data->setFunction($_POST['function_oid'], $_POST['original_function'], $_POST['formFunction'], $_POST['original_arguments'], $_POST['original_returns'], $def, $_POST['original_lang'], $_POST['formProperties'], isset($_POST['original_setof']), $_POST['original_owner'], $_POST['formFuncOwn'], $_POST['original_schema'], $_POST['formFuncSchema'], isset($_POST['formCost']) ? $_POST['formCost'] : null, isset($_POST['formRows']) ? $_POST['formRows'] : 0, $_POST['formComment']);
    if ($status == 0) {
        // If function has had schema altered, need to change to the new schema
        // and reload the browser frame.
        if (!empty($_POST['formFuncSchema']) && $_POST['formFuncSchema'] != $_POST['original_schema']) {
            // Jump them to the new function schema
            $misc->setCurrentSchema($_POST['formFuncSchema']);
            // Force a browser reload
            $_reload_browser = true;
        }
        doProperties($lang['strfunctionupdated']);
    } else {
        doEdit($lang['strfunctionupdatedbad']);
    }
}
Esempio n. 2
0
/**
 * Show confirmation of drop user from group and perform actual drop
 */
function doDropMember($confirm)
{
    global $data, $misc;
    global $lang;
    if ($confirm) {
        $misc->printTrail('group');
        $misc->printTitle($lang['strdropmember'], 'pg.group.alter');
        echo "<p>", sprintf($lang['strconfdropmember'], $misc->printVal($_REQUEST['user']), $misc->printVal($_REQUEST['group'])), "</p>\n";
        echo "<form action=\"groups.php\" method=\"post\">\n";
        echo $misc->form;
        echo "<input type=\"hidden\" name=\"action\" value=\"drop_member\" />\n";
        echo "<input type=\"hidden\" name=\"group\" value=\"", htmlspecialchars($_REQUEST['group']), "\" />\n";
        echo "<input type=\"hidden\" name=\"user\" value=\"", htmlspecialchars($_REQUEST['user']), "\" />\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->dropGroupMember($_REQUEST['group'], $_REQUEST['user']);
        if ($status == 0) {
            doProperties($lang['strmemberdropped']);
        } else {
            doDropMember(true, $lang['strmemberdroppedbad']);
        }
    }
}
Esempio n. 3
0
/**
 * Show confirmation of drop constraint and perform actual drop
 */
function doDropConstraint($confirm, $msg = '')
{
    global $data, $misc;
    global $lang;
    if ($confirm) {
        $misc->printTrail('domain');
        $misc->printTitle($lang['strdrop'], 'pg.constraint.drop');
        $misc->printMsg($msg);
        echo "<p>", sprintf($lang['strconfdropconstraint'], $misc->printVal($_REQUEST['constraint']), $misc->printVal($_REQUEST['domain'])), "</p>\n";
        echo "<form action=\"domains.php\" method=\"post\">\n";
        echo "<input type=\"hidden\" name=\"action\" value=\"drop_con\" />\n";
        echo "<input type=\"hidden\" name=\"domain\" value=\"", htmlspecialchars($_REQUEST['domain']), "\" />\n";
        echo "<input type=\"hidden\" name=\"constraint\" value=\"", htmlspecialchars($_REQUEST['constraint']), "\" />\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->dropDomainConstraint($_POST['domain'], $_POST['constraint'], isset($_POST['cascade']));
        if ($status == 0) {
            doProperties($lang['strconstraintdropped']);
        } else {
            doDropConstraint(true, $lang['strconstraintdroppedbad']);
        }
    }
}
Esempio n. 4
0
/**
 * Function to save after altering a sequence
 */
function doSaveAlter()
{
    global $data, $lang, $_reload_browser, $misc;
    if (!isset($_POST['owner'])) {
        $_POST['owner'] = null;
    }
    if (!isset($_POST['newschema'])) {
        $_POST['newschema'] = null;
    }
    if (!isset($_POST['formIncrement'])) {
        $_POST['formIncrement'] = null;
    }
    if (!isset($_POST['formMinValue'])) {
        $_POST['formMinValue'] = null;
    }
    if (!isset($_POST['formMaxValue'])) {
        $_POST['formMaxValue'] = null;
    }
    if (!isset($_POST['formStartValue'])) {
        $_POST['formStartValue'] = null;
    }
    if (!isset($_POST['formRestartValue'])) {
        $_POST['formRestartValue'] = null;
    }
    if (!isset($_POST['formCacheValue'])) {
        $_POST['formCacheValue'] = null;
    }
    if (!isset($_POST['formCycledValue'])) {
        $_POST['formCycledValue'] = null;
    }
    $status = $data->alterSequence($_POST['sequence'], $_POST['name'], $_POST['comment'], $_POST['owner'], $_POST['newschema'], $_POST['formIncrement'], $_POST['formMinValue'], $_POST['formMaxValue'], $_POST['formRestartValue'], $_POST['formCacheValue'], isset($_POST['formCycledValue']), $_POST['formStartValue']);
    if ($status == 0) {
        if ($_POST['sequence'] != $_POST['name']) {
            // Jump them to the new view name
            $_REQUEST['sequence'] = $_POST['name'];
            // Force a browser reload
            $_reload_browser = true;
        }
        if (!empty($_POST['newschema']) && $_POST['newschema'] != $data->_schema) {
            // Jump them to the new sequence schema
            $misc->setCurrentSchema($_POST['newschema']);
            $_reload_browser = true;
        }
        doProperties($lang['strsequencealtered']);
    } else {
        doProperties($lang['strsequencealteredbad']);
    }
}
Esempio n. 5
0
/**
 * Displays a screen where they can alter a column in a view
 */
function doProperties($msg = '')
{
    global $data, $misc;
    global $lang;
    if (!isset($_REQUEST['stage'])) {
        $_REQUEST['stage'] = 1;
    }
    switch ($_REQUEST['stage']) {
        case 1:
            global $lang;
            $misc->printTrail('column');
            $misc->printTitle($lang['stralter'], 'pg.column.alter');
            $misc->printMsg($msg);
            echo "<form action=\"viewproperties.php\" method=\"post\">\n";
            // Output view header
            echo "<table>\n";
            echo "<tr><th class=\"data required\">{$lang['strname']}</th><th class=\"data required\">{$lang['strtype']}</th>";
            echo "<th class=\"data\">{$lang['strdefault']}</th><th class=\"data\">{$lang['strcomment']}</th></tr>";
            $column = $data->getTableAttributes($_REQUEST['view'], $_REQUEST['column']);
            if (!isset($_REQUEST['default'])) {
                $_REQUEST['field'] = $column->fields['attname'];
                $_REQUEST['default'] = $_REQUEST['olddefault'] = $column->fields['adsrc'];
                $_REQUEST['comment'] = $column->fields['comment'];
            }
            echo "<tr><td><input name=\"field\" size=\"32\" value=\"", htmlspecialchars($_REQUEST['field']), "\" /></td>";
            echo "<td>", $misc->printVal($data->formatType($column->fields['type'], $column->fields['atttypmod'])), "</td>";
            echo "<td><input name=\"default\" size=\"20\" value=\"", htmlspecialchars($_REQUEST['default']), "\" /></td>";
            echo "<td><input name=\"comment\" size=\"32\" value=\"", htmlspecialchars($_REQUEST['comment']), "\" /></td>";
            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=\"view\" value=\"", htmlspecialchars($_REQUEST['view']), "\" />\n";
            echo "<input type=\"hidden\" name=\"column\" value=\"", htmlspecialchars($_REQUEST['column']), "\" />\n";
            echo "<input type=\"hidden\" name=\"olddefault\" value=\"", htmlspecialchars($_REQUEST['olddefault']), "\" />\n";
            echo "<input type=\"submit\" value=\"{$lang['stralter']}\" />\n";
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
            echo "</form>\n";
            break;
        case 2:
            global $data, $lang;
            // Check inputs
            if (trim($_REQUEST['field']) == '') {
                $_REQUEST['stage'] = 1;
                doProperties($lang['strcolneedsname']);
                return;
            }
            // Alter the view column
            $status = $data->alterColumn($_REQUEST['view'], $_REQUEST['column'], $_REQUEST['field'], false, false, $_REQUEST['default'], $_REQUEST['olddefault'], '', '', '', '', $_REQUEST['comment']);
            if ($status == 0) {
                doDefault($lang['strcolumnaltered']);
            } else {
                $_REQUEST['stage'] = 1;
                doProperties($lang['strcolumnalteredbad']);
                return;
            }
            break;
        default:
            echo "<p>{$lang['strinvalidparam']}</p>\n";
    }
}
Esempio n. 6
0
    $misc->printTabs('server', 'reports');
    $misc->printMsg($lang['strnoreportsdb']);
} else {
    switch ($action) {
        case 'save_edit':
            if (isset($_POST['cancel'])) {
                doDefault();
            } else {
                doSaveEdit();
            }
            break;
        case 'edit':
            doEdit();
            break;
        case 'properties':
            doProperties();
            break;
        case 'save_create':
            if (isset($_POST['cancel'])) {
                doDefault();
            } else {
                doSaveCreate();
            }
            break;
        case 'create':
            doCreate();
            break;
        case 'drop':
            if (isset($_POST['drop'])) {
                doDrop(false);
            } else {