56c162ea4143be0821eb3c5634aca400a8d4b2fc
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'];
19)   if ($domainid != -1) {
20)     $domain = new Domain( (int) $_POST['domain'] );
bernd Prüfe, ob Domain wirklich d...

bernd authored 14 years ago

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

bernd authored 15 years ago

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

bernd authored 14 years ago

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