c61521fa744024963e46a2d89065740866edfa98
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

1) <?php
2) 
3) require_once('inc/debug.php');
4) require_once('inc/security.php');
5) 
6) require_once('vhosts.php');
7) 
bernd Aliases editieren

bernd authored 16 years ago

8) $title = "Subdomain bearbeiten";
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

9) $section = 'vhosts_vhosts';
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

10) 
11) require_role(ROLE_SYSTEMUSER);
12) 
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

13) $id = (int) $_GET['vhost'];
14) $vhost = empty_vhost();
15) 
16) if ($id != 0)
17)   $vhost = get_vhost_details($id);
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

18) 
19) DEBUG($vhost);
bernd Aliases editieren

bernd authored 16 years ago

20) if ($id == 0) {
21)   output("<h3>Neue Subdomain anlegen</h3>");
22)   $title = "Subdomain anlegen";
23) }
24) else {
25)   output("<h3>Subdomain bearbeiten</h3>");
26) }
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

27) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

28) html_header("<script type=\"text/javascript\">
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

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

bernd authored 16 years ago

30)   function selectedDomain() {
31)     var selected;
32)     selected=document.getElementById('domain').options.selectedIndex;
33)     return document.getElementById('domain').options.item(selected).text;
34)     }
35)   
36)   function defaultDocumentRoot() {
37)     var hostname;
38)     if (document.getElementById('hostname').value == '') 
39)       hostname = selectedDomain();
40)     else
41)       hostname = document.getElementById('hostname').value + '.' + selectedDomain();
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

42)     var default_docroot = hostname + '/htdocs';
43)     useDefaultDocroot(default_docroot);
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

44)   }
45)   
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

46)   function useDefaultDocroot( default_docroot ) {
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

47)     var do_it = (document.getElementById('use_default_docroot').checked == true);
48)     var inputfield = document.getElementById('docroot');
49)     inputfield.disabled = do_it;
50)     if (do_it) {
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

51)       document.getElementById('docroot').value = default_docroot;
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

52)     }
53)   }
bernd Erster Versuch, SVN, DAV un...

bernd authored 16 years ago

54)   
55)   function showAppropriateLines() {
56)     if (document.getElementById('vhost_type_regular').checked == true) {
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

57)       document.getElementById('options_docroot').style.display = 'block';
58)       document.getElementById('options_scriptlang').style.display = 'block';
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

59)       document.getElementById('options_webapp').style.display = 'none';
bernd Erster Versuch, SVN, DAV un...

bernd authored 16 years ago

60)     }
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

61)     else if (document.getElementById('vhost_type_dav').checked == true) { 
62)       document.getElementById('options_docroot').style.display = 'block';
63)       document.getElementById('options_scriptlang').style.display = 'none';
64)       document.getElementById('options_webapp').style.display = 'none';
65)     }
66)     else if (document.getElementById('vhost_type_svn').checked == true) {
67)       document.getElementById('options_docroot').style.display = 'none';
68)       document.getElementById('options_scriptlang').style.display = 'none';
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

69)       document.getElementById('options_webapp').style.display = 'none';
bernd Erster Versuch, SVN, DAV un...

bernd authored 16 years ago

70)     }
71)     else if (document.getElementById('vhost_type_webapp').checked == true) {
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

72)       document.getElementById('options_docroot').style.display = 'none';
73)       document.getElementById('options_scriptlang').style.display = 'none';
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

74)       document.getElementById('options_webapp').style.display = 'block';
bernd Erster Versuch, SVN, DAV un...

bernd authored 16 years ago

75)     }
76)   }
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

77)   </script>");
78) 
79) $defaultdocroot = $vhost['domain'];
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

80) if (! $vhost['domain'])
81)   $defaultdocroot = $_SESSION['userinfo']['username'].'.schokokeks.org';
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

82) if ($vhost['hostname'])
83)   $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot;
84) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

85) $defaultdocroot = $defaultdocroot.'/htdocs';
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

86) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

87) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/websites/'.$defaultdocroot == $vhost['docroot']);
88) 
89) if ($vhost['docroot'] != '' && ! strstr($vhost['docroot'], '/websites/'))
90) {
91)   warning("Sie verwenden einen Speicherplatz außerhalb von »~/websites/«. Diese Einstellung ist momentan nicht mehr gestattet. Ihre Einstellung wurde daher auf die Standardeinstellung zurückgesetzt. Prüfen Sie dies bitte und verschieben Sie ggf. ihre Dateien.");
92)   $is_default_docroot = True;
93) }
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

94) 
95) $docroot = '';
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

96) if ($is_default_docroot)
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

97)   $docroot = $defaultdocroot;
98) else
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

99)   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'].'/websites/'));
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

100) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

101) $s = (strstr($vhost['options'], 'aliaswww') ? ' checked="checked" ' : '');
bernd error_log konfigurierbar

bernd authored 16 years ago

102) $errorlog = (strstr($vhost['errorlog'], 'on') ? ' checked="checked" ' : '');
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

103) 
104) $vhost_type = 'regular';
105) if ($vhost['is_dav'])
106)   $vhost_type = 'dav';
107) elseif ($vhost['is_svn'])
108)   $vhost_type = 'svn';
109) elseif ($vhost['is_webapp'])
110)   $vhost_type = 'webapp';
111) 
bernd Webapps implementiert

bernd authored 16 years ago

112) $applist = list_available_webapps();
113) $webapp_options = '';
114) foreach ($applist as $app)
115)   $webapp_options .= "<option value=\"{$app['id']}\">{$app['displayname']}</option>\n";
116) 
117) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

118) $form = "
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

119) <h4 style=\"margin-top: 2em;\">Name des VHost</h4>
bernd Schon beim tippen ändern, n...

bernd authored 16 years ago

120)     <div style=\"margin-left: 2em;\"><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" onkeyup=\"defaultDocumentRoot()\"  onchange=\"defaultDocumentRoot()\" /><strong>.</strong>".domainselect($vhost['domain_id'], 'onchange="defaultDocumentRoot()"');
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

121) $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label></div>
122) 
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

123) <div class=\"vhostsidebyside\">
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

124) <div class=\"vhostoptions\" id=\"options_docroot\" ".($vhost_type=='regular' || $vhost_type=='dav' ? '' : 'style="display: none;"').">
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

125)   <h4>Optionen</h4>
126)   <h5>Speicherort für Dateien (»Document Root«)</h5>
127)   <div style=\"margin-left: 2em;\">
bernd Fix bug #488

bernd authored 15 years ago

128)     <input type=\"checkbox\" id=\"use_default_docroot\" name=\"use_default_docroot\" value=\"1\" onclick=\"defaultDocumentRoot()\" ".($is_default_docroot ? 'checked="checked" ' : '')."/>&#160;<label for=\"use_default_docroot\">Standardeinstellung benutzen</label><br />
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

129)     <strong>".$vhost['homedir']."/websites/</strong>&#160;<input type=\"text\" id=\"docroot\" name=\"docroot\" size=\"30\" value=\"".$docroot."\" ".($is_default_docroot ? 'disabled="disabled" ' : '')."/>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

130)   </div>
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

131) </div>
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

132) ";
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

133) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

134) if ($vhost['php'] == 'mod_php')
135) {
136) $form .= "
bernd Docroot auch bei WebDAV anz...

bernd authored 16 years ago

137) <div class=\"vhostoptions\" id=\"options_scriptlang\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

138)   <h5>PHP</h5>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

139)   <div style=\"margin-left: 2em;\">
140)     <select name=\"php\" id=\"php\">
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

141)       <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >ausgeschaltet</option>
142)       <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >Eingeschaltet als Apache-Modul (veraltet)</option>
143)       <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >Eingeschaltet</option>
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

144)       <!--  <option value=\"rubyonrails\" ".($vhost['php'] == 'rubyonrails' ? 'selected="selected"' : '')." >Ruby-on-Rails</option> -->
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

145)     </select>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

146)   </div>
147) </div>
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

148) ";
149) }
150) else
151) {
152) $form .= "
153) <div class=\"vhostoptions\" id=\"options_scriptlang\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
154)   <h5>PHP</h5>
155)   <div style=\"margin-left: 2em;\">
156)     <input type=\"checkbox\" name=\"php\" id=\"php\" value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'checked="checked" ' : '')." />&#160;<label for=\"php\">PHP aktivieren</label>
157)   </div>
158) </div>
159) ";
160) }
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

161) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

162) $form .= "
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

163) <div class=\"vhostoptions\" id=\"options_webapp\" ".($vhost_type=='webapp' ? '' : 'style="display: none;"').">
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

164)   <h4>Optionen</h4>
165)   <h5>Anwendung</h5>
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

166)   <select name=\"webapp\" id=\"webapp\" size=\"1\">
bernd Webapps implementiert

bernd authored 16 years ago

167)     {$webapp_options}
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

168)   </select>
bernd Info-Text über E-mail mit Z...

bernd authored 16 years ago

169)   <p>Wenn Sie diese Option wählen, wird die Anwendung automatisch eingerichtet. Sie erhalten dann ihre Zugangsdaten per E-Mail.</p>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

170) </div>
171) 
172) <h4>Verwendung</h4>
173)         <div style=\"margin-left: 2em;\">
174) 	  <input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_regular\" value=\"regular\" ".(($vhost_type=='regular') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_regular\">&#160;Normal (selbst Dateien hinterlegen)</label><br />
bernd Gloable Webapps weiter hoch

bernd authored 16 years ago

175) 	  <input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_webapp\" value=\"webapp\" ".(($vhost_type=='webapp') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_webapp\">&#160;Eine vorgefertigte Applikation nutzen</label><br />
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

176) 	  <input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_dav\" value=\"dav\" ".(($vhost_type=='dav') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_dav\">&#160;WebDAV</label><br />
bernd Gloable Webapps weiter hoch

bernd authored 16 years ago

177) 	  <input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_svn\" value=\"svn\" ".(($vhost_type=='svn') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_svn\">&#160;Subversion-Server</label>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

178) 	</div>
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

179) <br />
180) </div>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

181) 
182) <h4 style=\"margin-top: 3em;\">Allgemeine Optionen</h4>
183) <div style=\"margin-left: 2em;\">
184)     <h5>SSL-Verschlüsselung</h5>
185)     <div style=\"margin-left: 2em;\">
186)     <select name=\"ssl\" id=\"ssl\">
bernd SSL auch über webinterface...

bernd authored 16 years ago

187)       <option value=\"none\" ".($vhost['ssl'] == NULL ? 'selected="selected"' : '')." >SSL optional anbieten</option>
188)       <option value=\"http\" ".($vhost['ssl'] == 'http' ? 'selected="selected"' : '')." >kein SSL</option>
189)       <option value=\"https\" ".($vhost['ssl'] == 'https' ? 'selected="selected"' : '')." >nur SSL</option>
190)       <option value=\"forward\" ".($vhost['ssl'] == 'forward' ? 'selected="selected"' : '')." >Immer auf SSL umleiten</option>
191)     </select>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

192)     </div>
193)     <h5>Logfiles <span class=\"warning\">*</span></h5>
194)     <div style=\"margin-left: 2em;\">
195)       <select name=\"logtype\" id=\"logtype\">
196)         <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
197)         <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
198)         <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
199)       </select><br />
200)       <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&#160;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label>
201)     </div>
202) </div>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

203)     ";
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

204) 
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

205) $form .= '
bernd eliminate .php extensions f...

bernd authored 15 years ago

206)   <p><input type="submit" value="Speichern" />&#160;&#160;&#160;&#160;'.internal_link('vhosts', 'Abbrechen').'</p>
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

207)   <p class="warning"><span class="warning">*</span>Es ist im Moment fraglich, ob die Speicherung von Logfiles mit IP-Adressen auf Webservern
bernd warnung bzgl. logfiles eing...

bernd authored 16 years ago

208)   zulässig ist. Wir weisen alle Nutzer darauf hin, dass sie selbst dafür verantwortlich sind, bei geloggten Nutzerdaten die
209)   Seitenbesucher darauf hinzuweisen. Wir empfehlen, wenn möglich, Logfiles abzuschalten oder anonymes Logging einzusetzen.</p>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

210) ';
bernd eliminate .php extensions f...

bernd authored 15 years ago

211) output(html_form('vhosts_edit_vhost', 'save', 'action=edit&vhost='.$vhost['id'], $form));