Changeset 4365 in subversion
- Timestamp:
- Dec 23, 2010 12:08:07 PM (2 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/steps/mail/func.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/steps/mail/func.inc
r4355 r4365 1144 1144 1145 1145 // 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)) { 1147 1148 $attrs = $m[0]; 1148 1149 // 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)) { 1150 1151 $attributes['background-color'] = $mb[1]; 1151 1152 $attrs = preg_replace('/bgcolor=["\']*([a-z0-9#]+)["\']*/', '', $attrs); 1152 1153 } 1153 1154 // 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)) { 1155 1156 $attributes['background-image'] = 'url('.$mb[1].')'; 1156 1157 $attrs = preg_replace('/background=["\']*([^"\'>\s]+)["\']*/', '', $attrs); 1157 1158 } 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 } 1160 1162 1161 1163 // handle body styles related to background image … … 1173 1175 // make sure there's 'rcmBody' div, we need it for proper css modification 1174 1176 // its name is hardcoded in rcmail_message_body() also 1175 else 1177 else { 1176 1178 $body = '<div class="' . $body_id . '">' . $body . '</div>'; 1179 } 1177 1180 1178 1181 return $body;
Note: See TracChangeset
for help on using the changeset viewer.
