list_zones.php
author rejo
Wed, 26 Mar 2008 14:48:25 +0000
changeset 90 d7bee09d98fe
parent 82 c255196bc447
child 108 b1015b3055af
permissions -rw-r--r--
[feladat @ 190] Changed 'print debug' function a tiny bit.
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
ae140472d97c [feladat @ 94]
rejo
parents: 44
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
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
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    25
if (verify_permission(zone_content_view_others)) { $perm_view = "all" ; } 
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    26
elseif (verify_permission(zone_content_view_own)) { $perm_view = "own" ; }
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    27
else { $perm_view = "none" ;}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    28
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    29
if (verify_permission(zone_content_edit_others)) { $perm_edit = "all" ; } 
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    30
elseif (verify_permission(zone_content_edit_own)) { $perm_edit = "own" ;} 
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") { 
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    41
	echo "     <p>" . _("You do not have the permission to see any zones.") . "</p>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    42
} else {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    43
	echo "     <div class=\"showmax\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    44
	show_pages($count_zones_all_letterstart,ROWAMOUNT);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    45
	echo "     </div>\n";
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    46
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    47
	if ($count_zones_view > ROWAMOUNT) {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    48
		echo "<div class=\"showmax\">";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    49
		show_letters(LETTERSTART);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    50
		echo "</div>";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    51
	}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    52
	echo "     <table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    53
	echo "      <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    54
	echo "       <th>&nbsp;</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    55
	echo "       <th>" . _('Name') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    56
	echo "       <th>" . _('Type') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    57
	echo "       <th>" . _('Records') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    58
	echo "       <th>" . _('Owner') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    59
	echo "      </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    60
	echo "      <tr>\n";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    61
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    62
	if ($count_zones_view < ROWAMOUNT) {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    63
		$zones = get_zones($perm_view,$_SESSION['userid'],"all",ROWSTART,ROWAMOUNT);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    64
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    65
		$zones = get_zones($perm_view,$_SESSION['userid'],LETTERSTART,ROWSTART,ROWAMOUNT);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    66
		$count_zones_shown = ($zones == -1) ? 0 : count($zones);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    67
	}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    68
	foreach ($zones as $zone)
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    69
	{
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    70
		$zone_owners = get_fullnames_owners_from_domainid($zone["id"]);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    71
82
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    72
		echo "         <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    73
		echo "          <td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    74
		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
    75
		if ( $perm_edit != "all" || $perm_edit != "none") {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    76
			$user_is_zone_owner = verify_user_is_owner_zoneid($zone["id"]);
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    77
		}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    78
		if ( $perm_edit == "all" || ( $perm_edit == "own" && $user_is_zone_owner == "1") ) {
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    79
      			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
    80
		}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    81
		echo "          </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    82
		echo "          <td class=\"y\">" . $zone["name"] . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    83
		echo "          <td class=\"y\">" . strtolower($zone["type"]) . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    84
		echo "          <td class=\"y\">" . $zone["count_records"] . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    85
		echo "          <td class=\"y\">" . $zone_owners . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    86
	}
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    87
	echo "           </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    88
	echo "          </table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 76
diff changeset
    89
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    90
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    91
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    92
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    93
?>