Use UrlGenerator in OC\Util::redirectToDefaultPage(). Fix #7936

This commit is contained in:
Thomas Tanghus 2014-03-28 18:05:48 +01:00
parent 0ae9ed4244
commit c14107550d
1 changed files with 5 additions and 4 deletions

View File

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