Changeset 4365 in subversion


Ignore:
Timestamp:
Dec 23, 2010 12:08:07 PM (2 years ago)
Author:
alec
Message:
  • Fix duplicated rcmBody div
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/func.inc

    r4355 r4365  
    11441144 
    11451145  // Handle body attributes that doesn't play nicely with div elements 
    1146   if (preg_match('/<div class="' . preg_quote($body_id, '/') . '" ([^>]+)/', $body, $m)) { 
     1146  $regexp = '/<div class="' . preg_quote($body_id, '/') . '"([^>]*)/'; 
     1147  if (preg_match($regexp, $body, $m)) { 
    11471148    $attrs = $m[0]; 
    11481149    // Get bgcolor, we'll set it as background-color of the message container 
    1149     if (preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $attrs, $mb)) { 
     1150    if ($m[1] && preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $attrs, $mb)) { 
    11501151      $attributes['background-color'] = $mb[1]; 
    11511152      $attrs = preg_replace('/bgcolor=["\']*([a-z0-9#]+)["\']*/', '', $attrs); 
    11521153    } 
    11531154    // Get background, we'll set it as background-image of the message container 
    1154     if (preg_match('/background=["\']*([^"\'>\s]+)["\']*/', $attrs, $mb)) { 
     1155    if ($m[1] && preg_match('/background=["\']*([^"\'>\s]+)["\']*/', $attrs, $mb)) { 
    11551156      $attributes['background-image'] = 'url('.$mb[1].')'; 
    11561157      $attrs = preg_replace('/background=["\']*([^"\'>\s]+)["\']*/', '', $attrs); 
    11571158    } 
    1158     if (!empty($attributes)) 
    1159       $body = preg_replace('/<div class="' . preg_quote($body_id, '/') . '" [^>]+/', rtrim($attrs), $body, 1); 
     1159    if (!empty($attributes)) { 
     1160      $body = preg_replace($regexp, rtrim($attrs), $body, 1); 
     1161    } 
    11601162 
    11611163    // handle body styles related to background image 
     
    11731175  // make sure there's 'rcmBody' div, we need it for proper css modification 
    11741176  // its name is hardcoded in rcmail_message_body() also 
    1175   else 
     1177  else { 
    11761178    $body = '<div class="' . $body_id . '">' . $body . '</div>'; 
     1179  } 
    11771180 
    11781181  return $body; 
Note: See TracChangeset for help on using the changeset viewer.