832d06daf74fc231d8df84cd171f3305d5c40f72
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\">
29)   
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();
42)     document.getElementById('defaultdocroot').firstChild.nodeValue = 'websites/' + hostname + '/htdocs';
43)     useDefaultDocroot();
44)   }
45)   
46)   function useDefaultDocroot() {
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) {
51)       document.getElementById('docroot').value = document.getElementById('defaultdocroot').firstChild.nodeValue;
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 VHosts-Modul mit neuem Layo...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

90) 
91) $vhost_type = 'regular';
92) if ($vhost['is_dav'])
93)   $vhost_type = 'dav';
94) elseif ($vhost['is_svn'])
95)   $vhost_type = 'svn';
96) elseif ($vhost['is_webapp'])
97)   $vhost_type = 'webapp';
98) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

100) <h4 style=\"margin-top: 2em;\">Name des VHost</h4>
101)     <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()"');
102) $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label></div>
103) 
104) <div id=\"options_regular\" style=\"margin-left: 2em; position: absolute; left: 45em; ".($vhost_type=='regular' ? '' : 'display: none;')."\">
105)   <h4>Optionen</h4>
106)   <h5>Speicherort für Dateien (»Document Root«)</h5>
107)   <div style=\"margin-left: 2em;\">
108)     <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

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

110)   </div>
111)   <h5>Script-Sprache</h5>
112)   <div style=\"margin-left: 2em;\">
113)     <select name=\"php\" id=\"php\">
114)       <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >keine Scriptsprache</option>
115)       <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >PHP als Apache-Modul</option>
116)       <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >PHP als FastCGI</option>
117)       <option value=\"rubyonrails\" ".($vhost['php'] == 'rubyonrails' ? 'selected="selected"' : '')." >Ruby-on-Rails</option>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 16 years ago

119)   </div>
120) </div>
121) 
122) <div id=\"options_webapp\" style=\"margin-left: 2em; position: absolute; left: 45em; ".($vhost_type=='webapp' ? '' : 'display: none;')."\">
123)   <h4>Optionen</h4>
124)   <h5>Anwendung</h5>
125)   <select name=\"webapp\" id=\"webapp\" size=\"1\"><option value=\"drupal-5\">Drupal 5.x</option></select>
126) </div>
127) 
128) <h4>Verwendung</h4>
129)         <div style=\"margin-left: 2em;\">
130) 	  <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 />
131) 	  <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 />
132) 	  <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 />
133) 	  <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>
134) 	</div>
135) 
136) <h4 style=\"margin-top: 3em;\">Allgemeine Optionen</h4>
137) <div style=\"margin-left: 2em;\">
138)     <h5>SSL-Verschlüsselung</h5>
139)     <div style=\"margin-left: 2em;\">
140)     <select name=\"ssl\" id=\"ssl\">
bernd SSL auch über webinterface...

bernd authored 16 years ago

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

bernd authored 16 years ago

146)     </div>
147)     <h5>Logfiles <span class=\"warning\">*</span></h5>
148)     <div style=\"margin-left: 2em;\">
149)       <select name=\"logtype\" id=\"logtype\">
150)         <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
151)         <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
152)         <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
153)       </select><br />
154)       <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&#160;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label>
155)     </div>
156) </div>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

159) $form .= '
bernd Entities repariert

bernd authored 16 years ago

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

bernd authored 16 years ago

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

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

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