diff options
Diffstat (limited to 'lib/private/legacy/OC_Util.php')
-rw-r--r-- | lib/private/legacy/OC_Util.php | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 333b621e359..35c81dd34e6 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -71,8 +71,8 @@ use OCP\Files\Template\ITemplateManager; use OCP\IConfig; use OCP\IGroupManager; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUser; -use OCP\IUserSession; use OCP\Share\IManager; use Psr\Log\LoggerInterface; @@ -1090,46 +1090,9 @@ class OC_Util { * @suppress PhanDeprecatedFunction */ public static function getDefaultPageUrl() { - /** @var IConfig $config */ - $config = \OC::$server->get(IConfig::class); - $urlGenerator = \OC::$server->getURLGenerator(); - // Deny the redirect if the URL contains a @ - // This prevents unvalidated redirects like ?redirect_url=:user@domain.com - if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) { - $location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url'])); - } else { - $defaultPage = \OC::$server->getConfig()->getAppValue('core', 'defaultpage'); - if ($defaultPage) { - $location = $urlGenerator->getAbsoluteURL($defaultPage); - } else { - $appId = 'files'; - $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'dashboard,files')); - - /** @var IUserSession $userSession */ - $userSession = \OC::$server->get(IUserSession::class); - $user = $userSession->getUser(); - if ($user) { - $userDefaultApps = explode(',', $config->getUserValue($user->getUID(), 'core', 'defaultapp')); - $defaultApps = array_filter(array_merge($userDefaultApps, $defaultApps)); - } - - // find the first app that is enabled for the current user - foreach ($defaultApps as $defaultApp) { - $defaultApp = OC_App::cleanAppId(strip_tags($defaultApp)); - if (static::getAppManager()->isEnabledForUser($defaultApp)) { - $appId = $defaultApp; - break; - } - } - - if ($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') { - $location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); - } else { - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); - } - } - } - return $location; + /** @var IURLGenerator $urlGenerator */ + $urlGenerator = \OC::$server->get(IURLGenerator::class); + return $urlGenerator->linkToDefaultPageUrl(); } /** |