838077f18b71321a685c84329342e6a711d22d09
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
5) Written 2008-2012 by schokokeks.org Hosting, namely
6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
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) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
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.
15) */
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

16) 
17) require_once('inc/security.php');
18) 
19) require_once('modules/vhosts/include/vhosts.php');
20) require_once('class/domain.php');
21) 
22) $url = '';
23) $docroot = '';
24) 
25) if ($_POST['target'] == 'new')
26) {
27)   check_form_token('webapp_install');
28)   $vhost = empty_vhost();
29) 
30)   $hostname = filter_input_hostname($_POST['hostname']);
31) 
32)   $domainid = (int) $_POST['domain'];
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

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

bernd authored 15 years ago

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

bernd authored 14 years ago

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

bernd authored 15 years ago

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

bernd authored 14 years ago

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

bernd authored 15 years ago

39)   }
bernd Nutze korrekte Domain

bernd authored 13 years ago

40)   DEBUG('Domain: '.$domainid.' / '.$domainname);
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

41) 
bernd Nutze korrekte Domain

bernd authored 13 years ago

42)   if (! isset($_POST['options']) || ! is_array($_POST['options']))
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

43)     $_POST['options'] = array();
44)   $aliaswww = in_array('aliaswww', $_POST['options']);
45) 
46)   $vhost['is_dav'] = 0;
47)   $vhost['is_svn'] = 0;
48)   $vhost['is_webapp'] = 0;
49)   
50)   $ssl = '';
51)   switch ($_POST['ssl']) {
52)     case 'http':
53)       $ssl = 'http';
54)       break;
55)     case 'https':
56)       $ssl = 'https';
57)       break;
58)     case 'forward':
59)       $ssl = 'forward';
60)       break;
61)     /* Wenn etwas anderes kommt, ist das "beides". So einfach ist das. */
62)   }
63) 
64)   $logtype = '';
65)   switch ($_POST['logtype']) {
66)     case 'anonymous':
67)       $logtype = 'anonymous';
68)       break;
69)     case 'default':
70)       $logtype = 'default';
71)       break;
72)     /* Wenn etwas anderes kommt, ist das "kein Logging". So einfach ist das. */
73)   }
74) 
75)   $errorlog = 0;
76)   if (isset($_POST['errorlog']) and ($_POST['errorlog'] == 1))
77)     $errorlog = 1;
78) 
79)   DEBUG("Logging: {$logtype}");
80) 
81)   $old_options = explode(',', $vhost['options']);
82)   $new_options = array();
83)   foreach ($old_options AS $op)
84)   {
85)     if ($op != 'aliaswww')
86)       array_push($new_options, $op);
87)   }
88)   if ($aliaswww)
89)     array_push($new_options, 'aliaswww');
90) 
91)   DEBUG($old_options);
92)   DEBUG($new_options);
93)   $options = implode(',', $new_options);
94)   DEBUG('New options: '.$options);
95) 
96)   $vhost['hostname'] = $hostname;
bernd Nutze korrekte Domain

bernd authored 13 years ago

97)   $vhost['domain_id'] = $domainid;
98)   $vhost['domain'] = $domainname;
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

99)   $vhost['docroot'] = '';
bernd Setze PHP 5.3 für neue Webapps

bernd authored 13 years ago

100)   $vhost['php'] = 'php53';
bernd Webapp-Installer, erste Ver...

bernd authored 15 years ago

101)   $vhost['ssl'] = $ssl;
102)   $vhost['logtype'] = $logtype;
103)   $vhost['errorlog'] = $errorlog; 
104)   $vhost['options'] = $options;
105)   
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

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

bernd authored 15 years ago

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

bernd authored 14 years ago

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