list_zones.php
author peter
Mon, 10 Mar 2008 19:15:59 +0000
changeset 79 0c0aa144356a
parent 76 0748816801b2
child 82 c255196bc447
permissions -rw-r--r--
[feladat @ 156] Made a lot of small changes to allow PHP to run with error_reporting E_ALL without giving notices. Most functions have been checked but some situations might give a notice.
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
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    25
$num_all_domains = zone_count(0);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    26
$doms = zone_count(0, LETTERSTART);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    27
?>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    28
   <h2><?php echo _('List all zones'); ?></h2>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    29
<?php
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    30
        echo "<div class=\"showmax\">";
76
0748816801b2 [feladat @ 123]
rejo
parents: 75
diff changeset
    31
        show_pages($doms,ROWAMOUNT);
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    32
        echo "</div>";
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    33
76
0748816801b2 [feladat @ 123]
rejo
parents: 75
diff changeset
    34
if ($num_all_domains > ROWAMOUNT)
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    35
{
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    36
        echo "<div class=\"showmax\">";
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    37
        show_letters(LETTERSTART);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    38
        echo "</div>";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    39
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    40
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    41
   <table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    42
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    43
     <th>&nbsp;</th>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    44
     <th><?php echo _('Name'); ?></th>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    45
     <th><?php echo _('Type'); ?></th>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    46
     <th><?php echo _('Records'); ?></th>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    47
     <th><?php echo _('Owner'); ?></th>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    48
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    49
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    50
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    51
<?php
76
0748816801b2 [feladat @ 123]
rejo
parents: 75
diff changeset
    52
if ($num_all_domains < ROWAMOUNT) {
0748816801b2 [feladat @ 123]
rejo
parents: 75
diff changeset
    53
   $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    54
} else {
76
0748816801b2 [feladat @ 123]
rejo
parents: 75
diff changeset
    55
   $doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT);
34
a2826b0ebcff [feladat @ 81]
rejo
parents: 29
diff changeset
    56
   $num_show_domains = ($doms == -1) ? 0 : count($doms);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    57
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    58
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    59
// If the user doesnt have any domains print a message saying so
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    60
if ($doms < 0)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    61
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    62
	?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    63
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    64
     <td>&nbsp;</td>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    65
     <td colspan="4"><?php echo _('There are no zones.'); ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    66
    </tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    67
<?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    68
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    69
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    70
// If he has domains, dump them (duh)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    71
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    72
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    73
	foreach ($doms as $c)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    74
	{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    75
		?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    76
		
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    77
    <tr>
37
b785e54690ce [feladat @ 84]
rejo
parents: 36
diff changeset
    78
     <td>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    79
      <a href="edit.php?id=<?php echo $c["id"] ?>"><img src="images/edit.gif" title="<?php echo _('Edit zone') . " " . $c['name']; ?>" alt="[ <?php echo _('Edit zone') . " " . $c['name']; ?> ]"></a>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    80
<?php
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    81
		if (level(5))
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    82
		{
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    83
?>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    84
      <a href="delete_domain.php?id=<?php echo $c["id"] ?>"><img src="images/delete.gif" title="<?php print _('Delete zone') . " " . $c['name']; ?>" alt="[<?php echo _('Delete zone') . " " . $c['name']; ?>]"></a>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    85
<?php
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    86
		}
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    87
?>
37
b785e54690ce [feladat @ 84]
rejo
parents: 36
diff changeset
    88
     </td>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    89
     <td class="y"><?php echo $c["name"] ?></td>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    90
     <td class="y"><?php echo strtolower(get_domain_type($c["id"])) ?></td>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    91
     <td class="y"><?php echo $c["numrec"] ?></td>
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    92
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
    93
<?php
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    94
		$zone_owners = get_owners_from_domainid($c["id"]);
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    95
		if ($zone_owners == "")
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    96
		{
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    97
			echo "<td class=\"n\"></td>";
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    98
		}
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    99
		else
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
   100
		{
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
   101
			print "<td class=\"y\">".$zone_owners."</td>";
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
   102
		}
68
0b8572de80f5 [feladat @ 115]
rejo
parents: 50
diff changeset
   103
		print "</tr>\n";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   104
	}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   105
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   106
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   107
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   108
   </table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   109
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   110
<?php
76
0748816801b2 [feladat @ 123]
rejo
parents: 75
diff changeset
   111
if ($num_all_domains < ROWAMOUNT) {
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   112
?>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   113
   <p><?php printf(_('This lists shows all %s zones(s) you have access to.'), $num_all_domains); ?></p>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   114
<?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   115
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   116
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   117
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   118
?>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   119
   <p><?php printf(_('This lists shows %s out of %s zones you have access to.'), $num_show_domains, $num_all_domains); ?></p>
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   120
<?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   121
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   122
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   123
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   124
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   125
<?php // RZ TODO Check next, does it work? 
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   126
//  <small> echo _('You only administer some records of domains marked with an (*).'); </small>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   127
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   128
71
e1b918eaf69a [feladat @ 118]
peter
parents: 68
diff changeset
   129
<?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   130
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   131
?>