da0e59cc4f30cec244a9f9ee757cf77d0a80f422
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

1) <?php
2) 
3) require_once('inc/security.php');
4) 
5) require_once('modules/vhosts/include/vhosts.php');
6) require_once('class/domain.php');
7) 
8) $url = '';
9) $docroot = '';
10) 
11) if ($_POST['target'] == 'new')
12) {
13)   check_form_token('webapp_install');
14)   $vhost = empty_vhost();
15) 
16)   $hostname = filter_input_hostname($_POST['hostname']);
17) 
18)   $domainid = (int) $_POST['domain'];
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

19)   $domainname = NULL;
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

20)   if ($domainid != -1) {
21)     $domain = new Domain( (int) $_POST['domain'] );
bernd Prüfe, ob Domain wirklich d...

bernd authored 14 years ago

22)     $domain->ensure_userdomain();
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

23)     $domainid = $domain->id;
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

24)     $domainname = $domain->fqdn;
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

25)   }
26) 
27)   if (! is_array($_POST['options']))
28)     $_POST['options'] = array();
29)   $aliaswww = in_array('aliaswww', $_POST['options']);
30) 
31)   $vhost['is_dav'] = 0;
32)   $vhost['is_svn'] = 0;
33)   $vhost['is_webapp'] = 0;
34)   
35)   $ssl = '';
36)   switch ($_POST['ssl']) {
37)     case 'http':
38)       $ssl = 'http';
39)       break;
40)     case 'https':
41)       $ssl = 'https';
42)       break;
43)     case 'forward':
44)       $ssl = 'forward';
45)       break;
46)     /* Wenn etwas anderes kommt, ist das "beides". So einfach ist das. */
47)   }
48) 
49)   $logtype = '';
50)   switch ($_POST['logtype']) {
51)     case 'anonymous':
52)       $logtype = 'anonymous';
53)       break;
54)     case 'default':
55)       $logtype = 'default';
56)       break;
57)     /* Wenn etwas anderes kommt, ist das "kein Logging". So einfach ist das. */
58)   }
59) 
60)   $errorlog = 0;
61)   if (isset($_POST['errorlog']) and ($_POST['errorlog'] == 1))
62)     $errorlog = 1;
63) 
64)   DEBUG("Logging: {$logtype}");
65) 
66)   $old_options = explode(',', $vhost['options']);
67)   $new_options = array();
68)   foreach ($old_options AS $op)
69)   {
70)     if ($op != 'aliaswww')
71)       array_push($new_options, $op);
72)   }
73)   if ($aliaswww)
74)     array_push($new_options, 'aliaswww');
75) 
76)   DEBUG($old_options);
77)   DEBUG($new_options);
78)   $options = implode(',', $new_options);
79)   DEBUG('New options: '.$options);
80) 
81)   $vhost['hostname'] = $hostname;
82)   $vhost['domainid'] = $domainid;
83)   $vhost['docroot'] = '';
84)   $vhost['php'] = 'fastcgi';
85)   $vhost['ssl'] = $ssl;
86)   $vhost['logtype'] = $logtype;
87)   $vhost['errorlog'] = $errorlog; 
88)   $vhost['options'] = $options;
89)   
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

90)   $domain = $domainname;
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

91)   if ($domainid == -1)
92)   {
bernd Mehr config-optionen und co...

bernd authored 14 years ago

93)     $domain = $_SESSION['userinfo']['username'].'.'.config('masterdomain');