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 ($_GET["id"]) { |
25 $record_id = "-1"; |
25 // check if we have access to the given id |
26 if (isset($_GET['id']) && v_num($_GET['id'])) { |
26 $zoneId = recid_to_domid($_GET['id']); |
27 $record_id = $_GET['id']; |
27 if ((!level(5)) && (!xs($zoneId))) { |
28 } |
28 error(ERR_RECORD_ACCESS_DENIED); |
29 |
29 } |
30 |
30 if ((!level(5)) && ($_SESSION[$zoneId.'_ispartial'] == 1)) { |
31 $confirm = "-1"; |
31 $db->setLimit(1); |
32 if ((isset($_GET['confirm']) && v_num($_GET['confirm']) |
32 $checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id=".$db->quote($_GET["id"])." AND user_id=".$db->quote($_SESSION["userid"])); |
33 $confirm = $_GET['confirm']; |
33 if (empty($checkPartial)) { |
34 } |
34 error(ERR_RECORD_ACCESS_DENIED); |
35 |
|
36 if (verify_permission(zone_content_edit_others)) { $perm_content_edit = "all" ; } |
|
37 elseif (verify_permission(zone_content_edit_own)) { $perm_content_edit = "own" ; } |
|
38 else { $perm_content_edit = "none" ; } |
|
39 |
|
40 $user_is_zone_owner = verify_user_is_owner_zoneid($_GET["domain"]); |
|
41 |
|
42 if ($record_id == "-1" ) { |
|
43 if ($confirm == '1') { |
|
44 if ( delete_record($record_id) ) { |
|
45 success(SUC_RECORD_DEL); |
35 } |
46 } |
36 } |
47 } else { |
37 if ($_GET["confirm"] == '0') { |
48 $zone_id = recid_to_domid($record_id); |
38 clean_page("edit.php?id=".$_GET["domain"]); |
49 $zone_name = get_domain_name_from_id($zone_id); |
39 } elseif ($_GET["confirm"] == '1') { |
50 $user_is_zone_owner = verify_user_is_owner_zoneid($zone_id); |
40 delete_record($_GET["id"]); |
51 $record_info = get_record_from_id($record_id); |
41 clean_page("edit.php?id=".$_GET["domain"]); |
52 |
|
53 echo " <h2>" . _('Delete record') . " in zone \"" . $zone_name . "\"</h2>\n"; |
|
54 |
|
55 if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { |
|
56 error(ERR_PERM_EDIT_RECORD); |
|
57 } else { |
|
58 echo " <table>\n"; |
|
59 echo " <tr>\n"; |
|
60 echo " <th>Name</th>\n"; |
|
61 echo " <th>Type</th>\n"; |
|
62 echo " <th>Content</th>\n"; |
|
63 echo " <th>Priority</th>\n"; |
|
64 echo " <th>TTL</th>\n"; |
|
65 echo " </tr>\n"; |
|
66 echo " <tr>\n"; |
|
67 echo " <td>" . $record_info['name'] . "</td>\n"; |
|
68 echo " <td>" . $record_info['type'] . "</td>\n"; |
|
69 echo " <td>" . $record_info['content'] . "</td>\n"; |
|
70 echo " <td>" . $record_info['priority'] . "</td>\n"; |
|
71 echo " <td>" . $record_info['ttl'] . "</td>\n"; |
|
72 echo " </tr>\n"; |
|
73 echo " </table>\n"; |
|
74 if (($record_info['type'] == 'NS' && $record_info['name'] == $zone_name) || $record_info['type'] == 'SOA') { |
|
75 echo " <p>" . _('You are trying to delete a record that is needed for this zone to work.') . "</p>\n"; |
|
76 } |
|
77 echo " <p>" . _('Are you sure?') . "</p>\n"; |
|
78 echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='" . $_SERVER["REQUEST_URI"] . "&confirm=1'\" value=\"" . _('Yes') . "\">\n"; |
|
79 echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n"; |
|
80 } |
42 } |
81 } |
43 include_once("inc/header.inc.php"); |
|
44 ?> |
|
45 |
|
46 <h2><?php echo _('Delete record'); ?> "<?php |
|
47 $data = get_record_from_id($_GET["id"]); |
|
48 print $data["name"]." IN ".$data["type"]." ".$data["content"]; |
|
49 ?>"</h2><?php |
|
50 if (($data["type"] == "NS" && $data["name"] == get_domain_name_from_id($_GET["domain"])) || $data["type"] == "SOA") { |
|
51 print "<font class=\"warning\">" . _('You are trying to delete a record that is needed for this zone to work.') . "</font><br>"; |
|
52 } |
|
53 ?><br><font class="warning"><?php echo _('Are you sure?'); ?></font><br><br> |
|
54 <input type="button" class="button" OnClick="location.href='<?php echo $_SERVER["REQUEST_URI"] ?>&confirm=1'" value="<?php echo _('Yes'); ?>"> |
|
55 <input type="button" class="button" OnClick="location.href='<?php echo $_SERVER["REQUEST_URI"] ?>&confirm=0'" value="<?php echo _('No'); ?>"> |
|
56 <?php |
|
57 } else { |
82 } else { |
58 include_once("inc/header.inc.php"); |
83 error(ERR_INV_INPUT); |
59 echo _('Nothing to do!'); |
|
60 } |
84 } |
61 include_once("inc/footer.inc.php"); |
85 include_once("inc/footer.inc.php"); |