3c2fddcaeffccc83c138202d47d97e789a9826f1
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 VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

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

bernd authored 16 years ago

60)     }
61)     else if ((document.getElementById('vhost_type_dav').checked == true) || 
62)          (document.getElementById('vhost_type_svn').checked == true)) {
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

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

bernd authored 16 years ago

65)     }
66)     else if (document.getElementById('vhost_type_webapp').checked == true) {
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

67)       document.getElementById('options_regular').style.display = 'none';
68)       document.getElementById('options_webapp').style.display = 'block';
bernd Erster Versuch, SVN, DAV un...

bernd authored 16 years ago

69)     }
70)   }
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

71)   </script>");
72) 
73) $defaultdocroot = $vhost['domain'];
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

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

bernd authored 16 years ago

76) if ($vhost['hostname'])
77)   $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot;
78) 
79) $defaultdocroot = 'websites/'.$defaultdocroot.'/htdocs';
80) 
81) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/'.$defaultdocroot == $vhost['docroot']);
82) 
83) $docroot = '';
84) if ($vhost['docroot'] == '')
85)   $docroot = $defaultdocroot;
86) else
87)   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'])+1);
88) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

91) 
92) $vhost_type = 'regular';
93) if ($vhost['is_dav'])
94)   $vhost_type = 'dav';
95) elseif ($vhost['is_svn'])
96)   $vhost_type = 'svn';
97) elseif ($vhost['is_webapp'])
98)   $vhost_type = 'webapp';
99) 
bernd Webapps implementiert

bernd authored 16 years ago

100) $applist = list_available_webapps();
101) $webapp_options = '';
102) foreach ($applist as $app)
103)   $webapp_options .= "<option value=\"{$app['id']}\">{$app['displayname']}</option>\n";
104) 
105) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

107) <h4 style=\"margin-top: 2em;\">Name des VHost</h4>
108)     <div style=\"margin-left: 2em;\"><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" onchange=\"defaultDocumentRoot()\" /><strong>.</strong>".domainselect($vhost['domain_id'], 'onchange="defaultDocumentRoot()"');
109) $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label></div>
110) 
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

111) <div class=\"vhostsidebyside\">
112) <div class=\"vhostoptions\" id=\"options_regular\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

113)   <h4>Optionen</h4>
114)   <h5>Speicherort für Dateien (»Document Root«)</h5>
115)   <div style=\"margin-left: 2em;\">
116)     <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

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

118)   </div>
119)   <h5>Script-Sprache</h5>
120)   <div style=\"margin-left: 2em;\">
121)     <select name=\"php\" id=\"php\">
122)       <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >keine Scriptsprache</option>
123)       <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >PHP als Apache-Modul</option>
124)       <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >PHP als FastCGI</option>
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

127)   </div>
128) </div>
129) 
bernd vhost-Modul kann jetzt SVN-...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

136) </div>
137) 
138) <h4>Verwendung</h4>
139)         <div style=\"margin-left: 2em;\">
140) 	  <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 />
141) 	  <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 />
142) 	  <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><br />
bernd Webapps implementiert

bernd authored 16 years ago

143) 	  <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>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

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

bernd authored 16 years ago

145) <br />
146) </div>
bernd VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

147) 
148) <h4 style=\"margin-top: 3em;\">Allgemeine Optionen</h4>
149) <div style=\"margin-left: 2em;\">
150)     <h5>SSL-Verschlüsselung</h5>
151)     <div style=\"margin-left: 2em;\">
152)     <select name=\"ssl\" id=\"ssl\">
bernd SSL auch über webinterface...

bernd authored 16 years ago

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

bernd authored 16 years ago

158)     </div>
159)     <h5>Logfiles <span class=\"warning\">*</span></h5>
160)     <div style=\"margin-left: 2em;\">
161)       <select name=\"logtype\" id=\"logtype\">
162)         <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
163)         <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
164)         <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
165)       </select><br />
166)       <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&#160;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label>
167)     </div>
168) </div>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

171) $form .= '
bernd Entities repariert

bernd authored 16 years ago

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

bernd authored 16 years ago

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

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

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