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

bernd authored 14 years ago

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