当前位置: 首页>>代码示例>>PHP>>正文


PHP authentication_require_role函数代码示例

本文整理汇总了PHP中authentication_require_role函数的典型用法代码示例。如果您正苦于以下问题:PHP authentication_require_role函数的具体用法?PHP authentication_require_role怎么用?PHP authentication_require_role使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了authentication_require_role函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authentication_require_role

 * @license GNU GPL v2 or later. 
 * 
 * File: edit-active-domain.php 
 * Responsible for toggling the status of a domain
 * Template File: message.php
 *
 * Template Variables:
 *
 * tMessage
 *
 * Form POST \ GET Variables:
 *
 * fDomain
 */
require_once 'common.php';
authentication_require_role('global-admin');
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if (isset($_GET['domain'])) {
        $fDomain = escape_string($_GET['domain']);
    }
    $sqlSet = 'active=1-active';
    if ('pgsql' == $CONF['database_type']) {
        $sqlSet = 'active=NOT active';
    }
    $result = db_query("UPDATE {$table_domain} SET {$sqlSet},modified=NOW() WHERE domain='{$fDomain}'");
    if ($result['rows'] != 1) {
        $error = 1;
        $tMessage = $PALANG['pAdminEdit_domain_result_error'];
    }
    if ($error != 1) {
        header("Location: list-domain.php");
开发者ID:albanpeignier,项目名称:postfixadmin,代码行数:31,代码来源:edit-active-domain.php

示例2: authentication_require_role

 * this package in the file LICENSE.TXT. 
 * 
 * Further details on the project are available at http://postfixadmin.sf.net 
 * 
 * @version $Id: main.php 1558 2013-11-10 15:57:32Z christian_boltz $ 
 * @license GNU GPL v2 or later. 
 * 
 * File: main.php
 * 'Home page' for logged in users.
 * Template File: main.php
 *
 * Template Variables:
 *
 * tummVacationtext
 *
 * Form POST \ GET Variables: -none-
 */
$rel_path = '../';
require_once '../common.php';
authentication_require_role('user');
$USERID_USERNAME = authentication_get_username();
$vh = new VacationHandler($USERID_USERNAME);
if ($vh->check_vacation()) {
    $tummVacationtext = $PALANG['pUsersMain_vacationSet'];
} else {
    $tummVacationtext = $PALANG['pUsersMain_vacation'];
}
$smarty->assign('tummVacationtext', $tummVacationtext);
$smarty->assign('smarty_template', 'users_main');
$smarty->display('index.tpl');
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
开发者ID:port22,项目名称:mail,代码行数:31,代码来源:main.php

示例3: authentication_require_role

 * tQuota
 * tDomain
 *
 * Form POST \ GET Variables:
 *
 * fUsername
 * fPassword
 * fPassword2
 * fName
 * fQuota
 * fDomain
 * fActive
 * fMail
 */
require_once 'common.php';
authentication_require_role('admin');
$SESSID_USERNAME = authentication_get_username();
if (authentication_has_role('global-admin')) {
    $list_domains = list_domains();
} else {
    $list_domains = list_domains_for_admin($SESSID_USERNAME);
}
$pCreate_mailbox_password_text = $PALANG['pCreate_mailbox_password_text'];
$pCreate_mailbox_name_text = $PALANG['pCreate_mailbox_name_text'];
$pCreate_mailbox_quota_text = $PALANG['pCreate_mailbox_quota_text'];
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    $fDomain = $list_domains[0];
    if (isset($_GET['domain'])) {
        $fDomain = escape_string($_GET['domain']);
    }
    if (!in_array($fDomain, $list_domains)) {
开发者ID:albanpeignier,项目名称:postfixadmin,代码行数:31,代码来源:create-mailbox.php

示例4: die

if (safeget('token') != $_SESSION['PFA_token']) {
    die('Invalid token!');
}
$username = authentication_get_username();
# enforce login
$id = safeget('delete');
$table = safeget('table');
$handlerclass = ucfirst($table) . 'Handler';
if (!preg_match('/^[a-z]+$/', $table) || !file_exists("model/{$handlerclass}.php")) {
    # validate $table
    die("Invalid table name given!");
}
$is_admin = authentication_has_role('admin');
$handler = new $handlerclass(0, $username, $is_admin);
$formconf = $handler->webformConfig();
if ($is_admin) {
    authentication_require_role($formconf['required_role']);
} else {
    if (empty($formconf['user_hardcoded_field'])) {
        die($handlerclass . ' is not available for users');
    }
}
if ($handler->init($id)) {
    # errors will be displayed as last step anyway, no need for duplicated code ;-)
    $handler->delete();
}
flash_error($handler->errormsg);
flash_info($handler->infomsg);
header("Location: " . $formconf['listview']);
exit;
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
开发者ID:port22,项目名称:mail,代码行数:31,代码来源:delete.php


注:本文中的authentication_require_role函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。