Bernd Wurst commited on 2020-07-13 14:01:55
Zeige 4 geänderte Dateien mit 23 Einfügungen und 27 Löschungen.
... | ... |
@@ -123,25 +123,18 @@ $form .= "<br /> |
123 | 123 |
</div> |
124 | 124 |
"; |
125 | 125 |
|
126 |
-/* |
|
127 |
- * Boolean option, to be used when only one PHP version is available |
|
128 |
- */ |
|
129 |
-$have_php = ($vhost['php'] == 'php56' ? ' checked="checked" ' : ''); |
|
130 |
- |
|
131 |
-/* |
|
132 |
-$phpoptions = "<h5>PHP</h5> |
|
133 |
- <div style=\"margin-left: 2em;\"> |
|
134 |
- <input type=\"checkbox\" name=\"php\" id=\"php\" value=\"php53\" {$have_php}/> <label for=\"php\">PHP einschalten</label> |
|
135 |
- </div> |
|
136 |
-"; |
|
137 |
-*/ |
|
138 | 126 |
/* |
139 | 127 |
* Choose what PHP version to use |
140 | 128 |
*/ |
141 |
-//if ($vhost['php'] == 'php54') |
|
142 |
-//{ |
|
143 |
- $options = array("none" => 'ausgeschaltet'); |
|
129 |
+$options = array("none" => 'ausgeschaltet', "default" => "Eingeschaltet (neueste Version)"); |
|
144 | 130 |
$phpinfo = valid_php_versions(); |
131 |
+$php_default_version = null; |
|
132 |
+ foreach ($phpinfo as $v) { |
|
133 |
+ if ($v['default'] == true) { |
|
134 |
+ $php_default_version = $v['major'].'.'.$v['minor']; |
|
135 |
+ break; |
|
136 |
+ } |
|
137 |
+ } |
|
145 | 138 |
foreach ($phpinfo as $tag => $info) { |
146 | 139 |
$options[$tag] = 'PHP '.$info['major'].'.'.$info['minor']; |
147 | 140 |
if ($info['status'] == 'deprecated') { |
... | ... |
@@ -155,9 +148,9 @@ $phpoptions = "<h5>PHP</h5> |
155 | 148 |
$phpoptions = " |
156 | 149 |
<h5>PHP</h5> |
157 | 150 |
<div style=\"margin-left: 2em;\"> |
158 |
- ".html_select("php", $options, $vhost['php'])." |
|
151 |
+ ".html_select("php", $options, $vhost['php'])."<br> |
|
152 |
+ <p>Aktuelle Standardversion: $php_default_version. Bei der Einstellung \"neueste Version\" wird Ihre Website immer mit der neuesten stabilen PHP-Version betrieben.</p> |
|
159 | 153 |
</div>"; |
160 |
-//} |
|
161 | 154 |
|
162 | 155 |
$safemode = ($vhost['cgi'] == 1 ? '' : ' checked="checked" '); |
163 | 156 |
|
... | ... |
@@ -54,11 +54,12 @@ function valid_php_versions() |
54 | 54 |
$ret[$key] = $ver; |
55 | 55 |
} |
56 | 56 |
/* Bis hier: aus der Datenbank ausgelesen */ |
57 |
+ krsort($ret); |
|
57 | 58 |
DEBUG($ret); |
58 | 59 |
/* Sonderfall: Wenn ein User noch Vhosts einer anderen Version hat, dann bleibt diese erlaubt */ |
59 | 60 |
$list = list_vhosts(); |
60 | 61 |
foreach ($list as $vhost) { |
61 |
- if ($vhost['php'] && !array_key_exists($vhost['php'], $ret)) { |
|
62 |
+ if ($vhost['php'] && $vhost['php'] != 'default' && !array_key_exists($vhost['php'], $ret)) { |
|
62 | 63 |
$key = $vhost['php']; |
63 | 64 |
$ret = array($key => array('major' => null, 'minor' => null, 'status' => 'used', 'default' => false)) + $ret; |
64 | 65 |
/* Wir nehmen an, dass unsere Tags immer an zweitletzter Stelle die Major-Version und |
... | ... |
@@ -134,13 +135,7 @@ function empty_vhost() |
134 | 135 |
$vhost['homedir'] = $_SESSION['userinfo']['homedir']; |
135 | 136 |
$vhost['docroot'] = null; |
136 | 137 |
|
137 |
- $vhost['php'] = null; |
|
138 |
- $phpversions = valid_php_versions(); |
|
139 |
- foreach ($phpversions as $tag => $info) { |
|
140 |
- if ($info['default']) { |
|
141 |
- $vhost['php'] = $tag; |
|
142 |
- } |
|
143 |
- } |
|
138 |
+ $vhost['php'] = 'default'; |
|
144 | 139 |
$vhost['cgi'] = 1; |
145 | 140 |
$vhost['ssl'] = null; |
146 | 141 |
$vhost['hsts'] = -1; |
... | ... |
@@ -95,7 +95,7 @@ if ($_GET['action'] == 'edit') { |
95 | 95 |
$php = null; |
96 | 96 |
if ($_POST['vhost_type'] == 'regular' && isset($_POST['php'])) { |
97 | 97 |
$phpinfo = valid_php_versions(); |
98 |
- if (array_key_exists($_POST['php'], $phpinfo)) { |
|
98 |
+ if ($_POST['php'] == 'default' || array_key_exists($_POST['php'], $phpinfo)) { |
|
99 | 99 |
$php = $_POST['php']; |
100 | 100 |
} else { |
101 | 101 |
$php = null; |
... | ... |
@@ -152,7 +152,15 @@ if (count($vhosts) > 0) { |
152 | 152 |
} else { |
153 | 153 |
$php = $vhost['php']; |
154 | 154 |
$phpinfo = valid_php_versions($php); |
155 |
- if (array_key_exists($php, $phpinfo)) { |
|
155 |
+ if ($php == 'default') { |
|
156 |
+ $php_default_version = null; |
|
157 |
+ foreach ($phpinfo as $v) { |
|
158 |
+ if ($v['default'] == true) { |
|
159 |
+ $php_default_version = $v['major'].'.'.$v['minor']; |
|
160 |
+ } |
|
161 |
+ } |
|
162 |
+ $php = icon_enabled('PHP in der neuesten stabilen Version eingeschaltet ('.$php_default_version.')'); |
|
163 |
+ } elseif (array_key_exists($php, $phpinfo)) { |
|
156 | 164 |
$phpinfo = $phpinfo[$php]; |
157 | 165 |
/* To create new PHP icon: |
158 | 166 |
convert ok.png -gravity center -draw "text 0,0 '7.2'" ok-php72.png |
159 | 167 |