Bernd Wurst commited on 2017-02-25 19:09:22
Zeige 4 geänderte Dateien mit 41 Einfügungen und 21 Löschungen.
| ... | ... |
@@ -109,6 +109,16 @@ |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 | 111 |
|
| 112 |
+ function showAliasWWWOptions( event ) {
|
|
| 113 |
+ if ($('#aliaswww').prop('checked')) {
|
|
| 114 |
+ $('#aliaswww_option').show();
|
|
| 115 |
+ } else {
|
|
| 116 |
+ $('#aliaswww_option').hide();
|
|
| 117 |
+ |
|
| 118 |
+ } |
|
| 119 |
+ } |
|
| 120 |
+ |
|
| 121 |
+ |
|
| 112 | 122 |
$(function() {
|
| 113 | 123 |
|
| 114 | 124 |
$('#hostname').change(useDefaultDocroot);
|
| ... | ... |
@@ -116,10 +126,10 @@ $(function() {
|
| 116 | 126 |
$('#use_default_docroot').change(useDefaultDocroot);
|
| 117 | 127 |
useDefaultDocroot(); |
| 118 | 128 |
|
| 119 |
- $(".buttonset").buttonset();
|
|
| 120 |
- |
|
| 121 | 129 |
$('.usageoption').change(showAppropriateLines);
|
| 122 | 130 |
|
| 131 |
+ $('#aliaswww').change(showAliasWWWOptions);
|
|
| 132 |
+ showAliasWWWOptions(); |
|
| 123 | 133 |
|
| 124 | 134 |
$('#ssl').change(showhsts);
|
| 125 | 135 |
$('#hsts_select').show();
|
| ... | ... |
@@ -87,25 +87,26 @@ $webapp_options = ''; |
| 87 | 87 |
foreach ($applist as $app) |
| 88 | 88 |
$webapp_options .= "<option value=\"{$app['id']}\">{$app['displayname']}</option>\n";
|
| 89 | 89 |
|
| 90 |
+$aliaswww_options = array("forwardwww" => "Umleiten auf www-Subdomain", "forwardnowww" => "Umleiten auf Stammdomain (ohne www)", "noforward" => "Keine Umleitung");
|
|
| 91 |
+$aliaswww_option = 'forwardwww'; |
|
| 92 |
+if (strstr($vhost['options'], 'aliaswww')) {
|
|
| 93 |
+ // Wenn aliaswww gar nicht gesetzt war, dann soll die select-Option für forwardwww trotzdem auf dem default stehen. |
|
| 94 |
+ // Ist nicht sichtbar und wird beim Speichern auch wieder entfernt |
|
| 95 |
+ if (strstr($vhost['options'], 'forwardwww')) {
|
|
| 96 |
+ $aliaswww_option = 'forwardwww'; |
|
| 97 |
+ } elseif (strstr($vhost['options'], 'forwardnowww')) {
|
|
| 98 |
+ $aliaswww_option = 'forwardnowww'; |
|
| 99 |
+ } else {
|
|
| 100 |
+ $aliaswww_option = 'noforward'; |
|
| 101 |
+ } |
|
| 102 |
+} |
|
| 90 | 103 |
|
| 91 | 104 |
$form = " |
| 92 | 105 |
<h4 style=\"margin-top: 2em;\">Name des VHost</h4> |
| 93 | 106 |
<div style=\"margin-left: 2em;\"><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" /><strong>.</strong>".domainselect($vhost['domain_id']);
|
| 94 | 107 |
$form .= "<br /> |
| 95 |
- <input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label><br/>
|
|
| 96 |
-<span class=\"buttonset ui-buttonset\" id=\"buttonset-aliaswww\"> |
|
| 97 |
- <input type=\"radio\" name=\"aliaswww\" id=\"aliaswww_forwardwww\" value=\"forwardwww\"/><label for=\"aliaswww_forwardwww\">Auf www-Präfix umleiten</label> |
|
| 98 |
- <input type=\"radio\" name=\"aliaswww\" id=\"aliaswww_forwardnowww\" value=\"forwardnowww\"/><label for=\"aliaswww_forwardnowww\">www-Präfix auf Stammdomain umleiten</label> |
|
| 99 |
- <input type=\"radio\" name=\"aliaswww\" id=\"aliaswww_aliaswww\" value=\"aliaswww\"/><label for=\"aliaswww_aliaswww\">www-Präfix als Alias einrichten</label> |
|
| 100 |
- <input type=\"radio\" name=\"aliaswww\" id=\"aliaswww_nowww\" value=\"nowww\"/><label for=\"aliaswww_nowww\">Kein www-Präfix erzeugen</label> |
|
| 101 |
- </span><br/> |
|
| 102 |
- <label for=\"aliaswww\">Soll auch ein www-Präfix erzeugt werden?</label> <select name=\"aliaswww\" id=\"aliaswww\"> |
|
| 103 |
- <option value=\"forwardwww\">Auf www-Präfix umleiten</option> |
|
| 104 |
- <option value=\"forwardnowww\">www-Präfix auf Stammdomain umleiten</option> |
|
| 105 |
- <option value=\"aliaswww\">www-Präfix als Alias einrichten</option> |
|
| 106 |
- <option value=\"nowww\">Kein www-Präfix erzeugen</option> |
|
| 107 |
- </select> |
|
| 108 |
- |
|
| 108 |
+ <input type=\"checkbox\" name=\"aliaswww\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label><br/>
|
|
| 109 |
+ <span id=\"aliaswww_option\"><label for=\"forwardwww\">Umleitungs-Option </label>".html_select('forwardwww', $aliaswww_options, $aliaswww_option)."</span><br />
|
|
| 109 | 110 |
</div> |
| 110 | 111 |
<div class=\"vhostsidebyside\"> |
| 111 | 112 |
<div class=\"vhostoptions\" id=\"options_docroot\" ".($vhost_type=='regular' || $vhost_type=='dav' ? '' : 'style="display: none;"')."> |
| ... | ... |
@@ -103,7 +103,7 @@ function empty_vhost() |
| 103 | 103 |
$vhost['ipv4'] = NULL; |
| 104 | 104 |
$vhost['autoipv6'] = 2; // 1 => Eine IP pro User, 2 => Eine IP pro VHost |
| 105 | 105 |
|
| 106 |
- $vhost['options'] = ''; |
|
| 106 |
+ $vhost['options'] = 'forwardwww'; |
|
| 107 | 107 |
$vhost['stats'] = NULL; |
| 108 | 108 |
return $vhost; |
| 109 | 109 |
} |
| ... | ... |
@@ -61,9 +61,15 @@ if ($_GET['action'] == 'edit') |
| 61 | 61 |
$domainname = $_SESSION['userinfo']['username'].".".config('masterdomain');
|
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
- if (! (isset($_POST['options']) && is_array($_POST['options']))) |
|
| 65 |
- $_POST['options'] = array(); |
|
| 66 |
- $aliaswww = in_array('aliaswww', $_POST['options']);
|
|
| 64 |
+ $aliaswww = (isset($_POST['aliaswww']) && $_POST['aliaswww'] == 'aliaswww'); |
|
| 65 |
+ $forwardwww = NULL; |
|
| 66 |
+ if ($aliaswww && isset($_POST['forwardwww'])) {
|
|
| 67 |
+ if ($_POST['forwardwww'] == 'forwardwww') {
|
|
| 68 |
+ $forwardwww = 'forwardwww'; |
|
| 69 |
+ } elseif ($_POST['forwardwww'] == 'forwardnowww') {
|
|
| 70 |
+ $forwardwww = 'forwardnowww'; |
|
| 71 |
+ } |
|
| 72 |
+ } |
|
| 67 | 73 |
|
| 68 | 74 |
$docroot = ''; |
| 69 | 75 |
if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav') |
| ... | ... |
@@ -216,12 +222,15 @@ if ($_GET['action'] == 'edit') |
| 216 | 222 |
$new_options = array(); |
| 217 | 223 |
foreach ($old_options AS $op) |
| 218 | 224 |
{
|
| 219 |
- if ($op != 'aliaswww' && $op != 'hsts_subdomains' && $op != 'hsts_preload') {
|
|
| 225 |
+ if (! in_array($op, array('aliaswww', 'forwardwww', 'hsts_subdomains', 'hsts_preload'))) {
|
|
| 220 | 226 |
array_push($new_options, $op); |
| 221 | 227 |
} |
| 222 | 228 |
} |
| 223 | 229 |
if ($aliaswww) {
|
| 224 | 230 |
array_push($new_options, 'aliaswww'); |
| 231 |
+ if ($forwardwww) {
|
|
| 232 |
+ array_push($new_options, $forwardwww); |
|
| 233 |
+ } |
|
| 225 | 234 |
} |
| 226 | 235 |
if ($hsts_subdomains) {
|
| 227 | 236 |
array_push($new_options, 'hsts_subdomains'); |
| 228 | 237 |