Changeset 2235


Ignore:
Timestamp:
07/24/08 00:55:28 (4 years ago)
Author:
ringmaster
Message:

Fix for #229. Rather than displaying a 403 when a session expires while entering a comment, the plugin sets a moderated status on the comment. The 403 still remains if the comment code doesn't match the one sent with the form, but this should only occur when forms aren't built correctly or the user tampers with the form.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • makaanga/0.x/htdocs/system/plugins/spamchecker/spamchecker.plugin.php

    r1922 r2235  
    131131                } 
    132132 
     133                // Any commenter that takes longer than the session timeout is automatically moderated 
     134                if(!isset($_SESSION['comments_allowed']) || ! in_array(Controller::get_var('ccode'), $_SESSION['comments_allowed'])) { 
     135                        $comment->status = Comment::STATUS_UNAPPROVED; 
     136                        $spamcheck[] = _t("The commenter's session timed out."); 
     137                } 
     138 
    133139                if( isset($comment->info->spamcheck) && is_array($comment->info->spamcheck)) { 
    134140                        $comment->info->spamcheck = array_unique(array_merge($comment->info->spamcheck, $spamcheck)); 
     
    194200         * @param float $spam_rating The spamminess of the comment as detected by other plugins 
    195201         * @param Comment $comment The submitted comment object 
    196          * @param array $handlervars And array of handlervars passed in via the comment submission URL 
     202         * @param array $handlervars An array of handlervars passed in via the comment submission URL 
    197203         * @return float The original spam rating 
    198204         */ 
     
    209215                        die('<h1>' . _t('The selected action is forbidden.') . '</h1>'); 
    210216                } 
    211                 if(!isset($_SESSION['comments_allowed']) || ! in_array($handlervars['ccode'], $_SESSION['comments_allowed'])) { 
    212                         ob_end_clean(); 
    213                         header('HTTP/1.1 403 Forbidden'); 
    214                         die('<h1>' . _t('The selected action is forbidden.') . '</h1>'); 
    215                 } 
    216217 
    217218                return $spam_rating; 
Note: See TracChangeset for help on using the changeset viewer.