1ab9db55d272aaa37a76d7a5c179e55c2ca52267
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');
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

7) require_once('certs.php');
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

8) 
bernd Aliases editieren

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

28) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

81) if (! $vhost['domain'])
bernd Mehr config-optionen und co...

bernd authored 14 years ago

82)   $defaultdocroot = $_SESSION['userinfo']['username'].'.'.config('masterdomain');
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

87) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

88) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/websites/'.$defaultdocroot == $vhost['docroot']);
89) 
90) if ($vhost['docroot'] != '' && ! strstr($vhost['docroot'], '/websites/'))
91) {
92)   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.");
93)   $is_default_docroot = True;
94) }
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

121)     <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

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

bernd authored 16 years ago

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

bernd authored 16 years ago

125) <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

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

bernd authored 15 years ago

129)     <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

130)     <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

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

134) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

162) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

170)   <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

171) </div>
bernd R.I.P. Shared-Drupal

bernd authored 15 years ago

172) ";
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

173) 
bernd R.I.P. Shared-Drupal

bernd authored 15 years ago

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

bernd authored 16 years ago

175) <h4>Verwendung</h4>
176)         <div style=\"margin-left: 2em;\">
177) 	  <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 R.I.P. Shared-Drupal

bernd authored 15 years ago

178) ";
179) if ($vhost_type=='webapp')
180) {
181)   // Wird nur noch angezeigt wenn der Vhost schon auf webapp konfiguriert ist, ansonsten nicht.
182)   // Die User sollen den Webapp-Installer benutzen.
183)   $form .= "
bernd Gloable Webapps weiter hoch

bernd authored 16 years ago

184) 	  <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 R.I.P. Shared-Drupal

bernd authored 15 years ago

185) ";
186) }
187) $form .= "
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

188) 	  <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

189) 	  <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

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

bernd authored 16 years ago

191) <br />
bernd R.I.P. Shared-Drupal

bernd authored 15 years ago

192) <br />
193) <br />
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

194) </div>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

195) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

196) <h4 style=\"clear: right; margin-top: 3em;\">Allgemeine Optionen</h4>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

197) <div style=\"margin-left: 2em;\">
198)     <h5>SSL-Verschlüsselung</h5>
199)     <div style=\"margin-left: 2em;\">
200)     <select name=\"ssl\" id=\"ssl\">
bernd SSL auch über webinterface...

bernd authored 16 years ago

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

bernd authored 16 years ago

206)     </div>
207)     <h5>Logfiles <span class=\"warning\">*</span></h5>
208)     <div style=\"margin-left: 2em;\">
209)       <select name=\"logtype\" id=\"logtype\">
210)         <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
211)         <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
212)         <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
213)       </select><br />
214)       <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&#160;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label>
215)     </div>
216) </div>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 16 years ago

218) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

219) $ipaddrs = user_ipaddrs();
220) $certs = user_certs();
221) 
222) if (count($ipaddrs) || count($certs))
223) {
224)   $form .= "
225) <h4 style=\"margin-top: 3em;\">Erweiterte Optionen</h4>
226) <div style=\"margin-left: 2em;\">
227) ";
228)   if (count($certs))
229)   {
230)     $certselect = array(0 => 'kein Zertifikat / System-Standard benutzen');
231)     foreach ($certs as $c)
232)     {
233)       $certselect[$c['id']] = $c['subject'];
234)     }
235)     $form .= "
236)       <h5>verwendetes SSL-Zertifikat</h5>
237)       <div style=\"margin-left: 2em;\">
238)       ".html_select('cert', $certselect, $vhost['certid'])."
239)       </div>";
240)   }
241)  /* if (count($ipaddrs))
242)   {
243)     $ipselect = array(0 => 'System-Standard');
244)     foreach ($ipaddrs AS $i)
245)     {
246)       $ipselect[$i] = $i;
247)     }
248)     $form .= "
249)       <h5>IP-Adresse</h5>
250)       <div style=\"margin-left: 2em;\">
251)       ".html_select('ipaddr', $ipselect, $vhost['ipaddr'])."
252)       </div>";
253)   } */
254)   $form .= "</div>";
255) }
256) 
257) 
258) 
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

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

bernd authored 15 years ago

260)   <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

261)   <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

262)   zulässig ist. Wir weisen alle Nutzer darauf hin, dass sie selbst dafür verantwortlich sind, bei geloggten Nutzerdaten die
263)   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

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

bernd authored 15 years ago

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