コード例 #1
0
ファイル: edit.php プロジェクト: mpietruschka/postfixadmin
            # should never happen and indicates a bug in $handler->init()
            flash_error($handlerclass . "->init() failed, but didn't set any error message");
        }
        flash_error($handler->errormsg);
        header("Location: " . $formconf['listview']);
        exit;
    }
}
$form_fields = $handler->getStruct();
$id_field = $handler->getId_field();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if ($new) {
        # new - prefill fields from URL parameters if allowed in $formconf['prefill']
        if (isset($formconf['prefill'])) {
            foreach ($formconf['prefill'] as $field) {
                $prefillvalue = safeget($field, safesession("prefill:{$table}:{$field}"));
                if ($prefillvalue != '') {
                    $form_fields[$field]['default'] = $prefillvalue;
                    $handler->prefill($field, $prefillvalue);
                }
            }
        }
        $form_fields = $handler->getStruct();
        # refresh $form_fields - a prefill field might have changed something
    } else {
        # edit mode - read values from database
        if (!$handler->view()) {
            flash_error($handler->errormsg);
            header("Location: " . $formconf['listview']);
            exit;
        } else {
コード例 #2
0
ファイル: list-virtual.php プロジェクト: stepkh/postfixadmin
 * Form POST \ GET Variables:
 *
 * fDomain
 * fDisplay
 * search
 */
require_once 'common.php';
authentication_require_role('admin');
$admin_username = authentication_get_username();
$list_domains = list_domains_for_admin($admin_username);
$page_size = $CONF['page_size'];
$fDomain = safepost('fDomain', safeget('domain', safesession('list-virtual:domain')));
if (safesession('list-virtual:domain') != $fDomain) {
    unset($_SESSION['list-virtual:limit']);
}
$fDisplay = (int) safepost('limit', safeget('limit', safesession('list-virtual:limit')));
$search = safepost('search', safeget('search', array()));
# not remembered in the session
if (!is_array($search)) {
    die(Config::Lang('invalid_parameter'));
}
if (count($list_domains) == 0) {
    if (authentication_has_role('global-admin')) {
        flash_error($PALANG['no_domains_exist']);
    } else {
        flash_error($PALANG['no_domains_for_this_admin']);
    }
    header("Location: list.php?table=domain");
    # no domains (for this admin at least) - redirect to domain list
    exit;
}
コード例 #3
0
ファイル: list.php プロジェクト: mpietruschka/postfixadmin
$handler = new $handlerclass(0, $username, $is_admin);
$formconf = $handler->webformConfig();
$list_admins = array($username);
if ($is_superadmin && $formconf['required_role'] != 'global-admin') {
    # 'simulate admin' dropdown doesn't make sense for superadmin-only modules
    $list_admins = array_keys(list_admins());
}
if ($is_admin) {
    authentication_require_role($formconf['required_role']);
} else {
    if (empty($formconf['user_hardcoded_field'])) {
        die($handlerclass . ' is not available for users');
    }
}
$search = safeget('search', safesession("search_{$table}", array()));
$searchmode = safeget('searchmode', safesession("searchmode_{$table}", array()));
if (!is_array($search) || !is_array($searchmode)) {
    # avoid injection of raw SQL if $search is a string instead of an array
    die("Invalid parameter");
}
if (safeget('reset_search', 0)) {
    $search = array();
    $searchmode = array();
}
$_SESSION["search_{$table}"] = $search;
$_SESSION["searchmode_{$table}"] = $searchmode;
if (count($search)) {
    $handler->getList($search, $searchmode);
} else {
    $handler->getList('');
}