From cde775bd2b7b3d56ba7cd608bad870feba75432f Mon Sep 17 00:00:00 2001 From: Harro Verton Date: Fri, 28 Apr 2017 11:09:59 +0100 Subject: [PATCH] Don't destroy the session if logins are still present. fixes #12301 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you are logged-in into multiple database servers, logOut() logs you out of all of them. This fix will prevent that, and will only destroy the session when you log out of the last server. Signed-off-by: Michal Čihař Signed-off-by: Harro Verton --- libraries/plugins/AuthenticationPlugin.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/plugins/AuthenticationPlugin.php b/libraries/plugins/AuthenticationPlugin.php index 479b06d51a..eb4b3285b7 100644 --- a/libraries/plugins/AuthenticationPlugin.php +++ b/libraries/plugins/AuthenticationPlugin.php @@ -74,9 +74,17 @@ abstract class AuthenticationPlugin $PHP_AUTH_USER = ''; $PHP_AUTH_PW = ''; + /* Get a logged-in server count */ + $servers = 0; + foreach ($GLOBALS['cfg']['Servers'] as $key => $val) { + if (isset($_COOKIE['pmaAuth-' . $key])) { + $servers++; + } + } + /* delete user's choices that were stored in session */ - $_SESSION = array(); - if (!defined('TESTSUITE')) { + if ($servers === 0 and ! defined('TESTSUITE')) { + $_SESSION = array(); session_destroy(); }