Fix PHP 5.6 array index and implode compatibility issues

Co-authored-by: peca <peca@mycity.rs>
This commit is contained in:
Cursor Agent 2025-08-10 11:48:54 +00:00
commit 4fff4b4985
4 changed files with 29 additions and 7 deletions

View file

@ -80,7 +80,11 @@ if (!empty($_POST['ok'])) {
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700) {
$_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
} else {
$_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
}
unset($v_domain);
}
}
@ -128,7 +132,11 @@ if (!empty($_POST['ok_rec'])) {
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',htmlentities($_POST[v_rec]),htmlentities($_POST[v_domain]));
if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700) {
$_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',htmlentities($_POST[v_rec]),htmlentities($_POST[v_domain]));
} else {
$_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',htmlentities($_POST['v_rec']),htmlentities($_POST['v_domain']));
}
unset($v_domain);
unset($v_rec);
unset($v_val);

View file

@ -186,8 +186,13 @@ if (!empty($_POST['ok_acc'])) {
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
$_SESSION['ok_msg'] .= " / <a style=\"text-decoration: underline; color: #9c8cff;\" href=".$webmail." target='_blank'>" . __('open webmail') . "</a>";
if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700) {
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
$_SESSION['ok_msg'] .= " / <a style=\"text-decoration: underline; color: #9c8cff;\" href=".$webmail." target='_blank'>" . __('open webmail') . "</a>";
} else {
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST['v_domain']),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST['v_domain']));
$_SESSION['ok_msg'] .= " / <a style=\"text-decoration: underline; color: #9c8cff;\" href=".$webmail." target='_blank'>" . __('open webmail') . "</a>";
}
unset($v_account);
unset($v_password);
unset($v_password);

View file

@ -323,7 +323,11 @@ if (!empty($_POST['ok'])) {
}
if (!empty($_SESSION['error_msg']) && $domain_added) {
$_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700) {
$_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
} else {
$_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
}
$_SESSION['flash_error_msg'] = $_SESSION['error_msg'];
$url = '/edit/web/?domain='.strtolower(preg_replace("/^www\./i", "", $_POST['v_domain']));
header('Location: ' . $url);

View file

@ -1095,8 +1095,13 @@ class UploadHandler
}
}
if (count($failed_versions)) {
$file->error = $this->get_error_message('image_resize')
.' ('.implode($failed_versions,', ').')';
if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700) {
$file->error = $this->get_error_message('image_resize')
.' ('.implode($failed_versions,', ').')';
} else {
$file->error = $this->get_error_message('image_resize')
.' ('.implode(', ', $failed_versions).')';
}
}
// Free memory:
$this->destroy_image_object($file_path);