1
+ − 1
<?php
+ − 2
119
+ − 3
/* Poweradmin, a friendly web-based admin tool for PowerDNS.
47
+ − 4
* See <https://rejo.zenger.nl/poweradmin> for more details.
+ − 5
*
+ − 6
* Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl>
+ − 7
*
+ − 8
* This program is free software: you can redistribute it and/or modify
+ − 9
* it under the terms of the GNU General Public License as published by
+ − 10
* the Free Software Foundation, either version 3 of the License, or
+ − 11
* (at your option) any later version.
+ − 12
*
+ − 13
* This program is distributed in the hope that it will be useful,
+ − 14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
+ − 15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ − 16
* GNU General Public License for more details.
+ − 17
*
+ − 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/>.
+ − 20
*/
+ − 21
1
+ − 22
require_once ( "inc/toolkit.inc.php" );
82
+ − 23
include_once ( "inc/header.inc.php" );
1
+ − 24
82
+ − 25
$record_id = "-1" ;
+ − 26
if ( isset ( $_GET [ 'id' ]) && v_num ( $_GET [ 'id' ])) {
+ − 27
$record_id = $_GET [ 'id' ];
+ − 28
}
+ − 29
+ − 30
$confirm = "-1" ;
98
+ − 31
if ( isset ( $_GET [ 'confirm' ]) && v_num ( $_GET [ 'confirm' ])) {
82
+ − 32
$confirm = $_GET [ 'confirm' ];
+ − 33
}
+ − 34
126
+ − 35
if ( verify_permission ( 'zone_content_edit_others' )) { $perm_content_edit = "all" ; }
+ − 36
elseif ( verify_permission ( 'zone_content_edit_own' )) { $perm_content_edit = "own" ; }
82
+ − 37
else { $perm_content_edit = "none" ; }
+ − 38
139
+ − 39
$zid = get_zone_id_from_record_id ( $_GET [ 'id' ]);
+ − 40
$user_is_zone_owner = verify_user_is_owner_zoneid ( $zid );
82
+ − 41
+ − 42
if ( $record_id == "-1" ) {
98
+ − 43
error ( ERR_INV_INPUT );
+ − 44
} else {
82
+ − 45
if ( $confirm == '1' ) {
+ − 46
if ( delete_record ( $record_id ) ) {
+ − 47
success ( SUC_RECORD_DEL );
37
+ − 48
}
82
+ − 49
} else {
+ − 50
$zone_id = recid_to_domid ( $record_id );
140
+ − 51
$zone_name = get_zone_name_from_id ( $zone_id );
82
+ − 52
$user_is_zone_owner = verify_user_is_owner_zoneid ( $zone_id );
+ − 53
$record_info = get_record_from_id ( $record_id );
13
+ − 54
82
+ − 55
echo " <h2>" . _ ( 'Delete record' ) . " in zone \" " . $zone_name . " \" </h2> \n " ;
+ − 56
+ − 57
if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) {
+ − 58
error ( ERR_PERM_EDIT_RECORD );
+ − 59
} else {
+ − 60
echo " <table> \n " ;
+ − 61
echo " <tr> \n " ;
+ − 62
echo " <th>Name</th> \n " ;
+ − 63
echo " <th>Type</th> \n " ;
+ − 64
echo " <th>Content</th> \n " ;
+ − 65
echo " <th>Priority</th> \n " ;
+ − 66
echo " <th>TTL</th> \n " ;
+ − 67
echo " </tr> \n " ;
+ − 68
echo " <tr> \n " ;
+ − 69
echo " <td>" . $record_info [ 'name' ] . "</td> \n " ;
+ − 70
echo " <td>" . $record_info [ 'type' ] . "</td> \n " ;
+ − 71
echo " <td>" . $record_info [ 'content' ] . "</td> \n " ;
+ − 72
echo " <td>" . $record_info [ 'priority' ] . "</td> \n " ;
+ − 73
echo " <td>" . $record_info [ 'ttl' ] . "</td> \n " ;
+ − 74
echo " </tr> \n " ;
+ − 75
echo " </table> \n " ;
+ − 76
if (( $record_info [ 'type' ] == 'NS' && $record_info [ 'name' ] == $zone_name ) || $record_info [ 'type' ] == 'SOA' ) {
+ − 77
echo " <p>" . _ ( 'You are trying to delete a record that is needed for this zone to work.' ) . "</p> \n " ;
+ − 78
}
+ − 79
echo " <p>" . _ ( 'Are you sure?' ) . "</p> \n " ;
+ − 80
echo " <input type= \" button \" class= \" button \" OnClick= \" location.href='" . $_SERVER [ "REQUEST_URI" ] . "&confirm=1' \" value= \" " . _ ( 'Yes' ) . " \" > \n " ;
+ − 81
echo " <input type= \" button \" class= \" button \" OnClick= \" location.href='index.php' \" value= \" " . _ ( 'No' ) . " \" > \n " ;
+ − 82
}
1
+ − 83
}
+ − 84
}
+ − 85
include_once ( "inc/footer.inc.php" );