delete_domain.php
changeset 82 c255196bc447
parent 79 0c0aa144356a
child 119 f74e4f88b680
equal deleted inserted replaced
81:c72d6d51f3d3 82:c255196bc447
    18  *  You should have received a copy of the GNU General Public License
    18  *  You should have received a copy of the GNU General Public License
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20  */
    20  */
    21 
    21 
    22 require_once("inc/toolkit.inc.php");
    22 require_once("inc/toolkit.inc.php");
       
    23 include_once("inc/header.inc.php");
    23 
    24 
    24 if (!level(5))
    25 if (verify_permission(zone_content_edit_others)) { $perm_edit = "all" ; }
    25 {
    26 elseif (verify_permission(zone_content_edit_own)) { $perm_edit = "own" ;}
    26         error(ERR_LEVEL_5);
    27 else { $perm_edit = "none" ; }
    27         
    28 
       
    29 $zone_id = "-1";
       
    30 if (isset($_GET['id']) && v_num($_GET['id'])) {
       
    31 	$zone_id = $_GET['id'];
    28 }
    32 }
    29 
    33 
    30 if (isset($_GET["id"])) {
    34 $confirm = "-1";
    31         if ((isset($_GET["confirm"])) && ($_GET['confirm'] == '0')) {
    35 if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    32                 clean_page("index.php");
    36 	$confirm = $_GET['confirm'];
    33         } elseif ((isset($_GET["confirm"])) && ($_GET['confirm'] == '1')) {
    37 }
    34                 delete_domain($_GET["id"]);
    38 
    35                 clean_page("index.php");
    39 $zone_info = get_zone_info_from_id($zone_id);
    36         }
    40 $zone_owners = get_fullnames_owners_from_domainid($zone_id);
    37         include_once("inc/header.inc.php");
    41 $user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
    38         $info = get_domain_info_from_id($_GET["id"]);
    42 
    39         ?><h2><?php echo _('Delete zone'); ?> "<?php echo $info["name"] ?>"</h2>
    43 if ($zone_id == "-1"){
    40         <?php
    44 	error(ERR_INV_INPUT);
    41 	if($info["owner"])
    45 	include_once("inc/footer.inc.php");
    42 	{
    46 	exit;
    43 		print (_('Owner') . ": " . $info["owner"] . "<br>"); 
    47 }
       
    48 
       
    49 echo "     <h2>" . _('Delete zone') . " \"" . $zone_info['name']. "\"</h2>\n";
       
    50 
       
    51 if ($confirm == '1') {
       
    52 	if ( delete_domain($zone_id) ) {
       
    53 		success(SUC_ZONE_DEL);
    44 	}
    54 	}
    45 	print (_('Type') . ": " . strtolower($info["type"]) . "<br>");
    55 } else {
    46 	print (_('Number of records in zone') . ": " . $info["numrec"] . "<br>");
    56 	if ( $perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1") ) {	
    47 	if($info["type"] == "SLAVE")
    57 		echo "      " . _('Owner') . ": " . $zone_owners . "<br>\n";
    48 	{
    58 		echo "      " . _('Type') . ": " . $zone_info['type'] . "\n";
    49 		$slave_master = get_domain_slave_master($_GET["id"]);
    59 		if ( $zone_info['type'] == "SLAVE" ) {
    50 		if(supermaster_exists($slave_master))
    60 			$slave_master = get_domain_slave_master($zone_id);
    51 		{
    61 			if(supermaster_exists($slave_master)) {
    52 			print ("<font class=\"warning\">");
    62 				echo "        <p>         \n";
    53 			printf(_('You are about to delete a slave zone of which the master nameserver, %s, is a supermaster. Deleting the zone now, will result in temporary removal only. Whenever the supermaster sends a notification for this zone, it will be added again!'), $slave_master);
    63 				printf (_('You are about to delete a slave zone of which the master nameserver, %s, is a supermaster. Deleting the zone now, will result in temporary removal only. Whenever the supermaster sends a notification for this zone, it will be added again!'), $slave_master);
    54 			print ("</font><br>");
    64 				echo "        </p>\n";
       
    65 			}
    55 		}
    66 		}
       
    67 		echo "     <p>" . _('Are you sure?') . "</p>\n";
       
    68 		echo "     <br><br>\n";
       
    69 		echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='" . $_SERVER["REQUEST_URI"] . "&confirm=1'\" value=\"" . _('Yes') . "\">\n";
       
    70 		echo "     <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
       
    71 	} else {
       
    72 		error(ERR_PERM_DEL_ZONE);
    56 	}
    73 	}
    57 	?>
       
    58 	<font class="warning"><?php echo _('Are you sure?'); ?></font>
       
    59 	<br><br>
       
    60 	<input type="button" class="button" OnClick="location.href='<?php echo $_SERVER["REQUEST_URI"] ?>&confirm=1'" value="<?php echo _('Yes'); ?>">
       
    61 	<input type="button" class="button" OnClick="location.href='<?php echo $_SERVER["REQUEST_URI"] ?>&confirm=0'" value="<?php echo _('No'); ?>">
       
    62 	<?php
       
    63 } elseif ($_GET["edit"]) {
       
    64         include_once("inc/header.inc.php");
       
    65 } else {
       
    66         include_once("inc/header.inc.php");
       
    67         echo _('Nothing to do!');
       
    68 }
    74 }
       
    75 
    69 include_once("inc/footer.inc.php");
    76 include_once("inc/footer.inc.php");
       
    77 
       
    78 ?>