Changeset 3903 for branches/2.0/wp-includes/comment-functions.php
- Timestamp:
- 06/22/2006 10:09:17 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-includes/comment-functions.php
r3888 r3903 6 6 global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity; 7 7 8 if ( is_single() || is_page() || $withcomments ) : 9 $req = get_settings('require_name_email'); 10 $comment_author = ''; 11 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { 12 $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]); 13 $comment_author = stripslashes($comment_author); 14 $comment_author = wp_specialchars($comment_author, true); 15 } 16 $comment_author_email = ''; 17 if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { 18 $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); 19 $comment_author_email = stripslashes($comment_author_email); 20 $comment_author_email = wp_specialchars($comment_author_email, true); 21 } 22 $comment_author_url = ''; 23 if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { 24 $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); 25 $comment_author_url = stripslashes($comment_author_url); 26 $comment_author_url = wp_specialchars($comment_author_url, true); 27 } 28 8 if ( ! (is_single() || is_page() || $withcomments) ) 9 return; 10 11 $req = get_settings('require_name_email'); 12 $commenter = wp_get_current_commenter(); 13 extract($commenter); 14 15 // TODO: Use API instead of SELECTs. 29 16 if ( empty($comment_author) ) { 30 17 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date"); … … 41 28 else 42 29 require( ABSPATH . 'wp-content/themes/default/comments.php'); 43 44 endif;45 30 } 46 31 … … 909 894 } 910 895 896 function sanitize_comment_cookies() { 897 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { 898 $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]); 899 $comment_author = stripslashes($comment_author); 900 $comment_author = wp_specialchars($comment_author, true); 901 $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author; 902 } 903 904 if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { 905 $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); 906 $comment_author_email = stripslashes($comment_author_email); 907 $comment_author_email = wp_specialchars($comment_author_email, true); 908 $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; 909 } 910 911 if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) { 912 $comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]); 913 $comment_author_url = stripslashes($comment_author_url); 914 $comment_author_url = wp_specialchars($comment_author_url, true); 915 $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url; 916 } 917 } 918 919 function wp_get_current_commenter() { 920 // Cookies should already be sanitized. 921 922 $comment_author = ''; 923 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) 924 $comment_author = $_COOKIE['comment_author_'.COOKIEHASH]; 925 926 $comment_author_email = ''; 927 if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) 928 $comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH]; 929 930 $comment_author_url = ''; 931 if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) 932 $comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH]; 933 934 return compact('comment_author', 'comment_author_email', 'comment_author_url'); 935 } 936 911 937 ?>
Note: See TracChangeset
for help on using the changeset viewer.