<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[11720] branches/2.8: Properly escape comment_author_url when displaying,
for 2.8</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/11720">11720</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-07-18 23:21:00 +0000 (Sat, 18 Jul 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Properly escape comment_author_url when displaying, for 2.8</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches28wpadmincommentphp">branches/2.8/wp-admin/comment.php</a></li>
<li><a href="#branches28wpadmineditformcommentphp">branches/2.8/wp-admin/edit-form-comment.php</a></li>
<li><a href="#branches28wpadminincludescommentphp">branches/2.8/wp-admin/includes/comment.php</a></li>
<li><a href="#branches28wpadminincludestemplatephp">branches/2.8/wp-admin/includes/template.php</a></li>
<li><a href="#branches28wpincludescommenttemplatephp">branches/2.8/wp-includes/comment-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches28wpadmincommentphp"></a>
<div class="modfile"><h4>Modified: branches/2.8/wp-admin/comment.php (11719 => 11720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/2.8/wp-admin/comment.php        2009-07-18 06:27:42 UTC (rev 11719)
+++ branches/2.8/wp-admin/comment.php        2009-07-18 23:21:00 UTC (rev 11720)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
</span><span class="cx"> */
</span><del>-function comment_footer_die( $msg ) { //
</del><ins>+function comment_footer_die( $msg ) {
</ins><span class="cx">         echo "<div class='wrap'><p>$msg</p></div>";
</span><span class="cx">         include('admin-footer.php');
</span><span class="cx">         die;
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx"> <?php if ( $comment->comment_author_url ) { ?>
</span><span class="cx"> <tr>
</span><span class="cx"> <th scope="row"><?php _e('URL'); ?></th>
</span><del>-<td><a href='<?php echo $comment->comment_author_url; ?>'><?php echo $comment->comment_author_url; ?></a></td>
</del><ins>+<td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td>
</ins><span class="cx"> </tr>
</span><span class="cx"> <?php } ?>
</span><span class="cx"> <tr>
</span></span></pre></div>
<a id="branches28wpadmineditformcommentphp"></a>
<div class="modfile"><h4>Modified: branches/2.8/wp-admin/edit-form-comment.php (11719 => 11720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/2.8/wp-admin/edit-form-comment.php        2009-07-18 06:27:42 UTC (rev 11719)
+++ branches/2.8/wp-admin/edit-form-comment.php        2009-07-18 23:21:00 UTC (rev 11720)
</span><span class="lines">@@ -24,13 +24,7 @@
</span><span class="cx"> <div id="poststuff" class="metabox-holder has-right-sidebar">
</span><span class="cx"> <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
</span><span class="cx"> <input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
</span><del>-<?php
</del><span class="cx">
</span><del>-$email = esc_attr( $comment->comment_author_email );
-$url = esc_attr( $comment->comment_author_url );
-// add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
-?>
-
</del><span class="cx"> <div id="side-info-column" class="inner-sidebar">
</span><span class="cx"> <div id="submitdiv" class="stuffbox" >
</span><span class="cx"> <h3><span class='hndle'><?php _e('Status') ?></span></h3>
</span><span class="lines">@@ -95,20 +89,19 @@
</span><span class="cx"> <tr valign="top">
</span><span class="cx">         <td class="first">
</span><span class="cx">         <?php
</span><del>-                if ( $email ) {
</del><ins>+                if ( $comment->comment_author_email ) {
</ins><span class="cx">                         printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) );
</span><span class="cx">                 } else {
</span><span class="cx">                         _e( 'E-mail:' );
</span><span class="cx">                 }
</span><span class="cx"> ?></td>
</span><del>-        <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo esc_attr($email); ?>" tabindex="2" id="email" /></td>
</del><ins>+        <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" tabindex="2" id="email" /></td>
</ins><span class="cx"> </tr>
</span><span class="cx"> <tr valign="top">
</span><span class="cx">         <td class="first">
</span><span class="cx">         <?php
</span><del>-                $url = get_comment_author_url();
-                if ( ! empty( $url ) && 'http://' != $url ) {
-                        $link = "<a href='$url' rel='external nofollow' target='_blank'>" . __('visit site') . "</a>";
</del><ins>+                if ( ! empty( $comment->comment_author_url ) && 'http://' != $comment->comment_author_url ) {
+                        $link = '<a href="' . $comment->comment_author_url . '" rel="external nofollow" target="_blank">' . __('visit site') . '</a>';
</ins><span class="cx">                         printf( __( 'URL (%s):' ), apply_filters('get_comment_author_link', $link ) );
</span><span class="cx">                 } else {
</span><span class="cx">                         _e( 'URL:' );
</span></span></pre></div>
<a id="branches28wpadminincludescommentphp"></a>
<div class="modfile"><h4>Modified: branches/2.8/wp-admin/includes/comment.php (11719 => 11720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/2.8/wp-admin/includes/comment.php        2009-07-18 06:27:42 UTC (rev 11719)
+++ branches/2.8/wp-admin/includes/comment.php        2009-07-18 23:21:00 UTC (rev 11720)
</span><span class="lines">@@ -89,8 +89,8 @@
</span><span class="cx">
</span><span class="cx">         $comment->comment_author = format_to_edit( $comment->comment_author );
</span><span class="cx">         $comment->comment_author_email = format_to_edit( $comment->comment_author_email );
</span><ins>+        $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
</ins><span class="cx">         $comment->comment_author_url = esc_url($comment->comment_author_url);
</span><del>-        $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
</del><span class="cx">
</span><span class="cx">         return $comment;
</span><span class="cx"> }
</span></span></pre></div>
<a id="branches28wpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: branches/2.8/wp-admin/includes/template.php (11719 => 11720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/2.8/wp-admin/includes/template.php        2009-07-18 06:27:42 UTC (rev 11719)
+++ branches/2.8/wp-admin/includes/template.php        2009-07-18 23:21:00 UTC (rev 11720)
</span><span class="lines">@@ -2085,9 +2085,7 @@
</span><span class="cx">         $author_url = get_comment_author_url();
</span><span class="cx">         if ( 'http://' == $author_url )
</span><span class="cx">                 $author_url = '';
</span><del>-        $author_url_display = $author_url;
-        $author_url_display = str_replace('http://www.', '', $author_url_display);
-        $author_url_display = str_replace('http://', '', $author_url_display);
</del><ins>+        $author_url_display = preg_replace('|http://(www\.)?|i', '', $author_url);
</ins><span class="cx">         if ( strlen($author_url_display) > 50 )
</span><span class="cx">                 $author_url_display = substr($author_url_display, 0, 49) . '...';
</span><span class="cx">
</span></span></pre></div>
<a id="branches28wpincludescommenttemplatephp"></a>
<div class="modfile"><h4>Modified: branches/2.8/wp-includes/comment-template.php (11719 => 11720)</h4>
<pre class="diff"><span>
<span class="info">--- branches/2.8/wp-includes/comment-template.php        2009-07-18 06:27:42 UTC (rev 11719)
+++ branches/2.8/wp-includes/comment-template.php        2009-07-18 23:21:00 UTC (rev 11720)
</span><span class="lines">@@ -194,6 +194,7 @@
</span><span class="cx"> function get_comment_author_url() {
</span><span class="cx">         global $comment;
</span><span class="cx">         $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
</span><ins>+        $url = esc_url( $url, array('http', 'https') );
</ins><span class="cx">         return apply_filters('get_comment_author_url', $url);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>