Merge branch 'ent-3568-limitar-acceso-a-la-consola-cuando-se-supere-el-limite-de-agentes' into 'develop'

Ent 3568 limitar acceso a la consola cuando se supere el limite de agentes

See merge request artica/pandorafms!2293

Former-commit-id: caedaf6470c3fbea8d76db4b61a5a8d241dc7830
This commit is contained in:
Daniel Rodriguez 2019-03-26 18:04:56 +01:00
commit 0982cd61b5
5 changed files with 55 additions and 7 deletions

View File

@ -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.',

View File

@ -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;

View File

@ -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) {
}
// ~ }
}
}

View File

@ -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);
}
});

View File

@ -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