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