Make WordPress Core


Ignore:
Timestamp:
12/24/2003 08:43:04 PM (23 years ago)
Author:
saxmatt
Message:

Add kses HTML cleaning to comment functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions.php

    r643 r650  
    15251525function comment_author() {
    15261526        global $comment;
    1527         if (!empty($comment->comment_author)) {
    1528                 echo htmlspecialchars(stripslashes($comment->comment_author));
     1527        $author = stripslashes(stripslashes($comment->comment_author));
     1528        $author = apply_filters('comment_auther', $author);
     1529        if (!empty($author)) {
     1530                echo htmlspecialchars($comment->comment_author);
    15291531        }
    15301532        else {
    … …  
    15351537function comment_author_email() {
    15361538        global $comment;
     1539        $email = stripslashes(stripslashes($comment->comment_author_email));
     1540       
    15371541        echo antispambot(stripslashes($comment->comment_author_email));
    15381542}
    … …  
    15481552
    15491553        $url = str_replace('http://url', '', $url);
    1550 
     1554        $url = preg_replace('|[^a-z0-9-_.,/:]|i', '', $url);
    15511555        if (empty($url) && empty($email)) {
    15521556                echo $author;
    … …  
    15791583        // convert & into &
    15801584        $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
     1585        $url = preg_replace('|[^a-z0-9-_.,/:]|i', '', $url);
    15811586        if ($url != 'http://url') {
    15821587                echo $url;
    … …  
    16001605        $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
    16011606        $url = (!stristr($url, '://')) ? 'http://'.$url : $url;
     1607        $url = preg_replace('|[^a-z0-9-_.,/:]|i', '', $url);
    16021608        if ((!empty($url)) && ($url != 'http://') && ($url != 'http://url')) {
    16031609                $display = ($linktext != '') ? $linktext : stripslashes($url);
    16041610                echo $before;
    1605                 echo '<a href="'.stripslashes($url).'" target="_blank">'.$display.'</a>';
     1611                echo '<a href="'.stripslashes($url).'" rel="external">'.$display.'</a>';
    16061612                echo $after;
    16071613        }
    … …  
    16801686
    16811687function comment_link_rss() {
    1682         global $comment,$postdata,$pagenow,$siteurl,$blogfilename;
    1683         global $querystring_start, $querystring_equal, $querystring_separator;
     1688        global $comment;
    16841689        echo get_permalink($comment->comment_post_ID).'#comments';
    16851690}
    16861691
    16871692function permalink_comments_rss() {
    1688         global $comment,$postdata,$pagenow,$siteurl,$blogfilename;
    1689         global $querystring_start, $querystring_equal, $querystring_separator;
     1693        global $comment;
    16901694        echo get_permalink($comment->comment_post_ID);
    16911695}
Note: See TracChangeset for help on using the changeset viewer.