summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-12-07 03:09:19 -0800
committerBart Visscher <bartv@thisnet.nl>2012-12-07 03:09:19 -0800
commit1e062ea895dbbc5a05997c14ff7bd1e4b71bdc9d (patch)
treec0c8d9a74ec4729a991e7b416188b67bcd7131bb /lib
parent380db4a29e6ef931bfbcc48ffecce3b25199405d (diff)
parent271b8384e7adc36b7c1a3df813c6a6156c661a0d (diff)
downloadnextcloud-server-1e062ea895dbbc5a05997c14ff7bd1e4b71bdc9d.tar.gz
nextcloud-server-1e062ea895dbbc5a05997c14ff7bd1e4b71bdc9d.zip
Merge pull request #182 from owncloud/fix-redirect
Make the redirect_url working again
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php8
-rwxr-xr-xlib/util.php10
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/base.php b/lib/base.php
index 273107e9b8a..bde65dcc7d1 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -506,6 +506,12 @@ class OC{
require_once 'core/setup.php';
exit();
}
+ // Handle redirect URL for logged in users
+ if(isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
+ $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
+ header( 'Location: '.$location );
+ return;
+ }
// Handle WebDAV
if($_SERVER['REQUEST_METHOD']=='PROPFIND') {
header('location: '.OC_Helper::linkToRemote('webdav'));
@@ -670,7 +676,7 @@ class OC{
else {
OC_User::unsetMagicInCookie();
}
- header( 'Location: '.$_SERVER['REQUEST_URI'] );
+ OC_Util::redirectToDefaultPage();
exit();
}
return true;
diff --git a/lib/util.php b/lib/util.php
index 2ee3f0e4efb..34c4d4f9b11 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -340,10 +340,8 @@ class OC_Util {
}
if (isset($_REQUEST['redirect_url'])) {
$redirect_url = OC_Util::sanitizeHTML($_REQUEST['redirect_url']);
- } else {
- $redirect_url = $_SERVER['REQUEST_URI'];
- }
- $parameters['redirect_url'] = $redirect_url;
+ $parameters['redirect_url'] = urlencode($redirect_url);
+ }
OC_Template::printGuestPage("", "login", $parameters);
}
@@ -439,8 +437,8 @@ class OC_Util {
* Redirect to the user default page
*/
public static function redirectToDefaultPage() {
- if(isset($_REQUEST['redirect_url']) && (substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT || $_REQUEST['redirect_url'][0] == '/')) {
- $location = $_REQUEST['redirect_url'];
+ if(isset($_REQUEST['redirect_url'])) {
+ $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
}
else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) {
$location = OC_Helper::linkToAbsolute( OC::$REQUESTEDAPP, 'index.php' );