diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-07-01 16:02:38 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-07-01 16:02:38 +0200 |
commit | 3e78f41d00a6b6d2f2dbc90beb9fb0a3e85f6cf4 (patch) | |
tree | 62917d60a3e85d33497301ab0097534d78842b0d | |
parent | c005515ebd3fcf1d79070b3e7e2a783cf2ea53e1 (diff) | |
download | nextcloud-server-3e78f41d00a6b6d2f2dbc90beb9fb0a3e85f6cf4.tar.gz nextcloud-server-3e78f41d00a6b6d2f2dbc90beb9fb0a3e85f6cf4.zip |
Use getAbsoluteUrl for redirection URL
Also separate the function into getDefaultPageUrl() and
redirectToDefaultPage() to make it testable.
-rwxr-xr-x | lib/private/util.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index e9e081a48fd..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']); @@ -837,11 +840,20 @@ class OC_Util { break; } } - $location = $urlGenerator->linkTo($appId, 'index.php'); + $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(); } |