list_zones.php
author peter
Sat, 29 Dec 2007 14:42:34 +0000
changeset 55 a885f557678f
parent 50 ed18c8317cff
child 68 0b8572de80f5
permissions -rw-r--r--
[feladat @ 102] Fixed the queries so both MySQL and PostgreSQL are supported. The 'REGEXP' queries are currently fixed with a workaround.
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
?>
44
f8886b13c495 [feladat @ 91]
rejo
parents: 37
diff changeset
    28
   <h2><? echo _('List all zones'); ?></h2>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    29
<?
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    30
        echo "<div class=\"showmax\">";
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    31
        show_pages($doms,ROWAMOUNT);
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
diff changeset
    32
        echo "</div>";
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    33
29
e1c60f72d494 [feladat @ 76]
rejo
parents: 26
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>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    44
     <th><? echo _('Name'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    45
     <th><? echo _('Type'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    46
     <th><? echo _('Records'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    47
     <th><? echo _('Owner'); ?></th>
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
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    51
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    52
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    53
   $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    54
} else {
2ff220cfde13 [feladat @ 60]
rejo
parents:
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>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    65
     <td colspan="4"><? echo _('There are no zones.'); ?></td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    66
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    67
<?
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>
b785e54690ce [feladat @ 84]
rejo
parents: 36
diff changeset
    79
      <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
    80
<?
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
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    84
      <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
    85
<?
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>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    89
     <td class="y"><? echo $c["name"] ?></td>
26
5d63f1e71d6e [feladat @ 73]
rejo
parents: 20
diff changeset
    90
     <td class="y"><? echo strtolower(get_domain_type($c["id"])) ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    91
     <td class="y"><? echo $c["numrec"] ?></td>
36
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    92
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
diff changeset
    93
<?
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
		}
4ec5ab29f634 [feladat @ 83]
rejo
parents: 34
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
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   110
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   111
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   112
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   113
   <p><? printf(_('This lists shows all %s zones(s) you have access to.'), $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   114
<?
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
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   119
   <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
   120
<?
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
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   125
<? // RZ TODO Check next, does it work? 
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
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   129
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   130
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   131
?>