<!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>[11721] trunk: Properly escape comment_author_url when displaying,
  for trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/11721">11721</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-07-18 23:21:50 +0000 (Sat, 18 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Properly escape comment_author_url when displaying, for trunk</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincommentphp">trunk/wp-admin/comment.php</a></li>
<li><a href="#trunkwpadmineditformcommentphp">trunk/wp-admin/edit-form-comment.php</a></li>
<li><a href="#trunkwpadminincludescommentphp">trunk/wp-admin/includes/comment.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpincludescommenttemplatephp">trunk/wp-includes/comment-template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/comment.php (11720 => 11721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/comment.php        2009-07-18 23:21:00 UTC (rev 11720)
+++ trunk/wp-admin/comment.php        2009-07-18 23:21:50 UTC (rev 11721)
</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 &quot;&lt;div class='wrap'&gt;&lt;p&gt;$msg&lt;/p&gt;&lt;/div&gt;&quot;;
</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"> &lt;?php if ( $comment-&gt;comment_author_url ) { ?&gt;
</span><span class="cx"> &lt;tr&gt;
</span><span class="cx"> &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('URL'); ?&gt;&lt;/th&gt;
</span><del>-&lt;td&gt;&lt;a href='&lt;?php echo $comment-&gt;comment_author_url; ?&gt;'&gt;&lt;?php echo $comment-&gt;comment_author_url; ?&gt;&lt;/a&gt;&lt;/td&gt;
</del><ins>+&lt;td&gt;&lt;a href=&quot;&lt;?php echo $comment-&gt;comment_author_url; ?&gt;&quot;&gt;&lt;?php echo $comment-&gt;comment_author_url; ?&gt;&lt;/a&gt;&lt;/td&gt;
</ins><span class="cx"> &lt;/tr&gt;
</span><span class="cx"> &lt;?php } ?&gt;
</span><span class="cx"> &lt;tr&gt;
</span><span class="lines">@@ -237,4 +237,4 @@
</span><span class="cx"> 
</span><span class="cx"> include('admin-footer.php');
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkwpadmineditformcommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-comment.php (11720 => 11721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-comment.php        2009-07-18 23:21:00 UTC (rev 11720)
+++ trunk/wp-admin/edit-form-comment.php        2009-07-18 23:21:50 UTC (rev 11721)
</span><span class="lines">@@ -24,13 +24,7 @@
</span><span class="cx"> &lt;div id=&quot;poststuff&quot; class=&quot;metabox-holder has-right-sidebar&quot;&gt;
</span><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;user_ID&quot; value=&quot;&lt;?php echo (int) $user_ID ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value='&lt;?php echo $form_action . $form_extra ?&gt;' /&gt;
</span><del>-&lt;?php
</del><span class="cx"> 
</span><del>-$email = esc_attr( $comment-&gt;comment_author_email );
-$url = esc_attr( $comment-&gt;comment_author_url );
-// add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
-?&gt;
-
</del><span class="cx"> &lt;div id=&quot;side-info-column&quot; class=&quot;inner-sidebar&quot;&gt;
</span><span class="cx"> &lt;div id=&quot;submitdiv&quot; class=&quot;stuffbox&quot; &gt;
</span><span class="cx"> &lt;h3&gt;&lt;span class='hndle'&gt;&lt;?php _e('Status') ?&gt;&lt;/span&gt;&lt;/h3&gt;
</span><span class="lines">@@ -95,20 +89,19 @@
</span><span class="cx"> &lt;tr valign=&quot;top&quot;&gt;
</span><span class="cx">         &lt;td class=&quot;first&quot;&gt;
</span><span class="cx">         &lt;?php
</span><del>-                if ( $email ) {
</del><ins>+                if ( $comment-&gt;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"> ?&gt;&lt;/td&gt;
</span><del>-        &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;newcomment_author_email&quot; size=&quot;30&quot; value=&quot;&lt;?php echo esc_attr($email); ?&gt;&quot; tabindex=&quot;2&quot; id=&quot;email&quot; /&gt;&lt;/td&gt;
</del><ins>+        &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;newcomment_author_email&quot; size=&quot;30&quot; value=&quot;&lt;?php echo $comment-&gt;comment_author_email; ?&gt;&quot; tabindex=&quot;2&quot; id=&quot;email&quot; /&gt;&lt;/td&gt;
</ins><span class="cx"> &lt;/tr&gt;
</span><span class="cx"> &lt;tr valign=&quot;top&quot;&gt;
</span><span class="cx">         &lt;td class=&quot;first&quot;&gt;
</span><span class="cx">         &lt;?php
</span><del>-                $url = get_comment_author_url();
-                if ( ! empty( $url ) &amp;&amp; 'http://' != $url ) {
-                        $link = &quot;&lt;a href='$url' rel='external nofollow' target='_blank'&gt;&quot; . __('visit site') . &quot;&lt;/a&gt;&quot;;
</del><ins>+                if ( ! empty( $comment-&gt;comment_author_url ) &amp;&amp; 'http://' != $comment-&gt;comment_author_url ) {
+                        $link = '&lt;a href=&quot;' . $comment-&gt;comment_author_url . '&quot; rel=&quot;external nofollow&quot; target=&quot;_blank&quot;&gt;' . __('visit site') . '&lt;/a&gt;';
</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="trunkwpadminincludescommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/comment.php (11720 => 11721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/comment.php        2009-07-18 23:21:00 UTC (rev 11720)
+++ trunk/wp-admin/includes/comment.php        2009-07-18 23:21:50 UTC (rev 11721)
</span><span class="lines">@@ -89,8 +89,8 @@
</span><span class="cx"> 
</span><span class="cx">         $comment-&gt;comment_author = format_to_edit( $comment-&gt;comment_author );
</span><span class="cx">         $comment-&gt;comment_author_email = format_to_edit( $comment-&gt;comment_author_email );
</span><ins>+        $comment-&gt;comment_author_url = format_to_edit( $comment-&gt;comment_author_url );
</ins><span class="cx">         $comment-&gt;comment_author_url = esc_url($comment-&gt;comment_author_url);
</span><del>-        $comment-&gt;comment_author_url = format_to_edit( $comment-&gt;comment_author_url );
</del><span class="cx"> 
</span><span class="cx">         return $comment;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (11720 => 11721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2009-07-18 23:21:00 UTC (rev 11720)
+++ trunk/wp-admin/includes/template.php        2009-07-18 23:21:50 UTC (rev 11721)
</span><span class="lines">@@ -2082,9 +2082,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) &gt; 50 )
</span><span class="cx">                 $author_url_display = substr($author_url_display, 0, 49) . '...';
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludescommenttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment-template.php (11720 => 11721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment-template.php        2009-07-18 23:21:00 UTC (rev 11720)
+++ trunk/wp-includes/comment-template.php        2009-07-18 23:21:50 UTC (rev 11721)
</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-&gt;comment_author_url) ? '' : $comment-&gt;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>