<!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 { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { 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>[12388] trunk/wp-includes/pluggable.php: Don'
 t html encode quotes in the blogname in email subjects as this is a plain text output
 .</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12388">12388</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2009-12-13 11:38:45 +0000 (Sun, 13 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Don't html encode quotes in the blogname in email subjects as this is a plain text output. Fixes <a href="http://trac.wordpress.org/ticket/9913">#9913</a> props tenpura.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludespluggablephp">trunk/wp-includes/pluggable.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludespluggablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/pluggable.php (12387 => 12388)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/pluggable.php        2009-12-13 00:02:01 UTC (rev 12387)
+++ trunk/wp-includes/pluggable.php        2009-12-13 11:38:45 UTC (rev 12388)
</span><span class="lines">@@ -976,9 +976,11 @@
</span><span class="cx">         if ('' == $user-&gt;user_email) return false; // If there's no email to send the comment to
</span><span class="cx"> 
</span><span class="cx">         $comment_author_domain = @gethostbyaddr($comment-&gt;comment_author_IP);
</span><ins>+        
+        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+        // we want to reverse this for the plain text arena of emails.
+        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
</ins><span class="cx"> 
</span><del>-        $blogname = get_option('blogname');
-
</del><span class="cx">         if ( empty( $comment_type ) ) $comment_type = 'comment';
</span><span class="cx"> 
</span><span class="cx">         if ('comment' == $comment_type) {
</span><span class="lines">@@ -1067,7 +1069,11 @@
</span><span class="cx"> 
</span><span class="cx">         $comment_author_domain = @gethostbyaddr($comment-&gt;comment_author_IP);
</span><span class="cx">         $comments_waiting = $wpdb-&gt;get_var(&quot;SELECT count(comment_ID) FROM $wpdb-&gt;comments WHERE comment_approved = '0'&quot;);
</span><del>-
</del><ins>+        
+        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+        // we want to reverse this for the plain text arena of emails.
+        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
+        
</ins><span class="cx">         switch ($comment-&gt;comment_type)
</span><span class="cx">         {
</span><span class="cx">                 case 'trackback':
</span><span class="lines">@@ -1103,7 +1109,7 @@
</span><span class="cx">                  'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . &quot;\r\n&quot;;
</span><span class="cx">         $notify_message .= admin_url(&quot;edit-comments.php?comment_status=moderated&quot;) . &quot;\r\n&quot;;
</span><span class="cx"> 
</span><del>-        $subject = sprintf( __('[%1$s] Please moderate: &quot;%2$s&quot;'), get_option('blogname'), $post-&gt;post_title );
</del><ins>+        $subject = sprintf( __('[%1$s] Please moderate: &quot;%2$s&quot;'), $blogname, $post-&gt;post_title );
</ins><span class="cx">         $admin_email = get_option('admin_email');
</span><span class="cx">         $message_headers = '';
</span><span class="cx"> 
</span><span class="lines">@@ -1130,7 +1136,7 @@
</span><span class="cx">         // but check to see if it's the admin whose password we're changing, and skip this
</span><span class="cx">         if ( $user-&gt;user_email != get_option('admin_email') ) {
</span><span class="cx">                 $message = sprintf(__('Password Lost and Changed for user: %s'), $user-&gt;user_login) . &quot;\r\n&quot;;
</span><del>-                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message);
</del><ins>+                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), @html_entity_decode(get_option('blogname'), ENT_QUOTES, get_option('blog_charset'))), $message);
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> endif;
</span><span class="lines">@@ -1149,12 +1155,16 @@
</span><span class="cx"> 
</span><span class="cx">         $user_login = stripslashes($user-&gt;user_login);
</span><span class="cx">         $user_email = stripslashes($user-&gt;user_email);
</span><ins>+        
+        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+        // we want to reverse this for the plain text arena of emails.
+        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
</ins><span class="cx"> 
</span><del>-        $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . &quot;\r\n\r\n&quot;;
</del><ins>+        $message  = sprintf(__('New user registration on your blog %s:'), $blogname) . &quot;\r\n\r\n&quot;;
</ins><span class="cx">         $message .= sprintf(__('Username: %s'), $user_login) . &quot;\r\n\r\n&quot;;
</span><span class="cx">         $message .= sprintf(__('E-mail: %s'), $user_email) . &quot;\r\n&quot;;
</span><span class="cx"> 
</span><del>-        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
</del><ins>+        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
</ins><span class="cx"> 
</span><span class="cx">         if ( empty($plaintext_pass) )
</span><span class="cx">                 return;
</span><span class="lines">@@ -1163,7 +1173,7 @@
</span><span class="cx">         $message .= sprintf(__('Password: %s'), $plaintext_pass) . &quot;\r\n&quot;;
</span><span class="cx">         $message .= wp_login_url() . &quot;\r\n&quot;;
</span><span class="cx"> 
</span><del>-        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
</del><ins>+        wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> endif;
</span></span></pre>
</div>
</div>

</body>
</html>