bernd commited on 2007-08-06 17:43:17
Zeige 4 geänderte Dateien mit 175 Einfügungen und 0 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@593 87cf0b9e-d624-0410-a070-f6ee81989793
| ... | ... |
@@ -0,0 +1,30 @@ |
| 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"; |
|
| 9 |
+ |
|
| 10 |
+require_role(ROLE_SYSTEMUSER); |
|
| 11 |
+ |
|
| 12 |
+$vhost = get_vhost_details($_GET['vhost']); |
|
| 13 |
+ |
|
| 14 |
+DEBUG($vhost); |
|
| 15 |
+output("<h3>VHost bearbeiten</h3>");
|
|
| 16 |
+ |
|
| 17 |
+$s = (strstr($vhost['options'], 'aliaswww') ? ' checked="checked" ' : ''); |
|
| 18 |
+$form = " |
|
| 19 |
+ <table> |
|
| 20 |
+ <tr><th>Einstellung</th><th>aktueller Wert</th><th>System-Standard</th></tr> |
|
| 21 |
+ <tr><td>Name</td> |
|
| 22 |
+ <td><div id=\"wwwprefix\" style=\"font-weight: bold; display: inline; color: #000;\">www.</div><input type=\"text\" name=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" />
|
|
| 23 |
+".domainselect($vhost['domain_id']); |
|
| 24 |
+$form .= "<br /><input type=\"checkbox\" name=\"options[]\" value=\"aliaswww\" onclick=\"document.getElementById('wwwprefix').firstChild='';\" {$s}/> Ohne <strong>www</strong> davor.</td><td><em>keiner</em></td></tr>";
|
|
| 25 |
+ |
|
| 26 |
+$form .= '</table>'; |
|
| 27 |
+output(html_form('vhosts_edit_vhost', 'save.php', '', $form));
|
|
| 28 |
+ |
|
| 29 |
+ |
|
| 30 |
+?> |
| ... | ... |
@@ -0,0 +1,67 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+require_once("inc/base.php");
|
|
| 4 |
+require_once("inc/error.php");
|
|
| 5 |
+require_once("inc/security.php");
|
|
| 6 |
+ |
|
| 7 |
+require_once('class/domain.php');
|
|
| 8 |
+ |
|
| 9 |
+function list_vhosts() |
|
| 10 |
+{
|
|
| 11 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
| 12 |
+ $result = db_query("SELECT id,fqdn,docroot,docroot_is_default,php,options FROM vhosts.v_vhost WHERE uid={$uid}");
|
|
| 13 |
+ $ret = array(); |
|
| 14 |
+ while ($item = mysql_fetch_assoc($result)) |
|
| 15 |
+ array_push($ret, $item); |
|
| 16 |
+ return $ret; |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+ |
|
| 20 |
+function domainselect($selected = NULL) |
|
| 21 |
+{
|
|
| 22 |
+ global $domainlist; |
|
| 23 |
+ if ($domainlist == NULL) |
|
| 24 |
+ $domainlist = get_domain_list($_SESSION['customerinfo']['customerno'], |
|
| 25 |
+ $_SESSION['userinfo']['uid']); |
|
| 26 |
+ $selected = (int) $selected; |
|
| 27 |
+ |
|
| 28 |
+ $ret = '<select name="domain" size="1">'; |
|
| 29 |
+ foreach ($domainlist as $dom) |
|
| 30 |
+ {
|
|
| 31 |
+ $s = ''; |
|
| 32 |
+ if ($selected == $dom->id) |
|
| 33 |
+ $s = ' selected="selected" '; |
|
| 34 |
+ $ret .= "<option value=\"{$dom->id}\"{$s}>{$dom->fqdn}</option>\n";
|
|
| 35 |
+ } |
|
| 36 |
+ $ret .= '</select>'; |
|
| 37 |
+ return $ret; |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+ |
|
| 41 |
+ |
|
| 42 |
+function get_vhost_details($id) |
|
| 43 |
+{
|
|
| 44 |
+ $id = (int) $id; |
|
| 45 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
| 46 |
+ $result = db_query("SELECT * FROM vhosts.v_vhost WHERE uid={$uid} AND id={$id}");
|
|
| 47 |
+ if (mysql_num_rows($result) != 1) |
|
| 48 |
+ system_failure('Interner Fehler beim Auslesen der Daten');
|
|
| 49 |
+ |
|
| 50 |
+ return mysql_fetch_assoc($result); |
|
| 51 |
+} |
|
| 52 |
+ |
|
| 53 |
+ |
|
| 54 |
+ |
|
| 55 |
+function get_aliases($vhost) |
|
| 56 |
+{
|
|
| 57 |
+ $vhost = (int) $vhost; |
|
| 58 |
+ $result = db_query("SELECT id,fqdn,options FROM vhosts.v_alias WHERE vhost={$vhost}");
|
|
| 59 |
+ $ret = array(); |
|
| 60 |
+ while ($item = mysql_fetch_assoc($result)) |
|
| 61 |
+ array_push($ret, $item); |
|
| 62 |
+ return $ret; |
|
| 63 |
+} |
|
| 64 |
+ |
|
| 65 |
+ |
|
| 66 |
+ |
|
| 67 |
+?> |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+$menu = array(); |
|
| 4 |
+ |
|
| 5 |
+$role = $_SESSION['role']; |
|
| 6 |
+ |
|
| 7 |
+if ($role & ROLE_SYSTEMUSER) |
|
| 8 |
+{
|
|
| 9 |
+ $menu["vhosts_vhosts"] = array("label" => "Webserver (VHosts)", "file" => "vhosts.php", "weight" => 1);
|
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+if (empty($menu)) |
|
| 13 |
+ $menu = false; |
|
| 14 |
+ |
|
| 15 |
+ |
|
| 16 |
+?> |
| ... | ... |
@@ -0,0 +1,62 @@ |
| 1 |
+<?php |
|
| 2 |
+require_once('inc/debug.php');
|
|
| 3 |
+require_once('inc/security.php');
|
|
| 4 |
+ |
|
| 5 |
+require_once('vhosts.php');
|
|
| 6 |
+ |
|
| 7 |
+$title = "Webserver VHosts"; |
|
| 8 |
+$error = ''; |
|
| 9 |
+ |
|
| 10 |
+require_role(ROLE_SYSTEMUSER); |
|
| 11 |
+ |
|
| 12 |
+ |
|
| 13 |
+output("<h3>Webserver (VHosts)</h3>
|
|
| 14 |
+<p>Mit dieser Funtkion legen Sie fest, welche Domains und Subdomains verfügbar sein sollen und welches Verzeichnis die Dateien enthalten soll.</p>"); |
|
| 15 |
+ |
|
| 16 |
+$vhosts = list_vhosts(); |
|
| 17 |
+ |
|
| 18 |
+if (count($vhosts) > 0) |
|
| 19 |
+{
|
|
| 20 |
+ output("<table><tr><th>(Sub-)Domain</th><th>Zusätzliche Alias-Namen</th><th>Lokaler Pfad</th><th>PHP</th></tr>");
|
|
| 21 |
+ |
|
| 22 |
+ foreach ($vhosts as $vhost) |
|
| 23 |
+ {
|
|
| 24 |
+ $fqdn = $vhost['fqdn']; |
|
| 25 |
+ if (strstr($vhost['options'], 'aliaswww')) |
|
| 26 |
+ $fqdn = 'www.'.$vhost['fqdn']; |
|
| 27 |
+ output("<tr><td>".internal_link('edit.php', $fqdn, "vhost={$vhost['id']}")."</td><td>");
|
|
| 28 |
+ $aliases = get_aliases($vhost['id']); |
|
| 29 |
+ if (strstr($vhost['options'], 'aliaswww')) |
|
| 30 |
+ output($vhost['fqdn'].'<br />'); |
|
| 31 |
+ foreach ($aliases as $alias) |
|
| 32 |
+ {
|
|
| 33 |
+ if (strstr($alias['options'], 'aliaswww')) |
|
| 34 |
+ output('www.'.$alias['fqdn'].'<br />');
|
|
| 35 |
+ output($alias['fqdn'].'<br />'); |
|
| 36 |
+ } |
|
| 37 |
+ output('</td>');
|
|
| 38 |
+ if ($vhost['docroot_is_default'] == 1) |
|
| 39 |
+ output("<td>{$vhost['docroot']}</td>");
|
|
| 40 |
+ else |
|
| 41 |
+ output("<td><strong>{$vhost['docroot']}</strong></td>");
|
|
| 42 |
+ $php = $vhost['php']; |
|
| 43 |
+ switch ($php) |
|
| 44 |
+ {
|
|
| 45 |
+ case NULL: |
|
| 46 |
+ $php = 'kein PHP'; |
|
| 47 |
+ break; |
|
| 48 |
+ case 'mod_php': |
|
| 49 |
+ $php = 'Apache-Modul'; |
|
| 50 |
+ break; |
|
| 51 |
+ case 'fastcgi': |
|
| 52 |
+ $php = 'FastCGI'; |
|
| 53 |
+ break; |
|
| 54 |
+ } |
|
| 55 |
+ output("<td>{$php}</td></tr>");
|
|
| 56 |
+ } |
|
| 57 |
+ output('</table><br />');
|
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+ |
|
| 61 |
+ |
|
| 62 |
+?> |
|
| 0 | 63 |