diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-07-01 15:42:26 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-07-01 15:42:26 +0200 |
commit | c005515ebd3fcf1d79070b3e7e2a783cf2ea53e1 (patch) | |
tree | 658ef61a0e5f3c0766d0bf9de87d6e0962a936cb /lib | |
parent | 894d69184abc78750160d4818412e45fdc22a81b (diff) | |
download | nextcloud-server-c005515ebd3fcf1d79070b3e7e2a783cf2ea53e1.tar.gz nextcloud-server-c005515ebd3fcf1d79070b3e7e2a783cf2ea53e1.zip |
Support for multiple default apps
If a default app isn't visible for the user, try the next one.
Else fallback to the "files" app.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/private/util.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index 424c27e74a7..e9e081a48fd 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -827,9 +827,17 @@ class OC_Util { if ($defaultPage) { $location = $urlGenerator->getAbsoluteURL($defaultPage); } else { - $defaultApp = \OCP\Config::getSystemValue('defaultapp', 'files'); - $defaultApp = OC_App::cleanAppId(strip_tags($defaultApp)); - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $defaultApp); + $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->linkTo($appId, 'index.php'); } } OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG); |