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 |
|
|
39 |
$user_is_zone_owner = verify_user_is_owner_zoneid($_GET["domain"]); |
|
40 |
|
|
41 |
if ($record_id == "-1" ) { |
98
|
42 |
error(ERR_INV_INPUT); |
|
43 |
} else { |
82
|
44 |
if ($confirm == '1') { |
|
45 |
if ( delete_record($record_id) ) { |
|
46 |
success(SUC_RECORD_DEL); |
37
|
47 |
} |
82
|
48 |
} else { |
|
49 |
$zone_id = recid_to_domid($record_id); |
|
50 |
$zone_name = get_domain_name_from_id($zone_id); |
|
51 |
$user_is_zone_owner = verify_user_is_owner_zoneid($zone_id); |
|
52 |
$record_info = get_record_from_id($record_id); |
13
|
53 |
|
82
|
54 |
echo " <h2>" . _('Delete record') . " in zone \"" . $zone_name . "\"</h2>\n"; |
|
55 |
|
|
56 |
if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { |
|
57 |
error(ERR_PERM_EDIT_RECORD); |
|
58 |
} else { |
|
59 |
echo " <table>\n"; |
|
60 |
echo " <tr>\n"; |
|
61 |
echo " <th>Name</th>\n"; |
|
62 |
echo " <th>Type</th>\n"; |
|
63 |
echo " <th>Content</th>\n"; |
|
64 |
echo " <th>Priority</th>\n"; |
|
65 |
echo " <th>TTL</th>\n"; |
|
66 |
echo " </tr>\n"; |
|
67 |
echo " <tr>\n"; |
|
68 |
echo " <td>" . $record_info['name'] . "</td>\n"; |
|
69 |
echo " <td>" . $record_info['type'] . "</td>\n"; |
|
70 |
echo " <td>" . $record_info['content'] . "</td>\n"; |
|
71 |
echo " <td>" . $record_info['priority'] . "</td>\n"; |
|
72 |
echo " <td>" . $record_info['ttl'] . "</td>\n"; |
|
73 |
echo " </tr>\n"; |
|
74 |
echo " </table>\n"; |
|
75 |
if (($record_info['type'] == 'NS' && $record_info['name'] == $zone_name) || $record_info['type'] == 'SOA') { |
|
76 |
echo " <p>" . _('You are trying to delete a record that is needed for this zone to work.') . "</p>\n"; |
|
77 |
} |
|
78 |
echo " <p>" . _('Are you sure?') . "</p>\n"; |
|
79 |
echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='" . $_SERVER["REQUEST_URI"] . "&confirm=1'\" value=\"" . _('Yes') . "\">\n"; |
|
80 |
echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n"; |
|
81 |
} |
1
|
82 |
} |
|
83 |
} |
|
84 |
include_once("inc/footer.inc.php"); |