Skip to content

Commit 497f7d9

Browse files
committed
i18n user/web/dns/mail
1 parent ebdbe96 commit 497f7d9

34 files changed

+2176
-2112
lines changed

web/add/dns/index.php

Lines changed: 127 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -12,160 +12,155 @@
1212
// Panel
1313
top_panel($user,$TAB);
1414

15-
// Are you admin?
16-
//if ($_SESSION['user'] == 'admin') {
17-
if (!empty($_POST['ok'])) {
18-
// Check input
19-
if (empty($_POST['v_domain'])) $errors[] = _('domain');
20-
if (empty($_POST['v_ip'])) $errors[] = _('ip');
21-
22-
// Protect input
23-
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
24-
$v_domain = escapeshellarg($v_domain);
25-
$v_ip = escapeshellarg($_POST['v_ip']);
26-
if ($_SESSION['user'] == 'admin') {
27-
$v_template = escapeshellarg($_POST['v_template']);
28-
} else {
29-
$v_template = "''";
30-
}
31-
if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
32-
if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
33-
if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
34-
if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
35-
36-
// Check for errors
37-
if (!empty($errors[0])) {
38-
foreach ($errors as $i => $error) {
39-
if ( $i == 0 ) {
40-
$error_msg = $error;
41-
} else {
42-
$error_msg = $error_msg.", ".$error;
43-
}
15+
if (!empty($_POST['ok'])) {
16+
// Check input
17+
if (empty($_POST['v_domain'])) $errors[] = _('domain');
18+
if (empty($_POST['v_ip'])) $errors[] = _('ip');
19+
20+
// Protect input
21+
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
22+
$v_domain = escapeshellarg($v_domain);
23+
$v_ip = escapeshellarg($_POST['v_ip']);
24+
if ($_SESSION['user'] == 'admin') {
25+
$v_template = escapeshellarg($_POST['v_template']);
26+
} else {
27+
$v_template = "''";
28+
}
29+
30+
if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
31+
if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
32+
if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
33+
if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
34+
35+
// Check for errors
36+
if (!empty($errors[0])) {
37+
foreach ($errors as $i => $error) {
38+
if ( $i == 0 ) {
39+
$error_msg = $error;
40+
} else {
41+
$error_msg = $error_msg.", ".$error;
4442
}
45-
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
46-
} else {
43+
}
44+
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
45+
} else {
46+
// Add DNS
47+
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var);
48+
if ($return_var != 0) {
49+
$error = implode('<br>', $output);
50+
if (empty($error)) $error = _('Error: vesta did not return any output.');
51+
$_SESSION['error_msg'] = $error;
52+
}
53+
unset($output);
4754

48-
// Add DNS
49-
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var);
55+
// Change Expiriation date
56+
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
57+
$v_exp = escapeshellarg($_POST['v_exp']);
58+
exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp, $output, $return_var);
5059
if ($return_var != 0) {
5160
$error = implode('<br>', $output);
5261
if (empty($error)) $error = _('Error: vesta did not return any output.');
5362
$_SESSION['error_msg'] = $error;
5463
}
5564
unset($output);
56-
57-
// Change Expiriation date
58-
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
59-
$v_exp = escapeshellarg($_POST['v_exp']);
60-
exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp, $output, $return_var);
61-
if ($return_var != 0) {
62-
$error = implode('<br>', $output);
63-
if (empty($error)) $error = _('Error: vesta did not return any output.');
64-
$_SESSION['error_msg'] = $error;
65-
}
66-
unset($output);
67-
}
68-
69-
// Change TTL
70-
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) {
71-
$v_ttl = escapeshellarg($_POST['v_ttl']);
72-
exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $output, $return_var);
73-
if ($return_var != 0) {
74-
$error = implode('<br>', $output);
75-
if (empty($error)) $error = _('Error: vesta did not return any output.');
76-
$_SESSION['error_msg'] = $error;
77-
}
78-
unset($output);
79-
}
80-
81-
if (empty($_SESSION['error_msg'])) {
82-
$_SESSION['ok_msg'] = _('DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]);
83-
unset($v_domain);
84-
}
8565
}
86-
}
8766

88-
89-
// DNS Record
90-
if (!empty($_POST['ok_rec'])) {
91-
// Check input
92-
if (empty($_POST['v_domain'])) $errors[] = 'domain';
93-
if (empty($_POST['v_rec'])) $errors[] = 'record';
94-
if (empty($_POST['v_type'])) $errors[] = 'type';
95-
if (empty($_POST['v_val'])) $errors[] = 'value';
96-
97-
// Protect input
98-
$v_domain = escapeshellarg($_POST['v_domain']);
99-
$v_rec = escapeshellarg($_POST['v_rec']);
100-
$v_type = escapeshellarg($_POST['v_type']);
101-
$v_val = escapeshellarg($_POST['v_val']);
102-
$v_priority = escapeshellarg($_POST['v_priority']);
103-
104-
// Check for errors
105-
if (!empty($errors[0])) {
106-
foreach ($errors as $i => $error) {
107-
if ( $i == 0 ) {
108-
$error_msg = $error;
109-
} else {
110-
$error_msg = $error_msg.", ".$error;
111-
}
112-
}
113-
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
114-
} else {
115-
// Add DNS Record
116-
exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
117-
$v_type = $_POST['v_type'];
67+
// Change TTL
68+
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) {
69+
$v_ttl = escapeshellarg($_POST['v_ttl']);
70+
exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $output, $return_var);
11871
if ($return_var != 0) {
11972
$error = implode('<br>', $output);
12073
if (empty($error)) $error = _('Error: vesta did not return any output.');
12174
$_SESSION['error_msg'] = $error;
12275
}
12376
unset($output);
124-
if (empty($_SESSION['error_msg'])) {
125-
$_SESSION['ok_msg'] = _('RECORD_CREATED_OK',$_POST[v_rec],$_POST[v_domain]);
126-
unset($v_domain);
127-
unset($v_rec);
128-
unset($v_val);
129-
unset($v_priority);
130-
}
13177
}
132-
}
133-
134-
135-
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
136-
exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var);
137-
$template = $output[0] ;
138-
unset($output);
13978

140-
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
141-
$templates = json_decode(implode('', $output), true);
142-
unset($output);
143-
144-
if ((empty($v_ns1)) && (empty($v_ns2))) {
145-
exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var);
146-
$nameservers = json_decode(implode('', $output), true);
147-
$v_ns1 = $nameservers[0];
148-
$v_ns2 = $nameservers[1];
149-
$v_ns3 = $nameservers[2];
150-
$v_ns4 = $nameservers[3];
151-
unset($output);
79+
if (empty($_SESSION['error_msg'])) {
80+
$_SESSION['ok_msg'] = _('DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]);
81+
unset($v_domain);
15282
}
153-
if (empty($v_ttl)) $v_ttl = 14400;
154-
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
155-
if ($_SESSION['user'] == 'admin') {
156-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
157-
} else {
158-
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html');
83+
}
84+
}
85+
86+
// DNS Record
87+
if (!empty($_POST['ok_rec'])) {
88+
// Check input
89+
if (empty($_POST['v_domain'])) $errors[] = 'domain';
90+
if (empty($_POST['v_rec'])) $errors[] = 'record';
91+
if (empty($_POST['v_type'])) $errors[] = 'type';
92+
if (empty($_POST['v_val'])) $errors[] = 'value';
93+
94+
// Protect input
95+
$v_domain = escapeshellarg($_POST['v_domain']);
96+
$v_rec = escapeshellarg($_POST['v_rec']);
97+
$v_type = escapeshellarg($_POST['v_type']);
98+
$v_val = escapeshellarg($_POST['v_val']);
99+
$v_priority = escapeshellarg($_POST['v_priority']);
100+
101+
// Check for errors
102+
if (!empty($errors[0])) {
103+
foreach ($errors as $i => $error) {
104+
if ( $i == 0 ) {
105+
$error_msg = $error;
106+
} else {
107+
$error_msg = $error_msg.", ".$error;
108+
}
109+
}
110+
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
111+
} else {
112+
// Add DNS Record
113+
exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
114+
$v_type = $_POST['v_type'];
115+
if ($return_var != 0) {
116+
$error = implode('<br>', $output);
117+
if (empty($error)) $error = _('Error: vesta did not return any output.');
118+
$_SESSION['error_msg'] = $error;
119+
}
120+
unset($output);
121+
if (empty($_SESSION['error_msg'])) {
122+
$_SESSION['ok_msg'] = _('RECORD_CREATED_OK',$_POST[v_rec],$_POST[v_domain]);
123+
unset($v_domain);
124+
unset($v_rec);
125+
unset($v_val);
126+
unset($v_priority);
159127
}
160-
unset($_SESSION['error_msg']);
161-
unset($_SESSION['ok_msg']);
128+
}
129+
}
130+
131+
132+
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
133+
exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var);
134+
$template = $output[0] ;
135+
unset($output);
136+
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
137+
$templates = json_decode(implode('', $output), true);
138+
unset($output);
139+
140+
if ((empty($v_ns1)) && (empty($v_ns2))) {
141+
exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var);
142+
$nameservers = json_decode(implode('', $output), true);
143+
$v_ns1 = $nameservers[0];
144+
$v_ns2 = $nameservers[1];
145+
$v_ns3 = $nameservers[2];
146+
$v_ns4 = $nameservers[3];
147+
unset($output);
148+
}
149+
if (empty($v_ttl)) $v_ttl = 14400;
150+
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
151+
if ($_SESSION['user'] == 'admin') {
152+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
162153
} else {
163-
$v_domain = $_GET['domain'];
164-
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html');
165-
unset($_SESSION['error_msg']);
166-
unset($_SESSION['ok_msg']);
154+
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html');
167155
}
168-
//}
156+
unset($_SESSION['error_msg']);
157+
unset($_SESSION['ok_msg']);
158+
} else {
159+
$v_domain = $_GET['domain'];
160+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html');
161+
unset($_SESSION['error_msg']);
162+
unset($_SESSION['ok_msg']);
163+
}
169164

170165
// Footer
171166
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

0 commit comments

Comments
 (0)