]> git.joonet.de Git - adminer.git/commitdiff
Centralize stopping session
authorJakub Vrana <jakub@vrana.cz>
Tue, 20 Feb 2018 22:14:36 +0000 (23:14 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 20 Feb 2018 22:14:36 +0000 (23:14 +0100)
adminer/include/auth.inc.php
adminer/include/functions.inc.php

index c25dc33ff763821a3186ba84408864c1fff627b7..71a713491550e12cf2499e57f9a535e900a06e58 100644 (file)
@@ -158,9 +158,7 @@ if (isset($_GET["username"]) && !class_exists("Min_DB")) {
        exit;
 }
 
-if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
-       session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
-}
+stop_session(true);
 
 if (isset($_GET["username"])) {
        list($host, $port) = explode(":", SERVER, 2);
index d599d1af1c9d51ccdcd8d7c00e0d87afaa50bd45..4742414e1391c260a612ed8e844fed56a8c1883a 100644 (file)
@@ -564,12 +564,13 @@ function restart_session() {
        }
 }
 
-/** Stop session if it would be possible to restart it later
+/** Stop session if possible
+* @param bool
 * @return null
 */
-function stop_session() {
-       if (!ini_bool("session.use_cookies")) {
-               session_write_close();
+function stop_session($force = false) {
+       if (!ini_bool("session.use_cookies") || ($force && @ini_set("session.use_cookies", false) !== false)) { // @ - may be disabled
+               session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
        }
 }