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