8d92bc6da2d5b83b63bab9844cf3cd80af76fdb3
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) 
8) $title = "VHost 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);
20) output("<h3>VHost bearbeiten</h3>");
21) 
bernd VHosts können bearbeitet we...

bernd authored 16 years ago

22) output("<script type=\"text/javascript\">
23)   
24)   function selectedDomain() {
25)     var selected;
26)     selected=document.getElementById('domain').options.selectedIndex;
27)     return document.getElementById('domain').options.item(selected).text;
28)     }
29)   
30)   function defaultDocumentRoot() {
31)     var hostname;
32)     if (document.getElementById('hostname').value == '') 
33)       hostname = selectedDomain();
34)     else
35)       hostname = document.getElementById('hostname').value + '.' + selectedDomain();
36)     document.getElementById('defaultdocroot').firstChild.nodeValue = 'websites/' + hostname + '/htdocs';
37)     useDefaultDocroot();
38)   }
39)   
40)   function useDefaultDocroot() {
41)     var do_it = (document.getElementById('use_default_docroot').checked == true);
42)     var inputfield = document.getElementById('docroot');
43)     inputfield.disabled = do_it;
44)     if (do_it) {
45)       document.getElementById('docroot').value = document.getElementById('defaultdocroot').firstChild.nodeValue;
46)     }
47)   }
48)   </script>");
49) 
50) $defaultdocroot = $vhost['domain'];
51) if ($vhost['hostname'])
52)   $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot;
53) 
54) $defaultdocroot = 'websites/'.$defaultdocroot.'/htdocs';
55) 
56) $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/'.$defaultdocroot == $vhost['docroot']);
57) 
58) $docroot = '';
59) if ($vhost['docroot'] == '')
60)   $docroot = $defaultdocroot;
61) else
62)   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'])+1);
63) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

95) $form .= '</table>
96)   <p><input type="submit" value="Änderungen speichern" />&nbsp;&nbsp;&nbsp;&nbsp;'.internal_link('vhosts.php', 'Ohne Speichern zurück').'</p>
97) ';
98) output(html_form('vhosts_edit_vhost', 'save.php', 'action=edit&vhost='.$vhost['id'], $form));