Changeset 1718

Show
Ignore:
Timestamp:
04/02/08 17:38:37 (6 months ago)
Author:
bchoate
Message:

Only register the CommentThrottleFilter callback once.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-33/lib/MT/App/Comments.pm

    r1635 r1718  
    4444    $app->init_commenter_authenticators; 
    4545    $app->init_captcha_providers(); 
     46    MT->add_callback( 'CommentThrottleFilter', 1, undef, 
     47        \&MT::App::Comments::_builtin_throttle ); 
    4648    $app; 
    4749} 
     
    102104 
    103105    my %cookies = $app->cookies(); 
    104     if ( !$cookies{ $app->COMMENTER_COOKIE_NAME() } ) { 
     106    my $cookie_name = MT::App::COMMENTER_COOKIE_NAME(); 
     107    if ( !$cookies{$cookie_name} ) { 
    105108        return ( undef, undef ); 
    106109    } 
    107     $session_key = $cookies{ $app->COMMENTER_COOKIE_NAME() }->value() || ""; 
     110    $session_key = $cookies{$cookie_name}->value() || ""; 
    108111    $session_key =~ y/+/ /; 
    109112    my $cfg = $app->config; 
     
    780783    } 
    781784 
    782     MT->add_callback( 'CommentThrottleFilter', 1, undef, 
    783         \&MT::App::Comments::_builtin_throttle ); 
    784  
    785785    # Run all the Comment-throttling callbacks 
    786786    my $passed_filter = 
     
    10861086    my %param       = @_; 
    10871087    my %cookies     = $app->cookies(); 
    1088     my $session_key = $cookies{ $app->COMMENTER_COOKIE_NAME() }->value() || ""; 
     1088    my $cookie_name = MT::App::COMMENTER_COOKIE_NAME(); 
     1089    my $session_key = $cookies{$cookie_name}->value() || ""; 
    10891090    $session_key =~ y/+/ /; 
    10901091    my $sessobj = MT::Session->load($session_key); 
     
    11011102    $sessobj->save(); 
    11021103    my %sess_cookie = ( 
    1103         -name    => $app->COMMENTER_COOKIE_NAME()
     1104        -name    => $cookie_name
    11041105        -value   => $session_key, 
    11051106        -path    => '/',