... | ... |
@@ -69,7 +69,7 @@ if ($_GET['action'] == 'edit') { |
69 | 69 |
} |
70 | 70 |
} |
71 | 71 |
|
72 |
- $fqdn = ($hostname!==""?$hostname.".":"").$domainname; |
|
72 |
+ $fqdn = ($hostname!=="" ? $hostname."." : "").$domainname; |
|
73 | 73 |
verify_input_hostname_utf8($fqdn); |
74 | 74 |
if ($aliaswww) { |
75 | 75 |
verify_input_hostname_utf8("www.".$fqdn); |
... | ... |
@@ -167,7 +167,7 @@ if ($_GET['action'] == 'edit') { |
167 | 167 |
|
168 | 168 |
$cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : null); |
169 | 169 |
|
170 |
- $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : null); |
|
170 |
+ $ipv4 = ($_POST['ipv4'] ?? null); |
|
171 | 171 |
|
172 | 172 |
if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes') { |
173 | 173 |
$vhost['autoipv6'] = 1; |
... | ... |
@@ -200,11 +200,11 @@ if ($_GET['action'] == 'edit') { |
200 | 200 |
|
201 | 201 |
$old_options = explode(',', $vhost['options']); |
202 | 202 |
if ($vhost['options'] == '') { |
203 |
- $old_options = array(); |
|
203 |
+ $old_options = []; |
|
204 | 204 |
} |
205 |
- $new_options = array(); |
|
205 |
+ $new_options = []; |
|
206 | 206 |
foreach ($old_options as $op) { |
207 |
- if (! in_array($op, array('aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'))) { |
|
207 |
+ if (! in_array($op, ['aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'])) { |
|
208 | 208 |
array_push($new_options, $op); |
209 | 209 |
} |
210 | 210 |
} |
... | ... |
@@ -302,18 +302,18 @@ if ($_GET['action'] == 'edit') { |
302 | 302 |
} |
303 | 303 |
|
304 | 304 |
if (! is_array($_POST['options'])) { |
305 |
- $_POST['options'] = array(); |
|
305 |
+ $_POST['options'] = []; |
|
306 | 306 |
} |
307 | 307 |
$aliaswww = in_array('aliaswww', $_POST['options']); |
308 | 308 |
$forward = in_array('forward', $_POST['options']); |
309 | 309 |
|
310 |
- $fqdn = ($hostname!==""?$hostname.".":"").$domainname; |
|
310 |
+ $fqdn = ($hostname!=="" ? $hostname."." : "").$domainname; |
|
311 | 311 |
verify_input_hostname_utf8($fqdn); |
312 | 312 |
if ($aliaswww) { |
313 | 313 |
verify_input_hostname_utf8("www.".$fqdn); |
314 | 314 |
} |
315 | 315 |
|
316 |
- $new_options = array(); |
|
316 |
+ $new_options = []; |
|
317 | 317 |
if ($aliaswww) { |
318 | 318 |
array_push($new_options, 'aliaswww'); |
319 | 319 |
} |
... | ... |
@@ -95,7 +95,7 @@ if ($_GET['action'] == 'edit') { |
95 | 95 |
$php = null; |
96 | 96 |
if ($_POST['vhost_type'] == 'regular' && isset($_POST['php'])) { |
97 | 97 |
$phpinfo = valid_php_versions(); |
98 |
- if (array_key_exists($_POST['php'], $phpinfo)) { |
|
98 |
+ if ($_POST['php'] == 'default' || array_key_exists($_POST['php'], $phpinfo)) { |
|
99 | 99 |
$php = $_POST['php']; |
100 | 100 |
} else { |
101 | 101 |
$php = null; |
... | ... |
@@ -196,18 +196,6 @@ if ($_GET['action'] == 'edit') { |
196 | 196 |
} |
197 | 197 |
|
198 | 198 |
|
199 |
- if (isset($_POST['stats']) && $_POST['stats'] == 1) { |
|
200 |
- if ($vhost['stats'] == null) { |
|
201 |
- $vhost['stats'] = 'private'; |
|
202 |
- } |
|
203 |
- } else { |
|
204 |
- $vhost['stats'] = null; |
|
205 |
- } |
|
206 |
- |
|
207 |
- if ($logtype == '') { |
|
208 |
- $vhost['stats'] = null; |
|
209 |
- } |
|
210 |
- |
|
211 | 199 |
DEBUG("PHP: {$php} / Logging: {$logtype}"); |
212 | 200 |
|
213 | 201 |
$old_options = explode(',', $vhost['options']); |
... | ... |
@@ -347,7 +347,7 @@ if ($_GET['action'] == 'edit') { |
347 | 347 |
header('Location: aliases?vhost='.$vhost['id']); |
348 | 348 |
} |
349 | 349 |
} elseif ($_GET['action'] == 'deletealias') { |
350 |
- $title = "Subdomain löschen"; |
|
350 |
+ $title = "Website-Alias löschen"; |
|
351 | 351 |
$section = 'vhosts_vhosts'; |
352 | 352 |
|
353 | 353 |
$alias = get_alias_details((int) $_GET['alias']); |
... | ... |
@@ -360,7 +360,7 @@ if ($_GET['action'] == 'edit') { |
360 | 360 |
|
361 | 361 |
$sure = user_is_sure(); |
362 | 362 |
if ($sure === null) { |
363 |
- are_you_sure("action=deletealias&alias={$_GET['alias']}", "Möchten Sie das Alias »{$alias_string}« für die Subdomain »{$vhost_string}« wirklich löschen?"); |
|
363 |
+ are_you_sure("action=deletealias&alias={$_GET['alias']}", "Möchten Sie das Alias »{$alias_string}« für die Website »{$vhost_string}« wirklich löschen?"); |
|
364 | 364 |
} elseif ($sure === true) { |
365 | 365 |
delete_alias($alias['id']); |
366 | 366 |
if (! $debugmode) { |
... | ... |
@@ -372,7 +372,7 @@ if ($_GET['action'] == 'edit') { |
372 | 372 |
} |
373 | 373 |
} |
374 | 374 |
} elseif ($_GET['action'] == 'delete') { |
375 |
- $title = "Subdomain löschen"; |
|
375 |
+ $title = "Website löschen"; |
|
376 | 376 |
$section = 'vhosts_vhosts'; |
377 | 377 |
|
378 | 378 |
$vhost = get_vhost_details((int) $_GET['vhost']); |
... | ... |
@@ -380,7 +380,7 @@ if ($_GET['action'] == 'edit') { |
380 | 380 |
|
381 | 381 |
$sure = user_is_sure(); |
382 | 382 |
if ($sure === null) { |
383 |
- are_you_sure("action=delete&vhost={$_GET['vhost']}", "Möchten Sie die Subdomain »{$vhost_string}« wirklich löschen?"); |
|
383 |
+ are_you_sure("action=delete&vhost={$_GET['vhost']}", "Möchten Sie die Website »{$vhost_string}« wirklich löschen?"); |
|
384 | 384 |
} elseif ($sure === true) { |
385 | 385 |
delete_vhost($vhost['id']); |
386 | 386 |
if (! $debugmode) { |
... | ... |
@@ -308,6 +308,9 @@ if ($_GET['action'] == 'edit') { |
308 | 308 |
$domainname = $domain->fqdn; |
309 | 309 |
$hostname = $hostname.'.'.$_SESSION['userinfo']['username']; |
310 | 310 |
$hostname = trim($hostname, " .-"); |
311 |
+ } elseif ($domain_id == -2) { |
|
312 |
+ # use system masterdomain |
|
313 |
+ $domainname = $_SESSION['userinfo']['username'].".".config('masterdomain'); |
|
311 | 314 |
} |
312 | 315 |
|
313 | 316 |
if (! is_array($_POST['options'])) { |
... | ... |
@@ -211,6 +211,9 @@ if ($_GET['action'] == 'edit') { |
211 | 211 |
DEBUG("PHP: {$php} / Logging: {$logtype}"); |
212 | 212 |
|
213 | 213 |
$old_options = explode(',', $vhost['options']); |
214 |
+ if ($vhost['options'] == '') { |
|
215 |
+ $old_options = array(); |
|
216 |
+ } |
|
214 | 217 |
$new_options = array(); |
215 | 218 |
foreach ($old_options as $op) { |
216 | 219 |
if (! in_array($op, array('aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'))) { |
... | ... |
@@ -252,6 +255,7 @@ if ($_GET['action'] == 'edit') { |
252 | 255 |
unset($new_options[$key]); |
253 | 256 |
} |
254 | 257 |
} |
258 |
+ |
|
255 | 259 |
|
256 | 260 |
DEBUG($old_options); |
257 | 261 |
DEBUG($new_options); |
... | ... |
@@ -37,7 +37,7 @@ if ($_GET['action'] == 'edit') { |
37 | 37 |
} |
38 | 38 |
DEBUG($vhost); |
39 | 39 |
|
40 |
- $hostname = filter_input_hostname($_POST['hostname'], true); |
|
40 |
+ $hostname = strtolower(trim($_POST['hostname'])); |
|
41 | 41 |
|
42 | 42 |
$domainname = null; |
43 | 43 |
$domain_id = (int) $_POST['domain']; |
... | ... |
@@ -69,6 +69,12 @@ if ($_GET['action'] == 'edit') { |
69 | 69 |
} |
70 | 70 |
} |
71 | 71 |
|
72 |
+ $fqdn = ($hostname!==""?$hostname.".":"").$domainname; |
|
73 |
+ verify_input_hostname_utf8($fqdn); |
|
74 |
+ if ($aliaswww) { |
|
75 |
+ verify_input_hostname_utf8("www.".$fqdn); |
|
76 |
+ } |
|
77 |
+ |
|
72 | 78 |
$docroot = ''; |
73 | 79 |
if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav') { |
74 | 80 |
$defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domainname).'/htdocs'; |
... | ... |
@@ -282,18 +288,20 @@ if ($_GET['action'] == 'edit') { |
282 | 288 |
$alias['vhost'] = $vhost['id']; |
283 | 289 |
|
284 | 290 |
|
285 |
- $hostname = filter_input_hostname($_POST['hostname'], true); |
|
286 |
- $domainid = (int) $_POST['domain']; |
|
287 |
- if ($domainid >= 0) { |
|
291 |
+ $hostname = strtolower(trim($_POST['hostname'])); |
|
292 |
+ |
|
293 |
+ $domain_id = (int) $_POST['domain']; |
|
294 |
+ if ($domain_id >= 0) { |
|
288 | 295 |
$domain = new Domain((int) $_POST['domain']); |
289 | 296 |
$domain->ensure_userdomain(); |
290 |
- $domainid = $domain->id; |
|
291 |
- } |
|
292 |
- if ($domainid == -1) { |
|
297 |
+ $domain_id = $domain->id; |
|
298 |
+ $domainname = $domain->fqdn; |
|
299 |
+ } elseif ($domain_id == -1) { |
|
293 | 300 |
# use configured user_vhosts_domain |
294 | 301 |
$userdomain = userdomain(); |
295 | 302 |
$domain = new Domain((int) $userdomain['id']); |
296 |
- $domainid = $domain->id; |
|
303 |
+ $domain_id = $domain->id; |
|
304 |
+ $domainname = $domain->fqdn; |
|
297 | 305 |
$hostname = $hostname.'.'.$_SESSION['userinfo']['username']; |
298 | 306 |
$hostname = trim($hostname, " .-"); |
299 | 307 |
} |
... | ... |
@@ -304,6 +312,12 @@ if ($_GET['action'] == 'edit') { |
304 | 312 |
$aliaswww = in_array('aliaswww', $_POST['options']); |
305 | 313 |
$forward = in_array('forward', $_POST['options']); |
306 | 314 |
|
315 |
+ $fqdn = ($hostname!==""?$hostname.".":"").$domainname; |
|
316 |
+ verify_input_hostname_utf8($fqdn); |
|
317 |
+ if ($aliaswww) { |
|
318 |
+ verify_input_hostname_utf8("www.".$fqdn); |
|
319 |
+ } |
|
320 |
+ |
|
307 | 321 |
$new_options = array(); |
308 | 322 |
if ($aliaswww) { |
309 | 323 |
array_push($new_options, 'aliaswww'); |
... | ... |
@@ -316,7 +330,7 @@ if ($_GET['action'] == 'edit') { |
316 | 330 |
DEBUG('New options: '.$options); |
317 | 331 |
|
318 | 332 |
$alias['hostname'] = $hostname; |
319 |
- $alias['domain_id'] = $domainid; |
|
333 |
+ $alias['domain_id'] = $domain_id; |
|
320 | 334 |
|
321 | 335 |
$alias ['options'] = $options; |
322 | 336 |
|
... | ... |
@@ -88,21 +88,12 @@ if ($_GET['action'] == 'edit') { |
88 | 88 |
} |
89 | 89 |
$php = null; |
90 | 90 |
if ($_POST['vhost_type'] == 'regular' && isset($_POST['php'])) { |
91 |
- switch ($_POST['php']) { |
|
92 |
- case 'php56': |
|
93 |
- $php = 'php56'; |
|
94 |
- break; |
|
95 |
- case 'fpm70': |
|
96 |
- $php = 'fpm70'; |
|
97 |
- break; |
|
98 |
- case 'fpm71': |
|
99 |
- $php = 'fpm71'; |
|
100 |
- break; |
|
101 |
- case 'fpm72': |
|
102 |
- $php = 'fpm72'; |
|
103 |
- break; |
|
104 |
- /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */ |
|
105 |
- } |
|
91 |
+ $phpinfo = valid_php_versions(); |
|
92 |
+ if (array_key_exists($_POST['php'], $phpinfo)) { |
|
93 |
+ $php = $_POST['php']; |
|
94 |
+ } else { |
|
95 |
+ $php = null; |
|
96 |
+ } |
|
106 | 97 |
} |
107 | 98 |
$cgi = 1; |
108 | 99 |
if (isset($_POST['safemode']) && $_POST['safemode'] == 'yes') { |
... | ... |
@@ -72,7 +72,7 @@ if ($_GET['action'] == 'edit') { |
72 | 72 |
$docroot = ''; |
73 | 73 |
if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav') { |
74 | 74 |
$defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domainname).'/htdocs'; |
75 |
- |
|
75 |
+ |
|
76 | 76 |
$docroot = ''; |
77 | 77 |
if (isset($_POST['docroot'])) { |
78 | 78 |
if (! check_path($_POST['docroot'])) { |
... | ... |
@@ -83,7 +83,7 @@ if ($_GET['action'] == 'edit') { |
83 | 83 |
if ((isset($_POST['use_default_docroot']) && $_POST['use_default_docroot'] == '1') || ($docroot == $defaultdocroot)) { |
84 | 84 |
$docroot = null; |
85 | 85 |
} |
86 |
- |
|
86 |
+ |
|
87 | 87 |
DEBUG("Document-Root: ".$docroot); |
88 | 88 |
} |
89 | 89 |
$php = null; |
... | ... |
@@ -136,7 +136,7 @@ if ($_GET['action'] == 'edit') { |
136 | 136 |
$vhost['webapp_id'] = (int) $_POST['webapp']; |
137 | 137 |
} |
138 | 138 |
|
139 |
- |
|
139 |
+ |
|
140 | 140 |
$ssl = null; |
141 | 141 |
switch ($_POST['ssl']) { |
142 | 142 |
case 'http': |
... | ... |
@@ -167,7 +167,7 @@ if ($_GET['action'] == 'edit') { |
167 | 167 |
} |
168 | 168 |
} |
169 | 169 |
} |
170 |
- |
|
170 |
+ |
|
171 | 171 |
$cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : null); |
172 | 172 |
|
173 | 173 |
$ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : null); |
... | ... |
@@ -180,7 +180,7 @@ if ($_GET['action'] == 'edit') { |
180 | 180 |
} else { |
181 | 181 |
$vhost['autoipv6'] = 0; |
182 | 182 |
} |
183 |
- |
|
183 |
+ |
|
184 | 184 |
|
185 | 185 |
$logtype = ''; |
186 | 186 |
switch ($_POST['logtype']) { |
... | ... |
@@ -210,7 +210,7 @@ if ($_GET['action'] == 'edit') { |
210 | 210 |
if ($logtype == '') { |
211 | 211 |
$vhost['stats'] = null; |
212 | 212 |
} |
213 |
- |
|
213 |
+ |
|
214 | 214 |
DEBUG("PHP: {$php} / Logging: {$logtype}"); |
215 | 215 |
|
216 | 216 |
$old_options = explode(',', $vhost['options']); |
... | ... |
@@ -273,7 +273,7 @@ if ($_GET['action'] == 'edit') { |
273 | 273 |
$vhost['logtype'] = $logtype; |
274 | 274 |
$vhost['errorlog'] = $errorlog; |
275 | 275 |
$vhost['options'] = $options; |
276 |
- |
|
276 |
+ |
|
277 | 277 |
DEBUG($vhost); |
278 | 278 |
save_vhost($vhost); |
279 | 279 |
success_msg("Ihre Einstellungen wurden gespeichert. Es dauert jedoch einige Minuten bis die Änderungen wirksam werden."); |
... | ... |
@@ -290,7 +290,7 @@ if ($_GET['action'] == 'edit') { |
290 | 290 |
$alias = empty_alias(); |
291 | 291 |
$alias['vhost'] = $vhost['id']; |
292 | 292 |
|
293 |
- |
|
293 |
+ |
|
294 | 294 |
$hostname = filter_input_hostname($_POST['hostname'], true); |
295 | 295 |
$domainid = (int) $_POST['domain']; |
296 | 296 |
if ($domainid >= 0) { |
... | ... |
@@ -326,9 +326,9 @@ if ($_GET['action'] == 'edit') { |
326 | 326 |
|
327 | 327 |
$alias['hostname'] = $hostname; |
328 | 328 |
$alias['domain_id'] = $domainid; |
329 |
- |
|
329 |
+ |
|
330 | 330 |
$alias ['options'] = $options; |
331 |
- |
|
331 |
+ |
|
332 | 332 |
save_alias($alias); |
333 | 333 |
|
334 | 334 |
if (! $debugmode) { |
... | ... |
@@ -337,15 +337,15 @@ if ($_GET['action'] == 'edit') { |
337 | 337 |
} elseif ($_GET['action'] == 'deletealias') { |
338 | 338 |
$title = "Subdomain löschen"; |
339 | 339 |
$section = 'vhosts_vhosts'; |
340 |
- |
|
340 |
+ |
|
341 | 341 |
$alias = get_alias_details((int) $_GET['alias']); |
342 | 342 |
DEBUG($alias); |
343 | 343 |
$alias_string = $alias['fqdn']; |
344 |
- |
|
344 |
+ |
|
345 | 345 |
$vhost = get_vhost_details($alias['vhost']); |
346 | 346 |
DEBUG($vhost); |
347 | 347 |
$vhost_string = $vhost['fqdn']; |
348 |
- |
|
348 |
+ |
|
349 | 349 |
$sure = user_is_sure(); |
350 | 350 |
if ($sure === null) { |
351 | 351 |
are_you_sure("action=deletealias&alias={$_GET['alias']}", "Möchten Sie das Alias »{$alias_string}« für die Subdomain »{$vhost_string}« wirklich löschen?"); |
... | ... |
@@ -362,10 +362,10 @@ if ($_GET['action'] == 'edit') { |
362 | 362 |
} elseif ($_GET['action'] == 'delete') { |
363 | 363 |
$title = "Subdomain löschen"; |
364 | 364 |
$section = 'vhosts_vhosts'; |
365 |
- |
|
365 |
+ |
|
366 | 366 |
$vhost = get_vhost_details((int) $_GET['vhost']); |
367 | 367 |
$vhost_string = $vhost['fqdn']; |
368 |
- |
|
368 |
+ |
|
369 | 369 |
$sure = user_is_sure(); |
370 | 370 |
if ($sure === null) { |
371 | 371 |
are_you_sure("action=delete&vhost={$_GET['vhost']}", "Möchten Sie die Subdomain »{$vhost_string}« wirklich löschen?"); |
... | ... |
@@ -8,7 +8,7 @@ Written 2008-2018 by schokokeks.org Hosting, namely |
8 | 8 |
|
9 | 9 |
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. |
10 | 10 |
|
11 |
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see |
|
11 |
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see |
|
12 | 12 |
http://creativecommons.org/publicdomain/zero/1.0/ |
13 | 13 |
|
14 | 14 |
Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. |
... | ... |
@@ -28,71 +28,67 @@ require_once("inc/debug.php"); |
28 | 28 |
global $debugmode; |
29 | 29 |
|
30 | 30 |
|
31 |
-if ($_GET['action'] == 'edit') |
|
32 |
-{ |
|
33 |
- check_form_token('vhosts_edit_vhost'); |
|
34 |
- $id = (int) $_GET['vhost']; |
|
35 |
- $vhost = empty_vhost(); |
|
36 |
- if ($id != 0) |
|
37 |
- $vhost = get_vhost_details( $id ); |
|
38 |
- DEBUG($vhost); |
|
39 |
- |
|
40 |
- $hostname = filter_input_hostname($_POST['hostname'], true); |
|
41 |
- |
|
42 |
- $domainname = NULL; |
|
43 |
- $domain_id = (int) $_POST['domain']; |
|
44 |
- if ($domain_id >= 0) { |
|
45 |
- $domain = new Domain( (int) $_POST['domain'] ); |
|
46 |
- $domain->ensure_userdomain(); |
|
47 |
- $domain_id = $domain->id; |
|
48 |
- $domainname = $domain->fqdn; |
|
49 |
- } |
|
50 |
- elseif ($domain_id == -1) { |
|
51 |
- # use configured user_vhosts_domain |
|
52 |
- $userdomain = userdomain(); |
|
53 |
- $domain = new Domain( (int) $userdomain['id'] ); |
|
54 |
- $domain_id = $domain->id; |
|
55 |
- $domainname = $domain->fqdn; |
|
56 |
- $hostname = $hostname.'.'.$_SESSION['userinfo']['username']; |
|
57 |
- $hostname = trim($hostname, " .-"); |
|
58 |
- } |
|
59 |
- elseif ($domain_id == -2) { |
|
60 |
- # use system masterdomain |
|
61 |
- $domainname = $_SESSION['userinfo']['username'].".".config('masterdomain'); |
|
62 |
- } |
|
31 |
+if ($_GET['action'] == 'edit') { |
|
32 |
+ check_form_token('vhosts_edit_vhost'); |
|
33 |
+ $id = (int) $_GET['vhost']; |
|
34 |
+ $vhost = empty_vhost(); |
|
35 |
+ if ($id != 0) { |
|
36 |
+ $vhost = get_vhost_details($id); |
|
37 |
+ } |
|
38 |
+ DEBUG($vhost); |
|
39 |
+ |
|
40 |
+ $hostname = filter_input_hostname($_POST['hostname'], true); |
|
41 |
+ |
|
42 |
+ $domainname = null; |
|
43 |
+ $domain_id = (int) $_POST['domain']; |
|
44 |
+ if ($domain_id >= 0) { |
|
45 |
+ $domain = new Domain((int) $_POST['domain']); |
|
46 |
+ $domain->ensure_userdomain(); |
|
47 |
+ $domain_id = $domain->id; |
|
48 |
+ $domainname = $domain->fqdn; |
|
49 |
+ } elseif ($domain_id == -1) { |
|
50 |
+ # use configured user_vhosts_domain |
|
51 |
+ $userdomain = userdomain(); |
|
52 |
+ $domain = new Domain((int) $userdomain['id']); |
|
53 |
+ $domain_id = $domain->id; |
|
54 |
+ $domainname = $domain->fqdn; |
|
55 |
+ $hostname = $hostname.'.'.$_SESSION['userinfo']['username']; |
|
56 |
+ $hostname = trim($hostname, " .-"); |
|
57 |
+ } elseif ($domain_id == -2) { |
|
58 |
+ # use system masterdomain |
|
59 |
+ $domainname = $_SESSION['userinfo']['username'].".".config('masterdomain'); |
|
60 |
+ } |
|
63 | 61 |
|
64 |
- $aliaswww = (isset($_POST['aliaswww']) && $_POST['aliaswww'] == 'aliaswww'); |
|
65 |
- $forwardwww = NULL; |
|
66 |
- if ($aliaswww && isset($_POST['forwardwww'])) { |
|
67 |
- if ($_POST['forwardwww'] == 'forwardwww') { |
|
68 |
- $forwardwww = 'forwardwww'; |
|
69 |
- } elseif ($_POST['forwardwww'] == 'forwardnowww') { |
|
70 |
- $forwardwww = 'forwardnowww'; |
|
62 |
+ $aliaswww = (isset($_POST['aliaswww']) && $_POST['aliaswww'] == 'aliaswww'); |
|
63 |
+ $forwardwww = null; |
|
64 |
+ if ($aliaswww && isset($_POST['forwardwww'])) { |
|
65 |
+ if ($_POST['forwardwww'] == 'forwardwww') { |
|
66 |
+ $forwardwww = 'forwardwww'; |
|
67 |
+ } elseif ($_POST['forwardwww'] == 'forwardnowww') { |
|
68 |
+ $forwardwww = 'forwardnowww'; |
|
69 |
+ } |
|
71 | 70 |
} |
72 |
- } |
|
73 | 71 |
|
74 |
- $docroot = ''; |
|
75 |
- if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav') |
|
76 |
- { |
|
77 |
- $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domainname).'/htdocs'; |
|
78 |
- |
|
79 | 72 |
$docroot = ''; |
80 |
- if (isset($_POST['docroot'])) |
|
81 |
- { |
|
82 |
- if (! check_path( $_POST['docroot'] )) |
|
83 |
- system_failure("Eingegebener Pfad enthält ungültige Angaben"); |
|
84 |
- $docroot = $vhost['homedir'].'/websites/'.$_POST['docroot']; |
|
85 |
- } |
|
86 |
- if ((isset($_POST['use_default_docroot']) && $_POST['use_default_docroot'] == '1') || ($docroot == $defaultdocroot)) { |
|
87 |
- $docroot = NULL; |
|
88 |
- } |
|
73 |
+ if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav') { |
|
74 |
+ $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domainname).'/htdocs'; |
|
89 | 75 |
|
90 |
- DEBUG("Document-Root: ".$docroot); |
|
91 |
- } |
|
92 |
- $php = NULL; |
|
93 |
- if ($_POST['vhost_type'] == 'regular' && isset($_POST['php'])) |
|
94 |
- { |
|
95 |
- switch ($_POST['php']) { |
|
76 |
+ $docroot = ''; |
|
77 |
+ if (isset($_POST['docroot'])) { |
|
78 |
+ if (! check_path($_POST['docroot'])) { |
|
79 |
+ system_failure("Eingegebener Pfad enthält ungültige Angaben"); |
|
80 |
+ } |
|
81 |
+ $docroot = $vhost['homedir'].'/websites/'.$_POST['docroot']; |
|
82 |
+ } |
|
83 |
+ if ((isset($_POST['use_default_docroot']) && $_POST['use_default_docroot'] == '1') || ($docroot == $defaultdocroot)) { |
|
84 |
+ $docroot = null; |
|
85 |
+ } |
|
86 |
+ |
|
87 |
+ DEBUG("Document-Root: ".$docroot); |
|
88 |
+ } |
|
89 |
+ $php = null; |
|
90 |
+ if ($_POST['vhost_type'] == 'regular' && isset($_POST['php'])) { |
|
91 |
+ switch ($_POST['php']) { |
|
96 | 92 |
case 'php56': |
97 | 93 |
$php = 'php56'; |
98 | 94 |
break; |
... | ... |
@@ -107,44 +103,42 @@ if ($_GET['action'] == 'edit') |
107 | 103 |
break; |
108 | 104 |
/* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */ |
109 | 105 |
} |
110 |
- } |
|
111 |
- $cgi = 1; |
|
112 |
- if (isset($_POST['safemode']) && $_POST['safemode'] == 'yes') |
|
113 |
- { |
|
114 |
- $cgi = 0; |
|
115 |
- } |
|
106 |
+ } |
|
107 |
+ $cgi = 1; |
|
108 |
+ if (isset($_POST['safemode']) && $_POST['safemode'] == 'yes') { |
|
109 |
+ $cgi = 0; |
|
110 |
+ } |
|
116 | 111 |
|
117 |
- if (isset($_POST['suexec_user'])) |
|
118 |
- $vhost['suexec_user'] = $_POST['suexec_user']; |
|
112 |
+ if (isset($_POST['suexec_user'])) { |
|
113 |
+ $vhost['suexec_user'] = $_POST['suexec_user']; |
|
114 |
+ } |
|
119 | 115 |
|
120 |
- if (isset($_POST['server'])) |
|
121 |
- $vhost['server'] = $_POST['server']; |
|
116 |
+ if (isset($_POST['server'])) { |
|
117 |
+ $vhost['server'] = $_POST['server']; |
|
118 |
+ } |
|
122 | 119 |
|
123 |
- if ($_POST['vhost_type'] == 'regular') { |
|
124 |
- $vhost['is_dav'] = 0; |
|
125 |
- $vhost['is_svn'] = 0; |
|
126 |
- $vhost['is_webapp'] = 0; |
|
127 |
- } |
|
128 |
- elseif ($_POST['vhost_type'] == 'dav') { |
|
129 |
- $vhost['is_dav'] = 1; |
|
130 |
- $vhost['is_svn'] = 0; |
|
131 |
- $vhost['is_webapp'] = 0; |
|
132 |
- } |
|
133 |
- elseif ($_POST['vhost_type'] == 'svn') { |
|
134 |
- $vhost['is_dav'] = 0; |
|
135 |
- $vhost['is_svn'] = 1; |
|
136 |
- $vhost['is_webapp'] = 0; |
|
137 |
- } |
|
138 |
- elseif ($_POST['vhost_type'] == 'webapp') { |
|
139 |
- $vhost['is_dav'] = 0; |
|
140 |
- $vhost['is_svn'] = 0; |
|
141 |
- $vhost['is_webapp'] = 1; |
|
142 |
- $vhost['webapp_id'] = (int) $_POST['webapp']; |
|
143 |
- } |
|
120 |
+ if ($_POST['vhost_type'] == 'regular') { |
|
121 |
+ $vhost['is_dav'] = 0; |
|
122 |
+ $vhost['is_svn'] = 0; |
|
123 |
+ $vhost['is_webapp'] = 0; |
|
124 |
+ } elseif ($_POST['vhost_type'] == 'dav') { |
|
125 |
+ $vhost['is_dav'] = 1; |
|
126 |
+ $vhost['is_svn'] = 0; |
|
127 |
+ $vhost['is_webapp'] = 0; |
|
128 |
+ } elseif ($_POST['vhost_type'] == 'svn') { |
|
129 |
+ $vhost['is_dav'] = 0; |
|
130 |
+ $vhost['is_svn'] = 1; |
|
131 |
+ $vhost['is_webapp'] = 0; |
|
132 |
+ } elseif ($_POST['vhost_type'] == 'webapp') { |
|
133 |
+ $vhost['is_dav'] = 0; |
|
134 |
+ $vhost['is_svn'] = 0; |
|
135 |
+ $vhost['is_webapp'] = 1; |
|
136 |
+ $vhost['webapp_id'] = (int) $_POST['webapp']; |
|
137 |
+ } |
|
144 | 138 |
|
145 | 139 |
|
146 |
- $ssl = NULL; |
|
147 |
- switch ($_POST['ssl']) { |
|
140 |
+ $ssl = null; |
|
141 |
+ switch ($_POST['ssl']) { |
|
148 | 142 |
case 'http': |
149 | 143 |
$ssl = 'http'; |
150 | 144 |
break; |
... | ... |
@@ -157,41 +151,39 @@ if ($_GET['action'] == 'edit') |
157 | 151 |
/* Wenn etwas anderes kommt, ist das "beides". So einfach ist das. */ |
158 | 152 |
} |
159 | 153 |
|
160 |
- $hsts = NULL; |
|
161 |
- $hsts_subdomains = false; |
|
162 |
- $hsts_preload = false; |
|
163 |
- if (isset($_POST['hsts'])) { |
|
164 |
- if (is_numeric($_POST['hsts']) && (int) $_POST['hsts'] > -2) { |
|
165 |
- $hsts = (int) $_POST['hsts']; |
|
166 |
- } else { |
|
167 |
- system_failure('Es wurde ein ungültiger HSTS-Wert eingegeben. Dort sind nur Sekunden erlaubt.'); |
|
154 |
+ $hsts = null; |
|
155 |
+ $hsts_subdomains = false; |
|
156 |
+ $hsts_preload = false; |
|
157 |
+ if (isset($_POST['hsts'])) { |
|
158 |
+ if (is_numeric($_POST['hsts']) && (int) $_POST['hsts'] > -2) { |
|
159 |
+ $hsts = (int) $_POST['hsts']; |
|
160 |
+ } else { |
|
161 |
+ system_failure('Es wurde ein ungültiger HSTS-Wert eingegeben. Dort sind nur Sekunden erlaubt.'); |
|
162 |
+ } |
|
163 |
+ if (isset($_POST['hsts_subdomains']) and $_POST['hsts_subdomains'] == 1) { |
|
164 |
+ $hsts_subdomains = true; |
|
165 |
+ if (isset($_POST['hsts_preload']) and $_POST['hsts_preload'] == 1) { |
|
166 |
+ $hsts_preload = true; |
|
167 |
+ } |
|
168 |
+ } |
|
168 | 169 |
} |
169 |
- if (isset($_POST['hsts_subdomains']) and $_POST['hsts_subdomains'] == 1) { |
|
170 |
- $hsts_subdomains = true; |
|
171 |
- if (isset($_POST['hsts_preload']) and $_POST['hsts_preload'] == 1) { |
|
172 |
- $hsts_preload = true; |
|
173 |
- } |
|
174 |
- } |
|
175 |
- } |
|
176 | 170 |
|
177 |
- $cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : NULL); |
|
171 |
+ $cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : null); |
|
178 | 172 |
|
179 |
- $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : NULL); |
|
173 |
+ $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : null); |
|
180 | 174 |
|
181 |
- if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes') |
|
182 |
- { |
|
183 |
- $vhost['autoipv6'] = 1; |
|
184 |
- if (isset($_POST['ipv6_separate']) && $_POST['ipv6_separate'] = 'yes') |
|
185 |
- { |
|
186 |
- $vhost['autoipv6'] = 2; |
|
175 |
+ if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes') { |
|
176 |
+ $vhost['autoipv6'] = 1; |
|
177 |
+ if (isset($_POST['ipv6_separate']) && $_POST['ipv6_separate'] = 'yes') { |
|
178 |
+ $vhost['autoipv6'] = 2; |
|
179 |
+ } |
|
180 |
+ } else { |
|
181 |
+ $vhost['autoipv6'] = 0; |
|
187 | 182 |
} |
188 |
- } else { |
|
189 |
- $vhost['autoipv6'] = 0; |
|
190 |
- } |
|
191 | 183 |
|
192 | 184 |
|
193 |
- $logtype = ''; |
|
194 |
- switch ($_POST['logtype']) { |
|
185 |
+ $logtype = ''; |
|
186 |
+ switch ($_POST['logtype']) { |
|
195 | 187 |
case 'anonymous': |
196 | 188 |
$logtype = 'anonymous'; |
197 | 189 |
break; |
... | ... |
@@ -201,205 +193,194 @@ if ($_GET['action'] == 'edit') |
201 | 193 |
/* Wenn etwas anderes kommt, ist das "kein Logging". So einfach ist das. */ |
202 | 194 |
} |
203 | 195 |
|
204 |
- $errorlog = 0; |
|
205 |
- if (isset($_POST['errorlog']) and ($_POST['errorlog'] == 1)) |
|
206 |
- $errorlog = 1; |
|
196 |
+ $errorlog = 0; |
|
197 |
+ if (isset($_POST['errorlog']) and ($_POST['errorlog'] == 1)) { |
|
198 |
+ $errorlog = 1; |
|
199 |
+ } |
|
207 | 200 |
|
208 | 201 |
|
209 |
- if (isset($_POST['stats']) && $_POST['stats'] == 1) |
|
210 |
- { |
|
211 |
- if ($vhost['stats'] == NULL) |
|
212 |
- $vhost['stats'] = 'private'; |
|
213 |
- } |
|
214 |
- else |
|
215 |
- $vhost['stats'] = NULL; |
|
202 |
+ if (isset($_POST['stats']) && $_POST['stats'] == 1) { |
|
203 |
+ if ($vhost['stats'] == null) { |
|
204 |
+ $vhost['stats'] = 'private'; |
|
205 |
+ } |
|
206 |
+ } else { |
|
207 |
+ $vhost['stats'] = null; |
|
208 |
+ } |
|
216 | 209 |
|
217 |
- if ($logtype == '') |
|
218 |
- $vhost['stats'] = NULL; |
|
210 |
+ if ($logtype == '') { |
|
211 |
+ $vhost['stats'] = null; |
|
212 |
+ } |
|
219 | 213 |
|
220 |
- DEBUG("PHP: {$php} / Logging: {$logtype}"); |
|
221 |
- |
|
222 |
- $old_options = explode(',', $vhost['options']); |
|
223 |
- $new_options = array(); |
|
224 |
- foreach ($old_options AS $op) |
|
225 |
- { |
|
226 |
- if (! in_array($op, array('aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'))) { |
|
227 |
- array_push($new_options, $op); |
|
214 |
+ DEBUG("PHP: {$php} / Logging: {$logtype}"); |
|
215 |
+ |
|
216 |
+ $old_options = explode(',', $vhost['options']); |
|
217 |
+ $new_options = array(); |
|
218 |
+ foreach ($old_options as $op) { |
|
219 |
+ if (! in_array($op, array('aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'))) { |
|
220 |
+ array_push($new_options, $op); |
|
221 |
+ } |
|
228 | 222 |
} |
229 |
- } |
|
230 |
- if ($aliaswww) { |
|
231 |
- array_push($new_options, 'aliaswww'); |
|
232 |
- if ($forwardwww) { |
|
233 |
- array_push($new_options, $forwardwww); |
|
223 |
+ if ($aliaswww) { |
|
224 |
+ array_push($new_options, 'aliaswww'); |
|
225 |
+ if ($forwardwww) { |
|
226 |
+ array_push($new_options, $forwardwww); |
|
227 |
+ } |
|
234 | 228 |
} |
235 |
- } |
|
236 |
- if ($hsts_subdomains) { |
|
237 |
- array_push($new_options, 'hsts_subdomains'); |
|
238 |
- } |
|
239 |
- if ($hsts_preload) { |
|
240 |
- array_push($new_options, 'hsts_preload'); |
|
241 |
- } |
|
242 |
- $letsencrypt = ($cert == 0 ? false : ($cert == -1 || cert_is_letsencrypt($cert))); |
|
243 |
- |
|
244 |
- if ($letsencrypt) { |
|
245 |
- array_push($new_options, 'letsencrypt'); |
|
246 |
- if ($vhost['cert'] != 0) { |
|
247 |
- # Wenn der User manuell von einem gültigen Cert auf "letsencrypt" umgestellt hat, |
|
248 |
- # dann sollte das alte Cert noch so lange eingetragen bleiben bis das neue da ist. |
|
249 |
- $cert = $vhost['cert']; |
|
250 |
- } elseif ($cert > 0) { |
|
251 |
- # Das Cert was der user gewählt hat, ist von Lets encrypt |
|
229 |
+ if ($hsts_subdomains) { |
|
230 |
+ array_push($new_options, 'hsts_subdomains'); |
|
231 |
+ } |
|
232 |
+ if ($hsts_preload) { |
|
233 |
+ array_push($new_options, 'hsts_preload'); |
|
234 |
+ } |
|
235 |
+ $letsencrypt = ($cert == 0 ? false : ($cert == -1 || cert_is_letsencrypt($cert))); |
|
236 |
+ |
|
237 |
+ if ($letsencrypt) { |
|
238 |
+ array_push($new_options, 'letsencrypt'); |
|
239 |
+ if ($vhost['cert'] != 0) { |
|
240 |
+ # Wenn der User manuell von einem gültigen Cert auf "letsencrypt" umgestellt hat, |
|
241 |
+ # dann sollte das alte Cert noch so lange eingetragen bleiben bis das neue da ist. |
|
242 |
+ $cert = $vhost['cert']; |
|
243 |
+ } elseif ($cert > 0) { |
|
244 |
+ # Das Cert was der user gewählt hat, ist von Lets encrypt |
|
252 | 245 |
# tu nix, $cert ist schon korrekt |
246 |
+ } else { |
|
247 |
+ # Wenn vorher kein Zertifikat aktiv war, dann setze jetzt auch keines. |
|
248 |
+ # Der letsencrypt-Automatismus macht das dann schon. |
|
249 |
+ $cert = 0; |
|
250 |
+ } |
|
253 | 251 |
} else { |
254 |
- # Wenn vorher kein Zertifikat aktiv war, dann setze jetzt auch keines. |
|
255 |
- # Der letsencrypt-Automatismus macht das dann schon. |
|
256 |
- $cert = 0; |
|
252 |
+ # Wenn kein Letsencrypt gewünscht ist, entferne die Letsencrypt-Option |
|
253 |
+ $key = array_search('letsencrypt', $new_options); |
|
254 |
+ if ($key !== false) { |
|
255 |
+ unset($new_options[$key]); |
|
256 |
+ } |
|
257 | 257 |
} |
258 |
- } else { |
|
259 |
- # Wenn kein Letsencrypt gewünscht ist, entferne die Letsencrypt-Option |
|
260 |
- $key = array_search('letsencrypt',$new_options); |
|
261 |
- if ($key !== false) { |
|
262 |
- unset($new_options[$key]); |
|
263 |
- } |
|
264 |
- } |
|
265 | 258 |
|
266 |
- DEBUG($old_options); |
|
267 |
- DEBUG($new_options); |
|
268 |
- $options = implode(',', $new_options); |
|
269 |
- DEBUG('New options: '.$options); |
|
270 |
- |
|
271 |
- $vhost['hostname'] = $hostname; |
|
272 |
- $vhost['domain_id'] = $domain_id; |
|
273 |
- $vhost['docroot'] = $docroot; |
|
274 |
- $vhost['php'] = $php; |
|
275 |
- $vhost['cgi'] = $cgi; |
|
276 |
- $vhost['ssl'] = $ssl; |
|
277 |
- $vhost['hsts'] = $hsts; |
|
278 |
- $vhost['cert'] = $cert; |
|
279 |
- $vhost['ipv4'] = $ipv4; |
|
280 |
- $vhost['logtype'] = $logtype; |
|
281 |
- $vhost['errorlog'] = $errorlog; |
|
282 |
- $vhost['options'] = $options; |
|
259 |
+ DEBUG($old_options); |
|
260 |
+ DEBUG($new_options); |
|
261 |
+ $options = implode(',', $new_options); |
|
262 |
+ DEBUG('New options: '.$options); |
|
263 |
+ |
|
264 |
+ $vhost['hostname'] = $hostname; |
|
265 |
+ $vhost['domain_id'] = $domain_id; |
|
266 |
+ $vhost['docroot'] = $docroot; |
|
267 |
+ $vhost['php'] = $php; |
|
268 |
+ $vhost['cgi'] = $cgi; |
|
269 |
+ $vhost['ssl'] = $ssl; |
|
270 |
+ $vhost['hsts'] = $hsts; |
|
271 |
+ $vhost['cert'] = $cert; |
|
272 |
+ $vhost['ipv4'] = $ipv4; |
|
273 |
+ $vhost['logtype'] = $logtype; |
|
274 |
+ $vhost['errorlog'] = $errorlog; |
|
275 |
+ $vhost['options'] = $options; |
|
283 | 276 |
|
284 |
- DEBUG($vhost); |
|
285 |
- save_vhost($vhost); |
|
286 |
- success_msg("Ihre Einstellungen wurden gespeichert. Es dauert jedoch einige Minuten bis die Änderungen wirksam werden."); |
|
277 |
+ DEBUG($vhost); |
|
278 |
+ save_vhost($vhost); |
|
279 |
+ success_msg("Ihre Einstellungen wurden gespeichert. Es dauert jedoch einige Minuten bis die Änderungen wirksam werden."); |
|
287 | 280 |
|
288 |
- if (! $debugmode) |
|
289 |
- header('Location: vhosts'); |
|
290 |
- |
|
291 |
-} |
|
292 |
-elseif ($_GET['action'] == 'addalias') |
|
293 |
-{ |
|
294 |
- check_form_token('vhosts_add_alias'); |
|
295 |
- $id = (int) $_GET['vhost']; |
|
296 |
- $vhost = get_vhost_details( $id ); |
|
297 |
- DEBUG($vhost); |
|
281 |
+ if (! $debugmode) { |
|
282 |
+ header('Location: vhosts'); |
|
283 |
+ } |
|
284 |
+} elseif ($_GET['action'] == 'addalias') { |
|
285 |
+ check_form_token('vhosts_add_alias'); |
|
286 |
+ $id = (int) $_GET['vhost']; |
|
287 |
+ $vhost = get_vhost_details($id); |
|
288 |
+ DEBUG($vhost); |
|
298 | 289 |
|
299 |
- $alias = empty_alias(); |
|
300 |
- $alias['vhost'] = $vhost['id']; |
|
290 |
+ $alias = empty_alias(); |
|
291 |
+ $alias['vhost'] = $vhost['id']; |
|
301 | 292 |
|
302 | 293 |
|
303 |
- $hostname = filter_input_hostname($_POST['hostname'], true); |
|
304 |
- $domainid = (int) $_POST['domain']; |
|
305 |
- if ($domainid >= 0) { |
|
306 |
- $domain = new Domain( (int) $_POST['domain'] ); |
|
307 |
- $domain->ensure_userdomain(); |
|
308 |
- $domainid = $domain->id; |
|
309 |
- } |
|
310 |
- if ($domainid == -1) { |
|
311 |
- # use configured user_vhosts_domain |
|
312 |
- $userdomain = userdomain(); |
|
313 |
- $domain = new Domain( (int) $userdomain['id'] ); |
|
314 |
- $domainid = $domain->id; |
|
315 |
- $hostname = $hostname.'.'.$_SESSION['userinfo']['username']; |
|
316 |
- $hostname = trim($hostname, " .-"); |
|
317 |
- } |
|
294 |
+ $hostname = filter_input_hostname($_POST['hostname'], true); |
|
295 |
+ $domainid = (int) $_POST['domain']; |
|
296 |
+ if ($domainid >= 0) { |
|
297 |
+ $domain = new Domain((int) $_POST['domain']); |
|
298 |
+ $domain->ensure_userdomain(); |
|
299 |
+ $domainid = $domain->id; |
|
300 |
+ } |
|
301 |
+ if ($domainid == -1) { |
|
302 |
+ # use configured user_vhosts_domain |
|
303 |
+ $userdomain = userdomain(); |
|
304 |
+ $domain = new Domain((int) $userdomain['id']); |
|
305 |
+ $domainid = $domain->id; |
|
306 |
+ $hostname = $hostname.'.'.$_SESSION['userinfo']['username']; |
|
307 |
+ $hostname = trim($hostname, " .-"); |
|
308 |
+ } |
|
309 |
+ |
|
310 |
+ if (! is_array($_POST['options'])) { |
|
311 |
+ $_POST['options'] = array(); |
|
312 |
+ } |
|
313 |
+ $aliaswww = in_array('aliaswww', $_POST['options']); |
|
314 |
+ $forward = in_array('forward', $_POST['options']); |
|
318 | 315 |
|
319 |
- if (! is_array($_POST['options'])) |
|
320 |
- $_POST['options'] = array(); |
|
321 |
- $aliaswww = in_array('aliaswww', $_POST['options']); |
|
322 |
- $forward = in_array('forward', $_POST['options']); |
|
323 |
- |
|
324 |
- $new_options = array(); |
|
325 |
- if ($aliaswww) |
|
326 |
- array_push($new_options, 'aliaswww'); |
|
327 |
- if ($forward) |
|
328 |
- array_push($new_options, 'forward'); |
|
329 |
- DEBUG($new_options); |
|
330 |
- $options = implode(',', $new_options); |
|
331 |
- DEBUG('New options: '.$options); |
|
332 |
- |
|
333 |
- $alias['hostname'] = $hostname; |
|
334 |
- $alias['domain_id'] = $domainid; |
|
316 |
+ $new_options = array(); |
|
317 |
+ if ($aliaswww) { |
|
318 |
+ array_push($new_options, 'aliaswww'); |
|
319 |
+ } |
|
320 |
+ if ($forward) { |
|
321 |
+ array_push($new_options, 'forward'); |
|
322 |