From c1536b79784b9465873dd75c174708818063dc88 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Mar 2019 11:46:50 +0100 Subject: [PATCH 1/5] Do not crash if an extension cannot be loaded. Former-commit-id: f303be21ceabe052545e53e1a4b6bcd08a4526c2 --- pandora_console/include/functions_extensions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index 8efb4c8f36..4e57ea84d1 100755 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -380,7 +380,15 @@ function extensions_load_extensions($process_login) // ~ } // ~ } // ~ else { + try { include_once $path_extension; + } + // PHP 7 + catch (Throwable $e) { + } + // PHP 5 + catch (Exception $e) { + } // ~ } } } From d740b328109432e8c1fba06f1baecc7f5d52e6a0 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Mar 2019 11:47:20 +0100 Subject: [PATCH 2/5] Add support for DESTDIR. Former-commit-id: 0252a660a3d8250657cd5f7b8fcfd620172c8a65 --- pandora_console/include/functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index e1861e70a3..9816e373bb 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1438,7 +1438,13 @@ function enterprise_include($filename) global $config; // Load enterprise extensions - $filepath = realpath($config['homedir'].'/'.ENTERPRISE_DIR.'/'.$filename); + if (defined('DESTDIR')) { + $destdir = DESTDIR; + } else { + $destdir = ''; + } + + $filepath = realpath($destdir.$config['homedir'].'/'.ENTERPRISE_DIR.'/'.$filename); if ($filepath === false) { return ENTERPRISE_NOT_HOOK; From c25143c27e13f7235ccf9ba1a2f117c5976ec0a3 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Mar 2019 11:53:03 +0100 Subject: [PATCH 3/5] Add a notification for 'limited mode'. Former-commit-id: dce72c7a9ea452029e5650a2012ff35cc6eca9b8 --- .../include/class/ConsoleSupervisor.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 64643b4c58..bddd417277 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -234,6 +234,7 @@ class ConsoleSupervisor /* * Check license. * NOTIF.LICENSE.EXPIRATION + * NOTIF.LICENSE.LIMITED */ $this->checkLicense(); @@ -537,6 +538,9 @@ class ConsoleSupervisor } switch ($data['type']) { + case 'NOTIF.LICENSE.LIMITED': + $max_age = 0; + break; case 'NOTIF.LICENSE.EXPIRATION': case 'NOTIF.FILES.ATTACHMENT': case 'NOTIF.FILES.DATAIN': @@ -684,11 +688,27 @@ class ConsoleSupervisor $days_to_expiry = ((strtotime($license['expiry_date']) - time()) / (60 * 60 * 24)); + // Limited mode. + if (isset($config['limited_mode'])) { + // Warn user if license is going to expire in 15 days or less. + $this->notify( + [ + 'type' => 'NOTIF.LICENSE.LIMITED', + 'title' => __('Limited mode.'), + 'message' => io_safe_output($config['limited_mode']), + 'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license', + ] + ); + } else { + $this->cleanNotifications('NOTIF.LICENSE.LIMITED'); + } + + // Expiry. if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) { // Warn user if license is going to expire in 15 days or less. $this->notify( [ - 'type' => 'NOTIF.LICENSE_EXPIRATION', + 'type' => 'NOTIF.LICENSE.EXPIRATION', 'title' => __('License is going to expire.'), 'message' => __( 'Your license is going to expire in %d days. Please contact sales.', From aa0ab53cf3d989a37d0e53b5dc289c900582ea06 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Mar 2019 15:31:51 +0100 Subject: [PATCH 4/5] Clear license errors when logging in. Former-commit-id: 1f68f190ebc84202b0e39b92c12d065f8b52543c --- pandora_console/index.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_console/index.php b/pandora_console/index.php index 1c05a97fd8..713799570c 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -244,6 +244,11 @@ if (strlen($search) > 0) { // Login process if (! isset($config['id_user'])) { + + // Clear error messages. + unset($_COOKIE['errormsg']); + setcookie('errormsg', null, -1); + if (isset($_GET['login'])) { include_once 'include/functions_db.php'; // Include it to use escape_string_sql function From fa7cdc020b1713e0a7e8e9a005253eaadbc0162e Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Mar 2019 15:32:57 +0100 Subject: [PATCH 5/5] Add a countdown to license error messages. Former-commit-id: bba7ccf777c05801731a790351dc9920b1546262 --- .../include/javascript/jquery.pandora.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index bd0da308c4..9e0b3447af 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -163,12 +163,21 @@ $(document).ready (function () { background: "black" }, open: function() { - setTimeout(function(){ - $("#spinner_ok").hide(); + var remaining = 30; + + // Timeout counter. + var count = function() { + if (remaining > 0) { + $("#license_error_remaining").text(remaining); + remaining -= 1; + } else { + $("#license_error_remaining").hide(); $("#ok_buttom").show(); - }, - 30000 - ); + clearInterval(count); + } + } + + setInterval(count, 1000); } });