Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

add_zone_slave.php 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 requests to add new slave zone
  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. global $dns_third_level_check;
  33. $owner = "-1";
  34. if ((isset($_POST['owner'])) && (v_num($_POST['owner']))) {
  35. $owner = $_POST['owner'];
  36. }
  37. $zone = "";
  38. if (isset($_POST['domain'])) {
  39. $zone = trim($_POST['domain']);
  40. }
  41. $master = "";
  42. if (isset($_POST['slave_master'])) {
  43. $master = $_POST['slave_master'];
  44. }
  45. $type = "SLAVE";
  46. /*
  47. Check permissions
  48. */
  49. (do_hook('verify_permission' , 'zone_slave_add' )) ? $zone_slave_add = "1" : $zone_slave_add = "0";
  50. (do_hook('verify_permission' , 'user_view_others' )) ? $perm_view_others = "1" : $perm_view_others = "0";
  51. if (isset($_POST['submit']) && $zone_slave_add == "1") {
  52. if (!is_valid_hostname_fqdn($zone, 0)) {
  53. error(ERR_DNS_HOSTNAME);
  54. } elseif ($dns_third_level_check && get_domain_level($zone) > 2 && domain_exists(get_second_level_domain($zone))) {
  55. error(ERR_DOMAIN_EXISTS);
  56. } elseif (domain_exists($zone) || record_name_exists($zone)) {
  57. error(ERR_DOMAIN_EXISTS);
  58. } elseif (!are_multipe_valid_ips($master)) {
  59. error(ERR_DNS_IP);
  60. } else {
  61. if (add_domain($zone, $owner, $type, $master, 'none')) {
  62. success("<a href=\"edit.php?id=" . get_zone_id_from_name($zone) . "\">" . SUC_ZONE_ADD . '</a>');
  63. log_info(sprintf('client_ip:%s user:%s operation:add_zone zone:%s zone_type:SLAVE zone_master:%s',
  64. $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"],
  65. $zone, $master));
  66. unset($zone, $owner, $webip, $mailip, $empty, $type, $master);
  67. }
  68. }
  69. }
  70. if ($zone_slave_add != "1") {
  71. error(ERR_PERM_ADD_ZONE_SLAVE);
  72. } else {
  73. echo " <h2>" . _('Add slave zone') . "</h2>\n";
  74. $users = do_hook('show_users');
  75. echo " <form method=\"post\" action=\"add_zone_slave.php\">\n";
  76. echo " <table>\n";
  77. echo " <tr>\n";
  78. echo " <td class=\"n\">" . _('Zone name') . "</td>\n";
  79. echo " <td class=\"n\">\n";
  80. echo " <input type=\"text\" class=\"input\" name=\"domain\" value=\"\">\n";
  81. echo " </td>\n";
  82. echo " </tr>\n";
  83. echo " <tr>\n";
  84. echo " <td class=\"n\">" . _('IP address of master NS') . ":</td>\n";
  85. echo " <td class=\"n\">\n";
  86. echo " <input type=\"text\" class=\"input\" name=\"slave_master\" value=\"\">\n";
  87. echo " </td>\n";
  88. echo " </tr>\n";
  89. echo " <tr>\n";
  90. echo " <td class=\"n\">" . _('Owner') . ":</td>\n";
  91. echo " <td class=\"n\">\n";
  92. echo " <select name=\"owner\">\n";
  93. /*
  94. Display list of users to assign slave zone to if the
  95. editing user has the permissions to, otherise just
  96. display the adding users name
  97. */
  98. foreach ($users as $user) {
  99. if ($user['id'] === $_SESSION['userid']) {
  100. echo " <option value=\"" . $user['id'] . "\" selected>" . $user['fullname'] . "</option>\n";
  101. } elseif ($perm_view_others == "1") {
  102. echo " <option value=\"" . $user['id'] . "\">" . $user['fullname'] . "</option>\n";
  103. }
  104. }
  105. echo " </select>\n";
  106. echo " </td>\n";
  107. echo " </tr>\n";
  108. echo " <tr>\n";
  109. echo " <td class=\"n\">&nbsp;</td>\n";
  110. echo " <td class=\"n\">\n";
  111. echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\">\n";
  112. echo " </td>\n";
  113. echo " </tr>\n";
  114. echo " </table>\n";
  115. echo " </form>\n";
  116. }
  117. include_once("inc/footer.inc.php");