709c9ea228a4039610d5aaafd0a4464e1f7b443e
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'];
57) if ($vhost['hostname'])
58)   $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot;
59) 
60) $defaultdocroot = 'websites/'.$defaultdocroot.'/htdocs';
61) 
62) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/'.$defaultdocroot == $vhost['docroot']);
63) 
64) $docroot = '';
65) if ($vhost['docroot'] == '')
66)   $docroot = $defaultdocroot;
67) else
68)   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'])+1);
69) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

75)     <td><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" onchange=\"defaultDocumentRoot()\" /><strong>.</strong>".domainselect($vhost['domain_id'], 'onchange="defaultDocumentRoot()"');
76) $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>
77)     <tr><td>Lokaler Pfad</td>
78)     <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 />
79)     <strong>".$vhost['homedir']."/</strong>&nbsp;<input type=\"text\" id=\"docroot\" name=\"docroot\" size=\"30\" value=\"".$docroot."\" ".($is_default_docroot ? 'disabled="disabled" ' : '')."/>
80)     </td>
81)     <td id=\"defaultdocroot\">{$defaultdocroot}</td></tr>
82)     <tr><td>PHP</td>
83)     <td><select name=\"php\" id=\"php\">
84)       <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >kein PHP</option>
85)       <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >als Apache-Modul</option>
86)       <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >FastCGI</option>
87)     </select>
88)     </td>
89)     <td id=\"defaultphp\">als Apache-Modul</td></tr>
90)     <tr>
91)       <td>Logfiles</td>
92)       <td><select name=\"logtype\" id=\"logtype\">
93)       <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
94)       <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
95)       <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
96)     </select>
97)     </td>
98)     <td id=\"defaultlogtype\">keine Logfiles</td></tr>
99)     ";
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

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