delete_supermaster.php
author rejo
Mon, 19 May 2008 10:20:44 +0000
changeset 172 4708e6b152a0
parent 160 19cc35549204
permissions -rw-r--r--
[feladat @ 279] Fixed a bug causing return of wrong seasrch results when searching for zones the user does own. Reported by Adhisimon. Closes: #56.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     1
<?php
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     2
119
f74e4f88b680 [feladat @ 222]
rejo
parents: 106
diff changeset
     3
/*  Poweradmin, a friendly web-based admin tool for PowerDNS.
47
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    21
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    23
include_once("inc/header.inc.php");
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
106
41d05ff53708 [feladat @ 206]
peter
parents: 82
diff changeset
    25
$master_ip = "-1";
160
19cc35549204 [feladat @ 266]
rejo
parents: 126
diff changeset
    26
if (isset($_GET['master_ip']) && (is_valid_ipv4($_GET['master_ip']) || is_valid_ipv6($_GET['master_ip']))) {
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    27
	 $master_ip = $_GET['master_ip'];
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    28
}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    29
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    30
$confirm = "-1";
106
41d05ff53708 [feladat @ 206]
peter
parents: 82
diff changeset
    31
if ((isset($_GET['confirm'])) && (v_num($_GET['confirm']))) {
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    32
        $confirm = $_GET['confirm'];
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    33
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    34
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    35
if ($master_ip == "-1"){
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    36
	error(ERR_INV_INPUT);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    37
} else {
126
cb06e3e29ed8 [feladat @ 230]
peter
parents: 119
diff changeset
    38
	(verify_permission('supermaster_edit')) ? $perm_sm_edit = "1" :  $perm_sm_edit = "0" ;
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    39
	if ($perm_sm_edit == "0") {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    40
		error(ERR_PERM_DEL_SM);
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    41
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    42
		$info = get_supermaster_info_from_ip($master_ip);
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    43
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    44
		echo "     <h2>" . _('Delete supermaster') . " \"" . $master_ip . "\"</h2>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    45
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    46
		if ($_GET["confirm"] == '1') {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    47
			if (delete_supermaster($master_ip)) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    48
				success(SUC_ZONE_DEL);
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    49
			}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    50
		} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    51
			echo "     <p>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    52
			echo "      " . _('Hostname in NS record') . ": " . $info['ns_name'] . "<br>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    53
			echo "      " . _('Account') . ": " . $info['account'] . "\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    54
			echo "     </p>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    55
			echo "     <p>" . _('Are you sure?') . "</p>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    56
			echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='" . $_SERVER['REQUEST_URI'] . "&confirm=1'\" value=\"" . _('Yes') . "\">\n"; 
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    57
			echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    58
		}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    59
	}
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    60
}
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    61
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    62
include_once("inc/footer.inc.php");