c71d1e51db1a91c5377a6d37b64f8f7a64eb834d
bernd VHosts können bearbeitet we...

bernd authored 16 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) 
Bernd Wurst Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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 VHosts können bearbeitet we...

bernd authored 16 years ago

16) 
17) require_once('session/start.php');
18) 
19) require_once('vhosts.php');
20) 
Bernd Wurst Weise Benutzer auf Wartezei...

Bernd Wurst authored 11 years ago

21) require_once('inc/error.php');
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

22) require_once('inc/security.php');
23) require_once('class/domain.php');
24) 
25) require_role(ROLE_SYSTEMUSER);
26) 
27) require_once("inc/debug.php");
28) global $debugmode;
29) 
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) 
bernd Erlaube wildcards bei vhosts

bernd authored 13 years ago

40)   $hostname = filter_input_hostname($_POST['hostname'], true);
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

41) 
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

42)   $domain_id = (int) $_POST['domain'];
43)   if ($domain_id != -1) {
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

44)     $domain = new Domain( (int) $_POST['domain'] );
bernd Mehr config-optionen und co...

bernd authored 14 years ago

45)     $domain->ensure_userdomain();
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

46)     $domain_id = $domain->id;
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

47)   }
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

48) 
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

49)   if (! (isset($_POST['options']) && is_array($_POST['options'])))
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

50)     $_POST['options'] = array();
51)   $aliaswww = in_array('aliaswww', $_POST['options']);
52) 
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

53)   $docroot = '';
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

54)   if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav')
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

55)   {
56)     $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domain->fqdn).'/htdocs';
57)   
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

58)     $docroot = '';
59)     if (isset($_POST['docroot']))
60)     {
61)       if (! check_path( $_POST['docroot'] ))
62)         system_failure("Eingegebener Pfad enthält ungültige Angaben");
63)       $docroot = $vhost['homedir'].'/websites/'.$_POST['docroot'];
64)     }
65)     if ((isset($_POST['use_default_docroot']) && $_POST['use_default_docroot'] == '1') || ($docroot == $defaultdocroot)) {
Bernd Wurst Bugfix: Werte dürfen nicht...

Bernd Wurst authored 10 years ago

66)       $docroot = NULL;
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

67)     }
68)   
69)     DEBUG("Document-Root: ".$docroot);
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

70)   }
Bernd Wurst Bugfix: Werte dürfen nicht...

Bernd Wurst authored 10 years ago

71)   $php = NULL;
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

72)   if ($_POST['vhost_type'] == 'regular' && isset($_POST['php']))
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

73)   {
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

74)     switch ($_POST['php']) {
75)       case 'mod_php':
76)         $php = 'mod_php';
77)         break;
78)       case 'fastcgi':
79)         $php = 'fastcgi';
80)         break;
bernd Vorbereitung für PHP 5.3

bernd authored 14 years ago

81)       case 'php53':
82)         $php = 'php53';
83)         break;
Bernd Wurst prepare for experimental PH...

Bernd Wurst authored 12 years ago

84)       case 'php54':
85)         $php = 'php54';
86)         break;
Hanno Böck übrige Änderungen für php55

Hanno Böck authored 10 years ago

87)       case 'php55':
88)         $php = 'php55';
89)         break;
Bernd Wurst PHP 5.6 experimentell

Bernd Wurst authored 9 years ago

90)       case 'php56':
91)         $php = 'php56';
92)         break;
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

93)       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
94)     }
95)   }
bernd "CGI-Aktivieren" ist jetzt...

bernd authored 13 years ago

96)   $cgi = 1;
97)   if (isset($_POST['safemode']) && $_POST['safemode'] == 'yes')
bernd CGI abschaltbar

bernd authored 14 years ago

98)   {
bernd "CGI-Aktivieren" ist jetzt...

bernd authored 13 years ago

99)     $cgi = 0;
bernd CGI abschaltbar

bernd authored 14 years ago

100)   }
101) 
bernd SuExec-Useraccount einstellbar

bernd authored 14 years ago

102)   if (isset($_POST['suexec_user']))
103)     $vhost['suexec_user'] = $_POST['suexec_user'];
104) 
Bernd Wurst Ermögliche das Auswählen de...

Bernd Wurst authored 11 years ago

105)   if (isset($_POST['server']))
106)     $vhost['server'] = $_POST['server'];
107) 
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

108)   if ($_POST['vhost_type'] == 'regular') {
109)     $vhost['is_dav'] = 0;
110)     $vhost['is_svn'] = 0;
111)     $vhost['is_webapp'] = 0;
112)   }
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

113)   elseif ($_POST['vhost_type'] == 'dav') {
114)     $vhost['is_dav'] = 1;
115)     $vhost['is_svn'] = 0;
116)     $vhost['is_webapp'] = 0;
117)   }
118)   elseif ($_POST['vhost_type'] == 'svn') {
119)     $vhost['is_dav'] = 0;
120)     $vhost['is_svn'] = 1;
121)     $vhost['is_webapp'] = 0;
122)   }
123)   elseif ($_POST['vhost_type'] == 'webapp') {
124)     $vhost['is_dav'] = 0;
125)     $vhost['is_svn'] = 0;
126)     $vhost['is_webapp'] = 1;
bernd Webapps implementiert

bernd authored 16 years ago

127)     $vhost['webapp_id'] = (int) $_POST['webapp'];
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

128)   }
129) 
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

130)   
Bernd Wurst Bugfix: Werte dürfen nicht...

Bernd Wurst authored 10 years ago

131)   $ssl = NULL;
bernd SSL auch über webinterface...

bernd authored 16 years ago

132)   switch ($_POST['ssl']) {
133)     case 'http':
134)       $ssl = 'http';
135)       break;
136)     case 'https':
137)       $ssl = 'https';
138)       break;
139)     case 'forward':
140)       $ssl = 'forward';
141)       break;
142)     /* Wenn etwas anderes kommt, ist das "beides". So einfach ist das. */
143)   }
144) 
Bernd Wurst JQuery als Include HSTS-Int...

Bernd Wurst authored 10 years ago

145)   $hsts = NULL;
146)   if (isset($_POST['hsts'])) {
147)     if (is_numeric($_POST['hsts']) && (int) $_POST['hsts'] > -2) {
148)       $hsts = (int) $_POST['hsts'];
149)     } else {
150)       system_failure('Es wurde ein ungültiger HSTS-Wert eingegeben. Dort sind nur Sekunden erlaubt.');
151)     }
152)   }
153)  
bernd fix a warning

bernd authored 14 years ago

154)   $cert = (isset($_POST['cert']) ? (int) $_POST['cert'] : NULL);
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

155) 
bernd fix a warning

bernd authored 14 years ago

156)   $ipv4 = (isset($_POST['ipv4']) ? $_POST['ipv4'] : NULL);
bernd IP-Adressen aktivieren

bernd authored 14 years ago

157) 
bernd IPv6

bernd authored 14 years ago

158)   if (isset($_POST['ipv6']) && $_POST['ipv6'] == 'yes')
159)   {
160)     $vhost['autoipv6'] = 1;
bernd Zusätzlicher Haken für eige...

bernd authored 13 years ago

161)     if (isset($_POST['ipv6_separate']) && $_POST['ipv6_separate'] = 'yes')
162)     {
163)       $vhost['autoipv6'] = 2;
164)     }
bernd IPv6

bernd authored 14 years ago

165)   } else {
166)     $vhost['autoipv6'] = 0;
167)   }
168)   
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

169) 
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

170)   $logtype = '';
171)   switch ($_POST['logtype']) {
172)     case 'anonymous':
173)       $logtype = 'anonymous';
174)       break;
175)     case 'default':
176)       $logtype = 'default';
177)       break;
178)     /* Wenn etwas anderes kommt, ist das "kein Logging". So einfach ist das. */
179)   }
180) 
bernd error_log konfigurierbar

bernd authored 16 years ago

181)   $errorlog = 0;
182)   if (isset($_POST['errorlog']) and ($_POST['errorlog'] == 1))
183)     $errorlog = 1;
184) 
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

185) 
186)   if (isset($_POST['stats']) && $_POST['stats'] == 1)
187)   {
188)     if ($vhost['stats'] == NULL)
189)       $vhost['stats'] = 'private';
190)   }
191)   else
192)     $vhost['stats'] = NULL;
193) 
194)   if ($logtype == '')
195)     $vhost['stats'] = NULL;
196)   
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

197)   DEBUG("PHP: {$php} / Logging: {$logtype}");
198) 
199)   $old_options = explode(',', $vhost['options']);
200)   $new_options = array();
201)   foreach ($old_options AS $op)
202)   {
203)     if ($op != 'aliaswww')
204)       array_push($new_options, $op);
205)   }
206)   if ($aliaswww)
207)     array_push($new_options, 'aliaswww');
208) 
209)   DEBUG($old_options);
210)   DEBUG($new_options);
211)   $options = implode(',', $new_options);
212)   DEBUG('New options: '.$options);
213) 
214)   $vhost['hostname'] = $hostname;
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

215)   $vhost['domain_id'] = $domain_id;
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

216)   $vhost['docroot'] = $docroot;
217)   $vhost['php'] = $php;
bernd CGI abschaltbar

bernd authored 14 years ago

218)   $vhost['cgi'] = $cgi;
bernd SSL auch über webinterface...

bernd authored 16 years ago

219)   $vhost['ssl'] = $ssl;
Bernd Wurst JQuery als Include HSTS-Int...

Bernd Wurst authored 10 years ago

220)   $vhost['hsts'] = $hsts;
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

221)   $vhost['cert'] = $cert;
bernd IP-Adressen aktivieren

bernd authored 14 years ago

222)   $vhost['ipv4'] = $ipv4;
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

223)   $vhost['logtype'] = $logtype;
bernd error_log konfigurierbar

bernd authored 16 years ago

224)   $vhost['errorlog'] = $errorlog; 
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

225)   $vhost['options'] = $options;
226)     
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

227)   DEBUG($vhost);
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

228)   save_vhost($vhost);
Bernd Wurst Weise Benutzer auf Wartezei...

Bernd Wurst authored 11 years ago

229)   success_msg("Ihre Einstellungen wurden gespeichert. Es dauert jedoch einige Minuten bis die Änderungen wirksam werden.");
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

230) 
231)   if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

232)     header('Location: vhosts');
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

233) 
234) }
bernd Aliases editieren

bernd authored 16 years ago

235) elseif ($_GET['action'] == 'addalias')
236) {
237)   check_form_token('vhosts_add_alias');
238)   $id = (int) $_GET['vhost'];
239)   $vhost = get_vhost_details( $id );
240)   DEBUG($vhost);
241) 
242)   $alias = empty_alias();
243)   $alias['vhost'] = $vhost['id'];
244) 
245)   
bernd Erlaube wildcards bei vhosts

bernd authored 13 years ago

246)   $hostname = filter_input_hostname($_POST['hostname'], true);
bernd auch aliases dürfen usernam...

bernd authored 16 years ago

247)   $domainid = (int) $_POST['domain'];
248)   if ($domainid != -1) {
249)     $domain = new Domain( (int) $_POST['domain'] );
bernd Mehr config-optionen und co...

bernd authored 14 years ago

250)     $domain->ensure_userdomain();
bernd auch aliases dürfen usernam...

bernd authored 16 years ago

251)     $domainid = $domain->id;
252)   }
bernd Aliases editieren

bernd authored 16 years ago

253) 
254)   if (! is_array($_POST['options']))
255)     $_POST['options'] = array();
256)   $aliaswww = in_array('aliaswww', $_POST['options']);
257)   $forward = in_array('forward', $_POST['options']);
258) 
259)   $new_options = array();
260)   if ($aliaswww)
261)     array_push($new_options, 'aliaswww');
262)   if ($forward)
263)     array_push($new_options, 'forward');
264)   DEBUG($new_options);
265)   $options = implode(',', $new_options);
266)   DEBUG('New options: '.$options);
267) 
268)   $alias['hostname'] = $hostname;
bernd domainid -> domain_id, fies...

bernd authored 14 years ago

269)   $alias['domain_id'] = $domainid;
bernd Aliases editieren

bernd authored 16 years ago

270)     
271)   $alias ['options'] = $options;
272)     
273)   save_alias($alias);
274) 
275)   if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

276)     header('Location: aliases?vhost='.$vhost['id']);
bernd Aliases editieren

bernd authored 16 years ago

277) 
278) }
279) elseif ($_GET['action'] == 'deletealias')
280) {
281)   $title = "Subdomain löschen";
282)   $section = 'vhosts_vhosts';
283)   
284)   $alias = get_alias_details( (int) $_GET['alias'] );
285)   DEBUG($alias);
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

286)   $alias_string = $alias['fqdn'];
bernd Aliases editieren

bernd authored 16 years ago

287)   
288)   $vhost = get_vhost_details( $alias['vhost'] );
289)   DEBUG($vhost);
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

290)   $vhost_string = $vhost['fqdn'];
bernd Aliases editieren

bernd authored 16 years ago

291)   
292)   $sure = user_is_sure();
293)   if ($sure === NULL)
294)   {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

295)     are_you_sure("action=deletealias&alias={$_GET['alias']}", "Möchten Sie das Alias »{$alias_string}« für die Subdomain »{$vhost_string}« wirklich löschen?");
bernd Aliases editieren

bernd authored 16 years ago

296)   }
297)   elseif ($sure === true)
298)   {
299)     delete_alias($alias['id']);
300)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

301)       header('Location: aliases?vhost='.$vhost['id']);
bernd Aliases editieren

bernd authored 16 years ago

302)   }
303)   elseif ($sure === false)
304)   {
305)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

306)       header('Location: aliases?vhost='.$vhost['id']);
bernd Aliases editieren

bernd authored 16 years ago

307)   }
308) }
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

309) elseif ($_GET['action'] == 'delete')
310) {
bernd Aliases editieren

bernd authored 16 years ago

311)   $title = "Subdomain löschen";
312)   $section = 'vhosts_vhosts';
313)   
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

314)   $vhost = get_vhost_details( (int) $_GET['vhost'] );
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

315)   $vhost_string = $vhost['fqdn'];
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

316)   
317)   $sure = user_is_sure();
318)   if ($sure === NULL)
319)   {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

320)     are_you_sure("action=delete&vhost={$_GET['vhost']}", "Möchten Sie die Subdomain »{$vhost_string}« wirklich löschen?");
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

321)   }
322)   elseif ($sure === true)
323)   {
324)     delete_vhost($vhost['id']);
325)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

326)       header("Location: vhosts");
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

327)   }
328)   elseif ($sure === false)
329)   {
330)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

331)       header("Location: vhosts");