bernd commited on 2007-12-05 14:59:33
Zeige 4 geänderte Dateien mit 91 Einfügungen und 66 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@836 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -54,20 +54,17 @@ output("<script type=\"text/javascript\"> |
54 | 54 |
|
55 | 55 |
function showAppropriateLines() { |
56 | 56 |
if (document.getElementById('vhost_type_regular').checked == true) { |
57 |
- document.getElementById('block_webapp').style.display = 'none'; |
|
58 |
- document.getElementById('block_localpath').style.display = ''; |
|
59 |
- document.getElementById('block_php').style.display = ''; |
|
57 |
+ document.getElementById('options_regular').style.display = 'block'; |
|
58 |
+ document.getElementById('options_webapp').style.display = 'none'; |
|
60 | 59 |
} |
61 | 60 |
else if ((document.getElementById('vhost_type_dav').checked == true) || |
62 | 61 |
(document.getElementById('vhost_type_svn').checked == true)) { |
63 |
- document.getElementById('block_webapp').style.display = 'none'; |
|
64 |
- document.getElementById('block_localpath').style.display = 'none'; |
|
65 |
- document.getElementById('block_php').style.display = 'none'; |
|
62 |
+ document.getElementById('options_regular').style.display = 'none'; |
|
63 |
+ document.getElementById('options_webapp').style.display = 'none'; |
|
66 | 64 |
} |
67 | 65 |
else if (document.getElementById('vhost_type_webapp').checked == true) { |
68 |
- document.getElementById('block_webapp').style.display = ''; |
|
69 |
- document.getElementById('block_localpath').style.display = 'none'; |
|
70 |
- document.getElementById('block_php').style.display = 'none'; |
|
66 |
+ document.getElementById('options_regular').style.display = 'none'; |
|
67 |
+ document.getElementById('options_webapp').style.display = 'block'; |
|
71 | 68 |
} |
72 | 69 |
} |
73 | 70 |
</script>"); |
... | ... |
@@ -90,62 +87,76 @@ else |
90 | 87 |
|
91 | 88 |
$s = (strstr($vhost['options'], 'aliaswww') ? ' checked="checked" ' : ''); |
92 | 89 |
$errorlog = (strstr($vhost['errorlog'], 'on') ? ' checked="checked" ' : ''); |
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 |
+ |
|
93 | 99 |
$form = " |
94 |
- <table> |
|
95 |
- <tr><th>Einstellung</th><th>aktueller Wert</th><th>System-Standard</th></tr> |
|
96 |
- <tr><td>Name</td> |
|
97 |
- <td><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" onchange=\"defaultDocumentRoot()\" /><strong>.</strong>".domainselect($vhost['domain_id'], 'onchange="defaultDocumentRoot()"'); |
|
98 |
-$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> |
|
99 |
- <tr><td>Verwendung</td> |
|
100 |
- <td> |
|
101 |
- <input onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_regular\" value=\"regular\" /><label for=\"vhost_type_regular\"> Normal (selbst Dateien hinterlegen)</label><br /> |
|
102 |
- <input onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_dav\" value=\"dav\" /><label for=\"vhost_type_dav\"> WebDAV</label><br /> |
|
103 |
- <input onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_svn\" value=\"svn\" /><label for=\"vhost_type_svn\"> Subversion-Server</label><br /> |
|
104 |
- <input onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_webapp\" value=\"webapp\" /><label for=\"vhost_type_webapp\"> Eine vorgefertigte Applikation nutzen</label> |
|
105 |
- </td> |
|
106 |
- <td> </td> |
|
107 |
- </tr> |
|
108 |
- <tr id=\"block_webapp\"> |
|
109 |
- <td>Vorgefertigte Applikation</td> |
|
110 |
- <td><select name=\"webapp\" size=\"1\"><option value=\"drupal-5\">Drupal 5.x</option></select> |
|
111 |
- </td> |
|
112 |
- <td> </td> |
|
113 |
- </tr> |
|
114 |
- <tr id=\"block_localpath\"><td>Lokaler Pfad</td> |
|
115 |
- <td><input type=\"checkbox\" id=\"use_default_docroot\" name=\"use_default_docroot\" value=\"1\" onclick=\"useDefaultDocroot()\" ".($is_default_docroot ? 'checked="checked" ' : '')."/> <label for=\"use_default_docroot\">Standardeinstellung benutzen</label><br /> |
|
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" ' : '')."/> <label for=\"use_default_docroot\">Standardeinstellung benutzen</label><br /> |
|
116 | 109 |
<strong>".$vhost['homedir']."/</strong> <input type=\"text\" id=\"docroot\" name=\"docroot\" size=\"30\" value=\"".$docroot."\" ".($is_default_docroot ? 'disabled="disabled" ' : '')."/> |
117 |
- </td> |
|
118 |
- <td id=\"defaultdocroot\">{$defaultdocroot}</td></tr> |
|
119 |
- <tr id=\"block_php\"><td>PHP</td> |
|
120 |
- <td><select name=\"php\" id=\"php\"> |
|
121 |
- <option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >kein PHP</option> |
|
122 |
- <option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >als Apache-Modul</option> |
|
123 |
- <option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >FastCGI</option> |
|
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> |
|
124 | 118 |
</select> |
125 |
- </td> |
|
126 |
- <td id=\"defaultphp\">als Apache-Modul</td></tr> |
|
127 |
- <tr><td>SSL-Verschlüsselung</td> |
|
128 |
- <td><select name=\"ssl\" id=\"ssl\"> |
|
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\"> 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\"> 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\"> 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\"> 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\"> |
|
129 | 141 |
<option value=\"none\" ".($vhost['ssl'] == NULL ? 'selected="selected"' : '')." >SSL optional anbieten</option> |
130 | 142 |
<option value=\"http\" ".($vhost['ssl'] == 'http' ? 'selected="selected"' : '')." >kein SSL</option> |
131 | 143 |
<option value=\"https\" ".($vhost['ssl'] == 'https' ? 'selected="selected"' : '')." >nur SSL</option> |
132 | 144 |
<option value=\"forward\" ".($vhost['ssl'] == 'forward' ? 'selected="selected"' : '')." >Immer auf SSL umleiten</option> |
133 | 145 |
</select> |
134 |
- </td> |
|
135 |
- <td id=\"defaultssl\">SSL optional anbieten</td></tr> |
|
136 |
- <tr> |
|
137 |
- <td>Logfiles <span class=\"warning\">*</span></td> |
|
138 |
- <td><select name=\"logtype\" id=\"logtype\"> |
|
146 |
+ </div> |
|
147 |
+ <h5>Logfiles <span class=\"warning\">*</span></h5> |
|
148 |
+ <div style=\"margin-left: 2em;\"> |
|
149 |
+ <select name=\"logtype\" id=\"logtype\"> |
|
139 | 150 |
<option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option> |
140 | 151 |
<option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option> |
141 | 152 |
<option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option> |
142 | 153 |
</select><br /> |
143 | 154 |
<input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." /> <label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label> |
144 |
- </td> |
|
145 |
- <td id=\"defaultlogtype\">keine Logfiles</td></tr> |
|
155 |
+ </div> |
|
156 |
+</div> |
|
146 | 157 |
"; |
147 | 158 |
|
148 |
-$form .= '</table> |
|
159 |
+$form .= ' |
|
149 | 160 |
<p><input type="submit" value="Speichern" />    '.internal_link('vhosts.php', 'Abbrechen').'</p> |
150 | 161 |
<p class="warning"><span class="warning">*</span>Es ist im Moment Gegenstand gerichtlicher Außeinandersetzungen, ob die Speicherung von Logfiles auf Webservern |
151 | 162 |
zulässig ist. Wir weisen alle Nutzer darauf hin, dass sie selbst dafür verantwortlich sind, bei geloggten Nutzerdaten die |
... | ... |
@@ -10,7 +10,7 @@ require_once('class/domain.php'); |
10 | 10 |
function list_vhosts() |
11 | 11 |
{ |
12 | 12 |
$uid = (int) $_SESSION['userinfo']['uid']; |
13 |
- $result = db_query("SELECT id,fqdn,docroot,docroot_is_default,php,options,logtype,errorlog FROM vhosts.v_vhost WHERE uid={$uid} ORDER BY domain,hostname"); |
|
13 |
+ $result = db_query("SELECT vh.id,fqdn,docroot,docroot_is_default,php,vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid={$uid} ORDER BY domain,hostname"); |
|
14 | 14 |
$ret = array(); |
15 | 15 |
while ($item = mysql_fetch_assoc($result)) |
16 | 16 |
array_push($ret, $item); |
... | ... |
@@ -74,7 +74,7 @@ function get_vhost_details($id) |
74 | 74 |
{ |
75 | 75 |
$id = (int) $id; |
76 | 76 |
$uid = (int) $_SESSION['userinfo']['uid']; |
77 |
- $result = db_query("SELECT * FROM vhosts.v_vhost WHERE uid={$uid} AND id={$id}"); |
|
77 |
+ $result = db_query("SELECT vh.*,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid={$uid} AND vh.id={$id}"); |
|
78 | 78 |
if (mysql_num_rows($result) != 1) |
79 | 79 |
system_failure('Interner Fehler beim Auslesen der Daten'); |
80 | 80 |
|
... | ... |
@@ -21,7 +21,7 @@ $vhosts = list_vhosts(); |
21 | 21 |
|
22 | 22 |
if (count($vhosts) > 0) |
23 | 23 |
{ |
24 |
- output("<table><tr><th>(Sub-)Domain</th><th></th><th>Zusätzliche Alias-Namen</th><th>PHP</th><th>Logfiles</th><th>Lokaler Pfad<sup>*</sup></th></tr>"); |
|
24 |
+ output("<table><tr><th>(Sub-)Domain</th><th></th><th>Zusätzliche Alias-Namen</th><th>Logfiles</th><th>PHP</th><th>Lokaler Pfad<sup>*</sup></th></tr>"); |
|
25 | 25 |
|
26 | 26 |
foreach ($vhosts as $vhost) |
27 | 27 |
{ |
... | ... |
@@ -34,6 +34,29 @@ if (count($vhosts) > 0) |
34 | 34 |
} |
35 | 35 |
output(internal_link('aliases.php', 'Aliase verwalten', 'vhost='.$vhost['id'])); |
36 | 36 |
output('</td>'); |
37 |
+ $logfiles = 'keine'; |
|
38 |
+ if ($vhost['logtype'] == 'default') |
|
39 |
+ $logfiles = 'normal'; |
|
40 |
+ elseif ($vhost['logtype'] == 'anonymous') |
|
41 |
+ $logfiles = 'anonym'; |
|
42 |
+ if ($vhost['errorlog'] == 1) |
|
43 |
+ { |
|
44 |
+ if ($logfiles == 'keine') |
|
45 |
+ $logfiles = 'nur Fehler'; |
|
46 |
+ else |
|
47 |
+ $logfiles .= ', Fehler'; |
|
48 |
+ } |
|
49 |
+ output("<td>{$logfiles}</td>"); |
|
50 |
+ if ($vhost['is_webapp'] == 1) { |
|
51 |
+ output('<td colspan="2"><em>globale Webanwendung</em></td>'); |
|
52 |
+ } |
|
53 |
+ elseif ($vhost['is_dav'] == 1) { |
|
54 |
+ output('<td colspan="2"><em>WebDAV</em></td>'); |
|
55 |
+ } |
|
56 |
+ elseif ($vhost['is_svn'] == 1) { |
|
57 |
+ output('<td colspan="2"><em>Subversion-Server</em></td>'); |
|
58 |
+ } |
|
59 |
+ else { |
|
37 | 60 |
$php = $vhost['php']; |
38 | 61 |
switch ($php) |
39 | 62 |
{ |
... | ... |
@@ -48,23 +71,11 @@ if (count($vhosts) > 0) |
48 | 71 |
break; |
49 | 72 |
} |
50 | 73 |
output("<td>{$php}</td>"); |
51 |
- $logfiles = 'keine'; |
|
52 |
- if ($vhost['logtype'] == 'default') |
|
53 |
- $logfiles = 'normal'; |
|
54 |
- elseif ($vhost['logtype'] == 'anonymous') |
|
55 |
- $logfiles = 'anonym'; |
|
56 |
- if ($vhost['errorlog'] == 1) |
|
57 |
- { |
|
58 |
- if ($logfiles == 'keine') |
|
59 |
- $logfiles = 'nur Fehler'; |
|
60 |
- else |
|
61 |
- $logfiles .= ', Fehler'; |
|
62 |
- } |
|
63 |
- output("<td>{$logfiles}</td>"); |
|
64 | 74 |
if ($vhost['docroot_is_default'] == 1) |
65 | 75 |
output("<td><span style=\"color:#777;\">{$vhost['docroot']}</span></td>"); |
66 | 76 |
else |
67 | 77 |
output("<td><strong>{$vhost['docroot']}</strong></td>"); |
78 |
+ } |
|
68 | 79 |
output("</tr>"); |
69 | 80 |
} |
70 | 81 |
output('</table>'); |
71 | 82 |