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.

dnssec_delete_key.php 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. $zone_id = "-1";
  34. if (isset($_GET['id']) && v_num($_GET['id'])) {
  35. $zone_id = $_GET['id'];
  36. }
  37. $key_id = "-1";
  38. if (isset($_GET['key_id']) && v_num($_GET['key_id'])) {
  39. $key_id = (int) $_GET['key_id'];
  40. }
  41. $confirm = "-1";
  42. if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
  43. $confirm = $_GET['confirm'];
  44. }
  45. $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid' , $zone_id );
  46. if ($zone_id == "-1") {
  47. error(ERR_INV_INPUT);
  48. include_once("inc/footer.inc.php");
  49. exit;
  50. }
  51. $domain_name = get_zone_name_from_id($zone_id);
  52. if ($key_id == "-1") {
  53. error(ERR_INV_INPUT);
  54. include_once("inc/footer.inc.php");
  55. exit;
  56. }
  57. if (!dnssec_zone_key_exists($domain_name, $key_id)) {
  58. error(ERR_INV_INPUT);
  59. include_once("inc/footer.inc.php");
  60. exit;
  61. }
  62. echo " <h2>" . _('Delete zone key') . "</h2>\n";
  63. if ($confirm == '1') {
  64. if (dnssec_remove_zone_key($domain_name, $key_id)) {
  65. success(SUC_EXEC_PDNSSEC_REMOVE_ZONE_KEY);
  66. }
  67. } else {
  68. if ($user_is_zone_owner == "1") {
  69. $key_info = dnssec_get_zone_key($domain_name, $key_id);
  70. echo " " . _('Domain') . ": " . $domain_name . "<br>\n";
  71. echo " " . _('Id') . ": " . $key_info[0] . "<br>\n";
  72. echo " " . _('Type') . ": " . $key_info[1] . "<br>\n";
  73. echo " " . _('Tag') . ": " . $key_info[2] . "<br>\n";
  74. echo " " . _('Algorithm') . ": " . dnssec_algorithm_to_name($key_info[3]) . "<br>\n";
  75. echo " " . _('Bits') . ": " . $key_info[4] . "<br>\n";
  76. echo " " . _('Active') . ": " . ($key_info[5] ? _('Yes') : _('No')) . "\n";
  77. echo " <p>" . _('Are you sure?') . "</p>\n";
  78. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='dnssec_delete_key.php?id=" . $zone_id . "&amp;key_id=$key_id&amp;confirm=1'\" value=\"" . _('Yes') . "\">\n";
  79. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
  80. } else {
  81. error(ERR_PDNSSEC_DEL_ZONE_KEY);
  82. }
  83. }
  84. include_once("inc/footer.inc.php");