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


PHP verify_permission函数代码示例

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


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

示例1: error

 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
$perm_templ = "-1";
if (isset($_GET['id']) && v_num($_GET['id'])) {
    $perm_templ = $_GET['id'];
}
$confirm = "-1";
if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    $confirm = $_GET['confirm'];
}
if ($perm_templ == "-1") {
    error(ERR_INV_INPUT);
} else {
    if (!verify_permission('user_edit_templ_perm')) {
        error(ERR_PERM_DEL_PERM_TEMPL);
    } else {
        $templ_details = get_permission_template_details($perm_templ);
        echo "     <h2>" . _('Delete permission template') . " \"" . $templ_details['name'] . "\"</h2>\n";
        if (isset($_GET['confirm']) && $_GET["confirm"] == '1') {
            delete_perm_templ($perm_templ);
            success(SUC_PERM_TEMPL_DEL);
        } else {
            echo "     <p>" . _('Are you sure?') . "</p>\n";
            echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='delete_perm_templ.php?id=" . $perm_templ . "&amp;confirm=1'\" value=\"" . _('Yes') . "\">\n";
            echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
        }
    }
}
include_once "inc/footer.inc.php";
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:31,代码来源:delete_perm_templ.php

示例2: verify_permission

 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
verify_permission('templ_perm_edit') ? $perm_templ_perm_edit = "1" : ($perm_templ_perm_edit = "0");
$permission_templates = get_list_permission_templates();
if ($perm_templ_perm_edit == "0") {
    error(ERR_PERM_EDIT_PERM_TEMPL);
} else {
    echo "    <h2>" . _('Permission templates') . "</h2>\n";
    echo "     <table>\n";
    echo "      <tr>\n";
    echo "       <th>&nbsp;</th>\n";
    echo "       <th>" . _('Name') . "</th>\n";
    echo "       <th>" . _('Description') . "</th>\n";
    echo "      </tr>\n";
    foreach ($permission_templates as $template) {
        $perm_item_list = get_permissions_by_template_id($template['id'], true);
        $perm_items = implode(', ', $perm_item_list);
        echo "      <tr>\n";
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:31,代码来源:list_perm_templ.php

示例3: delete_domains

function delete_domains($domains)
{
    global $db;
    $error = false;
    $return = false;
    $response = $db->beginTransaction();
    foreach ($domains as $id) {
        if (verify_permission('zone_content_edit_others')) {
            $perm_edit = "all";
        } elseif (verify_permission('zone_content_edit_own')) {
            $perm_edit = "own";
        } else {
            $perm_edit = "none";
        }
        $user_is_zone_owner = verify_user_is_owner_zoneid($id);
        if ($perm_edit == "all" || $perm_edit == "own" && $user_is_zone_owner == "1") {
            if (is_numeric($id)) {
                $db->exec("DELETE FROM zones WHERE domain_id=" . $db->quote($id, 'integer'));
                $db->exec("DELETE FROM domains WHERE id=" . $db->quote($id, 'integer'));
                $db->exec("DELETE FROM records WHERE domain_id=" . $db->quote($id, 'integer'));
            } else {
                error(sprintf(ERR_INV_ARGC, "delete_domains", "id must be a number"));
                $error = true;
            }
        } else {
            error(ERR_PERM_DEL_ZONE);
            $error = true;
        }
    }
    if (PEAR::isError($response)) {
        $response = $db->rollback();
        $commit = false;
    } else {
        $response = $db->commit();
        $commit = true;
    }
    if (true == $commit && false == $error) {
        $return = true;
    }
    return $return;
}
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:41,代码来源:record.inc.php

示例4: error

 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
$id = "-1";
if (isset($_GET['id']) || v_num($_GET['id'])) {
    $id = $_GET['id'];
}
if ($id == "-1") {
    error(ERR_INV_INPUT);
} elseif (!verify_permission('templ_perm_edit')) {
    error(ERR_PERM_EDIT_PERM_TEMPL);
} else {
    $id = $_GET['id'];
    if (isset($_POST['commit'])) {
        update_perm_templ_details($_POST);
    }
    $templ = get_permission_template_details($id);
    $perms_templ = get_permissions_by_template_id($id);
    $perms_avail = get_permissions_by_template_id();
    echo "    <h2>" . _('Edit permission template') . "</h2>\n";
    echo "    <form method=\"post\">\n";
    echo "    <input type=\"hidden\" name=\"templ_id\" value=\"" . $id . "\">\n";
    echo "     <table>\n";
    echo "      <tr>\n";
    echo "       <th>" . _('Name') . "</th>\n";
开发者ID:kitpz2,项目名称:grupappz,代码行数:31,代码来源:edit_perm_templ.php

示例5: add_new_user

function add_new_user($details)
{
    global $db;
    if (!verify_permission('user_add_new')) {
        error(ERR_PERM_ADD_USER);
        return false;
    } elseif (user_exists($details['username'])) {
        error(ERR_USER_EXISTS);
        return false;
    } elseif (!is_valid_email($details['email'])) {
        error(ERR_INV_EMAIL);
        return false;
    } elseif ($details['active'] == 1) {
        $active = 1;
    } else {
        $active = 0;
    }
    $query = "INSERT INTO users (username, password, fullname, email, description,";
    if (verify_permission('user_edit_templ_perm')) {
        $query .= ' perm_templ,';
    }
    $query .= " active) VALUES (" . $db->quote($details['username'], 'text') . ", " . $db->quote(md5($details['password']), 'text') . ", " . $db->quote($details['fullname'], 'text') . ", " . $db->quote($details['email'], 'text') . ", " . $db->quote($details['descr'], 'text') . ", ";
    if (verify_permission('user_edit_templ_perm')) {
        $query .= $db->quote($details['perm_templ'], 'integer') . ", ";
    }
    $query .= $db->quote($active, 'integer') . ")";
    $response = $db->query($query);
    if (PEAR::isError($response)) {
        error($response->getMessage());
        return false;
    }
    return true;
}
开发者ID:kitpz2,项目名称:grupappz,代码行数:33,代码来源:users.inc.php

示例6: verify_permission

include_once "inc/header.inc.php";
verify_permission('user_edit_own') ? $perm_edit_own = "1" : ($perm_edit_own = "0");
verify_permission('user_edit_others') ? $perm_edit_others = "1" : ($perm_edit_others = "0");
if (!(isset($_GET['id']) && v_num($_GET['id']))) {
    error(ERR_INV_INPUT);
    include_once "inc/footer.inc.php";
    exit;
} else {
    $uid = $_GET['id'];
}
if (isset($_POST['commit'])) {
    if (delete_user($uid, $_POST['zone'])) {
        success(SUC_USER_DEL);
    }
} else {
    if ($uid != $_SESSION['userid'] && !verify_permission('user_edit_others') || $uid == $_SESSION['userid'] && !verify_permission('user_edit_own')) {
        error(ERR_PERM_DEL_USER);
        include_once "inc/footer.inc.php";
        exit;
    } else {
        $fullname = get_fullname_from_userid($uid);
        $zones = get_zones("own", $uid);
        echo "     <h2>" . _('Delete user') . " \"" . $fullname . "\"</h2>\n";
        echo "     <form method=\"post\">\n";
        echo "      <table>\n";
        if (count($zones) > 0) {
            $users = show_users();
            echo "       <tr>\n";
            echo "        <td colspan=\"5\">\n";
            echo "         " . _('You are about to delete a user. This user is owner for a number of zones. Please decide what to do with these zones.') . "\n";
            echo "        </td>\n";
开发者ID:kitpz2,项目名称:grupappz,代码行数:31,代码来源:delete_user.php

示例7: verify_permission

 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
verify_permission('zone_master_add') ? $perm_zone_master_add = "1" : ($perm_zone_master_add = "0");
$zone_templ = get_list_zone_templ($_SESSION['userid']);
$username = get_fullname_from_userid($_SESSION['userid']);
if ($perm_zone_master_add == "0") {
    error(ERR_PERM_EDIT_ZONE_TEMPL);
} else {
    echo "    <h2>" . _('Zone templates for') . " " . $username . "</h2>\n";
    echo "     <table>\n";
    echo "      <tr>\n";
    echo "       <th>&nbsp;</th>\n";
    echo "       <th>" . _('Name') . "</th>\n";
    echo "       <th>" . _('Description') . "</th>\n";
    echo "      </tr>\n";
    foreach ($zone_templ as $template) {
        echo "      <tr>\n";
        if ($perm_zone_master_add == "1") {
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:31,代码来源:list_zone_templ.php

示例8: elseif

    $perm_view = "all";
} elseif (verify_permission('zone_content_view_own')) {
    $perm_view = "own";
} else {
    $perm_view = "none";
}
if (verify_permission('zone_content_edit_others')) {
    $perm_content_edit = "all";
} elseif (verify_permission('zone_content_edit_own')) {
    $perm_content_edit = "own";
} else {
    $perm_content_edit = "none";
}
if (verify_permission('zone_meta_edit_others')) {
    $perm_meta_edit = "all";
} elseif (verify_permission('zone_meta_edit_own')) {
    $perm_meta_edit = "own";
} else {
    $perm_meta_edit = "none";
}
$user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
if ($perm_meta_edit == "all" || $perm_meta_edit == "own" && $user_is_zone_owner == "1") {
    $meta_edit = "1";
}
if (isset($_POST['slave_master_change']) && is_numeric($_POST["domain"])) {
    change_zone_slave_master($_POST['domain'], $_POST['new_master']);
}
if (isset($_POST['type_change']) && in_array($_POST['newtype'], $server_types)) {
    change_zone_type($_POST['newtype'], $zone_id);
}
if (isset($_POST["newowner"]) && is_numeric($_POST["domain"]) && is_numeric($_POST["newowner"])) {
开发者ID:kitpz2,项目名称:grupappz,代码行数:31,代码来源:edit.php

示例9: edit_zone_templ

function edit_zone_templ($details, $zone_templ_id)
{
    global $db;
    $zone_name_exists = zone_templ_name_exists($details['templ_name'], $zone_templ_id);
    if (!verify_permission('zone_master_add')) {
        error(ERR_PERM_ADD_ZONE_TEMPL);
        return false;
    } elseif ($zone_name_exists != '0') {
        error(ERR_ZONE_TEMPL_EXIST);
        return false;
    } else {
        $query = "UPDATE zone_templ\n\t\t\tSET name=" . $db->quote($details['templ_name'], 'text') . ",\n\t\t\tdescr=" . $db->quote($details['templ_descr'], 'text') . "\n\t\t\tWHERE id=" . $db->quote($zone_templ_id, 'integer');
        $result = $db->query($query);
        if (PEAR::isError($result)) {
            error($result->getMessage());
            return false;
        }
        return true;
    }
}
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:20,代码来源:templates.inc.php

示例10: verify_permission

 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
verify_permission('user_view_others') ? $perm_view_others = "1" : ($perm_view_others = "0");
verify_permission('user_edit_own') ? $perm_edit_own = "1" : ($perm_edit_own = "0");
verify_permission('user_edit_others') ? $perm_edit_others = "1" : ($perm_edit_others = "0");
verify_permission('templ_perm_edit') ? $perm_templ_perm_edit = "1" : ($perm_templ_perm_edit = "0");
verify_permission('user_is_ueberuser') ? $perm_is_godlike = "1" : ($perm_is_godlike = "0");
verify_permission('user_add_new') ? $perm_add_new = "1" : ($perm_add_new = "0");
#if (isset($_GET['action']) && $_GET['action'] === "switchuser" && $perm_is_godlike === "1"){
#        $_SESSION["userlogin"] = $_GET['username'];
#	echo '<meta http-equiv="refresh" content="1"/>';
#}
unset($commit_button);
if (isset($_POST['commit'])) {
    foreach ($_POST['user'] as $user) {
        update_user_details($user);
    }
}
$users = get_user_detail_list("");
echo "    <h2>" . _('User administration') . "</h2>\n";
echo "    <form method=\"post\" action=\"\">\n";
echo "     <table>\n";
echo "      <tr>\n";
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:31,代码来源:users.php

示例11: get_zone_templ_is_owner

 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
$zone_templ_id = "-1";
if (isset($_GET['id']) && v_num($_GET['id'])) {
    $zone_templ_id = $_GET['id'];
}
$confirm = "-1";
if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    $confirm = $_GET['confirm'];
}
$owner = get_zone_templ_is_owner($zone_templ_id, $_SESSION['userid']);
if ($zone_templ_id == "-1") {
    error(ERR_INV_INPUT);
} else {
    if (!verify_permission('zone_master_add') || !$owner) {
        error(ERR_PERM_DEL_ZONE_TEMPL);
    } else {
        $templ_details = get_zone_templ_details($zone_templ_id);
        echo "     <h2>" . _('Delete zone template') . " \"" . $templ_details['name'] . "\"</h2>\n";
        if (isset($_GET['confirm']) && $_GET["confirm"] == '1') {
            delete_zone_templ($zone_templ_id);
            success(SUC_ZONE_TEMPL_DEL);
        } else {
            echo "     <p>" . _('Are you sure?') . "</p>\n";
            echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='delete_zone_templ.php?id=" . $zone_templ_id . "&amp;confirm=1'\" value=\"" . _('Yes') . "\">\n";
            echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
        }
    }
}
include_once "inc/footer.inc.php";
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:31,代码来源:delete_zone_templ.php

示例12: error

 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
if (!verify_permission('zone_master_add')) {
    error(ERR_PERM_ADD_ZONE_TEMPL);
} else {
    if (isset($_POST['commit'])) {
        if (add_zone_templ($_POST, $_SESSION['userid'])) {
            success(SUC_ZONE_TEMPL_ADD);
        }
        // TODO: otherwise repopulate values to form
    }
    /* 
    Display new zone template form
    */
    $username = get_fullname_from_userid($_SESSION['userid']);
    echo "    <h2>" . _('Add zone template for') . " " . $username . "</h2>\n";
    echo "    <form method=\"post\" action=\"add_zone_templ.php\">\n";
    echo "     <table>\n";
开发者ID:jelastic-public-cartridges,项目名称:jelastic-powerdns-cartridge,代码行数:31,代码来源:add_zone_templ.php

示例13: trim

 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
$owner = "-1";
if (isset($_POST['owner']) && v_num($_POST['owner'])) {
    $owner = $_POST['owner'];
}
$zone = trim($_POST['domain']);
$master = $_POST['slave_master'];
$type = "SLAVE";
verify_permission('zone_slave_add') ? $zone_slave_add = "1" : ($zone_slave_add = "0");
if ($_POST['submit'] && $zone_slave_add == "1") {
    if (!is_valid_hostname_fqdn($zone, 0)) {
        error(ERR_DNS_HOSTNAME);
    } elseif (domain_exists($zone)) {
        error(ERR_DOMAIN_EXISTS);
    } elseif (!is_valid_ipv4($master) && !is_valid_ipv6($master)) {
        error(ERR_DNS_IP);
    } else {
        if (add_domain($zone, $owner, $webip, $mailip, $empty, $type, $master)) {
            success(SUC_ZONE_ADD);
            unset($zone, $owner, $webip, $mailip, $empty, $type, $master);
        }
    }
}
if ($zone_slave_add != "1") {
开发者ID:kitpz2,项目名称:grupappz,代码行数:31,代码来源:add_zone_slave.php

示例14: elseif

 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
if (verify_permission('zone_content_edit_others')) {
    $perm_edit = "all";
} elseif (verify_permission('zone_content_edit_own')) {
    $perm_edit = "own";
} else {
    $perm_edit = "none";
}
$zone_id = "-1";
if (isset($_GET['id']) && v_num($_GET['id'])) {
    $zone_id = $_GET['id'];
}
$confirm = "-1";
if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    $confirm = $_GET['confirm'];
}
$zone_info = get_zone_info_from_id($zone_id);
$zone_owners = get_fullnames_owners_from_domainid($zone_id);
$user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
开发者ID:kitpz2,项目名称:grupappz,代码行数:31,代码来源:delete_domain.php

示例15: verify_permission

 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
$master_ip = $_POST["master_ip"];
$ns_name = $_POST["ns_name"];
$account = $_POST["account"];
verify_permission('supermaster_add') ? $supermasters_add = "1" : ($supermasters_add = "0");
if ($_POST["submit"]) {
    if (add_supermaster($master_ip, $ns_name, $account)) {
        success(SUC_SM_ADD);
    } else {
        $error = "1";
    }
}
echo "     <h2>" . _('Add supermaster') . "</h2>\n";
if ($supermasters_add != "1") {
    echo "     <p>" . _("You do not have the permission to add a new supermaster.") . "</p>\n";
} else {
    echo "     <form method=\"post\" action=\"add_supermaster.php\">\n";
    echo "      <table>\n";
    echo "       <tr>\n";
    echo "        <td class=\"n\">" . _('IP address of supermaster') . "</td>\n";
开发者ID:kitpz2,项目名称:grupappz,代码行数:31,代码来源:add_supermaster.php


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