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

bernd authored 16 years ago

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

bernd authored 16 years ago

29)   var default_docroot;
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 vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

43)     default_docroot = 'websites/' + hostname + '/htdocs';
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

44)     useDefaultDocroot();
45)   }
46)   
47)   function useDefaultDocroot() {
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'])
82)   $defaultdocroot = $_SESSION['userinfo']['username'].'.schokokeks.org';
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

83) if ($vhost['hostname'])
84)   $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot;
85) 
86) $defaultdocroot = 'websites/'.$defaultdocroot.'/htdocs';
87) 
88) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/'.$defaultdocroot == $vhost['docroot']);
89) 
90) $docroot = '';
91) if ($vhost['docroot'] == '')
92)   $docroot = $defaultdocroot;
93) else
94)   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'])+1);
95) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

98) 
99) $vhost_type = 'regular';
100) if ($vhost['is_dav'])
101)   $vhost_type = 'dav';
102) elseif ($vhost['is_svn'])
103)   $vhost_type = 'svn';
104) elseif ($vhost['is_webapp'])
105)   $vhost_type = 'webapp';
106) 
bernd Webapps implementiert

bernd authored 16 years ago

107) $applist = list_available_webapps();
108) $webapp_options = '';
109) foreach ($applist as $app)
110)   $webapp_options .= "<option value=\"{$app['id']}\">{$app['displayname']}</option>\n";
111) 
112) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

120)   <h4>Optionen</h4>
121)   <h5>Speicherort für Dateien (»Document Root«)</h5>
122)   <div style=\"margin-left: 2em;\">
123)     <input type=\"checkbox\" id=\"use_default_docroot\" name=\"use_default_docroot\" value=\"1\" onclick=\"useDefaultDocroot()\" ".($is_default_docroot ? 'checked="checked" ' : '')."/>&#160;<label for=\"use_default_docroot\">Standardeinstellung benutzen</label><br />
bernd Entities repariert

bernd authored 16 years ago

124)     <strong>".$vhost['homedir']."/</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

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

bernd authored 16 years ago

126) </div>
127) 
128) <div class=\"vhostoptions\" id=\"options_scriptlang\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

129)   <h5>Script-Sprache</h5>
130)   <div style=\"margin-left: 2em;\">
131)     <select name=\"php\" id=\"php\">
132)       <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >keine Scriptsprache</option>
133)       <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >PHP als Apache-Modul</option>
134)       <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >PHP als FastCGI</option>
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

137)   </div>
138) </div>
139) 
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

147) </div>
148) 
149) <h4>Verwendung</h4>
150)         <div style=\"margin-left: 2em;\">
151) 	  <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

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

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

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

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

bernd authored 16 years ago

156) <br />
157) </div>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

158) 
159) <h4 style=\"margin-top: 3em;\">Allgemeine Optionen</h4>
160) <div style=\"margin-left: 2em;\">
161)     <h5>SSL-Verschlüsselung</h5>
162)     <div style=\"margin-left: 2em;\">
163)     <select name=\"ssl\" id=\"ssl\">
bernd SSL auch über webinterface...

bernd authored 16 years ago

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

bernd authored 16 years ago

169)     </div>
170)     <h5>Logfiles <span class=\"warning\">*</span></h5>
171)     <div style=\"margin-left: 2em;\">
172)       <select name=\"logtype\" id=\"logtype\">
173)         <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
174)         <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
175)         <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
176)       </select><br />
177)       <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&#160;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label>
178)     </div>
179) </div>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

182) $form .= '
bernd Entities repariert

bernd authored 16 years ago

183)   <p><input type="submit" value="Speichern" />&#160;&#160;&#160;&#160;'.internal_link('vhosts.php', 'Abbrechen').'</p>
bernd typo

bernd authored 16 years ago

184)   <p class="warning"><span class="warning">*</span>Es ist im Moment Gegenstand gerichtlicher Außeinandersetzungen, ob die Speicherung von Logfiles auf Webservern
bernd warnung bzgl. logfiles eing...

bernd authored 16 years ago

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

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