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

git-svn-id: http://svn.automattic.com/wordpress/trunk@595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
alex_t_king 2003-12-09 17:16:28 +00:00
parent 2f9ab6e333
commit 0f682aad13
1 changed files with 16 additions and 3 deletions

View File

@ -1496,7 +1496,12 @@ function comment_ID() {
function comment_author() { function comment_author() {
global $comment; global $comment;
echo stripslashes($comment->comment_author); if (!empty($comment->comment_author)) {
echo htmlspecialchars(stripslashes($comment->comment_author));
}
else {
echo "Anonymous";
}
} }
function comment_author_email() { function comment_author_email() {
@ -1508,7 +1513,10 @@ function comment_author_link() {
global $comment; global $comment;
$url = trim(stripslashes($comment->comment_author_url)); $url = trim(stripslashes($comment->comment_author_url));
$email = stripslashes($comment->comment_author_email); $email = stripslashes($comment->comment_author_email);
$author = stripslashes($comment->comment_author); $author = htmlspecialchars(stripslashes($comment->comment_author));
if (empty($author)) {
$author = "Anonymous";
}
$url = str_replace('http://url', '', $url); $url = str_replace('http://url', '', $url);
@ -1619,7 +1627,12 @@ function comments_rss_link($link_text='Comments RSS', $commentsrssfilename = 'wp
function comment_author_rss() { function comment_author_rss() {
global $comment; global $comment;
echo strip_tags(stripslashes($comment->comment_author)); if (!empty($comment->comment_author)) {
echo htmlspecialchars(strip_tags(stripslashes($comment->comment_author)));
}
else {
echo "Anonymous";
}
} }
function comment_text_rss() { function comment_text_rss() {