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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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-2014 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-2014 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. global $pdnssec_use;
  34. $zone_id = "-1";
  35. if (isset($_GET['id']) && v_num($_GET['id'])) {
  36. $zone_id = $_GET['id'];
  37. }
  38. if ($zone_id == "-1") {
  39. error(ERR_INV_INPUT);
  40. include_once("inc/footer.inc.php");
  41. exit;
  42. }
  43. if (isset($_POST['commit'])) {
  44. $error = false;
  45. if (isset($_POST['record'])) {
  46. foreach ($_POST['record'] as $record) {
  47. $old_record_info = get_record_from_id($record['rid']);
  48. $edit_record = edit_record($record);
  49. if (false === $edit_record) {
  50. $error = true;
  51. } else {
  52. $new_record_info = get_record_from_id($record["rid"]);
  53. //Figure out if record was updated
  54. unset($new_record_info["change_date"]);
  55. unset($old_record_info["change_date"]);
  56. if ($new_record_info != $old_record_info){
  57. //The record was changed, so log the edit_record operation
  58. log_info(sprintf('client_ip:%s user:%s operation:edit_record'
  59. .' old_record_type:%s old_record:%s old_content:%s old_ttl:%s old_priority:%s'
  60. .' record_type:%s record:%s content:%s ttl:%s priority:%s',
  61. $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"],
  62. $old_record_info['type'], $old_record_info['name'],
  63. $old_record_info['content'], $old_record_info['ttl'], $old_record_info['prio'],
  64. $new_record_info['type'], $new_record_info['name'],
  65. $new_record_info['content'], $new_record_info['ttl'], $new_record_info['prio']));
  66. }
  67. }
  68. }
  69. }
  70. edit_zone_comment($_GET['id'], $_POST['comment']);
  71. if (false === $error) {
  72. update_soa_serial($_GET['id']);
  73. success(SUC_ZONE_UPD);
  74. if ($pdnssec_use) {
  75. if (dnssec_rectify_zone($_GET['id'])) {
  76. success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE);
  77. }
  78. }
  79. } else {
  80. error(ERR_ZONE_UPD);
  81. }
  82. }
  83. if (isset($_POST['save_as'])) {
  84. if (zone_templ_name_exists($_POST['templ_name'])) {
  85. error(ERR_ZONE_TEMPL_EXIST);
  86. } elseif ($_POST['templ_name'] == '') {
  87. error(ERR_ZONE_TEMPL_IS_EMPTY);
  88. } else {
  89. success(SUC_ZONE_TEMPL_ADD);
  90. $records = get_records_from_domain_id($zone_id);
  91. add_zone_templ_save_as($_POST['templ_name'], $_POST['templ_descr'], $_SESSION['userid'], $records, get_zone_name_from_id($zone_id));
  92. }
  93. }
  94. /*
  95. Check permissions
  96. */
  97. if (verify_permission('zone_content_view_others')) {
  98. $perm_view = "all";
  99. } elseif (verify_permission('zone_content_view_own')) {
  100. $perm_view = "own";
  101. } else {
  102. $perm_view = "none";
  103. }
  104. if (verify_permission('zone_content_edit_others')) {
  105. $perm_content_edit = "all";
  106. } elseif (verify_permission('zone_content_edit_own')) {
  107. $perm_content_edit = "own";
  108. } else {
  109. $perm_content_edit = "none";
  110. }
  111. if (verify_permission('zone_meta_edit_others')) {
  112. $perm_meta_edit = "all";
  113. } elseif (verify_permission('zone_meta_edit_own')) {
  114. $perm_meta_edit = "own";
  115. } else {
  116. $perm_meta_edit = "none";
  117. }
  118. verify_permission('zone_master_add') ? $perm_zone_master_add = "1" : $perm_zone_master_add = "0";
  119. verify_permission('zone_slave_add') ? $perm_zone_slave_add = "1" : $perm_zone_slave_add = "0";
  120. $user_is_zone_owner = verify_user_is_owner_zoneid($zone_id);
  121. if ($perm_meta_edit == "all" || ( $perm_meta_edit == "own" && $user_is_zone_owner == "1")) {
  122. $meta_edit = "1";
  123. } else {
  124. $meta_edit = "0";
  125. }
  126. (verify_permission('user_view_others')) ? $perm_view_others = "1" : $perm_view_others = "0";
  127. if (isset($_POST['slave_master_change']) && is_numeric($_POST["domain"])) {
  128. change_zone_slave_master($_POST['domain'], $_POST['new_master']);
  129. }
  130. if (isset($_POST['type_change']) && in_array($_POST['newtype'], $server_types)) {
  131. change_zone_type($_POST['newtype'], $zone_id);
  132. }
  133. if (isset($_POST["newowner"]) && is_numeric($_POST["domain"]) && is_numeric($_POST["newowner"])) {
  134. add_owner_to_zone($_POST["domain"], $_POST["newowner"]);
  135. }
  136. if (isset($_POST["delete_owner"]) && is_numeric($_POST["delete_owner"])) {
  137. delete_owner_from_zone($zone_id, $_POST["delete_owner"]);
  138. }
  139. if (isset($_POST["template_change"])) {
  140. if (!isset($_POST['zone_template']) || "none" == $_POST['zone_template']) {
  141. $new_zone_template = 0;
  142. } else {
  143. $new_zone_template = $_POST['zone_template'];
  144. }
  145. if ($_POST['current_zone_template'] != $new_zone_template) {
  146. update_zone_records($zone_id, $new_zone_template);
  147. }
  148. }
  149. if ($perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0") {
  150. error(ERR_PERM_VIEW_ZONE);
  151. include_once("inc/footer.inc.php");
  152. exit();
  153. }
  154. if (zone_id_exists($zone_id) == "0") {
  155. error(ERR_ZONE_NOT_EXIST);
  156. include_once("inc/footer.inc.php");
  157. exit();
  158. }
  159. if (isset($_POST['sign_zone'])) {
  160. $zone_name = get_zone_name_from_id($zone_id);
  161. update_soa_serial($zone_id);
  162. dnssec_secure_zone($zone_name);
  163. dnssec_rectify_zone($zone_id);
  164. }
  165. if (isset($_POST['unsign_zone'])) {
  166. $zone_name = get_zone_name_from_id($zone_id);
  167. dnssec_unsecure_zone($zone_name);
  168. update_soa_serial($zone_id);
  169. }
  170. $domain_type = get_domain_type($zone_id);
  171. $record_count = count_zone_records($zone_id);
  172. $zone_templates = get_list_zone_templ($_SESSION['userid']);
  173. $zone_template_id = get_zone_template($zone_id);
  174. echo " <h2>" . _('Edit zone') . " \"" . get_zone_name_from_id($zone_id) . "\"</h2>\n";
  175. echo " <div class=\"showmax\">\n";
  176. show_pages($record_count, $iface_rowamount, $zone_id);
  177. echo " </div>\n";
  178. $records = get_records_from_domain_id($zone_id, ROWSTART, $iface_rowamount, RECORD_SORT_BY);
  179. if ($records == "-1") {
  180. echo " <p>" . _("This zone does not have any records. Weird.") . "</p>\n";
  181. } else {
  182. echo " <form method=\"post\" action=\"\">\n";
  183. echo " <table>\n";
  184. echo " <tr>\n";
  185. echo " <th>&nbsp;</th>\n";
  186. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=id\">" . _('Id') . "</a></th>\n";
  187. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=name\">" . _('Name') . "</a></th>\n";
  188. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=type\">" . _('Type') . "</a></th>\n";
  189. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=content\">" . _('Content') . "</a></th>\n";
  190. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=prio\">" . _('Priority') . "</a></th>\n";
  191. echo " <th><a href=\"edit.php?id=" . $zone_id . "&amp;record_sort_by=ttl\">" . _('TTL') . "</a></th>\n";
  192. echo " </tr>\n";
  193. foreach ($records as $r) {
  194. if ($r['type'] != "SOA") {
  195. echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][rid]\" value=\"" . $r['id'] . "\">\n";
  196. echo " <input type=\"hidden\" name=\"record[" . $r['id'] . "][zid]\" value=\"" . $zone_id . "\">\n";
  197. }
  198. echo " <tr>\n";
  199. if ($domain_type == "SLAVE" || $perm_content_edit == "none" || $perm_content_edit == "own" && $user_is_zone_owner == "0") {
  200. echo " <td class=\"n\">&nbsp;</td>\n";
  201. } else {
  202. echo " <td class=\"n\">\n";
  203. echo " <a href=\"edit_record.php?id=" . $r['id'] . "&amp;domain=" . $zone_id . "\">
  204. <img src=\"images/edit.gif\" alt=\"[ " . _('Edit record') . " ]\"></a>\n";
  205. echo " <a href=\"delete_record.php?id=" . $r['id'] . "&amp;domain=" . $zone_id . "\">
  206. <img src=\"images/delete.gif\" ALT=\"[ " . _('Delete record') . " ]\" BORDER=\"0\"></a>\n";
  207. echo " </td>\n";
  208. }
  209. echo " <td class=\"n\">{$r['id']}</td>\n";
  210. if ($r['type'] == "SOA") {
  211. echo " <td class=\"n\">" . $r['name'] . "</td>\n";
  212. echo " <td class=\"n\">" . $r['type'] . "</td>\n";
  213. echo " <td class=\"n\">" . $r['content'] . "</td>\n";
  214. echo " <td class=\"n\">&nbsp;</td>\n";
  215. echo " <td class=\"n\">" . $r['ttl'] . "</td>\n";
  216. } else {
  217. echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][name]\" value=\"" . htmlspecialchars($r['name']) . "\"></td>\n";
  218. echo " <td class=\"u\">\n";
  219. echo " <select name=\"record[" . $r['id'] . "][type]\">\n";
  220. $found_selected_type = false;
  221. foreach (get_record_types() as $type_available) {
  222. if ($type_available == $r['type']) {
  223. $add = " SELECTED";
  224. $found_selected_type = true;
  225. } else {
  226. $add = "";
  227. }
  228. echo " <option" . $add . " value=\"" . htmlspecialchars($type_available) . "\" >" . $type_available . "</option>\n";
  229. }
  230. if (!$found_selected_type)
  231. echo " <option SELECTED value=\"" . htmlspecialchars($r['type']) . "\"><i>" . $r['type'] . "</i></option>\n";
  232. /*
  233. Sanitize content due to SPF record quoting in PowerDNS
  234. */
  235. if ($r['type'] == "SRV" || $r['type'] == "SPF" || $r['type'] == "TXT") {
  236. $clean_content = trim($r['content'], "\x22\x27");
  237. } else {
  238. $clean_content = $r['content'];
  239. }
  240. echo " </select>\n";
  241. echo " </td>\n";
  242. echo " <td class=\"u\"><input class=\"wide\" name=\"record[" . $r['id'] . "][content]\" value=\"" . htmlspecialchars($clean_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" && $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 = 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");