Make WordPress Core


Ignore:
Timestamp:
03/14/2007 11:10:57 PM (19 years ago)
Author:
markjaquith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-comments-post.php

    r4939 r5039  
    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        wp_die( __('Sorry, you must be logged in to post a comment.') );
    35 endif;
     41}
    3642
    3743$comment_type = '';
Note: See TracChangeset for help on using the changeset viewer.