Browse Source

Use getAbsoluteUrl for redirection URL

Also separate the function into getDefaultPageUrl() and
redirectToDefaultPage() to make it testable.
tags/v7.0.0RC1
Vincent Petry 10 years ago
parent
commit
3e78f41d00
1 changed files with 17 additions and 5 deletions
  1. 17
    5
      lib/private/util.php

+ 17
- 5
lib/private/util.php View File

@@ -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();
}


Loading…
Cancel
Save