選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

add_supermaster.php 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 supermaster servers
  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. $master_ip = "";
  33. if (isset($_POST["master_ip"])) {
  34. $master_ip = $_POST["master_ip"];
  35. }
  36. $ns_name = "";
  37. if (isset($_POST["ns_name"])) {
  38. $ns_name = $_POST["ns_name"];
  39. }
  40. $account = "";
  41. if (isset($_POST["account"])) {
  42. $account = $_POST["account"];
  43. }
  44. (do_hook('verify_permission' , 'supermaster_add' )) ? $supermasters_add = "1" : $supermasters_add = "0";
  45. (do_hook('verify_permission' , 'user_view_others' )) ? $perm_view_others = "1" : $perm_view_others = "0";
  46. $error = 0;
  47. if (isset($_POST["submit"])) {
  48. if (add_supermaster($master_ip, $ns_name, $account)) {
  49. success(SUC_SM_ADD);
  50. } else {
  51. $error = "1";
  52. }
  53. }
  54. echo " <h2>" . _('Add supermaster') . "</h2>\n";
  55. if ($supermasters_add != "1") {
  56. echo " <p>" . _("You do not have the permission to add a new supermaster.") . "</p>\n";
  57. } else {
  58. echo " <form method=\"post\" action=\"add_supermaster.php\">\n";
  59. echo " <table>\n";
  60. echo " <tr>\n";
  61. echo " <td class=\"n\">" . _('IP address of supermaster') . "</td>\n";
  62. echo " <td class=\"n\">\n";
  63. if ($error) {
  64. echo " <input type=\"text\" class=\"input\" name=\"master_ip\" value=\"" . $master_ip . "\">\n";
  65. } else {
  66. echo " <input type=\"text\" class=\"input\" name=\"master_ip\" value=\"\">\n";
  67. }
  68. echo " </td>\n";
  69. echo " </tr>\n";
  70. echo " <tr>\n";
  71. echo " <td class=\"n\">" . _('Hostname in NS record') . "</td>\n";
  72. echo " <td class=\"n\">\n";
  73. if ($error) {
  74. echo " <input type=\"text\" class=\"input\" name=\"ns_name\" value=\"" . $ns_name . "\">\n";
  75. } else {
  76. echo " <input type=\"text\" class=\"input\" name=\"ns_name\" value=\"\">\n";
  77. }
  78. echo " </td>\n";
  79. echo " </tr>\n";
  80. echo " <tr>\n";
  81. echo " <td class=\"n\">" . _('Account') . "</td>\n";
  82. echo " <td class=\"n\">\n";
  83. echo " <select name=\"account\">\n";
  84. /*
  85. Display list of users to assign slave zone to if the
  86. editing user has the permissions to, otherise just
  87. display the adding users name
  88. */
  89. $users = do_hook('show_users');
  90. foreach ($users as $user) {
  91. if ($user['id'] === $_SESSION['userid']) {
  92. echo " <option value=\"" . $user['username'] . "\" selected>" . $user['fullname'] . "</option>\n";
  93. } elseif ($perm_view_others == "1") {
  94. echo " <option value=\"" . $user['username'] . "\">" . $user['fullname'] . "</option>\n";
  95. }
  96. }
  97. echo " </select>\n";
  98. echo " </td>\n";
  99. echo " </tr>\n";
  100. echo " <tr>\n";
  101. echo " <td class=\"n\">&nbsp;</td>\n";
  102. echo " <td class=\"n\">\n";
  103. echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add supermaster') . "\">\n";
  104. echo " </td>\n";
  105. echo " </tr>\n";
  106. echo " </table>\n";
  107. echo " </form>\n";
  108. }
  109. include_once("inc/footer.inc.php");