From a6327a16ad6f3493e07c5e421ed10700458754bf Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 1 Jul 2019 12:46:09 +0200 Subject: [PATCH] Session expiration ignoring notifications checks --- pandora_console/ajax.php | 55 +++++--- pandora_console/include/functions_config.php | 12 +- pandora_console/include/load_session.php | 130 ++++++++++++++++--- 3 files changed, 159 insertions(+), 38 deletions(-) diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index 92f6c146bc..beb07e7752 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -1,17 +1,34 @@ $session_id]); + $retval_write = db_process_sql_update( + 'tsessions_php', + $values, + ['id_session' => $session_id] + ); } return $retval_write !== false; } +/** + * Destroy a session. + * + * @param string $session_id Session Id. + * + * @return boolean + */ function pandora_session_destroy($session_id) { $session_id = addslashes($session_id); - $retval = (bool) db_process_sql_delete('tsessions_php', ['id_session' => $session_id]); + $retval = (bool) db_process_sql_delete( + 'tsessions_php', + ['id_session' => $session_id] + ); return $retval; } +/** + * Session garbage collector. + * + * @param integer $max_lifetime Max lifetime. + * + * @return boolean. + */ function pandora_session_gc($max_lifetime=300) { global $config; @@ -80,7 +164,12 @@ function pandora_session_gc($max_lifetime=300) $time_limit = (time() - $max_lifetime); - $retval = (bool) db_process_sql_delete('tsessions_php', ['last_active' => '<'.$time_limit]); + $retval = (bool) db_process_sql_delete( + 'tsessions_php', + [ + 'last_active' => '<'.$time_limit, + ] + ); return $retval; } @@ -88,5 +177,12 @@ function pandora_session_gc($max_lifetime=300) // FIXME: SAML should work with pandora session handlers if (db_get_value('value', 'tconfig', 'token', 'auth') != 'saml') { - $result_handler = session_set_save_handler('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc'); + $result_handler = session_set_save_handler( + 'pandora_session_open', + 'pandora_session_close', + 'pandora_session_read', + 'pandora_session_write', + 'pandora_session_destroy', + 'pandora_session_gc' + ); }