*  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";
 *  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";
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;
}
コード例 #4
0
ファイル: edit_perm_templ.php プロジェクト: kitpz2/grupappz
 *  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";
コード例 #5
0
ファイル: users.inc.php プロジェクト: kitpz2/grupappz
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;
}
コード例 #6
0
ファイル: delete_user.php プロジェクト: kitpz2/grupappz
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";
 *  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") {
コード例 #8
0
ファイル: edit.php プロジェクト: kitpz2/grupappz
    $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"])) {
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;
    }
}
コード例 #10
0
 *  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";
 */
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";
 *  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";
コード例 #13
0
ファイル: add_zone_slave.php プロジェクト: kitpz2/grupappz
 *  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") {
コード例 #14
0
ファイル: delete_domain.php プロジェクト: kitpz2/grupappz
 *  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);
コード例 #15
0
ファイル: add_supermaster.php プロジェクト: kitpz2/grupappz
 *  (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";
コード例 #16
0
 *  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 = "-1";
if (isset($_GET['master_ip']) && (is_valid_ipv4($_GET['master_ip']) || is_valid_ipv6($_GET['master_ip']))) {
    $master_ip = $_GET['master_ip'];
}
$confirm = "-1";
if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    $confirm = $_GET['confirm'];
}
if ($master_ip == "-1") {
    error(ERR_INV_INPUT);
} else {
    verify_permission('supermaster_edit') ? $perm_sm_edit = "1" : ($perm_sm_edit = "0");
    if ($perm_sm_edit == "0") {
        error(ERR_PERM_DEL_SM);
    } else {
        $info = get_supermaster_info_from_ip($master_ip);
        echo "     <h2>" . _('Delete supermaster') . " \"" . $master_ip . "\"</h2>\n";
        if ($_GET["confirm"] == '1') {
            if (delete_supermaster($master_ip)) {
                success(SUC_ZONE_DEL);
            }
        } else {
            echo "     <p>\n";
            echo "      " . _('Hostname in NS record') . ": " . $info['ns_name'] . "<br>\n";
            echo "      " . _('Account') . ": " . $info['account'] . "\n";
            echo "     </p>\n";
            echo "     <p>" . _('Are you sure?') . "</p>\n";
 *  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('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('user_is_ueberuser') ? $perm_is_godlike = "1" : ($perm_is_godlike = "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 (is_valid_user($uid)) {
        $zones = $_POST['zone'];
        if (delete_user($uid, $zones)) {
            success(SUC_USER_DEL);
        }
    } else {
        header("Location: users.php");
コード例 #18
0
ファイル: header.inc.php プロジェクト: kitpz2/grupappz
if (file_exists('inc/custom_header.inc.php')) {
    include 'inc/custom_header.inc.php';
}
echo "  <h1>Poweradmin</h1>\n";
if (file_exists('install')) {
    error(ERR_INSTALL_DIR_EXISTS);
    include 'inc/footer.inc.php';
    exit;
} elseif (isset($_SESSION["userid"])) {
    verify_permission('search') ? $perm_search = "1" : ($perm_search = "0");
    verify_permission('zone_content_view_own') ? $perm_view_zone_own = "1" : ($perm_view_zone_own = "0");
    verify_permission('zone_content_view_other') ? $perm_view_zone_other = "1" : ($perm_view_zone_other = "0");
    verify_permission('supermaster_view') ? $perm_supermaster_view = "1" : ($perm_supermaster_view = "0");
    verify_permission('zone_master_add') ? $perm_zone_master_add = "1" : ($perm_zone_master_add = "0");
    verify_permission('zone_slave_add') ? $perm_zone_slave_add = "1" : ($perm_zone_slave_add = "0");
    verify_permission('supermaster_add') ? $perm_supermaster_add = "1" : ($perm_supermaster_add = "0");
    echo "    <div class=\"menu\">\n";
    echo "    <span class=\"menuitem\"><a href=\"index.php\">" . _('Index') . "</a></span>\n";
    if ($perm_search == "1") {
        echo "    <span class=\"menuitem\"><a href=\"search.php\">" . _('Search zones and records') . "</a></span>\n";
    }
    if ($perm_view_zone_own == "1" || $perm_view_zone_other == "1") {
        echo "    <span class=\"menuitem\"><a href=\"list_zones.php\">" . _('List zones') . "</a></span>\n";
    }
    if ($perm_supermaster_view) {
        echo "    <span class=\"menuitem\"><a href=\"list_supermasters.php\">" . _('List supermasters') . "</a></span>\n";
    }
    if ($perm_zone_master_add) {
        echo "    <span class=\"menuitem\"><a href=\"add_zone_master.php\">" . _('Add master zone') . "</a></span>\n";
    }
    if ($perm_zone_slave_add) {
コード例 #19
0
ファイル: record.inc.php プロジェクト: kitpz2/grupappz
function search_zone_and_record($holy_grail, $perm)
{
    global $db;
    $holy_grail = trim($holy_grail);
    $sql_add_from = '';
    $sql_add_where = '';
    $return_zones = array();
    $return_records = array();
    if (verify_permission('zone_content_view_others')) {
        $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";
    }
    // Search for matching domains
    if ($perm == "own") {
        $sql_add_from = ", zones ";
        $sql_add_where = " AND zones.domain_id = domains.id AND zones.owner = " . $db->quote($_SESSION['userid'], 'integer');
    }
    $query = "SELECT \n\t\t\tdomains.id AS zid,\n\t\t\tdomains.name AS name,\n\t\t\tdomains.type AS type,\n\t\t\tdomains.master AS master\n\t\t\tFROM domains" . $sql_add_from . "\n\t\t\tWHERE domains.name LIKE " . $db->quote($holy_grail, 'text') . $sql_add_where;
    $response = $db->query($query);
    if (PEAR::isError($response)) {
        error($response->getMessage());
        return false;
    }
    while ($r = $response->fetchRow()) {
        $return_zones[] = array("zid" => $r['zid'], "name" => $r['name'], "type" => $r['type'], "master" => $r['master']);
    }
    // Search for matching records
    if ($perm == "own") {
        $sql_add_from = ", zones ";
        $sql_add_where = " AND zones.domain_id = records.domain_id AND zones.owner = " . $db->quote($_SESSION['userid'], 'integer');
    }
    $query = "SELECT\n\t\t\trecords.id AS rid,\n\t\t\trecords.name AS name,\n\t\t\trecords.type AS type,\n\t\t\trecords.content AS content,\n\t\t\trecords.ttl AS ttl,\n\t\t\trecords.prio AS prio,\n\t\t\trecords.domain_id AS zid\n\t\t\tFROM records" . $sql_add_from . "\n\t\t\tWHERE (records.name LIKE " . $db->quote($holy_grail, 'text') . " OR records.content LIKE " . $db->quote($holy_grail, 'text') . ")" . $sql_add_where;
    $response = $db->query($query);
    if (PEAR::isError($response)) {
        error($response->getMessage());
        return false;
    }
    while ($r = $response->fetchRow()) {
        $return_records[] = array("rid" => $r['rid'], "name" => $r['name'], "type" => $r['type'], "content" => $r['content'], "ttl" => $r['ttl'], "zid" => $r['zid'], "prio" => $r['prio']);
    }
    return array('zones' => $return_zones, 'records' => $return_records);
}
        }
    }
    $domains = $temp;
} else {
    $domains = array();
}
if (isset($_POST['zone_template'])) {
    $zone_template = $_POST['zone_template'];
} else {
    $zone_template = "none";
}
/*
Check user permissions
*/
verify_permission('zone_master_add') ? $zone_master_add = "1" : ($zone_master_add = "0");
verify_permission('user_view_others') ? $perm_view_others = "1" : ($perm_view_others = "0");
if (isset($_POST['submit']) && $zone_master_add == "1") {
    $error = false;
    foreach ($domains as $domain) {
        if (!is_valid_hostname_fqdn($domain, 0)) {
            error($domain . ' failed - ' . ERR_DNS_HOSTNAME);
        } elseif (domain_exists($domain)) {
            error($domain . ' failed - ' . ERR_DOMAIN_EXISTS);
            // TODO: repopulate domain name(s) to the form if there was an error occured
            $error = true;
        } elseif (add_domain($domain, $owner, $dom_type, '', $zone_template)) {
            success("<a href=\"edit.php?id=" . get_zone_id_from_name($domain) . "\">" . $domain . " - " . SUC_ZONE_ADD . '</a>');
        }
    }
    if (false === $error) {
        unset($domains, $owner, $dom_type, $zone_template);
コード例 #21
0
ファイル: users.php プロジェクト: kitpz2/grupappz
        echo "      </tr>\n";
    } else {
        echo "      <tr>\n";
        echo "       <td>&nbsp;</td>\n";
        echo "       <td>" . $user['username'] . "</td>\n";
        echo "       <td>" . $user['fullname'] . "</td>\n";
        echo "       <td>" . $user['descr'] . "</td>\n";
        echo "       <td>" . $user['email'] . "</td>\n";
        echo "       <td>" . $user['tpl_name'] . "</td>\n";
        if ($active == " checked") {
            echo "       <td>Yes</td>\n";
        } else {
            echo "       <td>No</td>\n";
        }
        echo "      </tr>\n";
    }
}
echo "     </table>\n";
if ($commit_button) {
    echo "     <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
}
echo "    </form>\n";
echo "    <ul>\n";
if ($perm_templ_perm_edit == "1") {
    echo "<li><a href=\"list_perm_templ.php\">" . _('Edit permission template') . "</a>.</li>\n";
}
if (verify_permission('user_add_new')) {
    echo "<li><a href=\"add_user.php\">" . _('Add user') . "</a>.</li>\n";
}
echo "    </ul>\n";
include_once "inc/footer.inc.php";