Merge pull request #7939 from owncloud/wring_redirect_on_login

Use UrlGenerator in OC\Util::redirectToDefaultPage(). Fix #7936
This commit is contained in:
Vincent Petry 2014-03-31 10:50:05 +02:00
commit 65e3f63400
2 changed files with 6 additions and 6 deletions

View File

@ -78,8 +78,7 @@ class OC_Helper {
* Returns a absolute url to the given app and file.
*/
public static function linkToAbsolute($app, $file, $args = array()) {
$urlLinkTo = self::linkTo($app, $file, $args);
return self::makeURLAbsolute($urlLinkTo);
return self::linkTo($app, $file, $args);
}
/**

View File

@ -701,17 +701,18 @@ class OC_Util {
* @return void
*/
public static function redirectToDefaultPage() {
$urlGenerator = \OC::$server->getURLGenerator();
if(isset($_REQUEST['redirect_url'])) {
$location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
$location = urldecode($_REQUEST['redirect_url']);
}
else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) {
$location = OC_Helper::linkToAbsolute( OC::$REQUESTEDAPP, 'index.php' );
$location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.OC::$REQUESTEDAPP.'/index.php');
} else {
$defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
if ($defaultPage) {
$location = OC_Helper::makeURLAbsolute(OC::$WEBROOT.'/'.$defaultPage);
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
$location = OC_Helper::linkToAbsolute( 'files', 'index.php' );
$location = $urlGenerator->getAbsoluteURL('/index.php/files/index.php');
}
}
OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG);