fc35e6982695ba56c5da53c14ecfeb9e7b43d198
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)   }
54)   </script>");
55) 
56) $defaultdocroot = $vhost['domain'];
bernd domain = NULL ==> user-subd...

bernd authored 16 years ago

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

bernd authored 16 years ago

59) if ($vhost['hostname'])
60)   $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot;
61) 
62) $defaultdocroot = 'websites/'.$defaultdocroot.'/htdocs';
63) 
64) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/'.$defaultdocroot == $vhost['docroot']);
65) 
66) $docroot = '';
67) if ($vhost['docroot'] == '')
68)   $docroot = $defaultdocroot;
69) else
70)   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'])+1);
71) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

72) $s = (strstr($vhost['options'], 'aliaswww') ? ' checked="checked" ' : '');
73) $form = "
74)   <table>
75)     <tr><th>Einstellung</th><th>aktueller Wert</th><th>System-Standard</th></tr>
76)     <tr><td>Name</td>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

77)     <td><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" onchange=\"defaultDocumentRoot()\" /><strong>.</strong>".domainselect($vhost['domain_id'], 'onchange="defaultDocumentRoot()"');
78) $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label></td><td><em>keiner</em></td></tr>
79)     <tr><td>Lokaler Pfad</td>
80)     <td><input type=\"checkbox\" id=\"use_default_docroot\" name=\"use_default_docroot\" value=\"1\" onclick=\"useDefaultDocroot()\" ".($is_default_docroot ? 'checked="checked" ' : '')."/>&nbsp;<label for=\"use_default_docroot\">Standardeinstellung benutzen</label><br />
81)     <strong>".$vhost['homedir']."/</strong>&nbsp;<input type=\"text\" id=\"docroot\" name=\"docroot\" size=\"30\" value=\"".$docroot."\" ".($is_default_docroot ? 'disabled="disabled" ' : '')."/>
82)     </td>
83)     <td id=\"defaultdocroot\">{$defaultdocroot}</td></tr>
84)     <tr><td>PHP</td>
85)     <td><select name=\"php\" id=\"php\">
86)       <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >kein PHP</option>
87)       <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >als Apache-Modul</option>
88)       <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >FastCGI</option>
89)     </select>
90)     </td>
91)     <td id=\"defaultphp\">als Apache-Modul</td></tr>
bernd SSL auch über webinterface...

bernd authored 16 years ago

92)     <tr><td>SSL-Verschlüsselung</td>
93)     <td><select name=\"ssl\" id=\"ssl\">
94)       <option value=\"none\" ".($vhost['ssl'] == NULL ? 'selected="selected"' : '')." >SSL optional anbieten</option>
95)       <option value=\"http\" ".($vhost['ssl'] == 'http' ? 'selected="selected"' : '')." >kein SSL</option>
96)       <option value=\"https\" ".($vhost['ssl'] == 'https' ? 'selected="selected"' : '')." >nur SSL</option>
97)       <option value=\"forward\" ".($vhost['ssl'] == 'forward' ? 'selected="selected"' : '')." >Immer auf SSL umleiten</option>
98)     </select>
99)     </td>
100)     <td id=\"defaultssl\">SSL optional anbieten</td></tr>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

101)     <tr>
102)       <td>Logfiles</td>
103)       <td><select name=\"logtype\" id=\"logtype\">
104)       <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
105)       <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
106)       <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
107)     </select>
108)     </td>
109)     <td id=\"defaultlogtype\">keine Logfiles</td></tr>
110)     ";
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

112) $form .= '</table>
bernd Aliases editieren

bernd authored 16 years ago

113)   <p><input type="submit" value="Speichern" />&nbsp;&nbsp;&nbsp;&nbsp;'.internal_link('vhosts.php', 'Abbrechen').'</p>
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

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