list_zones.php
author rejo
Tue, 10 Jul 2007 21:24:06 +0000
changeset 37 b785e54690ce
parent 36 4ec5ab29f634
child 44 f8886b13c495
permissions -rw-r--r--
[feladat @ 84] Bugfix. The function zone_count() now also counts zones an owner has only partial access to, not just those zones the owner has full access to. This fixes just the count, the zones a user has partial access to are not (yet!) shown in the "list zones" page. Bugfix. In the zone listing the "edit" button is now show for users with access level 1. Untill now they were presented an overview of the zones they could change, but there was no link for them to actually edit the zone. Bugfix. Some of the buttons in the "edit zone" interface that are of no use to a user with access level 1 have been hidden. Bugfix. Make sure a user with access level 1 with only partial access to a zone cannot add new records to that zone. Only the zone owner should be able to add new record. Bugfix. If a user with access level 1 edits a record in a zone he has only partial access to, an error was shown because of call to a non- existing function in the PEAR:MDB2. This bug was most likely introduced while migrating from PEAR:DB to PEAR:MDB2. Bugfix. A user with access level 1 was able to delete all records of a zone he has only partial access to. Some additional checks have been added. Bugfix. If a user with accees level 1 has partial access to one or more zones starting with a certain character, but did not own at least one entire zone starting with the same character, the character wasn't clickable in the "list zone" page. Interface. If no record or zone id is given for delete_record.php or delete_domain.php, don't just die but echo a nice message. The i18n files have not yet been updated to reflect this change. Interface. If no master IP is given in delete_supermaster.php, don't just die but echo a nice message. The i18n files have not yet been updated to reflect this change. [All fixes by Peter Beernink.]
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     1
<?php
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     2
require_once("inc/i18n.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     3
require_once("inc/toolkit.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     4
include_once("inc/header.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     5
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
     6
$num_all_domains = zone_count(0);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
     7
$doms = zone_count(0, LETTERSTART);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     8
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     9
   <h2><? echo _('List zones'); ?></h2>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    10
<?
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    11
        echo "<div class=\"showmax\">";
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    12
        show_pages($doms,ROWAMOUNT);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    13
        echo "</div>";
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    14
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    15
if ($num_all_domains > ROWAMOUNT)
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    16
{
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    17
        echo "<div class=\"showmax\">";
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    18
        show_letters(LETTERSTART);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    19
        echo "</div>";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    20
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    21
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    22
   <table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    23
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
     <th>&nbsp;</th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    25
     <th><? echo _('Name'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    26
     <th><? echo _('Type'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    27
     <th><? echo _('Records'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    28
     <th><? echo _('Owner'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    29
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    30
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    31
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    32
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    33
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    34
   $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    35
} else {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    36
   $doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT);
34
a2826b0ebcff [feladat @ 81]
rejo
parents: 29
diff changeset
    37
   $num_show_domains = ($doms == -1) ? 0 : count($doms);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    38
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    39
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    40
// If the user doesnt have any domains print a message saying so
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    41
if ($doms < 0)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    42
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    43
	?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    44
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    45
     <td>&nbsp;</td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    46
     <td colspan="4"><? echo _('There are no zones.'); ?></td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    47
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    48
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    49
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    50
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    51
// If he has domains, dump them (duh)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    52
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    53
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    54
	foreach ($doms as $c)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    55
	{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    56
		?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    57
		
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    58
    <tr>
37
b785e54690ce [feladat @ 84]
rejo
parents: 36
diff changeset
    59
     <td>
b785e54690ce [feladat @ 84]
rejo
parents: 36
diff changeset
    60
      <a href="edit.php?id=<? echo $c["id"] ?>"><img src="images/edit.gif" title="<? echo _('Edit zone') . " " . $c['name']; ?>" alt="[ <? echo _('Edit zone') . " " . $c['name']; ?> ]"></a>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    61
<?
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    62
		if (level(5))
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    63
		{
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    64
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    65
      <a href="delete_domain.php?id=<? echo $c["id"] ?>"><img src="images/delete.gif" title="<? print _('Delete zone') . " " . $c['name']; ?>" alt="[<? echo _('Delete zone') . " " . $c['name']; ?>]"></a>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    66
<?
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    67
		}
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    68
?>
37
b785e54690ce [feladat @ 84]
rejo
parents: 36
diff changeset
    69
     </td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    70
     <td class="y"><? echo $c["name"] ?></td>
26
5d63f1e71d6e [feladat @ 73]
rejo
parents: 20
diff changeset
    71
     <td class="y"><? echo strtolower(get_domain_type($c["id"])) ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    72
     <td class="y"><? echo $c["numrec"] ?></td>
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    73
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    74
<?
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    75
		$zone_owners = get_owners_from_domainid($c["id"]);
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    76
		if ($zone_owners == "")
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    77
		{
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    78
			echo "<td class=\"n\"></td>";
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    79
		}
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    80
		else
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    81
		{
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    82
			print "<td class=\"y\">".$zone_owners."</td>";
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    83
		}
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    84
		print "<tr>\n";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    85
	}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    86
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    87
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    88
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    89
   </table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    90
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    91
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    92
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    93
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    94
   <p><? printf(_('This lists shows all %s zones(s) you have access to.'), $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    95
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    96
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    97
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    98
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    99
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   100
   <p><? printf(_('This lists shows %s out of %s zones you have access to.'), $num_show_domains, $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   101
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   102
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   103
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   104
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   105
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   106
<? // RZ TODO Check next, does it work? 
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   107
//  <small> echo _('You only administer some records of domains marked with an (*).'); </small>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   108
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   109
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   110
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   111
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   112
?>