bernd commited on 2007-08-09 19:30:02
Zeige 2 geänderte Dateien mit 143 Einfügungen und 0 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@611 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -0,0 +1,75 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+require_once('inc/debug.php'); |
|
4 |
+require_once('inc/security.php'); |
|
5 |
+ |
|
6 |
+require_once('vhosts.php'); |
|
7 |
+ |
|
8 |
+$title = "Aliasnamen für Subdomain bearbeiten"; |
|
9 |
+$section = 'vhosts_vhosts'; |
|
10 |
+ |
|
11 |
+require_role(ROLE_SYSTEMUSER); |
|
12 |
+ |
|
13 |
+$id = (int) $_GET['vhost']; |
|
14 |
+ |
|
15 |
+$vhost = get_vhost_details($id); |
|
16 |
+DEBUG($vhost); |
|
17 |
+ |
|
18 |
+$aliases = get_aliases($id); |
|
19 |
+DEBUG($aliases); |
|
20 |
+ |
|
21 |
+output("<h3>Aliasnamen für Subdomain bearbeiten</h3>"); |
|
22 |
+ |
|
23 |
+$mainalias = (strstr($vhost['options'], 'aliaswww') ? '<br /><strong>www.'.$vhost['fqdn'].'</strong>' : ''); |
|
24 |
+ |
|
25 |
+output(" |
|
26 |
+ <table> |
|
27 |
+ <tr><th>Adresse</th><th>Verhalten</th><th> </th></tr> |
|
28 |
+ <tr><td><strong>{$vhost['fqdn']}</strong>{$mainalias}</td><td>Haupt-Adresse</td><td> </td></tr> |
|
29 |
+"); |
|
30 |
+ |
|
31 |
+foreach ($aliases AS $alias) { |
|
32 |
+ $aliastype = 'Zusätzliche Adresse'; |
|
33 |
+ if (strstr($alias['options'], 'forward')) { |
|
34 |
+ $aliastype = 'Umleitung auf Haupt-Adresse'; |
|
35 |
+ } |
|
36 |
+ $formtoken = generate_form_token('aliases_toggle'); |
|
37 |
+ $havewww = '<br />www.'.$alias['fqdn'].' ('.internal_link('aliasoptions.php', 'WWW-Alias entfernen', "alias={$alias['id']}&aliaswww=0&formtoken={$formtoken}").')'; |
|
38 |
+ $nowww = '<br />'.internal_link('aliasoptions.php', 'Auch mit WWW', "alias={$alias['id']}&aliaswww=1&formtoken={$formtoken}"); |
|
39 |
+ $wwwalias = (strstr($alias['options'], 'aliaswww') ? $havewww : $nowww); |
|
40 |
+ |
|
41 |
+ $to_forward = internal_link('aliasoptions.php', 'In Umleitung umwandeln', "alias={$alias['id']}&forward=1&formtoken={$formtoken}"); |
|
42 |
+ $remove_forward = internal_link('aliasoptions.php', 'In zusätzliche Adresse umwandeln', "alias={$alias['id']}&forward=0&formtoken={$formtoken}"); |
|
43 |
+ $typetoggle = (strstr($alias['options'], 'forward') ? $remove_forward : $to_forward); |
|
44 |
+ |
|
45 |
+ |
|
46 |
+ output("<tr> |
|
47 |
+ <td>{$alias['fqdn']}{$wwwalias}</td> |
|
48 |
+ <td>{$aliastype}<br />{$typetoggle}</td> |
|
49 |
+ <td>".internal_link('save.php', 'Aliasname löschen', "action=deletealias&alias={$alias['id']}")."</td></tr> |
|
50 |
+ "); |
|
51 |
+} |
|
52 |
+ |
|
53 |
+output('</table>'); |
|
54 |
+ |
|
55 |
+ |
|
56 |
+output(html_form('vhosts_add_alias', 'save.php', 'action=addalias&vhost='.$vhost['id'], " |
|
57 |
+<div style=\"margin-top: 1em; padding: 1em;\"> |
|
58 |
+<h4>Neuen Aliasnamen hinzufügen</h4> |
|
59 |
+<p> |
|
60 |
+ <input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"\" /> |
|
61 |
+ <strong>.</strong>".domainselect()."<br /> |
|
62 |
+ <input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" /> |
|
63 |
+ <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label><br /> |
|
64 |
+ Modus: <select name=\"options[]\"> |
|
65 |
+ <option value=\"\">zusätzliche Adresse</option> |
|
66 |
+ <option value=\"forward\">Umleitung auf Haupt-Adresse</option> |
|
67 |
+ </select> |
|
68 |
+</p> |
|
69 |
+<p> |
|
70 |
+ <input type=\"submit\" value=\"Hinzufügen\" /></p> |
|
71 |
+</div> |
|
72 |
+")); |
|
73 |
+ |
|
74 |
+ |
|
75 |
+?> |
... | ... |
@@ -0,0 +1,68 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+require_once('inc/base.php'); |
|
4 |
+require_once('vhosts.php'); |
|
5 |
+ |
|
6 |
+require_once('inc/debug.php'); |
|
7 |
+global $debugmode; |
|
8 |
+ |
|
9 |
+check_form_token('aliases_toggle', $_GET['formtoken']); |
|
10 |
+ |
|
11 |
+if (isset($_GET['aliaswww'])) { |
|
12 |
+ |
|
13 |
+ $aliaswww = (bool) ( (int) $_GET['aliaswww'] ); |
|
14 |
+ |
|
15 |
+ $alias = get_alias_details($_GET['alias']); |
|
16 |
+ DEBUG($alias); |
|
17 |
+ $old_options = explode(',', $alias['options']); |
|
18 |
+ $new_options = array(); |
|
19 |
+ foreach ($old_options AS $op) |
|
20 |
+ { |
|
21 |
+ if ($op != 'aliaswww') |
|
22 |
+ array_push($new_options, $op); |
|
23 |
+ } |
|
24 |
+ if ($aliaswww) |
|
25 |
+ array_push($new_options, 'aliaswww'); |
|
26 |
+ |
|
27 |
+ DEBUG($old_options); |
|
28 |
+ DEBUG($new_options); |
|
29 |
+ $alias['options'] = implode(',', $new_options); |
|
30 |
+ DEBUG('New options: '.$options); |
|
31 |
+ |
|
32 |
+ $alias['domainid'] = $alias['domain_id']; |
|
33 |
+ save_alias($alias); |
|
34 |
+ |
|
35 |
+ if (! $debugmode) |
|
36 |
+ header('Location: aliases.php?vhost='.$alias['vhost']); |
|
37 |
+} |
|
38 |
+if (isset($_GET['forward'])) { |
|
39 |
+ |
|
40 |
+ $forward = (bool) ( (int) $_GET['forward'] ); |
|
41 |
+ |
|
42 |
+ $alias = get_alias_details($_GET['alias']); |
|
43 |
+ DEBUG($alias); |
|
44 |
+ $old_options = explode(',', $alias['options']); |
|
45 |
+ $new_options = array(); |
|
46 |
+ foreach ($old_options AS $op) |
|
47 |
+ { |
|
48 |
+ if ($op != 'forward') |
|
49 |
+ array_push($new_options, $op); |
|
50 |
+ } |
|
51 |
+ if ($forward) |
|
52 |
+ array_push($new_options, 'forward'); |
|
53 |
+ |
|
54 |
+ DEBUG($old_options); |
|
55 |
+ DEBUG($new_options); |
|
56 |
+ $alias['options'] = implode(',', $new_options); |
|
57 |
+ DEBUG('New options: '.$options); |
|
58 |
+ |
|
59 |
+ $alias['domainid'] = $alias['domain_id']; |
|
60 |
+ save_alias($alias); |
|
61 |
+ |
|
62 |
+ if (! $debugmode) |
|
63 |
+ header('Location: aliases.php?vhost='.$alias['vhost']); |
|
64 |
+} |
|
65 |
+ |
|
66 |
+ |
|
67 |
+ |
|
68 |
+?> |
|
0 | 69 |
\ No newline at end of file |
1 | 70 |