Changeset 7472893 in github


Ignore:
Timestamp:
Dec 6, 2010 6:13:55 AM (2 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
0e11940
Parents:
9e81b55
Message:
  • Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206)
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    re232acb r7472893  
    1515- Fix copying all messages in a folder copies only messages from current page 
    1616- Improve performance of moving or copying of all messages in a folder 
     17- Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206) 
    1718 
    1819RELEASE 0.5-BETA 
  • program/include/main.inc

    raf3c045e r7472893  
    16481648 
    16491649/** 
     1650 * Replaces TinyMCE's emoticon images with plain-text representation 
     1651 * 
     1652 * @param string HTML content 
     1653 * @return string HTML content 
     1654 */ 
     1655function rcmail_replace_emoticons($html) 
     1656{ 
     1657  $emoticons = array( 
     1658    '8-)' => 'smiley-cool', 
     1659    ':-#' => 'smiley-foot-in-mouth', 
     1660    ':-*' => 'smiley-kiss', 
     1661    ':-X' => 'smiley-sealed', 
     1662    ':-P' => 'smiley-tongue-out', 
     1663    ':-@' => 'smiley-yell', 
     1664    ":'(" => 'smiley-cry', 
     1665    ':-(' => 'smiley-frown', 
     1666    ':-D' => 'smiley-laughing', 
     1667    ':-)' => 'smiley-smile', 
     1668    ':-/' => 'smiley-undecided', 
     1669    ':-X' => 'smiley-embarassed', 
     1670    '0:-)' => 'smiley-innocent', 
     1671    ':-|' => 'smiley-money-mouth', 
     1672    ':-0' => 'smiley-surprised', 
     1673    ';-)' => 'smiley-wink', 
     1674  ); 
     1675 
     1676  foreach ($emoticons as $idx => $file) { 
     1677    // <img title="Cry" src="http://.../program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif" border="0" alt="Cry" /> 
     1678    $search[]  = '/<img title="[a-z ]+" src="https?:\/\/[a-z0-9_.\/-]+\/tiny_mce\/plugins\/emotions\/img\/'.$file.'.gif"[^>]+\/>/i'; 
     1679    $replace[] = $idx; 
     1680  } 
     1681 
     1682  return preg_replace($search, $replace, $html); 
     1683} 
     1684 
     1685 
     1686/** 
    16501687 * Check if working in SSL mode 
    16511688 * 
     
    18821919    } 
    18831920} 
     1921 
  • program/steps/mail/sendmail.inc

    r53604a0 r7472893  
    7171{ 
    7272  global $USER, $OUTPUT; 
    73    
     73 
    7474  if ($sql_arr = $USER->get_identity($id)) { 
    7575    $out = $sql_arr; 
     
    101101  // remove any null-byte characters before parsing 
    102102  $body = preg_replace('/\x00/', '', $body); 
    103    
     103 
    104104  $searchstr = 'program/js/tiny_mce/plugins/emotions/img/'; 
    105105  $offset = 0; 
     
    194194} 
    195195 
     196 
    196197/****** compose message ********/ 
    197198 
     
    442443  $MAIL_MIME->setHTMLBody($plugin['body']); 
    443444 
     445  // replace emoticons 
     446  $plugin['body'] = rcmail_replace_emoticons($plugin['body']); 
     447 
    444448  // add a plain text version of the e-mail as an alternative part. 
    445449  $h2t = new html2text($plugin['body'], false, true, 0); 
     
    447451  $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true); 
    448452  if (!$plainTextPart) { 
    449     // empty message body breaks attachment handling in drafts  
    450     $plainTextPart = "\r\n";  
     453    // empty message body breaks attachment handling in drafts 
     454    $plainTextPart = "\r\n"; 
    451455  } 
    452456  else { 
  • program/steps/utils/html2text.inc

    r11bcac5 r7472893  
    2020*/ 
    2121 
    22 $converter = new html2text($HTTP_RAW_POST_DATA); 
     22$html = $HTTP_RAW_POST_DATA; 
     23 
     24// Replace emoticon images with its text representation 
     25$html = rcmail_replace_emoticons($html); 
     26 
     27$converter = new html2text($html); 
    2328 
    2429header('Content-Type: text/plain; charset=UTF-8'); 
Note: See TracChangeset for help on using the changeset viewer.