13
|
1 |
<?php |
47
|
2 |
|
119
|
3 |
/* Poweradmin, a friendly web-based admin tool for PowerDNS. |
47
|
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 |
include_once("inc/header.inc.php"); |
|
24 |
|
82
|
25 |
$owner = "-1"; |
|
26 |
if ((isset($_POST['owner'])) && (v_num($_POST['owner']))) { |
|
27 |
$owner = $_POST['owner']; |
|
28 |
} |
|
29 |
|
|
30 |
$zone = trim($_POST['domain']); |
|
31 |
$master = $_POST['slave_master']; |
|
32 |
$type = "SLAVE"; |
|
33 |
|
126
|
34 |
(verify_permission('zone_slave_add')) ? $zone_slave_add = "1" : $zone_slave_add = "0" ; |
82
|
35 |
|
|
36 |
if ($_POST['submit'] && $zone_slave_add == "1") { |
|
37 |
if (!is_valid_domain($zone)) { |
|
38 |
error(ERR_DNS_HOSTNAME); |
|
39 |
} elseif (domain_exists($zone)) { |
|
40 |
error(ERR_DOMAIN_EXISTS); |
161
|
41 |
} elseif (!is_valid_ipv4($master) || !is_valid_ipv6($master)) { |
82
|
42 |
error(ERR_DNS_IP); |
|
43 |
} else { |
|
44 |
if(add_domain($zone, $owner, $webip, $mailip, $empty, $type, $master)) { |
|
45 |
success(SUC_ZONE_ADD); |
|
46 |
unset($zone, $owner, $webip, $mailip, $empty, $type, $master); |
|
47 |
} |
13
|
48 |
} |
82
|
49 |
} |
|
50 |
|
110
|
51 |
if ( $zone_slave_add != "1" ) { |
|
52 |
error(ERR_PERM_ADD_ZONE_SLAVE); |
|
53 |
} else { |
|
54 |
echo " <h2>" . _('Add slave zone') . "</h2>\n"; |
82
|
55 |
|
13
|
56 |
$users = show_users(); |
82
|
57 |
echo " <form method=\"post\" action=\"add_zone_slave.php\">\n"; |
|
58 |
echo " <table>\n"; |
|
59 |
echo " <tr>\n"; |
|
60 |
echo " <td class=\"n\">" . _('Zone name') . "</td>\n"; |
|
61 |
echo " <td class=\"n\">\n"; |
|
62 |
echo " <input type=\"text\" class=\"input\" name=\"domain\" value=\"" . $zone . "\">\n"; |
|
63 |
echo " </td>\n"; |
|
64 |
echo " </tr>\n"; |
|
65 |
echo " <tr>\n"; |
110
|
66 |
echo " <td class=\"n\">" . _('IP address of master NS') . ":</td>\n"; |
82
|
67 |
echo " <td class=\"n\">\n"; |
|
68 |
echo " <input type=\"text\" class=\"input\" name=\"slave_master\" value=\"" . $master . "\">\n"; |
|
69 |
echo " </td>\n"; |
|
70 |
echo " </tr>\n"; |
|
71 |
echo " <tr>\n"; |
|
72 |
echo " <td class=\"n\">" . _('Owner') . ":</td>\n"; |
|
73 |
echo " <td class=\"n\">\n"; |
|
74 |
echo " <select name=\"owner\">\n"; |
|
75 |
foreach ($users as $user) { |
|
76 |
echo " <option value=\"" . $user['id'] . "\">" . $user['fullname'] . "</option>\n"; |
|
77 |
} |
|
78 |
echo " </select>\n"; |
|
79 |
echo " </td>\n"; |
|
80 |
echo " </tr>\n"; |
|
81 |
echo " <tr>\n"; |
|
82 |
echo " <td class=\"n\"> </td>\n"; |
|
83 |
echo " <td class=\"n\">\n"; |
111
|
84 |
echo " <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add zone') . "\">\n"; |
82
|
85 |
echo " </td>\n"; |
|
86 |
echo " </tr>\n"; |
|
87 |
echo " </table>\n"; |
|
88 |
echo " </form>\n"; |
|
89 |
} |
|
90 |
|
13
|
91 |
include_once("inc/footer.inc.php"); |
|
92 |
?> |