Browse code

added php version tag "default"

Bernd Wurst authored on13/07/2020 14:01:49
Showing1 changed files
... ...
@@ -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;
Browse code

Statistik-Funktion entfernt

Bernd Wurst authored on29/07/2019 07:26:02
Showing1 changed files
... ...
@@ -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']);
Browse code

Beschriftung im VHosts-Modul einheitlich als "Website"

Bernd Wurst authored on15/03/2019 09:57:21
Showing1 changed files
... ...
@@ -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) {
Browse code

fix usersubdomain / -2

Hanno authored on13/03/2019 10:48:31
Showing1 changed files
... ...
@@ -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'])) {
Browse code

codingstyle fixes

Hanno authored on28/02/2019 18:01:50
Showing1 changed files
... ...
@@ -255,7 +255,7 @@ if ($_GET['action'] == 'edit') {
255 255
             unset($new_options[$key]);
256 256
         }
257 257
     }
258
-    
258
+
259 259
 
260 260
     DEBUG($old_options);
261 261
     DEBUG($new_options);
Browse code

Behandle Sonderfall des leeren strings in den Vhost-Optionen

Bernd Wurst authored on12/01/2019 13:43:26
Showing1 changed files
... ...
@@ -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);
Browse code

vhost-hostnamen vernünftig prüfen: IDN-encoding, PHP-eigene funktion, check von komplettem fqdn

Hanno Böck authored on07/08/2018 20:24:06
Showing1 changed files
... ...
@@ -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
 
Browse code

read available php versions from config

Bernd Wurst authored on18/07/2018 13:32:37
Showing1 changed files
... ...
@@ -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') {
Browse code

remove whitespace in empty lines

Hanno authored on26/06/2018 23:36:40
Showing1 changed files
... ...
@@ -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?");
Browse code

Fix coding style with php-cs-checker, see https://cs.sensiolabs.org/

Hanno authored on26/06/2018 13:58:19
Showing1 changed files
... ...
@@ -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
+    }
323
+    DEBUG($new_options);
324
+    $options = implode(',', $new_options);
325
+    DEBUG('New options: '.$options);
326
+
327
+    $alias['hostname'] = $hostname;
328
+    $alias['domain_id'] = $domainid;
335 329
     
336
-  $alias ['options'] = $options;
330
+    $alias ['options'] = $options;
337 331
     
338
-  save_alias($alias);
332
+    save_alias($alias);
339 333
 
340
-  if (! $debugmode)
341
-    header('Location: aliases?vhost='.$vhost['id']);
342
-
343
-}
344
-elseif ($_GET['action'] == 'deletealias')
345
-{
346
-  $title = "Subdomain löschen";
347
-  $section = 'vhosts_vhosts';
334
+    if (! $debugmode) {
335
+        header('Location: aliases?vhost='.$vhost['id']);
336
+    }
337
+} elseif ($_GET['action'] == 'deletealias') {
338
+    $title = "Subdomain löschen";
339
+    $section = 'vhosts_vhosts';
348 340
   
349
-  $alias = get_alias_details( (int) $_GET['alias'] );
350
-  DEBUG($alias);
351
-  $alias_string = $alias['fqdn'];
341
+    $alias = get_alias_details((int) $_GET['alias']);
342
+    DEBUG($alias);
343
+    $alias_string = $alias['fqdn'];
352 344
   
353
-  $vhost = get_vhost_details( $alias['vhost'] );
354
-  DEBUG($vhost);
355
-  $vhost_string = $vhost['fqdn'];
345
+    $vhost = get_vhost_details($alias['vhost']);
346
+    DEBUG($vhost);
347
+    $vhost_string = $vhost['fqdn'];
356 348
   
357
-  $sure = user_is_sure();
358
-  if ($sure === NULL)
359
-  {
360
-    are_you_sure("action=deletealias&alias={$_GET['alias']}", "Möchten Sie das Alias »{$alias_string}« für die Subdomain »{$vhost_string}« wirklich löschen?");
361
-  }
362
-  elseif ($sure === true)
363
-  {
364
-    delete_alias($alias['id']);
365
-    if (! $debugmode)
366
-      header('Location: aliases?vhost='.$vhost['id']);
367
-  }
368
-  elseif ($sure === false)
369
-  {
370
-    if (! $debugmode)
371
-      header('Location: aliases?vhost='.$vhost['id']);
372
-  }
373
-}
374
-elseif ($_GET['action'] == 'delete')
375
-{
376
-  $title = "Subdomain löschen";
377
-  $section = 'vhosts_vhosts';
349
+    $sure = user_is_sure();
350
+    if ($sure === null) {
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?");
352
+    } elseif ($sure === true) {
353
+        delete_alias($alias['id']);
354
+        if (! $debugmode) {
355
+            header('Location: aliases?vhost='.$vhost['id']);
356
+        }
357
+    } elseif ($sure === false) {
358
+        if (! $debugmode) {
359
+            header('Location: aliases?vhost='.$vhost['id']);
360
+        }
361
+    }
362
+} elseif ($_GET['action'] == 'delete') {
363
+    $title = "Subdomain löschen";
364
+    $section = 'vhosts_vhosts';
378 365
   
379
-  $vhost = get_vhost_details( (int) $_GET['vhost'] );
380
-  $vhost_string = $vhost['fqdn'];
366
+    $vhost = get_vhost_details((int) $_GET['vhost']);
367
+    $vhost_string = $vhost['fqdn'];
381 368
   
382
-  $sure = user_is_sure();
383
-  if ($sure === NULL)
384
-  {
385
-    are_you_sure("action=delete&vhost={$_GET['vhost']}", "Möchten Sie die Subdomain »{$vhost_string}« wirklich löschen?");
386
-  }
387
-  elseif ($sure === true)
388
-  {
389
-    delete_vhost($vhost['id']);
390
-    if (! $debugmode)
391
-      header("Location: vhosts");
392
-  }
393
-  elseif ($sure === false)
394
-  {
395
-    if (! $debugmode)
396
-      header("Location: vhosts");
397
-  }
369
+    $sure = user_is_sure();
370
+    if ($sure === null) {
371
+        are_you_sure("action=delete&vhost={$_GET['vhost']}", "Möchten Sie die Subdomain »{$vhost_string}« wirklich löschen?");
372
+    } elseif ($sure === true) {
373
+        delete_vhost($vhost['id']);
374
+        if (! $debugmode) {
375
+            header("Location: vhosts");
376
+        }
377
+    } elseif ($sure === false) {
378
+        if (! $debugmode) {
379
+            header("Location: vhosts");
380
+        }
381
+    }
382
+} else {
383
+    system_failure("Unimplemented action");
398 384
 }
399
-else
400
-  system_failure("Unimplemented action");
401 385
 
402 386
 output('');
403
-
404
-
405
-?>
Browse code

Bugfix: Weiterleitung auf "nowww" konnte nicht mehr entfernt werden

Bernd Wurst authored on13/03/2018 10:52:27
Showing1 changed files
... ...
@@ -223,7 +223,7 @@ if ($_GET['action'] == 'edit')
223 223
   $new_options = array();
224 224
   foreach ($old_options AS $op)
225 225
   {
226
-    if (! in_array($op, array('aliaswww', 'forwardwww', 'hsts_subdomains', 'hsts_preload'))) {
226
+    if (! in_array($op, array('aliaswww', 'forwardwww', 'forwardnowww', 'hsts_subdomains', 'hsts_preload'))) {
227 227
       array_push($new_options, $op);
228 228
     }
229 229
   }
Browse code

Copyright year update

Bernd Wurst authored on13/01/2018 06:07:05
Showing1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2014 by schokokeks.org Hosting, namely
5
+Written 2008-2018 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

add PHP 7.2 support, re-create php icons with imagemagick in same style

Hanno Böck authored on19/09/2017 11:37:17
Showing1 changed files
... ...
@@ -96,14 +96,15 @@ if ($_GET['action'] == 'edit')
96 96
       case 'php56':
97 97
         $php = 'php56';
98 98
         break;
99
-      case 'php70':
100 99
       case 'fpm70':
101 100
         $php = 'fpm70';
102 101
         break;
103
-      case 'php71':
104 102
       case 'fpm71':
105 103
         $php = 'fpm71';
106 104
         break;
105
+      case 'fpm72':
106
+        $php = 'fpm72';
107
+        break;
107 108
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
108 109
     }
109 110
   }
Browse code

Funktionsfähiger Prototyp

Bernd Wurst authored on21/02/2017 11:37:29
Showing1 changed files
... ...
@@ -61,9 +61,15 @@ if ($_GET['action'] == 'edit')
61 61
     $domainname = $_SESSION['userinfo']['username'].".".config('masterdomain');
62 62
   }
63 63
 
64
-  if (! (isset($_POST['options']) && is_array($_POST['options'])))
65
-    $_POST['options'] = array();
66
-  $aliaswww = in_array('aliaswww', $_POST['options']);
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';
71
+    }
72
+  }
67 73
 
68 74
   $docroot = '';
69 75
   if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav')
... ...
@@ -216,12 +222,15 @@ if ($_GET['action'] == 'edit')
216 222
   $new_options = array();
217 223
   foreach ($old_options AS $op)
218 224
   {
219
-    if ($op != 'aliaswww' && $op != 'hsts_subdomains' && $op != 'hsts_preload') {
225
+    if (! in_array($op, array('aliaswww', 'forwardwww', 'hsts_subdomains', 'hsts_preload'))) {
220 226
       array_push($new_options, $op);
221 227
     }
222 228
   }
223 229
   if ($aliaswww) {
224 230
     array_push($new_options, 'aliaswww');
231
+    if ($forwardwww) {
232
+        array_push($new_options, $forwardwww);
233
+    }
225 234
   }
226 235
   if ($hsts_subdomains) {
227 236
     array_push($new_options, 'hsts_subdomains');
Browse code

HSTS-Optionen includeSubdomains und preload

Bernd Wurst authored on18/02/2017 15:21:23
Showing1 changed files
... ...
@@ -151,12 +151,20 @@ if ($_GET['action'] == 'edit')
151 151
   }
152 152
 
153 153
   $hsts = NULL;
154
+  $hsts_subdomains = false;
155
+  $hsts_preload = false;
154 156
   if (isset($_POST['hsts'])) {
155 157
     if (is_numeric($_POST['hsts']) && (int) $_POST['hsts'] > -2) {
156 158
       $hsts = (int) $_POST['hsts'];
157 159
     } else {
158 160
       system_failure('Es wurde ein ungültiger HSTS-Wert eingegeben. Dort sind nur Sekunden erlaubt.');
159 161
     }
162
+    if (isset($_POST['hsts_subdomains']) and $_POST['hsts_subdomains'] == 1) {
163
+      $hsts_subdomains = true;
164
+      if (isset($_POST['hsts_preload']) and $_POST['hsts_preload'] == 1) {
165
+        $hsts_preload = true;
166
+      }
167
+    }
160 168
   }
161 169
  
162 170
   $cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : NULL);
... ...
@@ -208,13 +216,19 @@ if ($_GET['action'] == 'edit')
208 216
   $new_options = array();
209 217
   foreach ($old_options AS $op)
210 218
   {
211
-    if ($op != 'aliaswww') {
219
+    if ($op != 'aliaswww' && $op != 'hsts_subdomains' && $op != 'hsts_preload') {
212 220
       array_push($new_options, $op);
213 221
     }
214 222
   }
215 223
   if ($aliaswww) {
216 224
     array_push($new_options, 'aliaswww');
217 225
   }
226
+  if ($hsts_subdomains) {
227
+    array_push($new_options, 'hsts_subdomains');
228
+  }
229
+  if ($hsts_preload) {
230
+    array_push($new_options, 'hsts_preload');
231
+  }
218 232
   $letsencrypt = ($cert == 0 ? false : ($cert == -1 || cert_is_letsencrypt($cert)));
219 233
 
220 234
   if ($letsencrypt) {
Browse code

PHP <= 5.5 entfernt und Vorbereitung für PHP 7.1 getroffen

Bernd Wurst authored on10/09/2016 06:53:37
Showing1 changed files
... ...
@@ -87,18 +87,17 @@ if ($_GET['action'] == 'edit')
87 87
   if ($_POST['vhost_type'] == 'regular' && isset($_POST['php']))
88 88
   {
89 89
     switch ($_POST['php']) {
90
-      case 'php54':
91
-        $php = 'php54';
92
-        break;
93
-      case 'php55':
94
-        $php = 'php55';
95
-        break;
96 90
       case 'php56':
97 91
         $php = 'php56';
98 92
         break;
99
-      case 'fpm70': # FIXME: FPM soll bald der default sein, momentan nur einzelne Versionen
93
+      case 'php70':
94
+      case 'fpm70':
100 95
         $php = 'fpm70';
101 96
         break;
97
+      case 'php71':
98
+      case 'fpm71':
99
+        $php = 'fpm71';
100
+        break;
102 101
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
103 102
     }
104 103
   }
Browse code

zwinge PHP 7.0 auf FPM (hardcoded, FIXME)

Bernd Wurst authored on14/12/2015 15:49:34
Showing1 changed files
... ...
@@ -96,8 +96,8 @@ if ($_GET['action'] == 'edit')
96 96
       case 'php56':
97 97
         $php = 'php56';
98 98
         break;
99
-      case 'php70':
100
-        $php = 'php70';
99
+      case 'fpm70': # FIXME: FPM soll bald der default sein, momentan nur einzelne Versionen
100
+        $php = 'fpm70';
101 101
         break;
102 102
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
103 103
     }
Browse code

Status der letsencrypt-Option in diversen Situationen korrekt setzen

Bernd Wurst authored on30/11/2015 13:17:38
Showing1 changed files
... ...
@@ -213,15 +213,30 @@ if ($_GET['action'] == 'edit')
213 213
       array_push($new_options, $op);
214 214
     }
215 215
   }
216
-  if ($aliaswww){
216
+  if ($aliaswww) {
217 217
     array_push($new_options, 'aliaswww');
218 218
   }
219
-  if ($cert == -1) {
219
+  $letsencrypt = ($cert == 0 ? false : ($cert == -1 || cert_is_letsencrypt($cert)));
220
+
221
+  if ($letsencrypt) {
220 222
     array_push($new_options, 'letsencrypt');
221 223
     if ($vhost['cert'] != 0) {
222
-      # FIXME: Wenn der User manuell von einem gültigen Cert auf "letsencrypt" umgestellt hat, 
224
+      # Wenn der User manuell von einem gültigen Cert auf "letsencrypt" umgestellt hat, 
223 225
       # dann sollte das alte Cert noch so lange eingetragen bleiben bis das neue da ist.
224
-      $cert = $vhost['cert']
226
+      $cert = $vhost['cert'];
227
+    } elseif ($cert > 0) {
228
+      # Das Cert was der user gewählt hat, ist von Lets encrypt
229
+      # tu nix, $cert ist schon korrekt
230
+    } else {
231
+      # Wenn vorher kein Zertifikat aktiv war, dann setze jetzt auch keines. 
232
+      # Der letsencrypt-Automatismus macht das dann schon.
233
+      $cert = 0;
234
+    }
235
+  } else {
236
+    # Wenn kein Letsencrypt gewünscht ist, entferne die Letsencrypt-Option
237
+    $key = array_search('letsencrypt',$new_options);
238
+    if ($key !== false) {
239
+      unset($new_options[$key]);
225 240
     }
226 241
   }
227 242
 
Browse code

Letsencrypt vorbereitet und Default-Bitlänge auf 2048 zurückgesetzt

Bernd Wurst authored on30/11/2015 11:31:44
Showing1 changed files
... ...
@@ -218,6 +218,11 @@ if ($_GET['action'] == 'edit')
218 218
   }
219 219
   if ($cert == -1) {
220 220
     array_push($new_options, 'letsencrypt');
221
+    if ($vhost['cert'] != 0) {
222
+      # FIXME: Wenn der User manuell von einem gültigen Cert auf "letsencrypt" umgestellt hat, 
223
+      # dann sollte das alte Cert noch so lange eingetragen bleiben bis das neue da ist.
224
+      $cert = $vhost['cert']
225
+    }
221 226
   }
222 227
 
223 228
   DEBUG($old_options);
Browse code

* Ermögliche SAN bei CSRs * Vorbereitung für Let's Encrypt!

Bernd Wurst authored on29/11/2015 05:18:32
Showing1 changed files
... ...
@@ -209,11 +209,16 @@ if ($_GET['action'] == 'edit')
209 209
   $new_options = array();
210 210
   foreach ($old_options AS $op)
211 211
   {
212
-    if ($op != 'aliaswww')
212
+    if ($op != 'aliaswww') {
213 213
       array_push($new_options, $op);
214
+    }
214 215
   }
215
-  if ($aliaswww)
216
+  if ($aliaswww){
216 217
     array_push($new_options, 'aliaswww');
218
+  }
219
+  if ($cert == -1) {
220
+    array_push($new_options, 'letsencrypt');
221
+  }
217 222
 
218 223
   DEBUG($old_options);
219 224
   DEBUG($new_options);
Browse code

PHP 7.0 support

Hanno Böck authored on27/11/2015 12:35:36
Showing1 changed files
... ...
@@ -96,6 +96,9 @@ if ($_GET['action'] == 'edit')
96 96
       case 'php56':
97 97
         $php = 'php56';
98 98
         break;
99
+      case 'php70':
100
+        $php = 'php70';
101
+        break;
99 102
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
100 103
     }
101 104
   }
Browse code

Zeige Userdomains nur noch wenn nötig.

Bernd Wurst authored on18/02/2015 17:05:57
Showing1 changed files
... ...
@@ -39,20 +39,27 @@ if ($_GET['action'] == 'edit')
39 39
 
40 40
   $hostname = filter_input_hostname($_POST['hostname'], true);
41 41
 
42
+  $domainname = NULL;
42 43
   $domain_id = (int) $_POST['domain'];
43 44
   if ($domain_id >= 0) {
44 45
     $domain = new Domain( (int) $_POST['domain'] );
45 46
     $domain->ensure_userdomain();
46 47
     $domain_id = $domain->id;
48
+    $domainname = $domain->fqdn;
47 49
   }
48
-  if ($domain_id == -1) {
50
+  elseif ($domain_id == -1) {
49 51
     # use configured user_vhosts_domain
50 52
     $userdomain = userdomain();
51 53
     $domain = new Domain( (int) $userdomain['id'] );
52 54
     $domain_id = $domain->id;
55
+    $domainname = $domain->fqdn;
53 56
     $hostname = $hostname.'.'.$_SESSION['userinfo']['username'];
54 57
     $hostname = trim($hostname, " .-");
55 58
   }
59
+  elseif ($domain_id == -2) {
60
+    # use system masterdomain
61
+    $domainname = $_SESSION['userinfo']['username'].".".config('masterdomain');
62
+  }
56 63
 
57 64
   if (! (isset($_POST['options']) && is_array($_POST['options'])))
58 65
     $_POST['options'] = array();
... ...
@@ -61,7 +68,7 @@ if ($_GET['action'] == 'edit')
61 68
   $docroot = '';
62 69
   if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav')
63 70
   {
64
-    $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domain->fqdn).'/htdocs';
71
+    $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domainname).'/htdocs';
65 72
   
66 73
     $docroot = '';
67 74
     if (isset($_POST['docroot']))
Browse code

Ermögliche dem user Hosts mit der Domain aus user_vhosts_domain

Bernd Wurst authored on17/12/2014 08:35:33
Showing1 changed files
... ...
@@ -40,11 +40,19 @@ if ($_GET['action'] == 'edit')
40 40
   $hostname = filter_input_hostname($_POST['hostname'], true);
41 41
 
42 42
   $domain_id = (int) $_POST['domain'];
43
-  if ($domain_id != -1) {
43
+  if ($domain_id >= 0) {
44 44
     $domain = new Domain( (int) $_POST['domain'] );
45 45
     $domain->ensure_userdomain();
46 46
     $domain_id = $domain->id;
47 47
   }
48
+  if ($domain_id == -1) {
49
+    # use configured user_vhosts_domain
50
+    $userdomain = userdomain();
51
+    $domain = new Domain( (int) $userdomain['id'] );
52
+    $domain_id = $domain->id;
53
+    $hostname = $hostname.'.'.$_SESSION['userinfo']['username'];
54
+    $hostname = trim($hostname, " .-");
55
+  }
48 56
 
49 57
   if (! (isset($_POST['options']) && is_array($_POST['options'])))
50 58
     $_POST['options'] = array();
... ...
@@ -236,11 +244,19 @@ elseif ($_GET['action'] == 'addalias')
236 244
   
237 245
   $hostname = filter_input_hostname($_POST['hostname'], true);
238 246
   $domainid = (int) $_POST['domain'];
239
-  if ($domainid != -1) {
247
+  if ($domainid >= 0) {
240 248
     $domain = new Domain( (int) $_POST['domain'] );
241 249
     $domain->ensure_userdomain();
242 250
     $domainid = $domain->id;
243 251
   }
252
+  if ($domainid == -1) {
253
+    # use configured user_vhosts_domain
254
+    $userdomain = userdomain();
255
+    $domain = new Domain( (int) $userdomain['id'] );
256
+    $domainid = $domain->id;
257
+    $hostname = $hostname.'.'.$_SESSION['userinfo']['username'];
258
+    $hostname = trim($hostname, " .-");
259
+  }
244 260
 
245 261
   if (! is_array($_POST['options']))
246 262
     $_POST['options'] = array();
Browse code

php 5.6 zum default, php 5.3 raus

Hanno Böck authored on05/11/2014 15:42:06
Showing1 changed files
... ...
@@ -72,15 +72,6 @@ if ($_GET['action'] == 'edit')
72 72
   if ($_POST['vhost_type'] == 'regular' && isset($_POST['php']))
73 73
   {
74 74
     switch ($_POST['php']) {
75
-      case 'mod_php':
76
-        $php = 'mod_php';
77
-        break;
78
-      case 'fastcgi':
79
-        $php = 'fastcgi';
80
-        break;
81
-      case 'php53':
82
-        $php = 'php53';
83
-        break;
84 75
       case 'php54':
85 76
         $php = 'php54';
86 77
         break;
Browse code

PHP 5.6 experimentell

Bernd Wurst authored on31/08/2014 11:37:01
Showing1 changed files
... ...
@@ -87,6 +87,9 @@ if ($_GET['action'] == 'edit')
87 87
       case 'php55':
88 88
         $php = 'php55';
89 89
         break;
90
+      case 'php56':
91
+        $php = 'php56';
92
+        break;
90 93
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
91 94
     }
92 95
   }
Browse code

Lizenzinfos in eigenes Modul ausgelagert und Copyright auf 2014 angepasst

Bernd Wurst authored on08/02/2014 05:45:07
Showing1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2013 by schokokeks.org Hosting, namely
5
+Written 2008-2014 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Bugfix: Werte dürfen nicht auf "" stehen, wenn kein maybe_null mehr benutzt wird

Bernd Wurst authored on03/02/2014 17:24:57
Showing1 changed files
... ...
@@ -63,12 +63,12 @@ if ($_GET['action'] == 'edit')
63 63
       $docroot = $vhost['homedir'].'/websites/'.$_POST['docroot'];
64 64
     }
65 65
     if ((isset($_POST['use_default_docroot']) && $_POST['use_default_docroot'] == '1') || ($docroot == $defaultdocroot)) {
66
-      $docroot = '';
66
+      $docroot = NULL;
67 67
     }
68 68
   
69 69
     DEBUG("Document-Root: ".$docroot);
70 70
   }
71
-  $php = '';
71
+  $php = NULL;
72 72
   if ($_POST['vhost_type'] == 'regular' && isset($_POST['php']))
73 73
   {
74 74
     switch ($_POST['php']) {
... ...
@@ -125,7 +125,7 @@ if ($_GET['action'] == 'edit')
125 125
   }
126 126
 
127 127
   
128
-  $ssl = '';
128
+  $ssl = NULL;
129 129
   switch ($_POST['ssl']) {
130 130
     case 'http':
131 131
       $ssl = 'http';
Browse code

JQuery als Include HSTS-Interface

Bernd Wurst authored on27/01/2014 19:14:21
Showing1 changed files
... ...
@@ -139,6 +139,15 @@ if ($_GET['action'] == 'edit')
139 139
     /* Wenn etwas anderes kommt, ist das "beides". So einfach ist das. */
140 140
   }
141 141
 
142
+  $hsts = NULL;
143
+  if (isset($_POST['hsts'])) {
144
+    if (is_numeric($_POST['hsts']) && (int) $_POST['hsts'] > -2) {
145
+      $hsts = (int) $_POST['hsts'];
146
+    } else {
147
+      system_failure('Es wurde ein ungültiger HSTS-Wert eingegeben. Dort sind nur Sekunden erlaubt.');
148
+    }
149
+  }
150
+ 
142 151
   $cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : NULL);
143 152
 
144 153
   $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : NULL);
... ...
@@ -205,6 +214,7 @@ if ($_GET['action'] == 'edit')
205 214
   $vhost['php'] = $php;
206 215
   $vhost['cgi'] = $cgi;
207 216
   $vhost['ssl'] = $ssl;
217
+  $vhost['hsts'] = $hsts;
208 218
   $vhost['cert'] = $cert;
209 219
   $vhost['ipv4'] = $ipv4;
210 220
   $vhost['logtype'] = $logtype;
Browse code

übrige Änderungen für php55

Hanno Böck authored on28/07/2013 11:51:25
Showing1 changed files
... ...
@@ -84,6 +84,9 @@ if ($_GET['action'] == 'edit')
84 84
       case 'php54':
85 85
         $php = 'php54';
86 86
         break;
87
+      case 'php55':
88
+        $php = 'php55';
89
+        break;
87 90
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
88 91
     }
89 92
   }
Browse code

Weise Benutzer auf Wartezeit hin beim Ändern von vhost-Einstellungen

Bernd Wurst authored on19/03/2013 05:51:05
Showing1 changed files
... ...
@@ -18,6 +18,7 @@ require_once('session/start.php');
18 18
 
19