Skip to content

Commit a067450

Browse files
authored
Fix PHP warnings / 500 error when email was not installed (hestiacp#3877)
Fix warning in: $_POST["v_php_versions"] Fix 500 error when $_SESSION["WEBMAIL_SYSTEM"] was not set
1 parent da4d1f4 commit a067450

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

web/edit/server/index.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,13 @@
283283
unset($output);
284284
$v_hostname = $_POST["v_hostname"];
285285
}
286-
287286
if ($_SESSION["WEB_BACKEND"] == "php-fpm") {
288287
// Install/remove php versions
289288
if (empty($_SESSION["error_msg"])) {
290289
if (!empty($v_php_versions)) {
291-
$post_php = $_POST["v_php_versions"];
290+
if (!empty($_POST["v_php_versions"])) {
291+
$post_php = $_POST["v_php_versions"];
292+
}
292293
if (empty($post_php)) {
293294
$post_php = [];
294295
}
@@ -623,15 +624,17 @@
623624

624625
// Update webmail url
625626
if (empty($_SESSION["error_msg"])) {
626-
if ($_POST["v_webmail_alias"] != $_SESSION["WEBMAIL_ALIAS"]) {
627-
exec(
628-
HESTIA_CMD . "v-change-sys-webmail " . quoteshellarg($_POST["v_webmail_alias"]),
629-
$output,
630-
$return_var,
631-
);
632-
check_return_code($return_var, $output);
633-
unset($output);
634-
$v_mail_adv = "yes";
627+
if ($_SESSION["WEBMAIL_SYSTEM"] != "") {
628+
if ($_POST["v_webmail_alias"] != $_SESSION["WEBMAIL_ALIAS"]) {
629+
exec(
630+
HESTIA_CMD . "v-change-sys-webmail " . quoteshellarg($_POST["v_webmail_alias"]),
631+
$output,
632+
$return_var,
633+
);
634+
check_return_code($return_var, $output);
635+
unset($output);
636+
$v_mail_adv = "yes";
637+
}
635638
}
636639
}
637640

0 commit comments

Comments
 (0)