67 } |
67 } |
68 if(isset($_POST["delete_owner"]) && is_numeric($_POST["delete_owner"]) ) { |
68 if(isset($_POST["delete_owner"]) && is_numeric($_POST["delete_owner"]) ) { |
69 delete_owner_from_zone($zone_id, $_POST["delete_owner"]); |
69 delete_owner_from_zone($zone_id, $_POST["delete_owner"]); |
70 } |
70 } |
71 |
71 |
72 $domain_type=get_domain_type($zone_id); |
|
73 $record_count=count_zone_records($zone_id); |
|
74 |
|
75 echo " <h2>" . _('Edit zone') . " \"" . get_zone_name_from_id($zone_id) . "\"</h2>\n"; |
|
76 |
|
77 if ( $perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0" ) { |
72 if ( $perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0" ) { |
78 error(ERR_PERM_VIEW_ZONE); |
73 error(ERR_PERM_VIEW_ZONE); |
79 } else { |
74 } else { |
80 echo " <div class=\"showmax\">\n"; |
75 |
81 show_pages($record_count,$iface_rowamount,$zone_id); |
76 if (zone_id_exists($zone_id) == "0") { |
82 echo " </div>\n"; |
77 error(ERR_ZONE_NOT_EXIST); |
83 |
78 } else { |
84 $records = get_records_from_domain_id($zone_id,ROWSTART,$iface_rowamount); |
79 $domain_type=get_domain_type($zone_id); |
85 if ( $records == "-1" ) { |
80 $record_count=count_zone_records($zone_id); |
86 echo " <p>" . _("This zone does not have any records. Weird.") . "</p>\n"; |
81 |
87 } else { |
82 echo " <h2>" . _('Edit zone') . " \"" . get_zone_name_from_id($zone_id) . "\"</h2>\n"; |
88 echo " <form method=\"post\">\n"; |
83 |
89 echo " <table>\n"; |
84 echo " <div class=\"showmax\">\n"; |
90 echo " <tr>\n"; |
85 show_pages($record_count,$iface_rowamount,$zone_id); |
91 echo " <th> </th>\n"; |
86 echo " </div>\n"; |
92 echo " <th>" . _('Name') . "</th>\n"; |
87 |
93 echo " <th>" . _('Type') . "</th>\n"; |
88 $records = get_records_from_domain_id($zone_id,ROWSTART,$iface_rowamount); |
94 echo " <th>" . _('Content') . "</th>\n"; |
89 if ( $records == "-1" ) { |
95 echo " <th>" . _('Priority') . "</th>\n"; |
90 echo " <p>" . _("This zone does not have any records. Weird.") . "</p>\n"; |
96 echo " <th>" . _('TTL') . "</th>\n"; |
91 } else { |
97 echo " </tr>\n"; |
92 echo " <form method=\"post\">\n"; |
98 foreach ($records as $r) { |
93 echo " <table>\n"; |
99 echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][rid]\" value=\"" . $r['id'] . "\">\n"; |
|
100 echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][zid]\" value=\"" . $zone_id . "\">\n"; |
|
101 echo " <tr>\n"; |
94 echo " <tr>\n"; |
102 if ( $domain_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { |
95 echo " <th> </th>\n"; |
103 echo " <td class=\"n\"> </td>\n"; |
96 echo " <th>" . _('Name') . "</th>\n"; |
|
97 echo " <th>" . _('Type') . "</th>\n"; |
|
98 echo " <th>" . _('Content') . "</th>\n"; |
|
99 echo " <th>" . _('Priority') . "</th>\n"; |
|
100 echo " <th>" . _('TTL') . "</th>\n"; |
|
101 echo " </tr>\n"; |
|
102 foreach ($records as $r) { |
|
103 echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][rid]\" value=\"" . $r['id'] . "\">\n"; |
|
104 echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][zid]\" value=\"" . $zone_id . "\">\n"; |
|
105 echo " <tr>\n"; |
|
106 if ( $domain_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0" ) { |
|
107 echo " <td class=\"n\"> </td>\n"; |
|
108 } else { |
|
109 echo " <td class=\"n\">\n"; |
|
110 echo " <a href=\"edit_record.php?id=" . $r['id'] . "&domain=" . $zone_id . "\"> |
|
111 <img src=\"images/edit.gif\" alt=\"[ ". _('Edit record') . " ]\"></a>\n"; |
|
112 echo " <a href=\"delete_record.php?id=" . $r['id'] . "&domain=" . $zone_id . "\"> |
|
113 <img src=\"images/delete.gif\" ALT=\"[ " . _('Delete record') . " ]\" BORDER=\"0\"></a>\n"; |
|
114 echo " </td>\n"; |
|
115 } |
|
116 echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][name]\" value=\"" . $r['name'] . "\"></td>\n"; |
|
117 echo " <td class=\"u\">\n"; |
|
118 echo " <select name=\"record[" . $r['id'] . "][type]\">\n"; |
|
119 foreach (get_record_types() as $type_available) { |
|
120 if ($type_available == $r['type']) { |
|
121 $add = " SELECTED"; |
|
122 } else { |
|
123 $add = ""; |
|
124 } |
|
125 echo " <option" . $add . " value=\"" . $type_available . "\" >" . $type_available . "</option>\n"; |
|
126 } |
|
127 echo " </select>\n"; |
|
128 echo " </td>\n"; |
|
129 echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][content]\" value=\"" . $r['content'] . "\"></td>\n"; |
|
130 if ($r['type'] == "MX") { |
|
131 echo " <td class=\"u\"><input name=\"record[" . $r['id'] . "][prio]\" value=\"" . $r['prio'] . "\"></td>\n"; |
|
132 } else { |
|
133 echo " <td class=\"n\"> </td>\n"; |
|
134 } |
|
135 echo " <td class=\"u\"><input name=\"record[" . $r['id'] . "][ttl]\" value=\"" . $r['ttl'] . "\"></td>\n"; |
|
136 echo " </tr>\n"; |
|
137 } |
|
138 echo " </table>\n"; |
|
139 echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n"; |
|
140 echo " </form>"; |
|
141 } |
|
142 |
|
143 if ( $perm_content_edit == "all" || $perm_content_edit == "own" && $user_is_zone_owner == "1" ) { |
|
144 if ( $domain_type != "SLAVE") { |
|
145 echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='add_record.php?id=" . $zone_id . "'\" value=\"" . _('Add record') . "\">  \n"; |
|
146 } |
|
147 echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='delete_domain.php?id=" . $zone_id . "'\" value=\"" . _('Delete zone') . "\">\n"; |
|
148 } |
|
149 |
|
150 echo " <div id=\"meta\">\n"; |
|
151 echo " <table>\n"; |
|
152 echo " <tr>\n"; |
|
153 echo " <th colspan=\"2\">" . _('Owner of zone') . "</th>\n"; |
|
154 echo " </tr>\n"; |
|
155 |
|
156 $owners = get_users_from_domain_id($zone_id); |
|
157 |
|
158 if ($owners == "-1") { |
|
159 echo " <tr><td>" . _('No owner set for this zone.') . "</td></tr>"; |
|
160 } else { |
|
161 if ($meta_edit) { |
|
162 foreach ($owners as $owner) { |
|
163 echo " <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n"; |
|
164 echo " <tr>\n"; |
|
165 echo " <td>" . $owner["fullname"] . "</td>\n"; |
|
166 echo " <td>\n"; |
|
167 echo " <input type=\"hidden\" name=\"delete_owner\" value=\"" . $owner["id"] . "\">\n"; |
|
168 echo " <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Delete') . "\">\n"; |
|
169 echo " </td>\n"; |
|
170 echo " </tr>\n"; |
|
171 echo " </form>\n"; |
|
172 } |
104 } else { |
173 } else { |
105 echo " <td class=\"n\">\n"; |
174 foreach ($owners as $owner) { |
106 echo " <a href=\"edit_record.php?id=" . $r['id'] . "&domain=" . $zone_id . "\"> |
175 echo " <tr><td>" . $owner["fullname"] . "</td><td> </td></tr>"; |
107 <img src=\"images/edit.gif\" alt=\"[ ". _('Edit record') . " ]\"></a>\n"; |
176 } |
108 echo " <a href=\"delete_record.php?id=" . $r['id'] . "&domain=" . $zone_id . "\"> |
177 } |
109 <img src=\"images/delete.gif\" ALT=\"[ " . _('Delete record') . " ]\" BORDER=\"0\"></a>\n"; |
178 |
110 echo " </td>\n"; |
179 } |
111 } |
180 if ($meta_edit) { |
112 echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][name]\" value=\"" . $r['name'] . "\"></td>\n"; |
181 echo " <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n"; |
113 echo " <td class=\"u\">\n"; |
182 echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n"; |
114 echo " <select name=\"record[" . $r['id'] . "][type]\">\n"; |
183 echo " <tr>\n"; |
115 foreach (get_record_types() as $type_available) { |
184 echo " <td>\n"; |
116 if ($type_available == $r['type']) { |
185 echo " <select name=\"newowner\">\n"; |
|
186 $users = show_users(); |
|
187 foreach ($users as $user) { |
|
188 $add = ''; |
|
189 if ($user["id"] == $_SESSION["userid"]) { |
117 $add = " SELECTED"; |
190 $add = " SELECTED"; |
118 } else { |
191 } |
119 $add = ""; |
192 echo " <option" . $add . " value=\"" . $user["id"] . "\">" . $user["fullname"] . "</option>\n"; |
120 } |
193 } |
121 echo " <option" . $add . " value=\"" . $type_available . "\" >" . $type_available . "</option>\n"; |
194 echo " </select>\n"; |
122 } |
195 echo " </td>\n"; |
123 echo " </select>\n"; |
196 echo " <td>\n"; |
124 echo " </td>\n"; |
197 echo " <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Add') . "\">\n"; |
125 echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][content]\" value=\"" . $r['content'] . "\"></td>\n"; |
198 echo " </td>\n"; |
126 if ($r['type'] == "MX") { |
199 echo " </tr>\n"; |
127 echo " <td class=\"u\"><input name=\"record[" . $r['id'] . "][prio]\" value=\"" . $r['prio'] . "\"></td>\n"; |
200 echo " </form>\n"; |
128 } else { |
201 } |
129 echo " <td class=\"n\"> </td>\n"; |
|
130 } |
|
131 echo " <td class=\"u\"><input name=\"record[" . $r['id'] . "][ttl]\" value=\"" . $r['ttl'] . "\"></td>\n"; |
|
132 echo " </tr>\n"; |
|
133 } |
|
134 echo " </table>\n"; |
|
135 echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n"; |
|
136 echo " </form>"; |
|
137 } |
|
138 |
|
139 if ( $perm_content_edit == "all" || $perm_content_edit == "own" && $user_is_zone_owner == "1" ) { |
|
140 if ( $domain_type != "SLAVE") { |
|
141 echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='add_record.php?id=" . $zone_id . "'\" value=\"" . _('Add record') . "\">  \n"; |
|
142 } |
|
143 echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='delete_domain.php?id=" . $zone_id . "'\" value=\"" . _('Delete zone') . "\">\n"; |
|
144 } |
|
145 |
|
146 echo " <div id=\"meta\">\n"; |
|
147 echo " <table>\n"; |
|
148 echo " <tr>\n"; |
|
149 echo " <th colspan=\"2\">" . _('Owner of zone') . "</th>\n"; |
|
150 echo " </tr>\n"; |
|
151 |
|
152 $owners = get_users_from_domain_id($zone_id); |
|
153 |
|
154 if ($owners == "-1") { |
|
155 echo " <tr><td>" . _('No owner set for this zone.') . "</td></tr>"; |
|
156 } else { |
|
157 if ($meta_edit) { |
|
158 foreach ($owners as $owner) { |
|
159 echo " <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n"; |
|
160 echo " <tr>\n"; |
|
161 echo " <td>" . $owner["fullname"] . "</td>\n"; |
|
162 echo " <td>\n"; |
|
163 echo " <input type=\"hidden\" name=\"delete_owner\" value=\"" . $owner["id"] . "\">\n"; |
|
164 echo " <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Delete') . "\">\n"; |
|
165 echo " </td>\n"; |
|
166 echo " </tr>\n"; |
|
167 echo " </form>\n"; |
|
168 } |
|
169 } else { |
|
170 foreach ($owners as $owner) { |
|
171 echo " <tr><td>" . $owner["fullname"] . "</td><td> </td></tr>"; |
|
172 } |
|
173 } |
|
174 |
|
175 } |
|
176 if ($meta_edit) { |
|
177 echo " <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n"; |
|
178 echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n"; |
|
179 echo " <tr>\n"; |
|
180 echo " <td>\n"; |
|
181 echo " <select name=\"newowner\">\n"; |
|
182 $users = show_users(); |
|
183 foreach ($users as $user) { |
|
184 $add = ''; |
|
185 if ($user["id"] == $_SESSION["userid"]) { |
|
186 $add = " SELECTED"; |
|
187 } |
|
188 echo " <option" . $add . " value=\"" . $user["id"] . "\">" . $user["fullname"] . "</option>\n"; |
|
189 } |
|
190 echo " </select>\n"; |
|
191 echo " </td>\n"; |
|
192 echo " <td>\n"; |
|
193 echo " <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Add') . "\">\n"; |
|
194 echo " </td>\n"; |
|
195 echo " </tr>\n"; |
|
196 echo " </form>\n"; |
|
197 } |
|
198 echo " <tr>\n"; |
|
199 echo " <th colspan=\"2\">" . _('Type') . "</th>\n"; |
|
200 echo " </tr>\n"; |
|
201 |
|
202 if ($meta_edit) { |
|
203 echo " <form action=\"" . $_SERVER['PHP_SELF'] . "?id=" . $zone_id . "\" method=\"post\">\n"; |
|
204 echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n"; |
|
205 echo " <tr>\n"; |
|
206 echo " <td>\n"; |
|
207 echo " <select name=\"newtype\">\n"; |
|
208 foreach($server_types as $type) { |
|
209 $add = ''; |
|
210 if ($type == $domain_type) { |
|
211 $add = " SELECTED"; |
|
212 } |
|
213 echo " <option" . $add . " value=\"" . $type . "\">" . strtolower($type) . "</option>\n"; |
|
214 } |
|
215 echo " </select>\n"; |
|
216 echo " </td>\n"; |
|
217 echo " <td>\n"; |
|
218 echo " <input type=\"submit\" class=\"sbutton\" name=\"type_change\" value=\"" . _('Change') . "\">\n"; |
|
219 echo " </td>\n"; |
|
220 echo " </tr>\n"; |
|
221 echo " </form>\n"; |
|
222 } else { |
|
223 echo " <tr><td>" . strtolower($domain_type) . "</td><td> </td></tr>\n"; |
|
224 } |
|
225 |
|
226 if ($domain_type == "SLAVE" ) { |
|
227 $slave_master=get_domain_slave_master($zone_id); |
|
228 echo " <tr>\n"; |
202 echo " <tr>\n"; |
229 echo " <th colspan=\"2\">" . _('IP address of master NS') . "</th>\n"; |
203 echo " <th colspan=\"2\">" . _('Type') . "</th>\n"; |
230 echo " </tr>\n"; |
204 echo " </tr>\n"; |
231 |
205 |
232 if ($meta_edit) { |
206 if ($meta_edit) { |
233 echo " <form action=\"" . $_SERVER['PHP_SELF'] . "?id=" . $zone_id . "\" method=\"post\">\n"; |
207 echo " <form action=\"" . $_SERVER['PHP_SELF'] . "?id=" . $zone_id . "\" method=\"post\">\n"; |
234 echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n"; |
208 echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n"; |
235 echo " <tr>\n"; |
209 echo " <tr>\n"; |
236 echo " <td>\n"; |
210 echo " <td>\n"; |
237 echo " <input type=\"text\" name=\"new_master\" value=\"" . $slave_master . "\" class=\"input\">\n"; |
211 echo " <select name=\"newtype\">\n"; |
238 echo " </td>\n"; |
212 foreach($server_types as $type) { |
239 echo " <td>\n"; |
213 $add = ''; |
240 echo " <input type=\"submit\" class=\"sbutton\" name=\"slave_master_change\" value=\"" . _('Change') . "\">\n"; |
214 if ($type == $domain_type) { |
|
215 $add = " SELECTED"; |
|
216 } |
|
217 echo " <option" . $add . " value=\"" . $type . "\">" . strtolower($type) . "</option>\n"; |
|
218 } |
|
219 echo " </select>\n"; |
|
220 echo " </td>\n"; |
|
221 echo " <td>\n"; |
|
222 echo " <input type=\"submit\" class=\"sbutton\" name=\"type_change\" value=\"" . _('Change') . "\">\n"; |
241 echo " </td>\n"; |
223 echo " </td>\n"; |
242 echo " </tr>\n"; |
224 echo " </tr>\n"; |
243 echo " </form>\n"; |
225 echo " </form>\n"; |
244 } else { |
226 } else { |
245 echo " <tr><td>" . $slave_master . "</td><td> </td></tr>\n"; |
227 echo " <tr><td>" . strtolower($domain_type) . "</td><td> </td></tr>\n"; |
246 } |
228 } |
|
229 |
|
230 if ($domain_type == "SLAVE" ) { |
|
231 $slave_master=get_domain_slave_master($zone_id); |
|
232 echo " <tr>\n"; |
|
233 echo " <th colspan=\"2\">" . _('IP address of master NS') . "</th>\n"; |
|
234 echo " </tr>\n"; |
|
235 |
|
236 if ($meta_edit) { |
|
237 echo " <form action=\"" . $_SERVER['PHP_SELF'] . "?id=" . $zone_id . "\" method=\"post\">\n"; |
|
238 echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n"; |
|
239 echo " <tr>\n"; |
|
240 echo " <td>\n"; |
|
241 echo " <input type=\"text\" name=\"new_master\" value=\"" . $slave_master . "\" class=\"input\">\n"; |
|
242 echo " </td>\n"; |
|
243 echo " <td>\n"; |
|
244 echo " <input type=\"submit\" class=\"sbutton\" name=\"slave_master_change\" value=\"" . _('Change') . "\">\n"; |
|
245 echo " </td>\n"; |
|
246 echo " </tr>\n"; |
|
247 echo " </form>\n"; |
|
248 } else { |
|
249 echo " <tr><td>" . $slave_master . "</td><td> </td></tr>\n"; |
|
250 } |
|
251 } |
|
252 echo " </table>\n"; |
|
253 echo " </div>\n"; // eo div meta |
247 } |
254 } |
248 echo " </table>\n"; |
|
249 echo " </div>\n"; // eo div meta |
|
250 } |
255 } |
251 |
256 |
252 include_once("inc/footer.inc.php"); |
257 include_once("inc/footer.inc.php"); |
253 ?> |
258 ?> |