diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-06-30 16:16:05 +0200 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-06-30 16:20:57 +0200 |
commit | 12059eb65b5f72974aab05f81ded890ebd73daab (patch) | |
tree | 7da1e4baa80a27ccda958beeb8636aa3dc381102 /lib/private/legacy | |
parent | 75f7287b5ed7251599fd6c67ff3ae319f6a3dfc2 (diff) | |
download | nextcloud-server-12059eb65b5f72974aab05f81ded890ebd73daab.tar.gz nextcloud-server-12059eb65b5f72974aab05f81ded890ebd73daab.zip |
Add IUrlGenerator::linkToDefaultPageUrl()
Replaces the deprecated \OC_Util::getDefaultPageUrl() and makes this API public.
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/OC_Util.php | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 87964f98374..1f5f04ff055 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -1089,46 +1089,8 @@ 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; + return $urlGenerator->linkToDefaultPageUrl(); } /** |