You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

delete_domain.php 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 zone deletion
  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 $pdnssec_use;
  33. if (do_hook('verify_permission' , 'zone_content_edit_others' )) {
  34. $perm_edit = "all";
  35. } elseif (do_hook('verify_permission' , 'zone_content_edit_own' )) {
  36. $perm_edit = "own";
  37. } else {
  38. $perm_edit = "none";
  39. }
  40. $zone_id = "-1";
  41. if (isset($_GET['id']) && v_num($_GET['id'])) {
  42. $zone_id = $_GET['id'];
  43. }
  44. $confirm = "-1";
  45. if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
  46. $confirm = $_GET['confirm'];
  47. }
  48. $zone_info = get_zone_info_from_id($zone_id);
  49. if (!$zone_info) {
  50. header("Location: list_zones.php");
  51. exit;
  52. }
  53. $zone_owners = do_hook('get_fullnames_owners_from_domainid' , $zone_id );
  54. $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid' , $zone_id );
  55. if ($zone_id == "-1") {
  56. error(ERR_INV_INPUT);
  57. include_once("inc/footer.inc.php");
  58. exit;
  59. }
  60. echo " <h2>" . _('Delete zone') . " \"" . $zone_info['name'] . "\"</h2>\n";
  61. if ($confirm == '1') {
  62. if ($pdnssec_use && $zone_info['type'] == 'MASTER') {
  63. $zone_name = get_zone_name_from_id($zone_id);
  64. dnssec_unsecure_zone($zone_name);
  65. }
  66. if (delete_domain($zone_id)) {
  67. success(SUC_ZONE_DEL);
  68. log_info(sprintf('client_ip:%s user:%s operation:delete_zone zone:%s zone_type:%s',
  69. $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"],
  70. $zone_info['name'], $zone_info['type']));
  71. }
  72. } else {
  73. if ($perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1")) {
  74. echo " " . _('Owner') . ": " . $zone_owners . "<br>\n";
  75. echo " " . _('Type') . ": " . $zone_info['type'] . "\n";
  76. if ($zone_info['type'] == "SLAVE") {
  77. $slave_master = get_domain_slave_master($zone_id);
  78. if (supermaster_exists($slave_master)) {
  79. echo " <p> \n";
  80. printf(_('You are about to delete a slave zone of which the master nameserver, %s, is a supermaster. Deleting the zone now, will result in temporary removal only. Whenever the supermaster sends a notification for this zone, it will be added again!'), $slave_master);
  81. echo " </p>\n";
  82. }
  83. }
  84. echo " <p>" . _('Are you sure?') . "</p>\n";
  85. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='delete_domain.php?id=" . $zone_id . "&amp;confirm=1'\" value=\"" . _('Yes') . "\">\n";
  86. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
  87. } else {
  88. error(ERR_PERM_DEL_ZONE);
  89. }
  90. }
  91. include_once("inc/footer.inc.php");