Changeset 2801

Show
Ignore:
Timestamp:
11/12/08 09:41:15 (2 months ago)
Author:
moeffju
Message:

Leave the decision whether to continue processing after adding a redirect header up to the surrounding code.
Keeps #749 fixed.
Also removed now superfluous exit()s.

Location:
trunk/htdocs/system
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/system/admin/login.php

    r2725 r2801  
    6565        password_label = $('label[for=habari_password]'); 
    6666        // to fix autofill issues, we need to check the password field on every keyup 
    67         $('#habari_username').keyup( function() { 
     67        $('#habari_username').keyup( function(){ 
     68            setTimeout( "labeler.check( password_label );", 10 );  
     69        } ).click( function(){ 
    6870            setTimeout( "labeler.check( password_label );", 10 );  
    6971        } ); 
    70         // for autofill without user input 
    71         setTimeout( function(){ labeler.check( password_label ); }, 10 ); 
    7272    }) 
    7373  </script> 
  • trunk/htdocs/system/classes/adminhandler.php

    r2786 r2801  
    2727            } 
    2828            else { 
    29             if ( !empty( $_POST ) ) { 
    30                 Session::add_to_set( 'last_form_data', $_POST, 'post' ); 
    31                 Session::error( _t('We saved the last form you posted. Log back in to continue its submission.'), 'expired_form_submission' ); 
    32             } 
    33             if ( !empty( $_GET ) ) { 
    34                 Session::add_to_set( 'last_form_data', $_GET, 'get' ); 
    35                 Session::error( _t('We saved the last form you posted. Log back in to continue its submission.'), 'expired_form_submission' ); 
    36             } 
    37             Utils::redirect( URL::get( 'user', array( 'page' => 'login' ) ) ); 
     29                if ( !empty( $_POST ) ) { 
     30                    Session::add_to_set( 'last_form_data', $_POST, 'post' ); 
     31                    Session::error( _t('We saved the last form you posted. Log back in to continue its submission.'), 'expired_form_submission' ); 
     32                } 
     33                if ( !empty( $_GET ) ) { 
     34                    Session::add_to_set( 'last_form_data', $_GET, 'get' ); 
     35                    Session::error( _t('We saved the last form you posted. Log back in to continue its submission.'), 'expired_form_submission' ); 
     36                } 
     37                Utils::redirect( URL::get( 'user', array( 'page' => 'login' ) ) ); 
    3838            } 
    3939            exit; 
     
    297297        $form->save(); 
    298298        Utils::redirect(); 
    299         die(); 
    300299    } 
    301300 
     
    779778 
    780779        Utils::redirect( URL::get( 'admin', $results ) ); 
    781  
    782780    } 
    783781 
     
    10561054        if ( !isset( $_REQUEST['importer'] ) ) { 
    10571055            Utils::redirect( URL::get( 'admin', 'page=import' ) ); 
    1058             exit; 
    10591056        } 
    10601057 
     
    11841181                            $comment->delete(); 
    11851182                            Utils::redirect(URL::get('admin', 'page=comments')); 
    1186                             exit(); 
    11871183                        } 
    11881184                        if ( $action != 'save' ) { 
     
    13001296            Session::notice( _t( 'Deleted all spam comments' ) ); 
    13011297            Utils::redirect(); 
    1302             die(); 
    13031298        } 
    13041299        elseif ( isset( $mass_delete ) && $status == Comment::STATUS_UNAPPROVED ) { 
     
    13071302            Session::notice( _t( 'Deleted all unapproved comments' ) ); 
    13081303            Utils::redirect(); 
    1309             die(); 
    13101304        } 
    13111305        // if we're updating posts, let's do so: 
     
    14031397 
    14041398            Utils::redirect(); 
    1405             die(); 
    14061399 
    14071400        } 
     
    18761869        foreach($_POST as $id => $delete) { 
    18771870            // skip POST elements which are not post ids 
    1878             if ( preg_match( '/^p\d+/', $id )  && $delete ) { 
     1871            if ( preg_match( '/^p\d+/', $id ) && $delete ) { 
    18791872                $ids[] = substr($id, 1); 
    18801873            } 
     
    20712064 
    20722065            Utils::redirect(); 
    2073             die(); 
    2074  
    20752066        } 
    20762067 
  • trunk/htdocs/system/classes/feedbackhandler.php

    r2649 r2801  
    5656            // now send them back to the form 
    5757            Utils::redirect( $post->permalink . '#respond' ); 
    58             exit(); 
    5958        } 
    6059 
     
    6463            Session::error( _t( 'Comments on this post are disabled!' ) ); 
    6564            Utils::redirect( $post->permalink ); 
    66             exit(); 
    6765        } 
    6866 
     
    10199            Session::error( _t( 'Comment contains only whitespace/empty comment' ) ); 
    102100            Utils::redirect( $post->permalink ); 
    103             exit(); 
    104101        } 
    105102 
  • trunk/htdocs/system/classes/utils.php

    r2796 r2801  
    4848     * Redirects the request to a new URL 
    4949     * @param string $url The URL to redirect to, or omit to redirect to the current url 
    50      **/ 
    51     public static function redirect( $url = '' ) 
     50     * @param boolean $continue Whether to continue processing the script (default false for security reasons, cf. #749) 
     51     **/ 
     52    public static function redirect( $url = '', $continue = false ) 
    5253    { 
    5354        if($url == '') { 
     
    5657        header('Location: ' . $url, true, 302); 
    5758         
    58         // prevent the rest of the page from loading - we've moved on 
    59         exit(); 
     59        if (!$continue) exit; 
    6060    } 
    6161