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 |
{ |
|
69 |
?><div class="error"><? echo _('Error'); ?>: <? echo $error; ?></div><? |
|
70 |
} |
|
71 |
elseif ($success != "") |
|
72 |
{ |
|
73 |
?><div class="success"><? echo $success; ?></div><? |
|
74 |
} |
|
75 |
|
|
76 |
?> |
|
77 |
<h2>Add master zone</h2> |
|
78 |
<? |
|
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> |
|
88 |
<td class="n"><? echo _('Zone name'); ?>:</td> |
|
89 |
<td class="n"> |
|
90 |
<input type="text" class="input" name="domain" value="<? if ($error) print $_POST["domain"]; ?>"> |
|
91 |
</td> |
|
92 |
</tr> |
|
93 |
<tr> |
|
94 |
<td class="n"><? echo _('Web IP'); ?>:</td> |
|
95 |
<td class="n"> |
|
96 |
<input type="text" class="input" name="webip" value="<? if ($error) print $_POST["webip"]; ?>"> |
|
97 |
</td> |
|
98 |
</tr> |
|
99 |
<tr> |
|
100 |
<td class="n"><? echo _('Mail IP'); ?>:</TD> |
|
101 |
<td class="n"> |
|
102 |
<input type="text" class="input" name="mailip" value="<? if ($error) print $_POST["mailip"]; ?>"> |
|
103 |
</td> |
|
104 |
</tr> |
|
105 |
<tr> |
|
106 |
<td class="n"><? echo _('Owner'); ?>:</td> |
|
107 |
<td class="n"> |
|
108 |
<select name="owner"> |
|
109 |
<? |
|
110 |
foreach ($users as $u) |
|
111 |
{ |
|
112 |
?><option value="<? echo $u['id'] ?>"><? echo $u['fullname'] ?></option><? |
|
113 |
} |
|
114 |
?> |
|
115 |
</select> |
|
116 |
</td> |
|
117 |
</tr> |
|
118 |
<tr> |
|
119 |
<td class="n"><? echo _('Zone type'); ?>:</td> |
|
120 |
<td class="n"> |
|
121 |
<select name="dom_type"> |
|
122 |
<? |
|
123 |
foreach($zone_types as $s) |
|
124 |
{ |
|
125 |
?><option value="<? echo $s?>"><? echo $s ?></option><? |
|
126 |
} |
|
127 |
?> |
|
128 |
</select> |
|
129 |
</td> |
|
130 |
</tr> |
|
131 |
<tr> |
|
132 |
<td class="n"><? echo _('Create zone without applying records-template'); ?>:</td> |
|
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"> |
22
|
138 |
<input type="submit" class="button" name="submit" value="<? echo _('Add zone'); ?>"> |
13
|
139 |
</td> |
|
140 |
</tr> |
|
141 |
</table> |
|
142 |
</form> |
|
143 |
<? |
|
144 |
|
|
145 |
include_once("inc/footer.inc.php"); |