56c4c2ac039e0ccd1f92cc10bc9e4bebe63210bd
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 Einige notices (undefined i...

bernd authored 14 years ago

14) $id = (isset($_GET['vhost']) ? (int) $_GET['vhost'] : 0);
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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 Einige notices (undefined i...

bernd authored 14 years ago

103) $errorlog = ($vhost['errorlog'] == 1 ? ' 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 Vorbereitung für PHP 5.3

bernd authored 14 years ago

135) $options = array("none" => 'ausgeschaltet', "fastcgi" => "PHP 5.2", "php53" => 'Testbetrieb: PHP 5.3');
136) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

137) if ($vhost['php'] == 'mod_php')
138) {
bernd Vorbereitung für PHP 5.3

bernd authored 14 years ago

139)   $options['mod_php'] = 'PHP als Apache-Modul (veraltet)';
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

140) }
bernd Vorbereitung für PHP 5.3

bernd authored 14 years ago

141) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

142) $form .= "
143) <div class=\"vhostoptions\" id=\"options_scriptlang\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
144)   <h5>PHP</h5>
145)   <div style=\"margin-left: 2em;\">
bernd Vorbereitung für PHP 5.3

bernd authored 14 years ago

146)     ".html_select("php", $options, $vhost['php'])."
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

147)   </div>
148) </div>
149) ";
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

150) 
bernd mod_php deprecated, zwang z...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

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

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 15 years ago

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

bernd authored 16 years ago

163) <h4>Verwendung</h4>
164)         <div style=\"margin-left: 2em;\">
165) 	  <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

166) ";
167) if ($vhost_type=='webapp')
168) {
169)   // Wird nur noch angezeigt wenn der Vhost schon auf webapp konfiguriert ist, ansonsten nicht.
170)   // Die User sollen den Webapp-Installer benutzen.
171)   $form .= "
bernd Gloable Webapps weiter hoch

bernd authored 16 years ago

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

173) ";
174) }
175) $form .= "
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 />
bernd R.I.P. Shared-Drupal

bernd authored 15 years ago

180) <br />
181) <br />
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

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

bernd authored 16 years ago

183) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

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

bernd authored 16 years ago

185) <div style=\"margin-left: 2em;\">
186)     <h5>SSL-Verschlüsselung</h5>
187)     <div style=\"margin-left: 2em;\">
188)     <select name=\"ssl\" id=\"ssl\">
bernd SSL auch über webinterface...

bernd authored 16 years ago

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

bernd authored 16 years ago

194)     </div>
195)     <h5>Logfiles <span class=\"warning\">*</span></h5>
196)     <div style=\"margin-left: 2em;\">
197)       <select name=\"logtype\" id=\"logtype\">
198)         <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
199)         <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
200)         <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
201)       </select><br />
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

202)       <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&#160;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label><br />
203)       <input type=\"checkbox\" id=\"stats\" name=\"stats\" value=\"1\" ".($vhost['stats'] != NULL ? ' checked="checked" ' : '')." />&#160;<label for=\"stats\">Statistiken/Auswertungen erzeugen</label>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

204)     </div>
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

205)     <p>Logfiles werden unter <b>/var/log/apache2/".$_SESSION['userinfo']['username']."</b> abgelegt.</p>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

206) </div>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 16 years ago

208) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

209) $ipaddrs = user_ipaddrs();
210) $certs = user_certs();
211) 
212) if (count($ipaddrs) || count($certs))
213) {
214)   $form .= "
215) <h4 style=\"margin-top: 3em;\">Erweiterte Optionen</h4>
216) <div style=\"margin-left: 2em;\">
217) ";
218)   if (count($certs))
219)   {
220)     $certselect = array(0 => 'kein Zertifikat / System-Standard benutzen');
221)     foreach ($certs as $c)
222)     {
223)       $certselect[$c['id']] = $c['subject'];
224)     }
225)     $form .= "
226)       <h5>verwendetes SSL-Zertifikat</h5>
227)       <div style=\"margin-left: 2em;\">
228)       ".html_select('cert', $certselect, $vhost['certid'])."
229)       </div>";
230)   }
bernd IP-Adressen aktivieren

bernd authored 14 years ago

231)   if (count($ipaddrs))
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

232)   {
233)     $ipselect = array(0 => 'System-Standard');
234)     foreach ($ipaddrs AS $i)
235)     {
236)       $ipselect[$i] = $i;
237)     }
238)     $form .= "
239)       <h5>IP-Adresse</h5>
240)       <div style=\"margin-left: 2em;\">
bernd IP-Adressen aktivieren

bernd authored 14 years ago

241)       ".html_select('ipv4', $ipselect, $vhost['ipv4'])."
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

242)       </div>";
bernd IP-Adressen aktivieren

bernd authored 14 years ago

243)   } 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

244)   $form .= "</div>";
245) }
246) 
247) 
248) 
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

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

bernd authored 15 years ago

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

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

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

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

bernd authored 15 years ago

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