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
$webip = $_POST [ "webip" ];
+ − 35
$mailip = $_POST [ "mailip" ];
+ − 36
$empty = $_POST [ "empty" ];
+ − 37
$dom_type = isset ( $_POST [ "dom_type" ]) ? $_POST [ "dom_type" ] : "NATIVE" ;
+ − 38
if ( ! $empty )
+ − 39
{
+ − 40
$empty = 0 ;
+ − 41
if ( ! eregi ( 'in-addr.arpa' , $domain ) && ( ! is_valid_ip ( $webip ) || ! is_valid_ip ( $mailip )) )
+ − 42
{
+ − 43
$error = "Web or Mail ip is invalid!" ;
+ − 44
}
+ − 45
}
+ − 46
if ( ! $error )
+ − 47
{
+ − 48
if ( ! is_valid_domain ( $domain ))
+ − 49
{
+ − 50
$error = "Zone name is invalid!" ;
+ − 51
}
+ − 52
elseif ( domain_exists ( $domain ))
+ − 53
{
+ − 54
$error = "Zone already exists!" ;
+ − 55
}
+ − 56
//elseif (isset($mailip) && is_valid_ip(
+ − 57
else
+ − 58
{
+ − 59
add_domain ( $domain , $owner , $webip , $mailip , $empty , $dom_type , '' );
+ − 60
$success = _ ( 'Successfully added master zone.' );
+ − 61
}
+ − 62
}
+ − 63
}
+ − 64
+ − 65
include_once ( "inc/header.inc.php" );
+ − 66
+ − 67
if ( $error != "" )
+ − 68
{
71
+ − 69
?> <div class="error"> <?php echo _ ( 'Error' ); ?> : <?php echo $error ; ?> </div> <?php
13
+ − 70
}
+ − 71
elseif ( $success != "" )
+ − 72
{
71
+ − 73
?> <div class="success"> <?php echo $success ; ?> </div> <?php
13
+ − 74
}
+ − 75
+ − 76
?>
+ − 77
<h2>Add master zone</h2>
71
+ − 78
<?php
13
+ − 79
+ − 80
// Zone type set to master and native only, slave zones are created
+ − 81
// on a different page.
+ − 82
$zone_types = array ( "MASTER" , "NATIVE" );
+ − 83
$users = show_users ();
+ − 84
?>
+ − 85
<form method="post" action="add_zone_master.php">
+ − 86
<table>
+ − 87
<tr>
71
+ − 88
<td class="n"> <?php echo _ ( 'Zone name' ); ?> :</td>
13
+ − 89
<td class="n">
71
+ − 90
<input type="text" class="input" name="domain" value=" <?php if ( $error ) print $_POST [ "domain" ]; ?> ">
13
+ − 91
</td>
+ − 92
</tr>
+ − 93
<tr>
71
+ − 94
<td class="n"> <?php echo _ ( 'Web IP' ); ?> :</td>
13
+ − 95
<td class="n">
71
+ − 96
<input type="text" class="input" name="webip" value=" <?php if ( $error ) print $_POST [ "webip" ]; ?> ">
13
+ − 97
</td>
+ − 98
</tr>
+ − 99
<tr>
71
+ − 100
<td class="n"> <?php echo _ ( 'Mail IP' ); ?> :</TD>
13
+ − 101
<td class="n">
71
+ − 102
<input type="text" class="input" name="mailip" value=" <?php if ( $error ) print $_POST [ "mailip" ]; ?> ">
13
+ − 103
</td>
+ − 104
</tr>
+ − 105
<tr>
71
+ − 106
<td class="n"> <?php echo _ ( 'Owner' ); ?> :</td>
13
+ − 107
<td class="n">
+ − 108
<select name="owner">
71
+ − 109
<?php
13
+ − 110
foreach ( $users as $u )
+ − 111
{
71
+ − 112
?> <option value=" <?php echo $u [ 'id' ] ?> "> <?php echo $u [ 'fullname' ] ?> </option> <?php
13
+ − 113
}
+ − 114
?>
+ − 115
</select>
+ − 116
</td>
+ − 117
</tr>
+ − 118
<tr>
71
+ − 119
<td class="n"> <?php echo _ ( 'Zone type' ); ?> :</td>
13
+ − 120
<td class="n">
+ − 121
<select name="dom_type">
71
+ − 122
<?php
13
+ − 123
foreach ( $zone_types as $s )
+ − 124
{
71
+ − 125
?> <option value=" <?php echo $s ?> "> <?php echo $s ?> </option> <?php
13
+ − 126
}
+ − 127
?>
+ − 128
</select>
+ − 129
</td>
+ − 130
</tr>
+ − 131
<tr>
71
+ − 132
<td class="n"> <?php echo _ ( 'Create zone without applying records-template' ); ?> :</td>
13
+ − 133
<td class="n"><input type="checkbox" name="empty" value="1"></td>
+ − 134
</tr>
+ − 135
<tr>
+ − 136
<td class="n"> </td>
+ − 137
<td class="n">
71
+ − 138
<input type="submit" class="button" name="submit" value=" <?php echo _ ( 'Add zone' ); ?> ">
13
+ − 139
</td>
+ − 140
</tr>
+ − 141
</table>
+ − 142
</form>
71
+ − 143
<?php
13
+ − 144
+ − 145
include_once ( "inc/footer.inc.php" );