delete_perm_templ.php
author rejo
Thu, 24 Apr 2008 22:33:28 +0000
changeset 141 1ede5203910d
parent 126 cb06e3e29ed8
permissions -rw-r--r--
[feladat @ 247] If the user was listing the details of a zone that did not exist, all kinds of error messages were given. Now we first determine if the ID is valid and if not, immediately return the correct error message.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
92
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     1
<?php
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     2
119
f74e4f88b680 [feladat @ 222]
rejo
parents: 92
diff changeset
     3
/*  Poweradmin, a friendly web-based admin tool for PowerDNS.
92
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     5
 *
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     7
 *
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    11
 *  (at your option) any later version.
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    12
 *
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    16
 *  GNU General Public License for more details.
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    17
 *
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    20
 */
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    21
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    23
include_once("inc/header.inc.php");
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    24
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    25
$perm_templ = "-1";
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    26
if (isset($_GET['id']) && (v_num($_GET['id']))) {
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    27
	 $perm_templ = $_GET['id'];
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    28
}
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    29
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    30
$confirm = "-1";
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    31
if ((isset($_GET['confirm'])) && v_num($_GET['confirm'])) {
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    32
        $confirm = $_GET['confirm'];
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    33
}
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    34
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    35
if ($perm_templ == "-1"){
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    36
	error(ERR_INV_INPUT);
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    37
} else {
126
cb06e3e29ed8 [feladat @ 230]
peter
parents: 119
diff changeset
    38
	if (!(verify_permission('user_edit_templ_perm'))) {
92
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    39
		error(ERR_PERM_DEL_PERM_TEMPL);
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    40
	} else {
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    41
		$templ_details = get_permission_template_details($perm_templ);
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    42
		echo "     <h2>" . _('Delete permission template') . " \"" . $templ_details['name'] . "\"</h2>\n";
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    43
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    44
		if ($_GET["confirm"] == '1') {
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    45
			delete_perm_templ($perm_templ);
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    46
			success(SUC_PERM_TEMPL_DEL);
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    47
		} else {
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    48
			echo "     <p>" . _('Are you sure?') . "</p>\n";
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    49
			echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='" . $_SERVER['REQUEST_URI'] . "&confirm=1'\" value=\"" . _('Yes') . "\">\n"; 
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    50
		}
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    51
	}
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    52
}
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    53
c010ddacea32 [feladat @ 192]
rejo
parents:
diff changeset
    54
include_once("inc/footer.inc.php");