Changeset b575fa9 in github


Ignore:
Timestamp:
Mar 18, 2010 6:01:28 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
1845fb6
Parents:
98c489e
Message:
  • Fix blocked.gif attachment is not attached to the message (#1486516)
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r98c489e rb575fa9  
    22=========================== 
    33 
     4- Fix blocked.gif attachment is not attached to the message (#1486516) 
    45- Managesieve: import from Horde-INGO 
    56- Managesieve: support for more than one match (#1486078) 
  • program/steps/mail/compose.inc

    rc16986b rb575fa9  
    476476  $plugin = $RCMAIL->plugins->exec_hook('message_compose_body', 
    477477    array('body' => $body, 'html' => $isHtml, 'mode' => $compose_mode)); 
    478   $body = $plugin['body'];   
    479  
     478  $body = $plugin['body']; 
     479  unset($plugin); 
     480 
     481  // add blocked.gif attachment (#1486516) 
     482  if ($isHtml && preg_match('#<img src="\./program/blocked\.gif"#', $body)) { 
     483    if ($attachment = rcmail_save_image('program/blocked.gif', 'image/gif')) { 
     484      $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
     485      $body = preg_replace('#\./program/blocked\.gif#', 
     486        $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'], 
     487        $body); 
     488    } 
     489  } 
     490   
    480491  $out = $form_start ? "$form_start\n" : ''; 
    481492 
     
    780791} 
    781792 
     793function rcmail_save_image($path, $mimetype='') 
     794{ 
     795  // handle attachments in memory 
     796  $data = file_get_contents($path); 
     797 
     798  $attachment = array( 
     799    'name' => rcmail_basename($path), 
     800    'mimetype' => $mimetype ? $mimetype : rc_mime_content_type($path, $name), 
     801    'data' => $data, 
     802    'size' => strlen($data), 
     803  ); 
     804 
     805  $attachment = rcmail::get_instance()->plugins->exec_hook('save_attachment', $attachment); 
     806 
     807  if ($attachment['status']) { 
     808    unset($attachment['data'], $attachment['status'], $attachment['content_id'], $attachment['abort']); 
     809    return $attachment; 
     810  } 
     811   
     812  return false; 
     813} 
     814 
     815function rcmail_basename($filename) 
     816{ 
     817  // basename() is not unicode safe and locale dependent 
     818  if (stristr(PHP_OS, 'win') || stristr(PHP_OS, 'netware')) { 
     819    return preg_replace('/^.*[\\\\\\/]/', '', $filename); 
     820  } else { 
     821    return preg_replace('/^.*[\/]/', '', $filename); 
     822  } 
     823} 
    782824 
    783825function rcmail_compose_subject($attrib) 
Note: See TracChangeset for help on using the changeset viewer.