list_zones.php
author peter
Thu, 07 Aug 2008 18:45:13 +0000
changeset 192 3d18290ac993
parent 191 963d62dc1c80
permissions -rw-r--r--
[feladat @ 302] Applied the patches supplied in #82 and #85. Also quoted some additional values before they are send to the database.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     1
<?php
47
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     2
119
f74e4f88b680 [feladat @ 222]
rejo
parents: 108
diff changeset
     3
/*  Poweradmin, a friendly web-based admin tool for PowerDNS.
47
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
    21
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    23
include_once("inc/header.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
126
cb06e3e29ed8 [feladat @ 230]
peter
parents: 119
diff changeset
    25
if (verify_permission('zone_content_view_others')) { $perm_view = "all" ; } 
cb06e3e29ed8 [feladat @ 230]
peter
parents: 119
diff changeset
    26
elseif (verify_permission('zone_content_view_own')) { $perm_view = "own" ; }
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    27
else { $perm_view = "none" ;}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    28
126
cb06e3e29ed8 [feladat @ 230]
peter
parents: 119
diff changeset
    29
if (verify_permission('zone_content_edit_others')) { $perm_edit = "all" ; } 
cb06e3e29ed8 [feladat @ 230]
peter
parents: 119
diff changeset
    30
elseif (verify_permission('zone_content_edit_own')) { $perm_edit = "own" ;} 
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    31
else { $perm_edit = "none" ; }
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    32
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    33
$count_zones_all = zone_count_ng("all");
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    34
$count_zones_all_letterstart = zone_count_ng($perm_view,LETTERSTART); 
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    35
$count_zones_view = zone_count_ng($perm_view);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    36
$count_zones_edit = zone_count_ng($perm_edit);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    37
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    38
echo "    <h2>" . _('List zones') . "</h2>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    39
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    40
if ($perm_view == "none") { 
108
b1015b3055af [feladat @ 208]
rejo
parents: 82
diff changeset
    41
	echo "     <p>" . _('You do not have the permission to see any zones.') . "</p>\n";
143
bef105ffb017 [feladat @ 249]
rejo
parents: 136
diff changeset
    42
} elseif (($count_zones_view > $iface_rowamount && $count_zones_all_letterstart == "0") || $count_zones_view == 0) {
191
963d62dc1c80 [feladat @ 300]
peter
parents: 171
diff changeset
    43
	if ($count_zones_view > $iface_rowamount) {
963d62dc1c80 [feladat @ 300]
peter
parents: 171
diff changeset
    44
		echo "<div class=\"showmax\">";
963d62dc1c80 [feladat @ 300]
peter
parents: 171
diff changeset
    45
		show_letters(LETTERSTART);
963d62dc1c80 [feladat @ 300]
peter
parents: 171
diff changeset
    46
		echo "</div>";
963d62dc1c80 [feladat @ 300]
peter
parents: 171
diff changeset
    47
	}
108
b1015b3055af [feladat @ 208]
rejo
parents: 82
diff changeset
    48
	echo "     <p>" . _('There are no zones to show in this listing.') . "</p>\n";
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    49
} else {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    50
	echo "     <div class=\"showmax\">\n";
136
c795dd75a77e [feladat @ 242]
rejo
parents: 130
diff changeset
    51
	show_pages($count_zones_all_letterstart,$iface_rowamount);
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    52
	echo "     </div>\n";
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    53
136
c795dd75a77e [feladat @ 242]
rejo
parents: 130
diff changeset
    54
	if ($count_zones_view > $iface_rowamount) {
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    55
		echo "<div class=\"showmax\">";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    56
		show_letters(LETTERSTART);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    57
		echo "</div>";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    58
	}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    59
	echo "     <table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    60
	echo "      <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    61
	echo "       <th>&nbsp;</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    62
	echo "       <th>" . _('Name') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    63
	echo "       <th>" . _('Type') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    64
	echo "       <th>" . _('Records') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    65
	echo "       <th>" . _('Owner') . "</th>\n";
171
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    66
	if ($iface_zonelist_serial == "1") echo "       <th>" . _('Serial') . "</th>\n";
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    67
	echo "      </tr>\n";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    68
136
c795dd75a77e [feladat @ 242]
rejo
parents: 130
diff changeset
    69
	if ($count_zones_view <= $iface_rowamount) {
c795dd75a77e [feladat @ 242]
rejo
parents: 130
diff changeset
    70
		$zones = get_zones($perm_view,$_SESSION['userid'],"all",ROWSTART,$iface_rowamount);
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    71
	} else {
136
c795dd75a77e [feladat @ 242]
rejo
parents: 130
diff changeset
    72
		$zones = get_zones($perm_view,$_SESSION['userid'],LETTERSTART,ROWSTART,$iface_rowamount);
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    73
		$count_zones_shown = ($zones == -1) ? 0 : count($zones);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    74
	}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    75
	foreach ($zones as $zone)
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    76
	{
171
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    77
		$zone_owners = get_fullnames_owners_from_domainid($zone['id']);
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    78
		if ($iface_zonelist_serial == "1") $serial = get_serial_by_zid($zone['id']);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    79
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    80
		echo "         <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    81
		echo "          <td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    82
		echo "           <a href=\"edit.php?id=" . $zone['id'] . "\"><img src=\"images/edit.gif\" title=\"" . _('View zone') . " " . $zone['name'] . "\" alt=\"[ " . _('View zone') . " " . $zone['name'] . " ]\"></a>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    83
		if ( $perm_edit != "all" || $perm_edit != "none") {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    84
			$user_is_zone_owner = verify_user_is_owner_zoneid($zone["id"]);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    85
		}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    86
		if ( $perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1") ) {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    87
      			echo "           <a href=\"delete_domain.php?id=" . $zone["id"] . "\"><img src=\"images/delete.gif\" title=\"" . _('Delete zone') . " " . $zone['name'] . "\" alt=\"[ ". _('Delete zone') . " " . $zone['name'] . " ]\"></a>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    88
		}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    89
		echo "          </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    90
		echo "          <td class=\"y\">" . $zone["name"] . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    91
		echo "          <td class=\"y\">" . strtolower($zone["type"]) . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    92
		echo "          <td class=\"y\">" . $zone["count_records"] . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    93
		echo "          <td class=\"y\">" . $zone_owners . "</td>\n";
171
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    94
		if ($iface_zonelist_serial == "1") {
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    95
			if ($serial != "") {
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    96
				echo "          <td class=\"y\">" . $serial . "</td>\n";
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    97
			} else {
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    98
				echo "          <td class=\"n\">&nbsp;</td>\n";
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
    99
			}
2a10febd6af9 [feladat @ 278]
rejo
parents: 163
diff changeset
   100
		}
163
32d4c63c50c9 [feladat @ 269]
peter
parents: 143
diff changeset
   101
		echo "           </tr>\n";
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
   102
	}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
   103
	echo "          </table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
   104
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   105
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   106
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   107
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   108
?>