71
|
1 |
<?php |
1
|
2 |
|
47
|
3 |
/* PowerAdmin, a friendly web-based admin tool for PowerDNS. |
|
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 |
if (verify_permission(zone_content_view_others)) { $perm_view = "all" ; } |
|
26 |
elseif (verify_permission(zone_content_view_own)) { $perm_view = "own" ; } |
|
27 |
else { $perm_view = "none" ; } |
|
28 |
|
|
29 |
if (verify_permission(zone_content_edit_others)) { $perm_content_edit = "all" ; } |
|
30 |
elseif (verify_permission(zone_content_edit_own)) { $perm_content_edit = "own" ; } |
|
31 |
else { $perm_content_edit = "none" ; } |
|
32 |
|
|
33 |
if (verify_permission(zone_meta_edit_others)) { $perm_meta_edit = "all" ; } |
|
34 |
elseif (verify_permission(zone_meta_edit_own)) { $perm_meta_edit = "own" ; } |
|
35 |
else { $perm_meta_edit = "none" ; } |
1
|
36 |
|
82
|
37 |
$user_is_zone_owner = verify_user_is_owner_zoneid($_GET["domain"]); |
|
38 |
$zone_type = get_domain_type($_GET["domain"]); |
|
39 |
$zone_name = get_domain_name_from_id($_GET["domain"]); |
1
|
40 |
|
82
|
41 |
if ($_POST["commit"]) { |
|
42 |
if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { |
|
43 |
error(ERR_PERM_EDIT_RECORD); |
|
44 |
} else { |
|
45 |
$ret_val = edit_record($_POST["recordid"], $_POST["domainid"], $_POST["name"], $_POST["type"], $_POST["content"], $_POST["ttl"], $_POST["prio"]); |
|
46 |
if ( $ret_val == "1" ) { |
|
47 |
success(SUC_RECORD_UPD); |
|
48 |
} else { |
|
49 |
echo " <div class=\"error\">" . $ret_val . "</div>\n"; |
|
50 |
} |
|
51 |
} |
1
|
52 |
} |
|
53 |
|
82
|
54 |
echo " <h2>" . _('Edit record in zone') . " " . $zone_name . "</h2>\n"; |
|
55 |
|
|
56 |
if ( $perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0" ) { |
|
57 |
error(ERR_PERM_VIEW_RECORD); |
|
58 |
} else { |
|
59 |
$record = get_record_from_id($_GET["id"]); |
|
60 |
echo " <form method=\"post\" action=\"edit_record.php?domain=" . $_GET["domain"] . "&id=" . $_GET["id"] . "\">\n"; |
|
61 |
echo " <table>\n"; |
|
62 |
echo " <tr>\n"; |
|
63 |
echo " <th>" . _('Name') . "</td>\n"; |
|
64 |
echo " <th> </td>\n"; |
|
65 |
echo " <th>" . _('Type') . "</td>\n"; |
|
66 |
echo " <th>" . _('Priority') . "</td>\n"; |
|
67 |
echo " <th>" . _('Content') . "</td>\n"; |
|
68 |
echo " <th>" . _('TTL') . "</td>\n"; |
|
69 |
echo " </tr>\n"; |
1
|
70 |
|
82
|
71 |
if ( $zone_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { |
|
72 |
echo " <tr>\n"; |
|
73 |
echo " <td>" . $record["name"] . "</td>\n"; |
|
74 |
echo " <td>IN</td>\n"; |
|
75 |
echo " <td>" . $record["type"] . "</td>\n"; |
|
76 |
echo " <td>" . $record["content"] . "</td>\n"; |
|
77 |
echo " <td>" . $record["prio"] . "</td>\n"; |
|
78 |
echo " <td>" . $record["ttl"] . "</td>\n"; |
|
79 |
echo " </tr>\n"; |
|
80 |
} else { |
|
81 |
echo " <input type=\"hidden\" name=\"recordid\" value=\"" . $_GET["id"] . "\">\n"; |
|
82 |
echo " <input type=\"hidden\" name=\"domainid\" value=\"" . $_GET["domain"] . "\">\n"; |
|
83 |
echo " <tr>\n"; |
|
84 |
echo " <td><input type=\"text\" name=\"name\" value=\"" . trim(str_replace($zone_name, '', $record["name"]), '.') . "\" class=\"input\">." . $zone_name . "</td>\n"; |
|
85 |
echo " <td>IN</td>\n"; |
|
86 |
echo " <td>\n"; |
|
87 |
echo " <select name=\"type\">\n"; |
|
88 |
foreach (get_record_types() as $type_available) { |
|
89 |
if ($type_available == $record["type"]) { |
|
90 |
$add = " SELECTED"; |
|
91 |
} else { |
|
92 |
$add = ""; |
|
93 |
} |
|
94 |
echo " <option" . $add . " value=\"" . $type_available . "\" >" . $type_available . "</option>\n"; |
|
95 |
} |
|
96 |
echo " </select>\n"; |
|
97 |
echo " </td>\n"; |
|
98 |
echo " <td><input type=\"text\" name=\"prio\" value=\"" . $record["prio"] . "\" class=\"sinput\"></td>\n"; |
|
99 |
echo " <td><input type=\"text\" name=\"content\" value=\"" . $record["content"] . "\" class=\"input\"></td>\n"; |
|
100 |
echo " <td><input type=\"text\" name=\"ttl\" value=\"" . $record["ttl"] . "\" class=\"sinput\"></td>\n"; |
|
101 |
echo " </tr>\n"; |
13
|
102 |
} |
82
|
103 |
echo " </table>\n"; |
|
104 |
echo " <p>\n"; |
|
105 |
echo " <input type=\"submit\" name=\"commit\" value=\"" . _('Commit changes') . "\" class=\"button\"> \n"; |
|
106 |
echo " </p>\n"; |
|
107 |
echo " </form>\n"; |
1
|
108 |
} |
|
109 |
|
82
|
110 |
|
13
|
111 |
include_once("inc/footer.inc.php"); |
1
|
112 |
?> |
82
|
113 |
|