Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

edit_zone_templ_record.php 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. * Script that handles records editing in zone templates
  24. *
  25. * @package Poweradmin
  26. * @copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  27. * @copyright 2010-2017 Poweradmin Development Team
  28. * @license http://opensource.org/licenses/GPL-3.0 GPL
  29. */
  30. require_once("inc/toolkit.inc.php");
  31. include_once("inc/header.inc.php");
  32. $record_id = "-1";
  33. if (isset($_GET['id']) && v_num($_GET['id'])) {
  34. $record_id = $_GET['id'];
  35. }
  36. $zone_templ_id = "-1";
  37. if (isset($_GET['zone_templ_id']) && v_num($_GET['zone_templ_id'])) {
  38. $zone_templ_id = $_GET['zone_templ_id'];
  39. }
  40. $owner = get_zone_templ_is_owner($zone_templ_id, $_SESSION['userid']);
  41. if (isset($_POST["commit"])) {
  42. if (!(do_hook('verify_permission' , 'zone_master_add' )) || !$owner) {
  43. error(ERR_PERM_EDIT_RECORD);
  44. } else {
  45. $ret_val = edit_zone_templ_record($_POST);
  46. if ($ret_val == "1") {
  47. success(SUC_RECORD_UPD);
  48. } else {
  49. echo " <div class=\"error\">" . $ret_val . "</div>\n";
  50. }
  51. }
  52. }
  53. $templ_details = get_zone_templ_details($zone_templ_id);
  54. echo " <h2>" . _('Edit record in zone template') . " \"" . $templ_details['name'] . "\"</h2>\n";
  55. if (!(do_hook('verify_permission' , 'zone_master_add' )) || !$owner) {
  56. error(ERR_PERM_VIEW_RECORD);
  57. } else {
  58. $record = get_zone_templ_record_from_id($record_id);
  59. echo " <form method=\"post\" action=\"edit_zone_templ_record.php?zone_templ_id=" . $zone_templ_id . "&id=" . $record_id . "\">\n";
  60. echo " <table>\n";
  61. echo " <tr>\n";
  62. echo " <th>" . _('Name') . "</td>\n";
  63. echo " <th>&nbsp;</td>\n";
  64. echo " <th>" . _('Type') . "</td>\n";
  65. echo " <th>" . _('Content') . "</td>\n";
  66. echo " <th>" . _('Priority') . "</td>\n";
  67. echo " <th>" . _('TTL') . "</td>\n";
  68. echo " </tr>\n";
  69. echo " <input type=\"hidden\" name=\"rid\" value=\"" . $record_id . "\">\n";
  70. echo " <input type=\"hidden\" name=\"zid\" value=\"" . $zone_templ_id . "\">\n";
  71. echo " <tr>\n";
  72. echo " <td><input type=\"text\" name=\"name\" value=\"" . htmlspecialchars($record["name"]) . "\" class=\"input\"></td>\n";
  73. echo " <td>IN</td>\n";
  74. echo " <td>\n";
  75. echo " <select name=\"type\">\n";
  76. $found_selected_type = false;
  77. foreach (get_record_types() as $type_available) {
  78. if ($type_available == $record["type"]) {
  79. $add = " SELECTED";
  80. $found_selected_type = true;
  81. } else {
  82. $add = "";
  83. }
  84. echo " <option" . $add . " value=\"" . $type_available . "\" >" . $type_available . "</option>\n";
  85. }
  86. if (!$found_selected_type)
  87. echo " <option SELECTED value=\"" . htmlspecialchars($record['type']) . "\"><i>" . $record['type'] . "</i></option>\n";
  88. echo " </select>\n";
  89. echo " </td>\n";
  90. echo " <td><input type=\"text\" name=\"content\" value=\"" . htmlspecialchars($record['content']) . "\" class=\"input\"></td>\n";
  91. echo " <td><input type=\"text\" name=\"prio\" value=\"" . htmlspecialchars($record["prio"]) . "\" class=\"sinput\"></td>\n";
  92. echo " <td><input type=\"text\" name=\"ttl\" value=\"" . htmlspecialchars($record["ttl"]) . "\" class=\"sinput\"></td>\n";
  93. echo " </tr>\n";
  94. echo " </table>\n";
  95. echo " <p>\n";
  96. echo " <input type=\"submit\" name=\"commit\" value=\"" . _('Commit changes') . "\" class=\"button\">&nbsp;&nbsp;\n";
  97. echo " <input type=\"reset\" name=\"reset\" value=\"" . _('Reset changes') . "\" class=\"button\">&nbsp;&nbsp;\n";
  98. echo " </p>\n";
  99. echo " </form>\n";
  100. }
  101. include_once("inc/footer.inc.php");