diff --git a/index.php b/index.php index 2dbc86e3cb..9fbfb9cef7 100644 --- a/index.php +++ b/index.php @@ -110,6 +110,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) { $routes->addRoute(['GET', 'POST'], '/lint', function () { require_once ROOT_PATH . 'libraries/entry_points/lint.php'; }); + $routes->addRoute(['GET', 'POST'], '/logout', function () { + require_once ROOT_PATH . 'libraries/entry_points/logout.php'; + }); $routes->addGroup('/server', function (RouteCollector $routes) { $routes->addRoute(['GET', 'POST'], '/binlog', function () { require_once ROOT_PATH . 'libraries/entry_points/server/binlog.php'; diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index 76bdd4349a..79637ef321 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -2251,7 +2251,7 @@ class DatabaseInterface $error .= $separator . __('The server is not responding.'); } elseif ($error_number == 1698) { $error .= ' - ' . $error_message; - $error .= $separator . ''; + $error .= $separator . ''; $error .= __('Logout and try as another user.') . ''; } elseif ($error_number == 1005) { if (strpos($error_message, 'errno: 13') !== false) { diff --git a/logout.php b/libraries/entry_points/logout.php similarity index 75% rename from logout.php rename to libraries/entry_points/logout.php index c118396991..92efb95179 100644 --- a/logout.php +++ b/libraries/entry_points/logout.php @@ -10,14 +10,12 @@ declare(strict_types=1); use PhpMyAdmin\Core; use PhpMyAdmin\Plugins\AuthenticationPlugin; -if (! defined('ROOT_PATH')) { - define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); +if (! defined('PHPMYADMIN')) { + exit; } global $auth_plugin, $token_mismatch; -require_once ROOT_PATH . 'libraries/common.inc.php'; - if ($_SERVER['REQUEST_METHOD'] != 'POST' || $token_mismatch) { Core::sendHeaderLocation('./index.php'); } else { diff --git a/templates/navigation/main.twig b/templates/navigation/main.twig index becf789a70..8dc495c979 100644 --- a/templates/navigation/main.twig +++ b/templates/navigation/main.twig @@ -28,7 +28,7 @@ {% if server != 0 %} - + {{- get_image('s_loggoff', auth_type == 'config' ? 'Empty session data'|trans : 'Log out'|trans) -}} {% endif %} diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php index 875d21d616..c6dcb91f77 100644 --- a/test/classes/DatabaseInterfaceTest.php +++ b/test/classes/DatabaseInterfaceTest.php @@ -434,7 +434,7 @@ class DatabaseInterfaceTest extends PmaTestCase [ 1698, 'msg', - 'logout.php', + 'index.php?route=/logout', ], [ 1005,