Show
Ignore:
Timestamp:
03/14/07 23:13:36 (1 year ago)
Author:
markjaquith
Message:

nonce-protect comments by users with unfiltered_html cap to prevent xsrf/xss. fixes #3973 for 2.0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/wp-comments-post.php

    r4261 r5041  
    2626// If the user is logged in 
    2727$user = wp_get_current_user(); 
    28 if ( $user->ID ) : 
     28if ( $user->ID ) { 
    2929    $comment_author       = $wpdb->escape($user->display_name); 
    3030    $comment_author_email = $wpdb->escape($user->user_email); 
    3131    $comment_author_url   = $wpdb->escape($user->user_url); 
    32 else : 
     32    if ( current_user_can('unfiltered_html') ) { 
     33        if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { 
     34            kses_remove_filters(); // start with a clean slate 
     35            kses_init_filters(); // set up the filters 
     36        } 
     37    } 
     38} else { 
    3339    if ( get_option('comment_registration') ) 
    3440        die( __('Sorry, you must be logged in to post a comment.') ); 
    35 endif; 
     41
    3642 
    3743$comment_type = '';