Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

delete_domains.php 4.2KB

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 zones 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. if (do_hook('verify_permission' , 'zone_content_edit_others' )) {
  33. $perm_edit = "all";
  34. } elseif (do_hook('verify_permission' , 'zone_content_edit_own' )) {
  35. $perm_edit = "own";
  36. } else {
  37. $perm_edit = "none";
  38. }
  39. $confirm = "-1";
  40. if (isset($_POST['confirm'])) {
  41. $confirm = "1";
  42. }
  43. $zones = $_POST['zone_id'];
  44. if (!$zones) {
  45. header("Location: list_zones.php");
  46. exit;
  47. }
  48. echo " <h2>" . _('Delete zones') . "</h2>\n";
  49. if ($confirm == '1') {
  50. //Fetch information about zones before deleting them
  51. $deleted_zones = array();
  52. foreach ($zones as $zone) {
  53. $zone_info = get_zone_info_from_id($zone);
  54. array_push($deleted_zones,$zone_info);
  55. }
  56. $delete_domains = delete_domains($zones);
  57. if ($delete_domains) {
  58. count($deleted_zones) == 1 ? success(SUC_ZONE_DEL) : success(SUC_ZONES_DEL);
  59. //Zones successfully deleted so generate log messages from information retrieved earlier
  60. foreach ($deleted_zones as $zone_info) {
  61. log_info(sprintf('client_ip:%s user:%s operation:delete_zone zone:%s zone_type:%s',
  62. $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"],
  63. $zone_info['name'], $zone_info['type']));
  64. }
  65. }
  66. } else {
  67. echo " <form method=\"post\" action=\"delete_domains.php\">\n";
  68. foreach ($zones as $zone) {
  69. $zone_owners = do_hook('get_fullnames_owners_from_domainid' , $zone );
  70. $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid' , $zone );
  71. $zone_info = get_zone_info_from_id($zone);
  72. if ($perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1")) {
  73. echo " <input type=\"hidden\" name=\"zone_id[]\" value=\"" . $zone . "\">\n";
  74. echo " " . _('Name') . ": " . $zone_info['name'] . "<br>\n";
  75. echo " " . _('Owner') . ": " . $zone_owners . "<br>\n";
  76. echo " " . _('Type') . ": " . $zone_info['type'] . "\n";
  77. if ($zone_info['type'] == "SLAVE") {
  78. $slave_master = get_domain_slave_master($zone);
  79. if (supermaster_exists($slave_master)) {
  80. echo " <p> \n";
  81. 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);
  82. echo " </p>\n";
  83. }
  84. }
  85. echo " <br><br>\n";
  86. } else {
  87. error(ERR_PERM_DEL_ZONE);
  88. }
  89. }
  90. echo " <p>" . _('Are you sure?') . "</p>\n";
  91. echo " <input type=\"submit\" name=\"confirm\" value=\"" . _('Yes') . "\" class=\"button\">\n";
  92. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='list_zones.php'\" value=\"" . _('No') . "\">\n";
  93. echo " </form>\n";
  94. }
  95. include_once("inc/footer.inc.php");