]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move the redirect_url from linkTo function to the checkLoggedIn function
authorBart Visscher <bartv@thisnet.nl>
Tue, 21 Feb 2012 19:05:02 +0000 (20:05 +0100)
committerBart Visscher <bartv@thisnet.nl>
Tue, 21 Feb 2012 19:09:24 +0000 (20:09 +0100)
lib/helper.php
lib/util.php

index b1e6d053a1947b1a1f6345e7da7821bd73e63d8b..2f71bdad2dc8e22e9126dae7d063a92ea894429f 100644 (file)
@@ -29,12 +29,11 @@ class OC_Helper {
         * @brief Creates an url
         * @param $app app
         * @param $file file
-        * @param $redirect_url redirect_url variable is appended to the URL
         * @returns the url
         *
         * Returns a url to the given app and file.
         */
-       public static function linkTo( $app, $file, $redirect_url=NULL, $absolute=false ){
+       public static function linkTo( $app, $file ){
                if( $app != '' ){
                        $app .= '/';
                        // Check if the app is in the app folder
@@ -54,24 +53,19 @@ class OC_Helper {
                        }
                }
 
-               if($redirect_url)
-                       return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]);
-               else
-                       return $urlLinkTo;
-
+               return $urlLinkTo;
        }
 
        /**
         * @brief Creates an absolute url
         * @param $app app
         * @param $file file
-        * @param $redirect_url redirect_url variable is appended to the URL
         * @returns the url
         *
         * Returns a absolute url to the given app and file.
         */
-       public static function linkToAbsolute( $app, $file, $redirect_url=NULL ) {
-               $urlLinkTo = self::linkTo( $app, $file, $redirect_url );
+       public static function linkToAbsolute( $app, $file ) {
+               $urlLinkTo = self::linkTo( $app, $file );
                // Checking if the request was made through HTTPS. The last in line is for IIS
                $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
                $urlLinkTo = ($protocol?'https':'http') . '://'  . $_SERVER['HTTP_HOST'] . $urlLinkTo;
index aa9fcdec65fea827a5186628c75ff537b1bb94a2..1b1e29b674980f89133f81ca1006160591640184 100644 (file)
@@ -240,7 +240,7 @@ class OC_Util {
 
 
        /**
-       * Check if the app is enabled, send json error msg if not
+       * Check if the app is enabled, redirects to home if not
        */
        public static function checkAppEnabled($app){
                if( !OC_App::isEnabled($app)){
@@ -250,12 +250,13 @@ class OC_Util {
        }
 
        /**
-       * Check if the user is logged in, redirects to home if not
+       * Check if the user is logged in, redirects to home if not. With
+       * redirect URL parameter to the request URI.
        */
        public static function checkLoggedIn(){
                // Check if we are a user
                if( !OC_User::isLoggedIn()){
-                       header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php', TRUE ));
+                       header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ).'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]));
                        exit();
                }
        }