Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

edit_comment.php 4.0KB

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