diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/app.php | 2 | ||||
-rw-r--r-- | lib/base.php | 9 | ||||
-rw-r--r-- | lib/filecache.php | 6 | ||||
-rw-r--r-- | lib/template.php | 24 | ||||
-rwxr-xr-x | lib/util.php | 10 |
5 files changed, 26 insertions, 25 deletions
diff --git a/lib/app.php b/lib/app.php index 79c1d83314f..5d4fbbd9c23 100755 --- a/lib/app.php +++ b/lib/app.php @@ -253,6 +253,8 @@ class OC_App{ * highlighting the current position of the user. */ public static function setActiveNavigationEntry( $id ) { + // load all the apps, to make sure we have all the navigation entries + self::loadApps(); self::$activeapp = $id; return true; } diff --git a/lib/base.php b/lib/base.php index 8c508c48767..bde65dcc7d1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -506,13 +506,18 @@ 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')); return; } try { - OC_App::loadApps(); OC::getRouter()->match(OC_Request::getPathInfo()); return; } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) { @@ -671,7 +676,7 @@ class OC{ else { OC_User::unsetMagicInCookie(); } - header( 'Location: '.$_SERVER['REQUEST_URI'] ); + OC_Util::redirectToDefaultPage(); exit(); } return true; diff --git a/lib/filecache.php b/lib/filecache.php index 7bf98f43a37..bbf55bc1f86 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -354,18 +354,18 @@ class OC_FileCache{ public static function increaseSize($path, $sizeDiff, $root=false) { if($sizeDiff==0) return; $item = OC_FileCache_Cached::get($path); - //stop walking up the filetree if we hit a non-folder - if($item['mimetype'] !== 'httpd/unix-directory'){ + //stop walking up the filetree if we hit a non-folder or reached to root folder + if($path == '/' || $path=='' || $item['mimetype'] !== 'httpd/unix-directory'){ return; } $id = $item['id']; while($id!=-1) {//walk up the filetree increasing the size of all parent folders $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `size`=`size`+? WHERE `id`=?'); $query->execute(array($sizeDiff, $id)); + $path=dirname($path); if($path == '' or $path =='/'){ return; } - $path=dirname($path); $parent = OC_FileCache_Cached::get($path); $id = $parent['id']; //stop walking up the filetree if we hit a non-folder diff --git a/lib/template.php b/lib/template.php index 868d5f2ba2e..04667d73a2c 100644 --- a/lib/template.php +++ b/lib/template.php @@ -497,18 +497,14 @@ class OC_Template{ return $content->printPage(); } - /** - * @brief Print a fatal error page and terminates the script - * @param string $error The error message to show - * @param string $hint An option hint message - */ - public static function printErrorPage( $error, $hint = '' ) { - $error['error']=$error; - $error['hint']=$hint; - $errors[]=$error; - OC_Template::printGuestPage("", "error", array("errors" => $errors)); - die(); - } - - + /** + * @brief Print a fatal error page and terminates the script + * @param string $error The error message to show + * @param string $hint An option hint message + */ + public static function printErrorPage( $error_msg, $hint = '' ) { + $errors = array(array('error' => $error_msg, 'hint' => $hint)); + OC_Template::printGuestPage("", "error", array("errors" => $errors)); + die(); + } } 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' ); |