From 07e8760e608a37e82a47a8cb47642b55acf3d3ac Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 10 Aug 2025 12:55:40 +0000 Subject: [PATCH] Fix PHP 7.x compatibility issues in Vesta Control Panel Co-authored-by: peca --- web/add/favorite/index.php | 2 +- web/edit/server/index.php | 11 ++++-- web/inc/i18n.php | 6 +++- web/inc/main.php | 34 +++++++++++++++---- web/list/backup/index.php | 4 +-- web/list/cron/index.php | 2 +- web/list/db/index.php | 2 +- web/list/directory/index.php | 1 + web/list/dns/index.php | 4 +-- web/list/firewall/banlist/index.php | 2 +- web/list/firewall/banlist/ip_info.php | 4 +-- web/list/firewall/index.php | 2 +- web/list/ip/index.php | 2 +- web/list/mail/index.php | 4 +-- web/list/notifications/index.php | 4 +-- web/list/package/index.php | 1 + web/list/rrd/index.php | 1 + web/list/server/index.php | 2 ++ web/list/stats/index.php | 6 ++-- web/list/updates/index.php | 1 + web/list/user/index.php | 2 +- web/list/web/index.php | 2 +- web/login/index.php | 49 +++++++++++++++++++++++---- web/reset/index.php | 14 ++++++-- web/search/index.php | 1 + web/templates/admin/add_web.html | 2 +- web/templates/admin/list_stats.html | 2 +- web/templates/right.html | 2 +- web/templates/user/list_stats.html | 2 +- 29 files changed, 128 insertions(+), 43 deletions(-) diff --git a/web/add/favorite/index.php b/web/add/favorite/index.php index a3054d99..4159c421 100644 --- a/web/add/favorite/index.php +++ b/web/add/favorite/index.php @@ -1,4 +1,4 @@ - $value) { $v_dns_cluster = 'yes'; @@ -49,11 +51,12 @@ foreach ($dns_cluster as $key => $value) { // List Database hosts exec (VESTA_CMD."v-list-database-hosts json", $output, $return_var); $db_hosts = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($db_hosts)) { $db_hosts = array(); } unset($output); $v_mysql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'mysql';})); -$v_mysql = count($v_mysql_hosts) ? 'yes' : 'no'; +$v_mysql = (version_compare(PHP_VERSION, '5.6', '==') ? count($v_mysql_hosts) : (is_array($v_mysql_hosts) ? count($v_mysql_hosts) : 0)) ? 'yes' : 'no'; $v_pgsql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'pgsql';})); -$v_pgsql = count($v_pgsql_hosts) ? 'yes' : 'no'; +$v_pgsql = (version_compare(PHP_VERSION, '5.6', '==') ? count($v_pgsql_hosts) : (is_array($v_pgsql_hosts) ? count($v_pgsql_hosts) : 0)) ? 'yes' : 'no'; unset($db_hosts); // List backup settings @@ -81,12 +84,14 @@ foreach ($backup_types as $backup_type) { // List ssl web domains exec (VESTA_CMD."v-search-ssl-certificates json", $output, $return_var); $v_ssl_domains = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($v_ssl_domains)) { $v_ssl_domains = array(); } //$v_vesta_certificate unset($output); // List ssl certificate info exec (VESTA_CMD."v-list-sys-vesta-ssl json", $output, $return_var); $v_sys_ssl_str = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($v_sys_ssl_str)) { $v_sys_ssl_str = array('VESTA'=>array()); } unset($output); $v_sys_ssl_crt = $v_sys_ssl_str['VESTA']['CRT']; $v_sys_ssl_key = $v_sys_ssl_str['VESTA']['KEY']; @@ -103,6 +108,7 @@ $v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER']; if (!empty($_SESSION['VESTA_CERTIFICATE'])); { exec (VESTA_CMD."v-list-sys-mail-ssl json", $output, $return_var); $v_mail_ssl_str = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($v_mail_ssl_str)) { $v_mail_ssl_str = array('MAIL'=>array()); } unset($output); $v_mail_ssl_crt = $v_mail_ssl_str['MAIL']['CRT']; $v_mail_ssl_key = $v_mail_ssl_str['MAIL']['KEY']; @@ -242,6 +248,7 @@ if (!empty($_POST['save'])) { // List SSL certificate info exec (VESTA_CMD."v-list-sys-mail-ssl json", $output, $return_var); $v_mail_ssl_str = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($v_mail_ssl_str)) { $v_mail_ssl_str = array('MAIL'=>array()); } unset($output); $v_mail_ssl_crt = $v_mail_ssl_str['MAIL']['CRT']; $v_mail_ssl_key = $v_mail_ssl_str['MAIL']['KEY']; diff --git a/web/inc/i18n.php b/web/inc/i18n.php index 9d6c1b7e..5a41c54a 100644 --- a/web/inc/i18n.php +++ b/web/inc/i18n.php @@ -89,7 +89,11 @@ function detect_user_language($fallback='en') { $accept_langs_sorted[$code] = (double)$q; } } - arsort($accept_langs_sorted); + if (version_compare(PHP_VERSION, '5.6', '==')) { + arsort($accept_langs_sorted); + } else { + if (!empty($accept_langs_sorted)) { arsort($accept_langs_sorted); } + } // List languages exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); diff --git a/web/inc/main.php b/web/inc/main.php index f13e4142..8a969cb9 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -109,8 +109,13 @@ if (isset($_SESSION['look']) && ( $_SESSION['look'] != 'admin' )) { function get_favourites(){ exec (VESTA_CMD."v-list-user-favourites ".$_SESSION['user']." json", $output, $return_var); // $data = json_decode(implode('', $output).'}', true); - $data = json_decode(implode('', $output), true); - $data = array_reverse($data,true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $data = json_decode(implode('', $output), true); + $data = array_reverse($data, true); + } else { + $data = json_decode(implode('', $output), true); + $data = is_array($data) ? array_reverse($data, true) : array(); + } $favourites = array(); foreach($data['Favourites'] as $key => $favourite){ @@ -188,16 +193,26 @@ function top_panel($user, $TAB) { header("Location: /error/"); exit; } - $panel = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $panel = json_decode(implode('', $output), true); + } else { + $panel = json_decode(implode('', $output), true); + if (!is_array($panel)) { $panel = array(); } + } unset($output); // getting notifications $command = VESTA_CMD."v-list-user-notifications '".$user."' 'json'"; exec ($command, $output, $return_var); - $notifications = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $notifications = json_decode(implode('', $output), true); + } else { + $notifications = json_decode(implode('', $output), true); + if (!is_array($notifications)) { $notifications = array(); } + } foreach($notifications as $message){ - if($message['ACK'] == 'no'){ + if(isset($message['ACK']) && $message['ACK'] == 'no'){ $panel[$user]['NOTIFICATIONS'] = 'yes'; break; } @@ -214,7 +229,14 @@ function top_panel($user, $TAB) { function translate_date($date){ $date = strtotime($date); - return strftime("%d  ", $date).__(strftime("%b", $date)).strftime("  %Y", $date); + if (version_compare(PHP_VERSION, '5.6', '==')) { + return strftime("%d  ", $date).__(strftime("%b", $date)).strftime("  %Y", $date); + } else { + $day = date('d', $date); + $mon = date('M', $date); + $year = date('Y', $date); + return $day.'  '.__($mon).'  '.$year; + } } function humanize_time($usage) { diff --git a/web/list/backup/index.php b/web/list/backup/index.php index 2e29a50a..28460a70 100644 --- a/web/list/backup/index.php +++ b/web/list/backup/index.php @@ -9,14 +9,14 @@ include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php'); if (empty($_GET['backup'])){ exec (VESTA_CMD."v-list-user-backups $user json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data,true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } unset($output); render_page($user, $TAB, 'list_backup'); } else { exec (VESTA_CMD."v-list-user-backup $user ".escapeshellarg($_GET['backup'])." json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data,true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } unset($output); render_page($user, $TAB, 'list_backup_detail'); diff --git a/web/list/cron/index.php b/web/list/cron/index.php index 230483cb..0014be84 100644 --- a/web/list/cron/index.php +++ b/web/list/cron/index.php @@ -8,7 +8,7 @@ include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php'); // Data exec (VESTA_CMD."v-list-cron-jobs $user json", $output, $return_var); $data = json_decode(implode('', $output), true); -$data = array_reverse($data,true); +if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } unset($output); // Render page diff --git a/web/list/db/index.php b/web/list/db/index.php index 42129064..0a2560ef 100644 --- a/web/list/db/index.php +++ b/web/list/db/index.php @@ -8,7 +8,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Data exec (VESTA_CMD."v-list-databases $user json", $output, $return_var); $data = json_decode(implode('', $output), true); -$data = array_reverse($data, true); +if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); // Render page diff --git a/web/list/directory/index.php b/web/list/directory/index.php index 7a57566c..0b845f00 100644 --- a/web/list/directory/index.php +++ b/web/list/directory/index.php @@ -22,6 +22,7 @@ if (empty($panel)) { exit; } $panel = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($panel)) { $panel = array(); } } $path_a = !empty($_REQUEST['dir_a']) ? htmlentities($_REQUEST['dir_a']) : ''; diff --git a/web/list/dns/index.php b/web/list/dns/index.php index 53d5980c..8da98594 100644 --- a/web/list/dns/index.php +++ b/web/list/dns/index.php @@ -9,14 +9,14 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); if (empty($_GET['domain'])){ exec (VESTA_CMD."v-list-dns-domains ".escapeshellarg($user)." json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data, true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); render_page($user, $TAB, 'list_dns'); } else { exec (VESTA_CMD."v-list-dns-records ".escapeshellarg($user)." ".escapeshellarg($_GET['domain'])." json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data, true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); render_page($user, $TAB, 'list_dns_rec'); diff --git a/web/list/firewall/banlist/index.php b/web/list/firewall/banlist/index.php index 6d8cddb4..b03a419d 100644 --- a/web/list/firewall/banlist/index.php +++ b/web/list/firewall/banlist/index.php @@ -14,7 +14,7 @@ if ($_SESSION['user'] != 'admin') { // Data exec (VESTA_CMD."v-list-firewall-ban json", $output, $return_var); $data = json_decode(implode('', $output), true); -$data = array_reverse($data, true); +if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); // Render page diff --git a/web/list/firewall/banlist/ip_info.php b/web/list/firewall/banlist/ip_info.php index e7888a75..dd94a029 100644 --- a/web/list/firewall/banlist/ip_info.php +++ b/web/list/firewall/banlist/ip_info.php @@ -1,8 +1,8 @@ - $note){ $note['ID'] = $key; $data[$key] = $note; @@ -25,7 +25,7 @@ $TAB = 'NOTIFICATIONS'; // Data exec (VESTA_CMD."v-list-user-notifications $user json", $output, $return_var); $data = json_decode(implode('', $output), true); -$data = array_reverse($data,true); +if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } // Render page render_page($user, $TAB, 'list_notifications'); diff --git a/web/list/package/index.php b/web/list/package/index.php index 7d7f35e5..8bf029ab 100644 --- a/web/list/package/index.php +++ b/web/list/package/index.php @@ -15,6 +15,7 @@ if ($_SESSION['user'] != 'admin') { // Data exec (VESTA_CMD."v-list-user-packages json", $output, $return_var); $data = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($data)) { $data = array(); } unset($output); // Render page diff --git a/web/list/rrd/index.php b/web/list/rrd/index.php index 2c30b530..fd79e64f 100644 --- a/web/list/rrd/index.php +++ b/web/list/rrd/index.php @@ -18,6 +18,7 @@ if (!empty($_GET['period'])) { // Data exec (VESTA_CMD."v-list-sys-rrd json", $output, $return_var); $data = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($data)) { $data = array(); } unset($output); // Render page diff --git a/web/list/server/index.php b/web/list/server/index.php index b7150778..cda1fca9 100644 --- a/web/list/server/index.php +++ b/web/list/server/index.php @@ -116,9 +116,11 @@ if (isset($_GET['db'])) { // Data exec (VESTA_CMD."v-list-sys-info json", $output, $return_var); $sys = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($sys)) { $sys = array(); } unset($output); exec (VESTA_CMD."v-list-sys-services json", $output, $return_var); $data = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($data)) { $data = array(); } unset($output); // Render page diff --git a/web/list/stats/index.php b/web/list/stats/index.php index 3c730632..4db65f9b 100644 --- a/web/list/stats/index.php +++ b/web/list/stats/index.php @@ -10,13 +10,13 @@ if ($user == 'admin') { if (empty($_GET['user'])) { exec (VESTA_CMD."v-list-users-stats json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data, true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); } else { $v_user = escapeshellarg($_GET['user']); exec (VESTA_CMD."v-list-user-stats $v_user json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data, true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); } @@ -26,7 +26,7 @@ if ($user == 'admin') { } else { exec (VESTA_CMD."v-list-user-stats $user json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data, true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data, true); } else { $data = is_array($data) ? array_reverse($data, true) : array(); } unset($output); } diff --git a/web/list/updates/index.php b/web/list/updates/index.php index ef1f9b17..e27f4138 100644 --- a/web/list/updates/index.php +++ b/web/list/updates/index.php @@ -14,6 +14,7 @@ if ($_SESSION['user'] != 'admin') { // Data exec (VESTA_CMD."v-list-sys-vesta-updates json", $output, $return_var); $data = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($data)) { $data = array(); } unset($output); exec (VESTA_CMD."v-list-sys-vesta-autoupdate plain", $output, $return_var); $autoupdate = $output['0']; diff --git a/web/list/user/index.php b/web/list/user/index.php index da708edc..93a56ee1 100644 --- a/web/list/user/index.php +++ b/web/list/user/index.php @@ -12,7 +12,7 @@ if ($user == 'admin') { exec (VESTA_CMD . "v-list-user ".$user." json", $output, $return_var); } $data = json_decode(implode('', $output), true); -$data = array_reverse($data,true); +if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } // Check and get changelog if needed if ($user == 'admin') { diff --git a/web/list/web/index.php b/web/list/web/index.php index 688dfeaa..11b187dc 100644 --- a/web/list/web/index.php +++ b/web/list/web/index.php @@ -8,7 +8,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Data exec (VESTA_CMD."v-list-web-domains $user json", $output, $return_var); $data = json_decode(implode('', $output), true); -$data = array_reverse($data,true); +if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } $ips = json_decode(shell_exec(VESTA_CMD.'v-list-sys-ips json'), true); // Render page diff --git a/web/login/index.php b/web/login/index.php index 5de05451..f508c845 100644 --- a/web/login/index.php +++ b/web/login/index.php @@ -27,7 +27,12 @@ if (isset($_SESSION['user'])) { if ($_SESSION['user'] == 'admin' && !empty($_GET['loginas'])) { exec (VESTA_CMD . "v-list-user ".escapeshellarg($_GET['loginas'])." json", $output, $return_var); if ( $return_var == 0 ) { - $data = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $data = json_decode(implode('', $output), true); + } else { + $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array(); } + } reset($data); $_SESSION['look'] = key($data); $_SESSION['look_alert'] = 'yes'; @@ -51,7 +56,12 @@ if (isset($_POST['user']) && isset($_POST['password'])) { // Get user's salt $output = ''; exec (VESTA_CMD."v-get-user-salt ".$v_user." ".$v_ip." json" , $output, $return_var); - $pam = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $pam = json_decode(implode('', $output), true); + } else { + $pam = json_decode(implode('', $output), true); + if (!is_array($pam)) { $pam = array(); } + } if ( $return_var > 0 ) { $ERROR = "".__('Invalid username or password').""; } else { @@ -94,7 +104,12 @@ if (isset($_POST['user']) && isset($_POST['password'])) { // Get user speciefic parameters exec (VESTA_CMD . "v-list-user ".$v_user." json", $output, $return_var); - $data = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $data = json_decode(implode('', $output), true); + } else { + $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array(); } + } // Define session user $_SESSION['user'] = key($data); @@ -106,7 +121,12 @@ if (isset($_POST['user']) && isset($_POST['password'])) { // Define language $output = ''; exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); - $languages = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $languages = json_decode(implode('', $output), true); + } else { + $languages = json_decode(implode('', $output), true); + if (!is_array($languages)) { $languages = array(); } + } if (in_array($data[$v_user]['LANGUAGE'], $languages)){ $_SESSION['language'] = $data[$v_user]['LANGUAGE']; } else { @@ -135,7 +155,12 @@ if (isset($_POST['user']) && isset($_POST['password'])) { // Check system configuration exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var); -$data = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '==')) { + $data = json_decode(implode('', $output), true); +} else { + $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array('config' => array()); } +} $sys_arr = $data['config']; foreach ($sys_arr as $key => $value) { $_SESSION[$key] = $value; @@ -145,12 +170,22 @@ foreach ($sys_arr as $key => $value) { if (empty($_SESSION['language'])) { $output = ''; exec (VESTA_CMD."v-list-sys-config json", $output, $return_var); - $config = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $config = json_decode(implode('', $output), true); + } else { + $config = json_decode(implode('', $output), true); + if (!is_array($config)) { $config = array('config' => array('LANGUAGE' => 'en')); } + } $lang = $config['config']['LANGUAGE']; $output = ''; exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); - $languages = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $languages = json_decode(implode('', $output), true); + } else { + $languages = json_decode(implode('', $output), true); + if (!is_array($languages)) { $languages = array(); } + } if(in_array($lang, $languages)){ $_SESSION['language'] = $lang; } diff --git a/web/reset/index.php b/web/reset/index.php index 9a42b2cb..816d3155 100644 --- a/web/reset/index.php +++ b/web/reset/index.php @@ -24,7 +24,12 @@ if ((!empty($_POST['user'])) && (empty($_POST['code']))) { $cmd="/usr/bin/sudo /usr/local/vesta/bin/v-list-user"; exec ($cmd." ".$v_user." json", $output, $return_var); if ( $return_var == 0 ) { - $data = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $data = json_decode(implode('', $output), true); + } else { + $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array(); } + } unset($output); exec("/usr/bin/sudo /usr/local/vesta/bin/v-get-user-value ".$v_user." RKEYEXP", $output, $return_var); $rkeyexp = trim(implode('', $output)); @@ -84,7 +89,12 @@ if ((!empty($_POST['user'])) && (!empty($_POST['code'])) && (!empty($_POST['pass $cmd="/usr/bin/sudo /usr/local/vesta/bin/v-list-user"; exec ($cmd." ".$v_user." json", $output, $return_var); if ( $return_var == 0 ) { - $data = json_decode(implode('', $output), true); + if (version_compare(PHP_VERSION, '5.6', '==')) { + $data = json_decode(implode('', $output), true); + } else { + $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array(); } + } unset($output); $rkey = $data[$user]['RKEY']; if (hash_equals($rkey, $_POST['code'])) { diff --git a/web/search/index.php b/web/search/index.php index 808b6f41..2b7f5c97 100644 --- a/web/search/index.php +++ b/web/search/index.php @@ -28,6 +28,7 @@ $command = $_SESSION['user'] == 'admin' exec (VESTA_CMD . $command, $output, $return_var); $data = json_decode(implode('', $output), true); +if (version_compare(PHP_VERSION, '5.6', '!=') && !is_array($data)) { $data = array(); } // Render page render_page($user, $TAB, 'list_search'); diff --git a/web/templates/admin/add_web.html b/web/templates/admin/add_web.html index 77e72239..7db3be5a 100644 --- a/web/templates/admin/add_web.html +++ b/web/templates/admin/add_web.html @@ -253,7 +253,7 @@ - + diff --git a/web/templates/admin/list_stats.html b/web/templates/admin/list_stats.html index bc3192d2..27637751 100644 --- a/web/templates/admin/list_stats.html +++ b/web/templates/admin/list_stats.html @@ -74,7 +74,7 @@
- +
diff --git a/web/templates/right.html b/web/templates/right.html index 88e1f5f0..bec69b4f 100644 --- a/web/templates/right.html +++ b/web/templates/right.html @@ -64,7 +64,7 @@ $output=''; exec (VESTA_CMD . "v-list-user ".$GLOBALS['CURRENT_USER_FINAL']." json", $output, $return_var); $data = json_decode(implode('', $output), true); - $data = array_reverse($data,true); + if (version_compare(PHP_VERSION, '5.6', '==')) { $data = array_reverse($data,true); } else { $data = is_array($data) ? array_reverse($data,true) : array(); } //print_r($data); exit; $key=$GLOBALS['CURRENT_USER_FINAL']; if ($data[$key]['DISK_QUOTA']=='unlimited') echo __('unlimited'); diff --git a/web/templates/user/list_stats.html b/web/templates/user/list_stats.html index 7313060b..71e9765a 100644 --- a/web/templates/user/list_stats.html +++ b/web/templates/user/list_stats.html @@ -77,7 +77,7 @@
- +