Changeset 5430 in subversion
- Timestamp:
- Nov 15, 2011 11:47:40 AM (19 months ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/lib/washtml.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/lib/washtml.php
r5428 r5430 142 142 $this->config = $p + array('show_washed'=>true, 'allow_remote'=>false, 'cid_map'=>array()); 143 143 } 144 144 145 145 /* Register a callback function for a certain tag */ 146 146 public function add_callback($tagName, $callback) … … 148 148 $this->handlers[$tagName] = $callback; 149 149 } 150 150 151 151 /* Check CSS style */ 152 152 private function wash_style($style) { … … 162 162 '|rgb\(\s*[0-9]+\s*,\s*[0-9]+\s*,\s*[0-9]+\s*\)'. 163 163 '|-?[0-9.]+\s*(em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)?'. 164 '|#[0-9a-f]{3,6}|[a-z0-9 \-]+'.164 '|#[0-9a-f]{3,6}|[a-z0-9", -]+'. 165 165 ')\s*/i', $str, $match)) { 166 166 if ($match[2]) { … … 179 179 } 180 180 } 181 else if ($match[0] != 'url' && $match[0] != 'r bg') //whitelist ?181 else if ($match[0] != 'url' && $match[0] != 'rgb') //whitelist ? 182 182 $value .= ' ' . $match[0]; 183 183 184 $str = substr($str, strlen($match[0])); 184 185 } … … 201 202 ($key == 'href' && preg_match('/^(http:|https:|ftp:|mailto:|#).+/i', $value))) 202 203 $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; 203 else if ($key == 'style' && ($style = $this->wash_style($value))) 204 $t .= ' style="' . $style . '"'; 204 else if ($key == 'style' && ($style = $this->wash_style($value))) { 205 $quot = strpos($style, '"') !== false ? "'" : '"'; 206 $t .= ' style=' . $quot . $style . $quot; 207 } 205 208 else if ($key == 'background' || ($key == 'src' && strtolower($node->tagName) == 'img')) { //check tagName anyway 206 209 if (($src = $this->config['cid_map'][$value])
Note: See TracChangeset
for help on using the changeset viewer.
