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