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" );
82
+ − 23
include_once ( "inc/header.inc.php" );
13
+ − 24
82
+ − 25
$owner = "-1" ;
+ − 26
if (( isset ( $_POST [ 'owner' ])) && ( v_num ( $_POST [ 'owner' ]))) {
+ − 27
$owner = $_POST [ 'owner' ];
+ − 28
}
13
+ − 29
82
+ − 30
$dom_type = "NATIVE" ;
+ − 31
if ( isset ( $_POST [ "dom_type" ]) && ( in_array ( $_POST [ 'dom_type' ], $server_types ))) {
+ − 32
$dom_type = $_POST [ "dom_type" ];
13
+ − 33
}
+ − 34
82
+ − 35
$domain = trim ( $_POST [ "domain" ]);
+ − 36
$webip = $_POST [ "webip" ];
+ − 37
$mailip = $_POST [ "mailip" ];
+ − 38
$empty = $_POST [ "empty" ];
+ − 39
+ − 40
( verify_permission ( zone_master_add )) ? $zone_master_add = "1" : $zone_master_add = "0" ;
+ − 41
+ − 42
if ( $_POST [ 'submit' ] && $zone_master_add == "1" ) {
+ − 43
+ − 44
// Boy. I will be happy when I have found the time to replace
+ − 45
// this "template wanabee" code with something that is really
+ − 46
// worth to be called "templating". Whoever wrote this should
+ − 47
// be... should be... how can I say this politicaly correct?
+ − 48
// 20080303/RZ
+ − 49
+ − 50
if ( ! $empty ) {
13
+ − 51
$empty = 0 ;
82
+ − 52
if ( ! eregi ( 'in-addr.arpa' , $domain ) && ( ! is_valid_ip ( $webip ) || ! is_valid_ip ( $mailip )) ) {
110
+ − 53
error ( _ ( 'IP address of web- or mailserver is invalid.' ));
82
+ − 54
$error = "1" ;
13
+ − 55
}
+ − 56
}
82
+ − 57
+ − 58
if ( ! $error ) {
+ − 59
if ( ! is_valid_domain ( $domain )) {
110
+ − 60
error ( ERR_DOMAIN_INVALID );
82
+ − 61
$error = "1" ;
+ − 62
} elseif ( domain_exists ( $domain )) {
110
+ − 63
error ( ERR_DOMAIN_EXISTS );
82
+ − 64
$error = "1" ;
+ − 65
} else {
+ − 66
if ( add_domain ( $domain , $owner , $webip , $mailip , $empty , $dom_type , '' )) {
+ − 67
success ( SUC_ZONE_ADD );
+ − 68
unset ( $domain , $owner , $webip , $mailip , $empty , $dom_type );
+ − 69
} else {
+ − 70
$error = "1" ;
+ − 71
}
13
+ − 72
}
+ − 73
}
+ − 74
}
+ − 75
110
+ − 76
if ( $zone_master_add != "1" ) {
+ − 77
error ( ERR_PERM_ADD_ZONE_MASTER );
+ − 78
} else {
+ − 79
echo " <h2>" . _ ( 'Add master zone' ) . "</h2> \n " ;
13
+ − 80
82
+ − 81
$available_zone_types = array ( "MASTER" , "NATIVE" );
+ − 82
$users = show_users ();
13
+ − 83
82
+ − 84
echo " <form method= \" post \" action= \" add_zone_master.php \" > \n " ;
+ − 85
echo " <table> \n " ;
+ − 86
echo " <tr> \n " ;
+ − 87
echo " <td class= \" n \" >" . _ ( 'Zone name' ) . ":</td> \n " ;
+ − 88
echo " <td class= \" n \" > \n " ;
+ − 89
echo " <input type= \" text \" class= \" input \" name= \" domain \" value= \" " . $domain . " \" > \n " ;
+ − 90
echo " </td> \n " ;
+ − 91
echo " </tr> \n " ;
+ − 92
echo " <tr> \n " ;
110
+ − 93
echo " <td class= \" n \" >" . _ ( 'IP address of webserver' ) . ":</td> \n " ;
82
+ − 94
echo " <td class= \" n \" > \n " ;
+ − 95
echo " <input type= \" text \" class= \" input \" name= \" webip \" value= \" " . $webip . " \" > \n " ;
+ − 96
echo " </td> \n " ;
+ − 97
echo " </tr> \n " ;
+ − 98
echo " <tr> \n " ;
110
+ − 99
echo " <td class= \" n \" >" . _ ( 'IP address of mailserver' ) . ":</td> \n " ;
82
+ − 100
echo " <td class= \" n \" > \n " ;
+ − 101
echo " <input type= \" text \" class= \" input \" name= \" mailip \" value= \" " . $mailip . " \" > \n " ;
+ − 102
echo " </td> \n " ;
+ − 103
echo " </tr> \n " ;
+ − 104
echo " <tr> \n " ;
+ − 105
echo " <td class= \" n \" >" . _ ( 'Owner' ) . ":</td> \n " ;
+ − 106
echo " <td class= \" n \" > \n " ;
+ − 107
echo " <select name= \" owner \" > \n " ;
+ − 108
foreach ( $users as $user ) {
+ − 109
echo " <option value= \" " . $user [ 'id' ] . " \" >" . $user [ 'fullname' ] . "</option> \n " ;
13
+ − 110
}
82
+ − 111
echo " </select> \n " ;
+ − 112
echo " </td> \n " ;
+ − 113
echo " </tr> \n " ;
+ − 114
echo " <tr> \n " ;
111
+ − 115
echo " <td class= \" n \" >" . _ ( 'Type' ) . ":</td> \n " ;
82
+ − 116
echo " <td class= \" n \" > \n " ;
+ − 117
echo " <select name= \" dom_type \" > \n " ;
+ − 118
foreach ( $available_zone_types as $type ) {
+ − 119
echo " <option value= \" " . $type . " \" >" . strtolower ( $type ) . "</option> \n " ;
13
+ − 120
}
82
+ − 121
echo " </select> \n " ;
+ − 122
echo " </td> \n " ;
+ − 123
echo " </tr> \n " ;
+ − 124
echo " <tr> \n " ;
+ − 125
echo " <td class= \" n \" >" . _ ( 'Create zone without applying records-template' ) . "</td> \n " ;
+ − 126
echo " <td class= \" n \" ><input type= \" checkbox \" name= \" empty \" value= \" 1 \" ></td> \n " ;
+ − 127
echo " </tr> \n " ;
+ − 128
echo " <tr> \n " ;
+ − 129
echo " <td class= \" n \" > </td> \n " ;
+ − 130
echo " <td class= \" n \" > \n " ;
+ − 131
echo " <input type= \" submit \" class= \" button \" name= \" submit \" value= \" " . _ ( 'Add zone' ) . " \" > \n " ;
+ − 132
echo " </td> \n " ;
+ − 133
echo " </tr> \n " ;
+ − 134
echo " </table> \n " ;
+ − 135
echo " </form> \n " ;
+ − 136
}
13
+ − 137
+ − 138
include_once ( "inc/footer.inc.php" );