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,14 @@ 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 (!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 = 'no'; +if (is_array($v_mysql_hosts) && count($v_mysql_hosts) > 0) $v_mysql = 'yes'; $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 = 'no'; +if (is_array($v_pgsql_hosts) && count($v_pgsql_hosts) > 0) $v_pgsql = 'yes'; unset($db_hosts); // List backup settings @@ -81,39 +86,42 @@ 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 (!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 (!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']; -$v_sys_ssl_ca = $v_sys_ssl_str['VESTA']['CA']; -$v_sys_ssl_subject = $v_sys_ssl_str['VESTA']['SUBJECT']; -$v_sys_ssl_aliases = $v_sys_ssl_str['VESTA']['ALIASES']; -$v_sys_ssl_not_before = $v_sys_ssl_str['VESTA']['NOT_BEFORE']; -$v_sys_ssl_not_after = $v_sys_ssl_str['VESTA']['NOT_AFTER']; -$v_sys_ssl_signature = $v_sys_ssl_str['VESTA']['SIGNATURE']; -$v_sys_ssl_pub_key = $v_sys_ssl_str['VESTA']['PUB_KEY']; -$v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER']; +$v_sys_ssl_crt = isset($v_sys_ssl_str['VESTA']['CRT']) ? $v_sys_ssl_str['VESTA']['CRT'] : ''; +$v_sys_ssl_key = isset($v_sys_ssl_str['VESTA']['KEY']) ? $v_sys_ssl_str['VESTA']['KEY'] : ''; +$v_sys_ssl_ca = isset($v_sys_ssl_str['VESTA']['CA']) ? $v_sys_ssl_str['VESTA']['CA'] : ''; +$v_sys_ssl_subject = isset($v_sys_ssl_str['VESTA']['SUBJECT']) ? $v_sys_ssl_str['VESTA']['SUBJECT'] : ''; +$v_sys_ssl_aliases = isset($v_sys_ssl_str['VESTA']['ALIASES']) ? $v_sys_ssl_str['VESTA']['ALIASES'] : ''; +$v_sys_ssl_not_before = isset($v_sys_ssl_str['VESTA']['NOT_BEFORE']) ? $v_sys_ssl_str['VESTA']['NOT_BEFORE'] : ''; +$v_sys_ssl_not_after = isset($v_sys_ssl_str['VESTA']['NOT_AFTER']) ? $v_sys_ssl_str['VESTA']['NOT_AFTER'] : ''; +$v_sys_ssl_signature = isset($v_sys_ssl_str['VESTA']['SIGNATURE']) ? $v_sys_ssl_str['VESTA']['SIGNATURE'] : ''; +$v_sys_ssl_pub_key = isset($v_sys_ssl_str['VESTA']['PUB_KEY']) ? $v_sys_ssl_str['VESTA']['PUB_KEY'] : ''; +$v_sys_ssl_issuer = isset($v_sys_ssl_str['VESTA']['ISSUER']) ? $v_sys_ssl_str['VESTA']['ISSUER'] : ''; // List mail ssl certificate info -if (!empty($_SESSION['VESTA_CERTIFICATE'])); { +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 (!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']; - $v_mail_ssl_ca = $v_mail_ssl_str['MAIL']['CA']; - $v_mail_ssl_subject = $v_mail_ssl_str['MAIL']['SUBJECT']; - $v_mail_ssl_aliases = $v_mail_ssl_str['MAIL']['ALIASES']; - $v_mail_ssl_not_before = $v_mail_ssl_str['MAIL']['NOT_BEFORE']; - $v_mail_ssl_not_after = $v_mail_ssl_str['MAIL']['NOT_AFTER']; - $v_mail_ssl_signature = $v_mail_ssl_str['MAIL']['SIGNATURE']; - $v_mail_ssl_pub_key = $v_mail_ssl_str['MAIL']['PUB_KEY']; - $v_mail_ssl_issuer = $v_mail_ssl_str['MAIL']['ISSUER']; + $v_mail_ssl_crt = isset($v_mail_ssl_str['MAIL']['CRT']) ? $v_mail_ssl_str['MAIL']['CRT'] : ''; + $v_mail_ssl_key = isset($v_mail_ssl_str['MAIL']['KEY']) ? $v_mail_ssl_str['MAIL']['KEY'] : ''; + $v_mail_ssl_ca = isset($v_mail_ssl_str['MAIL']['CA']) ? $v_mail_ssl_str['MAIL']['CA'] : ''; + $v_mail_ssl_subject = isset($v_mail_ssl_str['MAIL']['SUBJECT']) ? $v_mail_ssl_str['MAIL']['SUBJECT'] : ''; + $v_mail_ssl_aliases = isset($v_mail_ssl_str['MAIL']['ALIASES']) ? $v_mail_ssl_str['MAIL']['ALIASES'] : ''; + $v_mail_ssl_not_before = isset($v_mail_ssl_str['MAIL']['NOT_BEFORE']) ? $v_mail_ssl_str['MAIL']['NOT_BEFORE'] : ''; + $v_mail_ssl_not_after = isset($v_mail_ssl_str['MAIL']['NOT_AFTER']) ? $v_mail_ssl_str['MAIL']['NOT_AFTER'] : ''; + $v_mail_ssl_signature = isset($v_mail_ssl_str['MAIL']['SIGNATURE']) ? $v_mail_ssl_str['MAIL']['SIGNATURE'] : ''; + $v_mail_ssl_pub_key = isset($v_mail_ssl_str['MAIL']['PUB_KEY']) ? $v_mail_ssl_str['MAIL']['PUB_KEY'] : ''; + $v_mail_ssl_issuer = isset($v_mail_ssl_str['MAIL']['ISSUER']) ? $v_mail_ssl_str['MAIL']['ISSUER'] : ''; } // Check POST request @@ -242,17 +250,18 @@ 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 (!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']; - $v_mail_ssl_ca = $v_mail_ssl_str['MAIL']['CA']; - $v_mail_ssl_subject = $v_mail_ssl_str['MAIL']['SUBJECT']; - $v_mail_ssl_aliases = $v_mail_ssl_str['MAIL']['ALIASES']; - $v_mail_ssl_not_before = $v_mail_ssl_str['MAIL']['NOT_BEFORE']; - $v_mail_ssl_not_after = $v_mail_ssl_str['MAIL']['NOT_AFTER']; - $v_mail_ssl_signature = $v_mail_ssl_str['MAIL']['SIGNATURE']; - $v_mail_ssl_pub_key = $v_mail_ssl_str['MAIL']['PUB_KEY']; - $v_mail_ssl_issuer = $v_mail_ssl_str['MAIL']['ISSUER']; + $v_mail_ssl_crt = isset($v_mail_ssl_str['MAIL']['CRT']) ? $v_mail_ssl_str['MAIL']['CRT'] : ''; + $v_mail_ssl_key = isset($v_mail_ssl_str['MAIL']['KEY']) ? $v_mail_ssl_str['MAIL']['KEY'] : ''; + $v_mail_ssl_ca = isset($v_mail_ssl_str['MAIL']['CA']) ? $v_mail_ssl_str['MAIL']['CA'] : ''; + $v_mail_ssl_subject = isset($v_mail_ssl_str['MAIL']['SUBJECT']) ? $v_mail_ssl_str['MAIL']['SUBJECT'] : ''; + $v_mail_ssl_aliases = isset($v_mail_ssl_str['MAIL']['ALIASES']) ? $v_mail_ssl_str['MAIL']['ALIASES'] : ''; + $v_mail_ssl_not_before = isset($v_mail_ssl_str['MAIL']['NOT_BEFORE']) ? $v_mail_ssl_str['MAIL']['NOT_BEFORE'] : ''; + $v_mail_ssl_not_after = isset($v_mail_ssl_str['MAIL']['NOT_AFTER']) ? $v_mail_ssl_str['MAIL']['NOT_AFTER'] : ''; + $v_mail_ssl_signature = isset($v_mail_ssl_str['MAIL']['SIGNATURE']) ? $v_mail_ssl_str['MAIL']['SIGNATURE'] : ''; + $v_mail_ssl_pub_key = isset($v_mail_ssl_str['MAIL']['PUB_KEY']) ? $v_mail_ssl_str['MAIL']['PUB_KEY'] : ''; + $v_mail_ssl_issuer = isset($v_mail_ssl_str['MAIL']['ISSUER']) ? $v_mail_ssl_str['MAIL']['ISSUER'] : ''; } } } @@ -444,17 +453,18 @@ if (!empty($_POST['save'])) { // 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 (!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']; - $v_sys_ssl_ca = $v_sys_ssl_str['VESTA']['CA']; - $v_sys_ssl_subject = $v_sys_ssl_str['VESTA']['SUBJECT']; - $v_sys_ssl_aliases = $v_sys_ssl_str['VESTA']['ALIASES']; - $v_sys_ssl_not_before = $v_sys_ssl_str['VESTA']['NOT_BEFORE']; - $v_sys_ssl_not_after = $v_sys_ssl_str['VESTA']['NOT_AFTER']; - $v_sys_ssl_signature = $v_sys_ssl_str['VESTA']['SIGNATURE']; - $v_sys_ssl_pub_key = $v_sys_ssl_str['VESTA']['PUB_KEY']; - $v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER']; + $v_sys_ssl_crt = isset($v_sys_ssl_str['VESTA']['CRT']) ? $v_sys_ssl_str['VESTA']['CRT'] : ''; + $v_sys_ssl_key = isset($v_sys_ssl_str['VESTA']['KEY']) ? $v_sys_ssl_str['VESTA']['KEY'] : ''; + $v_sys_ssl_ca = isset($v_sys_ssl_str['VESTA']['CA']) ? $v_sys_ssl_str['VESTA']['CA'] : ''; + $v_sys_ssl_subject = isset($v_sys_ssl_str['VESTA']['SUBJECT']) ? $v_sys_ssl_str['VESTA']['SUBJECT'] : ''; + $v_sys_ssl_aliases = isset($v_sys_ssl_str['VESTA']['ALIASES']) ? $v_sys_ssl_str['VESTA']['ALIASES'] : ''; + $v_sys_ssl_not_before = isset($v_sys_ssl_str['VESTA']['NOT_BEFORE']) ? $v_sys_ssl_str['VESTA']['NOT_BEFORE'] : ''; + $v_sys_ssl_not_after = isset($v_sys_ssl_str['VESTA']['NOT_AFTER']) ? $v_sys_ssl_str['VESTA']['NOT_AFTER'] : ''; + $v_sys_ssl_signature = isset($v_sys_ssl_str['VESTA']['SIGNATURE']) ? $v_sys_ssl_str['VESTA']['SIGNATURE'] : ''; + $v_sys_ssl_pub_key = isset($v_sys_ssl_str['VESTA']['PUB_KEY']) ? $v_sys_ssl_str['VESTA']['PUB_KEY'] : ''; + $v_sys_ssl_issuer = isset($v_sys_ssl_str['VESTA']['ISSUER']) ? $v_sys_ssl_str['VESTA']['ISSUER'] : ''; } } } @@ -490,17 +500,18 @@ if (!empty($_POST['save'])) { // 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 (!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']; - $v_sys_ssl_ca = $v_sys_ssl_str['VESTA']['CA']; - $v_sys_ssl_subject = $v_sys_ssl_str['VESTA']['SUBJECT']; - $v_sys_ssl_aliases = $v_sys_ssl_str['VESTA']['ALIASES']; - $v_sys_ssl_not_before = $v_sys_ssl_str['VESTA']['NOT_BEFORE']; - $v_sys_ssl_not_after = $v_sys_ssl_str['VESTA']['NOT_AFTER']; - $v_sys_ssl_signature = $v_sys_ssl_str['VESTA']['SIGNATURE']; - $v_sys_ssl_pub_key = $v_sys_ssl_str['VESTA']['PUB_KEY']; - $v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER']; + $v_sys_ssl_crt = isset($v_sys_ssl_str['VESTA']['CRT']) ? $v_sys_ssl_str['VESTA']['CRT'] : ''; + $v_sys_ssl_key = isset($v_sys_ssl_str['VESTA']['KEY']) ? $v_sys_ssl_str['VESTA']['KEY'] : ''; + $v_sys_ssl_ca = isset($v_sys_ssl_str['VESTA']['CA']) ? $v_sys_ssl_str['VESTA']['CA'] : ''; + $v_sys_ssl_subject = isset($v_sys_ssl_str['VESTA']['SUBJECT']) ? $v_sys_ssl_str['VESTA']['SUBJECT'] : ''; + $v_sys_ssl_aliases = isset($v_sys_ssl_str['VESTA']['ALIASES']) ? $v_sys_ssl_str['VESTA']['ALIASES'] : ''; + $v_sys_ssl_not_before = isset($v_sys_ssl_str['VESTA']['NOT_BEFORE']) ? $v_sys_ssl_str['VESTA']['NOT_BEFORE'] : ''; + $v_sys_ssl_not_after = isset($v_sys_ssl_str['VESTA']['NOT_AFTER']) ? $v_sys_ssl_str['VESTA']['NOT_AFTER'] : ''; + $v_sys_ssl_signature = isset($v_sys_ssl_str['VESTA']['SIGNATURE']) ? $v_sys_ssl_str['VESTA']['SIGNATURE'] : ''; + $v_sys_ssl_pub_key = isset($v_sys_ssl_str['VESTA']['PUB_KEY']) ? $v_sys_ssl_str['VESTA']['PUB_KEY'] : ''; + $v_sys_ssl_issuer = isset($v_sys_ssl_str['VESTA']['ISSUER']) ? $v_sys_ssl_str['VESTA']['ISSUER'] : ''; } } } diff --git a/web/inc/i18n.php b/web/inc/i18n.php index 9d6c1b7e..48cdf63d 100644 --- a/web/inc/i18n.php +++ b/web/inc/i18n.php @@ -89,7 +89,7 @@ function detect_user_language($fallback='en') { $accept_langs_sorted[$code] = (double)$q; } } - arsort($accept_langs_sorted); + 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/mail-wrapper.php b/web/inc/mail-wrapper.php index 4281aaad..c5041c3a 100755 --- a/web/inc/mail-wrapper.php +++ b/web/inc/mail-wrapper.php @@ -20,6 +20,7 @@ include("/usr/local/vesta/web/inc/main.php"); // Set system language exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var); $data = json_decode(implode('', $output), true); +if (!is_array($data)) $data = array('config' => array()); if (!empty( $data['config']['LANGUAGE'])) { $_SESSION['language'] = $data['config']['LANGUAGE']; } else { diff --git a/web/inc/main.php b/web/inc/main.php index f13e4142..99e4ca90 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -108,18 +108,19 @@ 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); + $data = is_array($data) ? array_reverse($data, true) : array(); $favourites = array(); - foreach($data['Favourites'] as $key => $favourite){ - $favourites[$key] = array(); + if (isset($data['Favourites']) && is_array($data['Favourites'])) { + foreach($data['Favourites'] as $key => $favourite){ + $favourites[$key] = array(); - $items = explode(',', $favourite); - foreach($items as $item){ - if($item) - $favourites[$key][trim($item)] = 1; + $items = explode(',', $favourite); + foreach($items as $item){ + if($item) + $favourites[$key][trim($item)] = 1; + } } } @@ -189,6 +190,7 @@ function top_panel($user, $TAB) { exit; } $panel = json_decode(implode('', $output), true); + if (!is_array($panel)) $panel = array(); unset($output); @@ -196,8 +198,9 @@ function top_panel($user, $TAB) { $command = VESTA_CMD."v-list-user-notifications '".$user."' 'json'"; exec ($command, $output, $return_var); $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 +217,10 @@ function top_panel($user, $TAB) { function translate_date($date){ $date = strtotime($date); - return strftime("%d  ", $date).__(strftime("%b", $date)).strftime("  %Y", $date); + $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..c32324e9 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); + $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); + $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..dc1e1121 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); +$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..e2610e0f 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); +$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..ef5defeb 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 (!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..ec47d8c2 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); + $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); + $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..e278defb 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); +$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); +$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..3feb622d 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 (!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..81fde136 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 (!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..15cd306f 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 (!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 (!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..b9b19ded 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); + $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); + $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); + $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..3b346fc1 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 (!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 4e5ac369..ca82dbba 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); +$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..39985128 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); +$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..8a22e204 100644 --- a/web/login/index.php +++ b/web/login/index.php @@ -28,6 +28,7 @@ if (isset($_SESSION['user'])) { exec (VESTA_CMD . "v-list-user ".escapeshellarg($_GET['loginas'])." json", $output, $return_var); if ( $return_var == 0 ) { $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array(); } reset($data); $_SESSION['look'] = key($data); $_SESSION['look_alert'] = 'yes'; @@ -52,6 +53,7 @@ if (isset($_POST['user']) && isset($_POST['password'])) { $output = ''; exec (VESTA_CMD."v-get-user-salt ".$v_user." ".$v_ip." json" , $output, $return_var); $pam = json_decode(implode('', $output), true); + if (!is_array($pam)) $pam = array(); if ( $return_var > 0 ) { $ERROR = "".__('Invalid username or password').""; } else { @@ -95,6 +97,7 @@ 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 (!is_array($data)) $data = array(); // Define session user $_SESSION['user'] = key($data); @@ -107,7 +110,8 @@ if (isset($_POST['user']) && isset($_POST['password'])) { $output = ''; exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); $languages = json_decode(implode('', $output), true); - if (in_array($data[$v_user]['LANGUAGE'], $languages)){ + if (!is_array($languages)) $languages = array(); + if (isset($data[$v_user]['LANGUAGE']) && in_array($data[$v_user]['LANGUAGE'], $languages)){ $_SESSION['language'] = $data[$v_user]['LANGUAGE']; } else { $_SESSION['language'] = 'en'; @@ -136,6 +140,7 @@ 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 (!is_array($data)) $data = array('config' => array()); $sys_arr = $data['config']; foreach ($sys_arr as $key => $value) { $_SESSION[$key] = $value; @@ -146,11 +151,13 @@ if (empty($_SESSION['language'])) { $output = ''; exec (VESTA_CMD."v-list-sys-config json", $output, $return_var); $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 (!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..4c3629a0 100644 --- a/web/reset/index.php +++ b/web/reset/index.php @@ -25,13 +25,14 @@ if ((!empty($_POST['user'])) && (empty($_POST['code']))) { exec ($cmd." ".$v_user." json", $output, $return_var); if ( $return_var == 0 ) { $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)); if (strlen($rkeyexp)>9) $rkeyexp=intval($rkeyexp); unset($output); if ($rkeyexp === null || $rkeyexp < time() - 900) { - if ($email == $data[$user]['CONTACT']) { + if (isset($data[$user]['CONTACT']) && $email == $data[$user]['CONTACT']) { exec("/usr/bin/sudo /usr/local/vesta/bin/v-change-user-rkey ".$v_user, $output, $return_var); unset($output); $CMD="/usr/bin/sudo /usr/local/vesta/bin/v-get-user-value ".$v_user." RKEY"; @@ -41,10 +42,10 @@ if ((!empty($_POST['user'])) && (empty($_POST['code']))) { //echo $rkey; exit; //echo $CMD."\n
"; //var_dump($rkey); exit; - $fname = $data[$user]['FNAME']; - $lname = $data[$user]['LNAME']; - $contact = $data[$user]['CONTACT']; - $to = $data[$user]['CONTACT']; + $fname = isset($data[$user]['FNAME']) ? $data[$user]['FNAME'] : ''; + $lname = isset($data[$user]['LNAME']) ? $data[$user]['LNAME'] : ''; + $contact = isset($data[$user]['CONTACT']) ? $data[$user]['CONTACT'] : ''; + $to = isset($data[$user]['CONTACT']) ? $data[$user]['CONTACT'] : ''; $subject = __('MAIL_RESET_SUBJECT',date("Y-m-d H:i:s")); $hostname = exec('hostname'); $from = __('MAIL_FROM',$hostname); @@ -85,8 +86,9 @@ if ((!empty($_POST['user'])) && (!empty($_POST['code'])) && (!empty($_POST['pass exec ($cmd." ".$v_user." json", $output, $return_var); if ( $return_var == 0 ) { $data = json_decode(implode('', $output), true); + if (!is_array($data)) { $data = array(); } unset($output); - $rkey = $data[$user]['RKEY']; + $rkey = isset($data[$user]['RKEY']) ? $data[$user]['RKEY'] : ''; if (hash_equals($rkey, $_POST['code'])) { unset($output); exec("/usr/bin/sudo /usr/local/vesta/bin/v-get-user-value ".$v_user." RKEYEXP", $output, $return_var); diff --git a/web/search/index.php b/web/search/index.php index 808b6f41..022de39f 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 (!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..910da764 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..06b29d26 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..3079231a 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); + $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..c069e234 100644 --- a/web/templates/user/list_stats.html +++ b/web/templates/user/list_stats.html @@ -77,7 +77,7 @@
- +