Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

edit_comment.php 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 editing of zone comments
  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. if (do_hook('verify_permission', 'zone_content_view_others')) {
  33. $perm_view = "all";
  34. } elseif (do_hook('verify_permission', 'zone_content_view_own')) {
  35. $perm_view = "own";
  36. } else {
  37. $perm_view = "none";
  38. }
  39. if (do_hook('verify_permission', 'zone_content_edit_others')) {
  40. $perm_content_edit = "all";
  41. } elseif (do_hook('verify_permission', 'zone_content_edit_own')) {
  42. $perm_content_edit = "own";
  43. } elseif (do_hook('verify_permission', 'zone_content_edit_own_as_client')) {
  44. $perm_content_edit = "own_as_client";
  45. } else {
  46. $perm_content_edit = "none";
  47. }
  48. if (do_hook('verify_permission', 'zone_meta_edit_others')) {
  49. $perm_meta_edit = "all";
  50. } elseif (do_hook('verify_permission', 'zone_meta_edit_own')) {
  51. $perm_meta_edit = "own";
  52. } else {
  53. $perm_meta_edit = "none";
  54. }
  55. $zid = $_GET['domain'];
  56. $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid' , $zid );
  57. $zone_type = get_domain_type($zid);
  58. $zone_name = get_zone_name_from_id($zid);
  59. if (isset($_POST["commit"])) {
  60. if ($zone_type == "SLAVE" || $perm_content_edit == "none" || ($perm_content_edit == "own" || $perm_content_edit == "own_as_client") && $user_is_zone_owner == "0") {
  61. error(ERR_PERM_EDIT_COMMENT);
  62. } else {
  63. edit_zone_comment($_GET['domain'], $_POST['comment']);
  64. success(SUC_COMMENT_UPD);
  65. }
  66. }
  67. echo " <h2>" . _('Edit comment in zone') . " " . $zone_name . "</h2>\n";
  68. if ($perm_view == "none" || $perm_view == "own" && $user_is_zone_owner == "0") {
  69. error(ERR_PERM_VIEW_COMMENT);
  70. } else {
  71. $comment = get_zone_comment($zid);
  72. echo " <form method=\"post\" action=\"edit_comment.php?domain=" . $zid . "\">\n";
  73. echo " <table>\n";
  74. echo " <tr>\n";
  75. echo " <td colspan=\"6\">&nbsp;</td>\n";
  76. echo " </tr>\n";
  77. echo " <tr>\n";
  78. echo " <td>&nbsp;</td><td colspan=\"5\">Comments:</td>\n";
  79. echo " </tr>\n";
  80. if ($zone_type == "SLAVE" || $perm_content_edit == "none" || ($perm_content_edit == "own" || $perm_content_edit == "own_as_client") && $user_is_zone_owner == "0") {
  81. echo " <tr>\n";
  82. echo " <td class=\"n\">\n";
  83. echo " &nbsp;\n";
  84. echo " </td>\n";
  85. echo " <td colspan=\"4\"><textarea rows=\"15\" name=\"comment\" disabled>" . $comment . "</textarea></td>\n";
  86. echo " <td>&nbsp;</td>\n";
  87. echo " </tr>\n";
  88. } else {
  89. echo " <tr>\n";
  90. echo " <td class=\"n\">\n";
  91. echo " &nbsp;\n";
  92. echo " </td>\n";
  93. echo " <td colspan=\"4\"><textarea rows=\"15\" name=\"comment\">" . $comment . "</textarea></td>\n";
  94. echo " <td>&nbsp;</td>\n";
  95. echo " </tr>\n";
  96. }
  97. echo " </table>\n";
  98. echo " <p>\n";
  99. echo " <input type=\"submit\" name=\"commit\" value=\"" . _('Commit changes') . "\" class=\"button\">&nbsp;&nbsp;\n";
  100. echo " <input type=\"reset\" name=\"reset\" value=\"" . _('Reset changes') . "\" class=\"button\">&nbsp;&nbsp;\n";
  101. echo " </p>\n";
  102. echo " </form>\n";
  103. }
  104. include_once("inc/footer.inc.php");