Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

list_zones.php 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 displays zone list
  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. global $pdnssec_use;
  33. if (verify_permission('zone_content_view_others')) {
  34. $perm_view = "all";
  35. } elseif (verify_permission('zone_content_view_own')) {
  36. $perm_view = "own";
  37. } else {
  38. $perm_view = "none";
  39. }
  40. if (verify_permission('zone_content_edit_others')) {
  41. $perm_edit = "all";
  42. } elseif (verify_permission('zone_content_edit_own')) {
  43. $perm_edit = "own";
  44. } else {
  45. $perm_edit = "none";
  46. }
  47. $count_zones_all = zone_count_ng("all");
  48. $count_zones_all_letterstart = zone_count_ng($perm_view, LETTERSTART);
  49. $count_zones_view = zone_count_ng($perm_view);
  50. $count_zones_edit = zone_count_ng($perm_edit);
  51. # OUCH: Temporary workaround for nasty sorting issue.
  52. # The problem is that sorting order is saved as a session variable
  53. # and it's used in two different screens - zone list and search results.
  54. # Both have different queries for getting data, but same order field
  55. # that causes failure.
  56. $zone_sort_by = ZONE_SORT_BY;
  57. if (!in_array(ZONE_SORT_BY, array('name', 'type', 'count_records'))) {
  58. $zone_sort_by = 'name';
  59. }
  60. echo " <h2>" . _('List zones') . "</h2>\n";
  61. if ($perm_view == "none") {
  62. echo " <p>" . _('You do not have the permission to see any zones.') . "</p>\n";
  63. } elseif (($count_zones_view > $iface_rowamount && $count_zones_all_letterstart == "0") || $count_zones_view == 0) {
  64. if ($count_zones_view > $iface_rowamount) {
  65. echo "<div class=\"showmax\">";
  66. show_letters(LETTERSTART);
  67. echo "</div>";
  68. }
  69. echo " <p>" . _('There are no zones to show in this listing.') . "</p>\n";
  70. } else {
  71. if (LETTERSTART != 'all') {
  72. echo " <div class=\"showmax\">\n";
  73. show_pages($count_zones_all_letterstart, $iface_rowamount);
  74. echo " </div>\n";
  75. }
  76. if ($count_zones_view > $iface_rowamount) {
  77. echo "<div class=\"showmax\">";
  78. show_letters(LETTERSTART);
  79. echo "</div>";
  80. }
  81. echo " <form method=\"post\" action=\"delete_domains.php\">\n";
  82. echo " <table>\n";
  83. echo " <tr>\n";
  84. echo " <th>&nbsp;</th>\n";
  85. echo " <th>&nbsp;</th>\n";
  86. echo " <th><a href=\"list_zones.php?zone_sort_by=name\">" . _('Name') . "</a></th>\n";
  87. echo " <th><a href=\"list_zones.php?zone_sort_by=type\">" . _('Type') . "</a></th>\n";
  88. echo " <th><a href=\"list_zones.php?zone_sort_by=count_records\">" . _('Records') . "</a></th>\n";
  89. echo " <th>" . _('Owner') . "</th>\n";
  90. if ($iface_zonelist_serial) {
  91. echo " <th>" . _('Serial') . "</th>\n";
  92. }
  93. if ($pdnssec_use) {
  94. echo " <th>" . _('DNSSEC') . "</th>\n";
  95. }
  96. echo " </tr>\n";
  97. if ($count_zones_view <= $iface_rowamount) {
  98. $zones = get_zones($perm_view, $_SESSION['userid'], "all", ROWSTART, $iface_rowamount, $zone_sort_by);
  99. } elseif (LETTERSTART == 'all') {
  100. $zones = get_zones($perm_view, $_SESSION['userid'], "all", ROWSTART, 'all', $zone_sort_by);
  101. } else {
  102. $zones = get_zones($perm_view, $_SESSION['userid'], LETTERSTART, ROWSTART, $iface_rowamount, $zone_sort_by);
  103. $count_zones_shown = ($zones == -1) ? 0 : count($zones);
  104. }
  105. foreach ($zones as $zone) {
  106. if ($zone['count_records'] == NULL) {
  107. $zone['count_records'] = 0;
  108. }
  109. $zone_owners = get_fullnames_owners_from_domainid($zone['id']);
  110. if ($iface_zonelist_serial)
  111. $serial = get_serial_by_zid($zone['id']);
  112. if ($perm_edit != "all" || $perm_edit != "none") {
  113. $user_is_zone_owner = verify_user_is_owner_zoneid($zone["id"]);
  114. }
  115. echo " <tr>\n";
  116. echo " <td class=\"checkbox\">\n";
  117. if ($count_zones_edit > 0 && ($perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1"))) {
  118. echo " <input type=\"checkbox\" name=\"zone_id[]\" value=\"" . $zone['id'] . "\">";
  119. }
  120. echo " </td>\n";
  121. echo " <td class=\"actions\">\n";
  122. echo " <a href=\"edit.php?name=" . $zone['name'] . "&id=" . $zone['id'] . "\"><img src=\"images/edit.gif\" title=\"" . _('View zone') . " " . $zone['name'] . "\" alt=\"[ " . _('View zone') . " " . $zone['name'] . " ]\"></a>\n";
  123. if ($perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1")) {
  124. echo " <a href=\"delete_domain.php?name=" . $zone['name'] . "&id=" . $zone["id"] . "\"><img src=\"images/delete.gif\" title=\"" . _('Delete zone') . " " . $zone['name'] . "\" alt=\"[ " . _('Delete zone') . " " . $zone['name'] . " ]\"></a>\n";
  125. }
  126. echo " </td>\n";
  127. echo " <td class=\"name\">" . $zone["name"] . "</td>\n";
  128. echo " <td class=\"type\">" . strtolower($zone["type"]) . "</td>\n";
  129. echo " <td class=\"count\">" . $zone["count_records"] . "</td>\n";
  130. echo " <td class=\"owner\">" . $zone_owners . "</td>\n";
  131. if ($iface_zonelist_serial) {
  132. if ($serial != "") {
  133. echo " <td class=\"y\">" . $serial . "</td>\n";
  134. } else {
  135. echo " <td class=\"n\">&nbsp;</td>\n";
  136. }
  137. }
  138. if ($pdnssec_use) {
  139. echo " <td class=\"dnssec\"><input type=\"checkbox\" onclick=\"return false\" " . (dnssec_is_zone_secured($zone['name']) ? 'checked' : '') . "></td>\n";
  140. }
  141. echo " </tr>\n";
  142. }
  143. echo " </table>\n";
  144. echo " <input type=\"submit\" name=\"commit\" value=\"" . _('Delete zone(s)') . "\" class=\"button\">\n";
  145. echo " </form>\n";
  146. }
  147. include_once("inc/footer.inc.php");