From aa99319d4574182b61f409ec4cea3c792a1862ef Mon Sep 17 00:00:00 2001 From: "Jehan-Guillaume (ioguix) de Rorthais" Date: Fri, 5 Apr 2013 14:35:54 +0200 Subject: [PATCH] Instanciate $plugin_manager from login.php script if needed This answers the question in commit message: 7d89d7cca40b5a8c3ac1874436630993f518410c. When the script require a database connexion and the user must login, or in some cases of some other related errors, we ar eincluding the login.php script and exit immediatly. The login.php script requires the $plugin_manager, but it is instanciated AFTER the connection codeblock (see commit 7d89d7cc), leading to a FATAL error. --- libraries/lib.inc.php | 1 - login.php | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index 0a05f101..bf4b9a55 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -202,7 +202,6 @@ // Redirect to the login form if not logged in if (!isset($_server_info['username'])) { - $plugin_manager = new PluginManager($_language); include('./login.php'); exit; } diff --git a/login.php b/login.php index cdcf311e..6fa92567 100755 --- a/login.php +++ b/login.php @@ -5,12 +5,15 @@ * * $Id: login.php,v 1.38 2007/09/04 19:39:48 ioguix Exp $ */ - global $conf; + global $conf, $plugin_manager; // This needs to be an include once to prevent lib.inc.php infinite recursive includes. // Check to see if the configuration file exists, if not, explain require_once('./libraries/lib.inc.php'); + if (!isset($plugin_manager)) + $plugin_manager = new PluginManager($_SESSION['webdbLanguage']); + $misc->printHeader($lang['strlogin']); $misc->printBody(); $misc->printTrail('root'); -- 2.39.5