add_zone_slave.php
author peter
Wed, 12 Mar 2008 19:47:25 +0000
changeset 80 48b5f7021aaa
parent 79 0c0aa144356a
child 82 c255196bc447
permissions -rw-r--r--
[feladat @ 158] Bugfix for ticket:18: Minor modification in the CSS to make sure no data is displayed on top of other data. Also a little modification to make sure the sub-owners (if there are any) are displayed above the record form, instead of next to it.
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: 13
diff changeset
     2
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 13
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
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
if (!level(5))
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    25
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    26
        error(ERR_LEVEL_5);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    27
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    28
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    29
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    30
if (isset($_POST["submit"]))
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    31
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    32
     $domain = trim($_POST["domain"]);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    33
     $owner = $_POST["owner"];
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    34
     $slave_master = $_POST["slave_master"];
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    35
     $dom_type = "SLAVE";
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    36
     if (!isset($error))
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    37
     {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    38
             if (!is_valid_domain($domain))
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    39
             {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    40
                     $error = "Zone name is invalid!";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    41
             }
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    42
             elseif (domain_exists($domain))
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    43
             {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    44
                     $error = "Zone already exists!";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    45
             }
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    46
             elseif (!is_valid_ip($slave_master))
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    47
             {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    48
                     $error = "IP of master NS for slave zone is not valid!";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    49
             }
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    50
             else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    51
             {
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    52
                     if(add_domain($domain, $owner, '', '', 1, $dom_type, $slave_master))
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    53
		     {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    54
                                $success = _('Successfully added slave zone.');
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
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    59
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    60
include_once("inc/header.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    61
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    62
	if ((isset($error)) && ($error != ""))
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    63
	{
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    64
	        ?><div class="error"><?php echo _('Error'); ?>: <?php echo $error; ?></div><?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    65
	}
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    66
	elseif ((isset($success)) && ($success != ""))
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    67
	{
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    68
		?><div class="success"><?php echo $success; ?></div><?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    69
	}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    70
	
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    71
	$users = show_users();
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    72
	
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    73
	?>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    74
	    <h2><?php echo _('Add slave zone'); ?></h2>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    75
	    <form method="post" action="add_zone_slave.php">
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    76
	     <table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    77
	      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    78
	       <td class="n"><?php echo _('Zone name'); ?>:</td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    79
	       <td class="n">
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    80
	        <input type="text" class="input" name="domain" value="<?php if (isset($error)) print $_POST["domain"]; ?>">
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    81
	       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    82
	      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    83
	      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    84
	       <td class="n"><?php echo _('IP of master NS'); ?>:</td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    85
	       <td class="n">
79
0c0aa144356a [feladat @ 156]
peter
parents: 71
diff changeset
    86
	        <input type="text" class="input" name="slave_master" value="<?php if (isset($error)) print $_POST["slave_master"]; ?>">
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    87
	       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    88
	      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    89
	      <tr>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    90
	       <td class="n"><?php echo _('Owner'); ?>:</td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    91
	       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    92
	        <select name="owner">
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    93
	         <?php 
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    94
	         foreach ($users as $u)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    95
	         {
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
    96
	           ?><option value="<?php echo $u['id'] ?>"><?php echo $u['fullname'] ?></option><?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    97
	         } 
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    98
	        ?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    99
	        </select>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   100
	       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   101
	      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   102
	      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   103
	       <td class="n">&nbsp;</td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   104
	       <td class="n">
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
   105
	        <input type="submit" class="button" name="submit" value="<?php echo _('Add domain'); ?>">
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   106
	       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   107
	      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   108
	     </table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   109
	    </form>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 50
diff changeset
   110
<?php
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   111
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   112
?>