From 939e33e0507484fbb50eb8588acf0295d6ffb787 Mon Sep 17 00:00:00 2001 From: Domo12 Date: Thu, 7 Sep 2023 18:13:03 +0800 Subject: [PATCH] change on administratorApplication --- .../Application/AdministratorApplication.php | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/libraries/src/Application/AdministratorApplication.php b/libraries/src/Application/AdministratorApplication.php index 51a3b8517504d..fb0d61a2b1e6f 100644 --- a/libraries/src/Application/AdministratorApplication.php +++ b/libraries/src/Application/AdministratorApplication.php @@ -461,42 +461,42 @@ protected function route() * * @since 4.0.0 */ -public function findOption(): string -{ - /** @var self $app */ - $app = Factory::getApplication(); - $option = strtolower($app->getInput()->get('option', '')); - $user = $app->getIdentity(); + public function findOption(): string + { + /** @var self $app */ + $app = Factory::getApplication(); + $option = strtolower($app->getInput()->get('option', '')); + $user = $app->getIdentity(); - /** - * Special handling for guest users and authenticated users without the Backend Login privilege. - * - * If the component they are trying to access is in the $this->allowedUnprivilegedOptions array we allow the - * request to go through. Otherwise, we force com_login to be loaded, letting the user (re)try authenticating - * with a user account that has the Backend Login privilege. - */ - if ($user->get('guest') || !$user->authorise('core.login.admin')) { - $option = in_array($option, $this->allowedUnprivilegedOptions) ? $option : 'com_login'; - } + /** + * Special handling for guest users and authenticated users without the Backend Login privilege. + * + * If the component they are trying to access is in the $this->allowedUnprivilegedOptions array we allow the + * request to go through. Otherwise, we force com_login to be loaded, letting the user (re)try authenticating + * with a user account that has the Backend Login privilege. + */ + if ($user->get('guest') || !$user->authorise('core.login.admin')) { + $option = in_array($option, $this->allowedUnprivilegedOptions) ? $option : 'com_login'; + } - /** - * If no component is defined in the request, we will try to load com_cpanel, the administrator Control Panel - * component. This allows the /administrator URL to display something meaningful after logging in instead of an - * error. - */ - if (empty($option)) { - $option = 'com_cpanel'; - } + /** + * If no component is defined in the request, we will try to load com_cpanel, the administrator Control Panel + * component. This allows the /administrator URL to display something meaningful after logging in instead of an + * error. + */ + if (empty($option)) { + $option = 'com_cpanel'; + } - /** - * Force the option to the input object. This is necessary because we might have force-changed the component in - * the two if-blocks above. - */ - $app->getInput()->set('option', $option); + /** + * Force the option to the input object. This is necessary because we might have force-changed the component in + * the two if-blocks above. + */ + $app->getInput()->set('option', $option); - // Echo the result to the console - echo "Result of findOption(): $option\n"; + // Echo the result to the console + echo "Result of findOption(): $option\n"; - return $option; -} + return $option; + } }