Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <?php
  2. /* Poweradmin, a friendly web-based admin tool for PowerDNS.
  3. * See <http://www.poweradmin.org> for more details.
  4. *
  5. * Copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  6. * Copyright 2010-2017 Poweradmin Development Team
  7. * <http://www.poweradmin.org/credits.html>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. /**
  24. * Script that handles editing of zone records
  25. *
  26. * @package Poweradmin
  27. * @copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  28. * @copyright 2010-2017 Poweradmin Development Team
  29. * @license http://opensource.org/licenses/GPL-3.0 GPL
  30. */
  31. require_once("inc/toolkit.inc.php");
  32. include_once("inc/header.inc.php");
  33. include_once("inc/RecordLog.class.php");
  34. global $pdnssec_use;
  35. $zone_id = "-1";
  36. if (isset($_GET['id']) && v_num($_GET['id'])) {
  37. $zone_id = $_GET['id'];
  38. }
  39. if ($zone_id == "-1") {
  40. error(ERR_INV_INPUT);
  41. include_once("inc/footer.inc.php");
  42. exit;
  43. }
  44. if (isset($_POST['commit'])) {
  45. $error = false;
  46. $one_record_changed = false;
  47. if (isset($_POST['record'])) {
  48. foreach ($_POST['record'] as $record) {
  49. $old_record_info = get_record_from_id($record['rid']);
  50. // Check if a record changed and save the state
  51. $log = new RecordLog();
  52. $log->log_prior($record['rid']);
  53. if (!$log->has_changed($record)) {
  54. continue;
  55. } else {
  56. $one_record_changed = true;
  57. }
  58. $edit_record = edit_record($record);
  59. if (false === $edit_record) {
  60. $error = true;
  61. } else {
  62. // Log the state after saving and write it to logging table
  63. $log->log_after($record['rid']);
  64. $log->write();
  65. }
  66. }
  67. }
  68. edit_zone_comment($_GET['id'], $_POST['comment']);
  69. if (false === $error) {
  70. update_soa_serial($_GET['id']);
  71. if ($one_record_changed) {
  72. success(SUC_ZONE_UPD);
  73. } else {
  74. success(SUC_ZONE_NOCHANGE);
  75. }
  76. if ($pdnssec_use) {
  77. if (dnssec_rectify_zone($_GET['id'])) {
  78. success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE);
  79. }
  80. }
  81. } else {
  82. error(ERR_ZONE_UPD);
  83. }
  84. }
  85. if (isset($_POST['save_as'])) {
  86. if (zone_templ_name_exists($_POST['templ_name'])) {
  87. error(ERR_ZONE_TEMPL_EXIST);
  88. } elseif ($_POST['templ_name'] == '') {
  89. error(ERR_ZONE_TEMPL_IS_EMPTY);
  90. } else {
  91. success(SUC_ZONE_TEMPL_ADD);
  92. $records = get_records_from_domain_id($zone_id);
  93. add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records, get_zone_name_from_id($zone_id));
  94. }
  95. }
  96. /*
  97. Check permissions
  98. */
  99. if (do_hook('verify_permission', 'zone_content_view_others')) {
  100. $perm_view = "all";
  101. } elseif (do_hook('verify_permission', 'zone_content_view_own')) {
  102. $perm_view = "own";
  103. } else {
  104. $perm_view = "none";
  105. }
  106. if (do_hook('verify_permission', 'zone_content_edit_others')) {
  107. $perm_content_edit = "all";
  108. } elseif (do_hook('verify_permission', 'zone_content_edit_own')) {
  109. $perm_content_edit = "own";
  110. } elseif (do_hook('verify_permission', 'zone_content_edit_own_as_client')) {
  111. $perm_content_edit = "own_as_client";
  112. } else {
  113. $perm_content_edit = "none";
  114. }
  115. if (do_hook('verify_permission', 'zone_meta_edit_others')) {
  116. $perm_meta_edit = "all";
  117. } elseif (do_hook('verify_permission', 'zone_meta_edit_own')) {
  118. $perm_meta_edit = "own";
  119. } else {
  120. $perm_meta_edit = "none";
  121. }
  122. do_hook('verify_permission' , 'zone_master_add' ) ? $perm_zone_master_add = "1" : $perm_zone_master_add = "0";
  123. do_hook('verify_permission' , 'zone_slave_add' ) ? $perm_zone_slave_add = "1" : $perm_zone_slave_add = "0";
  124. $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid' , $zone_id );
  125. if ($perm_meta_edit == "all" || ( $perm_meta_edit == "own" && $user_is_zone_owner == "1")) {
  126. $meta_edit = "1";
  127. } else {
  128. $meta_edit = "0";
  129. }
  130. (do_hook('verify_permission' , 'user_view_others' )) ? $perm_view_others = "1" : $perm_view_others = "0";
  131. if (isset($_POST['slave_master_change']) && is_numeric($_POST["domain"])) {
  132. change_zone_slave_master($_POST['domain'], $_POST['new_master']);
  133. }
  134. if (isset($_POST['type_change']) && in_array($_POST['newtype'], $server_types)) {
  135. change_zone_type($_POST['newtype'], $zone_id);
  136. }
  137. if (isset($_POST["newowner"]) && is_numeric($_POST["domain"]) && is_numeric($_POST["newowner"])) {
  138. add_owner_to_zone($_POST["domain"], $_POST["newowner"]);
  139. }
  140. if (isset($_POST["delete_owner"]) && is_numeric($_POST["delete_owner"])) {
  141. delete_owner_from_zone($zone_id, $_POST["delete_owner"]);
  142. }
  143. if (isset($_POST["template_change"])) {
  144. if (!isset($_POST['zone_template']) || "none" == $_POST['zone_template']) {
  145. $new_zone_template = 0;
  146. } else {
  147. $new_zone_template = $_POST['zone_template'];
  148. }
  149. if ($_POST['current_zone_template'] != $new_zone_template) {
  150. update_zone_records($zone_id, $new_zone_template);
  151. }
  152. }
  153. if ($perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0") {
  154. error(ERR_PERM_VIEW_ZONE);
  155. include_once("inc/footer.inc.php");
  156. exit();
  157. }
  158. if (zone_id_exists($zone_id) == "0") {
  159. error(ERR_ZONE_NOT_EXIST);
  160. include_once("inc/footer.inc.php");
  161. exit();
  162. }
  163. if (isset($_POST['sign_zone'])) {
  164. $zone_name = get_zone_name_from_id($zone_id);
  165. update_soa_serial($zone_id);
  166. dnssec_secure_zone($zone_name);
  167. dnssec_rectify_zone($zone_id);
  168. }
  169. if (isset($_POST['unsign_zone'])) {
  170. $zone_name = get_zone_name_from_id($zone_id);
  171. dnssec_unsecure_zone($zone_name);
  172. update_soa_serial($zone_id);
  173. }
  174. $domain_type = get_domain_type($zone_id);
  175. $record_count = count_zone_records($zone_id);
  176. $zone_templates = get_list_zone_templ($_SESSION['userid']);
  177. $zone_template_id = get_zone_template($zone_id);
  178. echo " <h2>" . _('Edit zone') . " \"" . get_zone_name_from_id($zone_id) . "\"</h2>\n";
  179. echo " <div class=\"showmax\">\n";
  180. show_pages($record_count, $iface_rowamount, $zone_id);
  181. echo " </div>\n";
  182. $records = get_records_from_domain_id($zone_id, ROWSTART, $iface_rowamount, RECORD_SORT_BY);
  183. if ($records == "-1") {
  184. echo " <p>" . _("This zone does not have any records. Weird.") . "</p>\n";
  185. } else {
  186. echo " <form method=\"post\" action=\"\">\n";
  187. echo " <table>\n";
  188. echo " <tr>\n";
  189. echo " <th>&nbsp;</th>\n";
  190. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=id\">" . _('Id') . "</a></th>\n";
  191. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=name\">" . _('Name') . "</a></th>\n";
  192. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=type\">" . _('Type') . "</a></th>\n";
  193. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=content\">" . _('Content') . "</a></th>\n";
  194. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=prio\">" . _('Priority') . "</a></th>\n";
  195. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=ttl\">" . _('TTL') . "</a></th>\n";
  196. echo " </tr>\n";
  197. foreach ($records as $r) {
  198. if (!($r['type'] == "SOA" || ($r['type'] == "NS" && $perm_content_edit == "own_as_client"))) {
  199. echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][rid]\" value=\"" . $r['id'] . "\">\n";
  200. echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][zid]\" value=\"" . $zone_id . "\">\n";
  201. }
  202. echo " <tr>\n";
  203. if ($domain_type == "SLAVE" || $perm_content_edit == "none" || (($perm_content_edit == "own" || $perm_content_edit == "own_as_client") && $user_is_zone_owner == "0")) {
  204. echo " <td class=\"n\">&nbsp;</td>\n";
  205. }
  206. elseif ($r['type'] == "SOA" && $perm_content_edit != "all" || ($r['type'] == "NS" && $perm_content_edit == "own_as_client")) {
  207. echo " <td class=\"n\">&nbsp;</td>\n";
  208. }
  209. else {
  210. echo " <td class=\"n\">\n";
  211. echo " <a href=\"edit_record.php?id=" . $r['id'] . "&amp;domain=" . $zone_id . "\">
  212. <img src=\"images/edit.gif\" alt=\"[ " . _('Edit record') . " ]\"></a>\n";
  213. echo " <a href=\"delete_record.php?id=" . $r['id'] . "&amp;domain=" . $zone_id . "\">
  214. <img src=\"images/delete.gif\" ALT=\"[ " . _('Delete record') . " ]\" BORDER=\"0\"></a>\n";
  215. echo " </td>\n";
  216. }
  217. echo " <td class=\"n\">{$r['id']}</td>\n";
  218. if ($r['type'] == "SOA" || ($r['type'] == "NS" && $perm_content_edit == "own_as_client")) {
  219. echo " <td class=\"n\">" . $r['name'] . "</td>\n";
  220. echo " <td class=\"n\">" . $r['type'] . "</td>\n";
  221. echo " <td class=\"n\">" . $r['content'] . "</td>\n";
  222. echo " <td class=\"n\">&nbsp;</td>\n";
  223. echo " <td class=\"n\">" . $r['ttl'] . "</td>\n";
  224. } else {
  225. echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][name]\" value=\"" . htmlspecialchars($r['name']) . "\"></td>\n";
  226. echo " <td class=\"u\">\n";
  227. echo " <select name=\"record[" . $r['id'] . "][type]\">\n";
  228. $found_selected_type = false;
  229. foreach (get_record_types() as $type_available) {
  230. if ($type_available == $r['type']) {
  231. $add = " SELECTED";
  232. $found_selected_type = true;
  233. } else {
  234. $add = "";
  235. }
  236. echo " <option" . $add . " value=\"" . htmlspecialchars($type_available) . "\" >" . $type_available . "</option>\n";
  237. }
  238. if (!$found_selected_type)
  239. echo " <option SELECTED value=\"" . htmlspecialchars($r['type']) . "\"><i>" . $r['type'] . "</i></option>\n";
  240. echo " </select>\n";
  241. echo " </td>\n";
  242. echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][content]\" value=\"" . htmlspecialchars($r['content']) . "\"></td>\n";
  243. echo " <td class=\"u\"><input size=\"4\" id=\"priority_field_" . $r['id'] . "\" name=\"record[" . $r['id'] . "][prio]\" value=\"" . htmlspecialchars($r['prio']) . "\"></td>\n";
  244. echo " <td class=\"u\"><input size=\"4\" name=\"record[" . $r['id'] . "][ttl]\" value=\"" . htmlspecialchars($r['ttl']) . "\"></td>\n";
  245. }
  246. echo " </tr>\n";
  247. }
  248. echo " <tr>\n";
  249. echo " <td colspan=\"6\">&nbsp;</td>\n";
  250. echo " </tr>\n";
  251. echo " <tr>\n";
  252. echo " <td>&nbsp;</td><td colspan=\"5\">Comments:</td>\n";
  253. echo " </tr>\n";
  254. echo " <tr>\n";
  255. echo " <td class=\"n\">\n";
  256. echo " <a href=\"edit_comment.php?domain=" . $zone_id . "\">
  257. <img src=\"images/edit.gif\" alt=\"[ " . _('Edit comment') . " ]\"></a>\n";
  258. echo " </td>\n";
  259. echo " <td colspan=\"4\"><textarea rows=\"5\" cols=\"80\" name=\"comment\">" . htmlspecialchars(get_zone_comment($zone_id)) . "</textarea></td>\n";
  260. echo " <td>&nbsp;</td>\n";
  261. echo " <tr>\n";
  262. echo " <th colspan=\"6\"><br>Save as new template:</th>\n";
  263. echo " </tr>\n";
  264. echo " <tr>\n";
  265. echo " <td colspan=\"2\">" . _('Template Name') . "</td>\n";
  266. echo " <td><input class=\"wide\" type=\"text\" name=\"templ_name\" value=\"\"></td>\n";
  267. echo " </tr>\n";
  268. echo " <tr>\n";
  269. echo " <td colspan=\"2\">" . _('Template Description') . "</td>\n";
  270. echo " <td><input class=\"wide\" type=\"text\" name=\"templ_descr\" value=\"\"></td>\n";
  271. echo " </tr>\n";
  272. echo " </table>\n";
  273. echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
  274. echo " <input type=\"reset\" class=\"button\" name=\"reset\" value=\"" . _('Reset changes') . "\">\n";
  275. echo " <input type=\"submit\" class=\"button\" name=\"save_as\" value=\"" . _('Save as template') . "\">\n";
  276. if ($pdnssec_use) {
  277. $zone_name = get_zone_name_from_id($zone_id);
  278. if (dnssec_is_zone_secured($zone_name)) {
  279. echo " <input type=\"button\" class=\"button\" name=\"dnssec\" onclick=\"location.href = 'dnssec.php?id=".$zone_id."';\" value=\"" . _('DNSSEC') . "\">\n";
  280. echo " <input type=\"submit\" class=\"button\" name=\"unsign_zone\" value=\"" . _('Unsign this zone') . "\">\n";
  281. } else {
  282. echo " <input type=\"submit\" class=\"button\" name=\"sign_zone\" value=\"" . _('Sign this zone') . "\">\n";
  283. }
  284. }
  285. echo " </form>\n";
  286. }
  287. if ($perm_content_edit == "all" || ($perm_content_edit == "own" || $perm_content_edit == "own_as_client") && $user_is_zone_owner == "1") {
  288. if ($domain_type != "SLAVE") {
  289. $zone_name = get_zone_name_from_id($zone_id);
  290. echo " <form method=\"post\" action=\"add_record.php?id=" . $zone_id . "\">\n";
  291. echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n";
  292. echo " <table border=\"0\" cellspacing=\"4\">\n";
  293. echo " <tr>\n";
  294. echo " <td class=\"n\">" . _('Name') . "</td>\n";
  295. echo " <td class=\"n\">&nbsp;</td>\n";
  296. echo " <td class=\"n\">" . _('Type') . "</td>\n";
  297. echo " <td class=\"n\">" . _('Content') . "</td>\n";
  298. echo " <td class=\"n\">" . _('Priority') . "</td>\n";
  299. echo " <td class=\"n\">" . _('TTL') . "</td>\n";
  300. echo " </tr>\n";
  301. echo " <tr>\n";
  302. echo " <td class=\"n\"><input type=\"text\" name=\"name\" class=\"input\" value=\"\">." . $zone_name . "</td>\n";
  303. echo " <td class=\"n\">IN</td>\n";
  304. echo " <td class=\"n\">\n";
  305. echo " <select name=\"type\">\n";
  306. $found_selected_type = !(isset($type) && $type);
  307. foreach (get_record_types() as $record_type) {
  308. if (isset($type) && $type) {
  309. if ($type == $record_type) {
  310. $add = " SELECTED";
  311. $found_selected_type = true;
  312. } else {
  313. $add = "";
  314. }
  315. } else {
  316. if (preg_match('/i(p6|n-addr).arpa/i', $zone_name) && strtoupper($record_type) == 'PTR') {
  317. $add = " SELECTED";
  318. $rev = "";
  319. } else if ((strtoupper($record_type) == 'A') && $iface_add_reverse_record) {
  320. $add = " SELECTED";
  321. $rev = "<input type=\"checkbox\" name=\"reverse\"><span class=\"normaltext\">" . _('Add also reverse record') . "</span>\n";
  322. } else {
  323. $add = "";
  324. }
  325. }
  326. echo " <option" . $add . " value=\"" . htmlspecialchars($record_type) . "\">" . $record_type . "</option>\n";
  327. }
  328. if (!$found_selected_type)
  329. echo " <option SELECTED value=\"" . htmlspecialchars($type) . "\"><i>" . htmlspecialchars($type) . "</i></option>\n";
  330. echo " </select>\n";
  331. echo " </td>\n";
  332. echo " <td class=\"n\"><input type=\"text\" name=\"content\" class=\"input\" value=\"\"></td>\n";
  333. echo " <td class=\"n\"><input type=\"text\" name=\"prio\" class=\"sinput\" value=\"\"></td>\n";
  334. echo " <td class=\"n\"><input type=\"text\" name=\"ttl\" class=\"sinput\" value=\"\"></td>\n";
  335. echo " </tr>\n";
  336. echo " </table>\n";
  337. echo " <input type=\"submit\" name=\"commit\" value=\"" . _('Add record') . "\" class=\"button\">\n";
  338. echo " $rev";
  339. echo " </form>\n";
  340. }
  341. }
  342. echo " <div id=\"meta\">\n";
  343. echo " <table>\n";
  344. echo " <tr>\n";
  345. echo " <th colspan=\"2\">" . _('Owner of zone') . "</th>\n";
  346. echo " </tr>\n";
  347. $owners = get_users_from_domain_id($zone_id);
  348. if ($owners == "-1") {
  349. echo " <tr><td>" . _('No owner set for this zone.') . "</td></tr>";
  350. } else {
  351. if ($meta_edit) {
  352. foreach ($owners as $owner) {
  353. echo " <tr>\n";
  354. echo " <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n";
  355. echo " <td>" . $owner["fullname"] . "</td>\n";
  356. echo " <td>\n";
  357. echo " <input type=\"hidden\" name=\"delete_owner\" value=\"" . $owner["id"] . "\">\n";
  358. echo " <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Delete') . "\">\n";
  359. echo " </td>\n";
  360. echo " </form>\n";
  361. echo " </tr>\n";
  362. }
  363. } else {
  364. foreach ($owners as $owner) {
  365. echo " <tr><td>" . $owner["fullname"] . "</td><td>&nbsp;</td></tr>";
  366. }
  367. }
  368. }
  369. if ($meta_edit) {
  370. echo " <form method=\"post\" action=\"edit.php?id=" . $zone_id . "\">\n";
  371. echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n";
  372. echo " <tr>\n";
  373. echo " <td>\n";
  374. echo " <select name=\"newowner\">\n";
  375. /*
  376. Show list of users to add as owners of this domain, only if we have permission to do so.
  377. */
  378. $users = do_hook('show_users');
  379. foreach ($users as $user) {
  380. $add = '';
  381. if ($user["id"] == $_SESSION["userid"]) {
  382. echo " <option" . $add . " value=\"" . $user["id"] . "\">" . $user["fullname"] . "</option>\n";
  383. } elseif ($perm_view_others == "1") {
  384. echo " <option value=\"" . $user["id"] . "\">" . $user["fullname"] . "</option>\n";
  385. }
  386. }
  387. echo " </select>\n";
  388. echo " </td>\n";
  389. echo " <td>\n";
  390. echo " <input type=\"submit\" class=\"sbutton\" name=\"co\" value=\"" . _('Add') . "\">\n";
  391. echo " </td>\n";
  392. echo " </tr>\n";
  393. echo " </form>\n";
  394. }
  395. echo " <tr>\n";
  396. echo " <th colspan=\"2\">" . _('Type') . "</th>\n";
  397. echo " </tr>\n";
  398. if ($meta_edit) {
  399. echo " <form action=\"" . htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES) . "?id=" . $zone_id . "\" method=\"post\">\n";
  400. echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n";
  401. echo " <tr>\n";
  402. echo " <td>\n";
  403. echo " <select name=\"newtype\">\n";
  404. foreach ($server_types as $type) {
  405. $add = '';
  406. if ($type == $domain_type) {
  407. $add = " SELECTED";
  408. }
  409. if (($perm_zone_master_add == "0" && $type == "MASTER") || ($perm_zone_slave_add == "0" && $type == "SLAVE")) {
  410. continue;
  411. }
  412. echo " <option" . $add . " value=\"" . $type . "\">" . strtolower($type) . "</option>\n";
  413. }
  414. echo " </select>\n";
  415. echo " </td>\n";
  416. echo " <td>\n";
  417. echo " <input type=\"submit\" class=\"sbutton\" name=\"type_change\" value=\"" . _('Change') . "\">\n";
  418. echo " </td>\n";
  419. echo " </tr>\n";
  420. echo " </form>\n";
  421. } else {
  422. echo " <tr><td>" . strtolower($domain_type) . "</td><td>&nbsp;</td></tr>\n";
  423. }
  424. echo " <tr>\n";
  425. echo " <th colspan=\"2\">" . _('Template') . "</th>\n";
  426. echo " </tr>\n";
  427. if ($meta_edit) {
  428. echo " <form action=\"" . htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES) . "?id=" . $zone_id . "\" method=\"post\">\n";
  429. echo " <input type=\"hidden\" name=\"current_zone_template\" value=\"" . $zone_template_id . "\">\n";
  430. echo " <tr>\n";
  431. echo " <td>\n";
  432. echo " <select name=\"zone_template\">\n";
  433. echo " <option value=\"none\">none</option>\n";
  434. foreach ($zone_templates as $zone_template) {
  435. $add = '';
  436. if ($zone_template['id'] == $zone_template_id) {
  437. $add = " SELECTED";
  438. }
  439. echo " <option . $add . value=\"" . $zone_template['id'] . "\">" . $zone_template['name'] . "</option>\n";
  440. }
  441. echo " </select>\n";
  442. echo " </td>\n";
  443. echo " <td>\n";
  444. echo " <input type=\"submit\" class=\"sbutton\" name=\"template_change\" value=\"" . _('Change') . "\">\n";
  445. echo " </td>\n";
  446. echo " </tr>\n";
  447. echo " </form>\n";
  448. } else {
  449. $zone_template_details = get_zone_templ_details($zone_template_id);
  450. echo " <tr><td>" . (isset($zone_template_details) ? strtolower($zone_template_details['name']) : "none" ) . "</td><td>&nbsp;</td></tr>\n";
  451. }
  452. if ($domain_type == "SLAVE") {
  453. $slave_master = get_domain_slave_master($zone_id);
  454. echo " <tr>\n";
  455. echo " <th colspan=\"2\">" . _('IP address of master NS') . "</th>\n";
  456. echo " </tr>\n";
  457. if ($meta_edit) {
  458. echo " <form action=\"" . htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES) . "?id=" . $zone_id . "\" method=\"post\">\n";
  459. echo " <input type=\"hidden\" name=\"domain\" value=\"" . $zone_id . "\">\n";
  460. echo " <tr>\n";
  461. echo " <td>\n";
  462. echo " <input type=\"text\" name=\"new_master\" value=\"" . $slave_master . "\" class=\"input\">\n";
  463. echo " </td>\n";
  464. echo " <td>\n";
  465. echo " <input type=\"submit\" class=\"sbutton\" name=\"slave_master_change\" value=\"" . _('Change') . "\">\n";
  466. echo " </td>\n";
  467. echo " </tr>\n";
  468. echo " </form>\n";
  469. } else {
  470. echo " <tr><td>" . $slave_master . "</td><td>&nbsp;</td></tr>\n";
  471. }
  472. }
  473. echo " </table>\n";
  474. echo " </div>\n"; // eo div meta
  475. include_once("inc/footer.inc.php");