diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/app.php | 2 | ||||
-rwxr-xr-x | lib/private/util.php | 32 |
2 files changed, 28 insertions, 6 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index 9fb0ec2e34f..0ca2ca36bd2 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -163,7 +163,7 @@ class OC_App { /** * get all enabled apps */ - private static $enabledAppsCache = array(); + protected static $enabledAppsCache = array(); public static function getEnabledApps($forceRefresh = false) { if (!OC_Config::getValue('installed', false)) { diff --git a/lib/private/util.php b/lib/private/util.php index 7836489832d..897795f7535 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -815,10 +815,13 @@ class OC_Util { } /** - * Redirect to the user default page - * @return void + * Returns the URL of the default page + * based on the system configuration and + * the apps visible for the current user + * + * @return string URL */ - public static function redirectToDefaultPage() { + public static function getDefaultPageUrl() { $urlGenerator = \OC::$server->getURLGenerator(); if(isset($_REQUEST['redirect_url'])) { $location = urldecode($_REQUEST['redirect_url']); @@ -827,11 +830,30 @@ class OC_Util { if ($defaultPage) { $location = $urlGenerator->getAbsoluteURL($defaultPage); } else { - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/files'); + $appId = 'files'; + $defaultApps = explode(',', \OCP\Config::getSystemValue('defaultapp', 'files')); + // find the first app that is enabled for the current user + foreach ($defaultApps as $defaultApp) { + $defaultApp = OC_App::cleanAppId(strip_tags($defaultApp)); + if (OC_App::isEnabled($defaultApp)) { + $appId = $defaultApp; + break; + } + } + $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); } } + return $location; + } + + /** + * Redirect to the user default page + * @return void + */ + public static function redirectToDefaultPage() { + $location = self::getDefaultPageUrl(); OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG); - header( 'Location: '.$location ); + header('Location: '.$location); exit(); } |