Make WordPress Core

Changeset 595


Ignore:
Timestamp:
12/09/2003 05:16:28 PM (23 years ago)
Author:
alex_t_king
Message:

added htmlspecialchars to outputing comment author name, added 'Anonymous' as a default if no name provided

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2-include/b2template.functions.php

    r583 r595  
    14971497function comment_author() {
    14981498        global $comment;
    1499         echo stripslashes($comment->comment_author);
     1499        if (!empty($comment->comment_author)) {
     1500                echo htmlspecialchars(stripslashes($comment->comment_author));
     1501        }
     1502        else {
     1503                echo "Anonymous";
     1504        }
    15001505}
    15011506
    … …  
    15091514        $url = trim(stripslashes($comment->comment_author_url));
    15101515        $email = stripslashes($comment->comment_author_email);
    1511         $author = stripslashes($comment->comment_author);
     1516        $author = htmlspecialchars(stripslashes($comment->comment_author));
     1517        if (empty($author)) {
     1518                $author = "Anonymous";
     1519        }
    15121520
    15131521        $url = str_replace('http://url', '', $url);
    … …  
    16201628function comment_author_rss() {
    16211629        global $comment;
    1622         echo strip_tags(stripslashes($comment->comment_author));
     1630        if (!empty($comment->comment_author)) {
     1631                echo htmlspecialchars(strip_tags(stripslashes($comment->comment_author)));
     1632        }
     1633        else {
     1634                echo "Anonymous";
     1635        }
    16231636}
    16241637
Note: See TracChangeset for help on using the changeset viewer.