Changeset 99f2b31 in github


Ignore:
Timestamp:
Dec 29, 2008 7:32:16 AM (4 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
a1733f0
Parents:
17060ee
Message:

#1485653: fix enless loop in rcmail_attach_emoticons() + fix attaching the same image a few times

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/steps/mail/sendmail.inc

    r4e74d2c r99f2b31  
    9999   
    100100  $last_img_pos = 0; 
    101  
    102101  $searchstr = 'program/js/tiny_mce/plugins/emotions/img/'; 
     102  $path_len = strlen(INSTALL_PATH . '/'); 
    103103 
    104104  // keep track of added images, so they're only added once 
     
    110110    $pos2 = strpos($body, '"', $pos); 
    111111    $body_pre = substr($body, 0, $pos); 
     112    $body_post = substr($body, $pos2); 
     113 
    112114    $image_name = substr($body, 
    113115                         $pos + strlen($searchstr), 
    114116                         $pos2 - ($pos + strlen($searchstr))); 
     117 
    115118    // sanitize image name so resulting attachment doesn't leave images dir 
    116119    $image_name = preg_replace('/[^a-zA-Z0-9_\.\-]/i','',$image_name); 
    117  
    118     $body_post = substr($body, $pos2); 
     120    $img_file = INSTALL_PATH . '/' . $searchstr . $image_name; 
    119121 
    120122    if (! in_array($image_name, $included_images)) 
    121123      { 
    122124      // add the image to the MIME message 
    123       $img_file = INSTALL_PATH . '/' . $searchstr . $image_name; 
    124125      if(! $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) 
    125126        $OUTPUT->show_message("emoticonerror", 'error'); 
    126  
    127127      array_push($included_images, $image_name); 
    128128      } 
    129  
     129     
    130130    $body = $body_pre . $img_file . $body_post; 
    131131 
    132     $last_img_pos = $pos2; 
    133     } 
    134     
     132    $last_img_pos = $pos2 + $path_len; 
     133    } 
     134 
    135135  $mime_message->setHTMLBody($body); 
    136136} 
Note: See TracChangeset for help on using the changeset viewer.