Changeset 3651 in subversion
- Timestamp:
- May 22, 2010 3:27:15 AM (3 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/lib/washtml.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r3650 r3651 2 2 =========================== 3 3 4 - Add support for data URI scheme [RFC2397] (#1486740) 4 5 - Added 'actionbefore', 'actionafter', 'responsebefore', 'responseafter' events 5 6 - Removed response.callbacks feature -
trunk/roundcubemail/program/lib/washtml.php
r3521 r3651 74 74 * - added $block_elements 75 75 * - changed $ignore_elements behaviour 76 * - added RFC2397 support 76 77 */ 77 78 … … 132 133 $s = ''; 133 134 134 foreach (explode(';', $style) as $declaration) {135 if (preg_match('/^\s*([a-z\-]+)\s*:\s*(.*)\s*$/i', $declaration, $match)) {135 foreach (explode(';', $style) as $declaration) { 136 if (preg_match('/^\s*([a-z\-]+)\s*:\s*(.*)\s*$/i', $declaration, $match)) { 136 137 $cssid = $match[1]; 137 138 $str = $match[2]; 138 139 $value = ''; 139 while (sizeof($str) > 0 &&140 while (sizeof($str) > 0 && 140 141 preg_match('/^(url\(\s*[\'"]?([^\'"\)]*)[\'"]?\s*\)'./*1,2*/ 141 142 '|rgb\(\s*[0-9]+\s*,\s*[0-9]+\s*,\s*[0-9]+\s*\)'. … … 143 144 '|#[0-9a-f]{3,6}|[a-z0-9\-]+'. 144 145 ')\s*/i', $str, $match)) { 145 if ($match[2]) {146 if ($src = $this->config['cid_map'][$match[2]])147 $value .= ' url( \''.htmlspecialchars($src, ENT_QUOTES) . '\')';148 else if (preg_match('/^(http|https|ftp):.*$/i', $match[2], $url)) {149 if ($this->config['allow_remote'])150 $value .= ' url( \''.htmlspecialchars($url[0], ENT_QUOTES).'\')';146 if ($match[2]) { 147 if ($src = $this->config['cid_map'][$match[2]]) 148 $value .= ' url('.htmlspecialchars($src, ENT_QUOTES) . ')'; 149 else if (preg_match('/^(http|https|ftp):.*$/i', $match[2], $url)) { 150 if ($this->config['allow_remote']) 151 $value .= ' url('.htmlspecialchars($url[0], ENT_QUOTES).')'; 151 152 else 152 153 $this->extlinks = true; 153 154 } 154 } else if($match[0] != 'url' && $match[0] != 'rbg')//whitelist ? 155 else if (preg_match('/^data:.+/i', $url)) { // RFC2397 156 $value .= ' url('.htmlspecialchars($url, ENT_QUOTES).')'; 157 } 158 } else if ($match[0] != 'url' && $match[0] != 'rbg') //whitelist ? 155 159 $value .= ' ' . $match[0]; 156 160 $str = substr($str, strlen($match[0])); 157 161 } 158 if ($value)162 if ($value) 159 163 $s .= ($s?' ':'') . $cssid . ':' . $value . ';'; 160 164 } … … 168 172 $washed; 169 173 170 foreach ($node->attributes as $key => $plop) {174 foreach ($node->attributes as $key => $plop) { 171 175 $key = strtolower($key); 172 176 $value = $node->getAttribute($key); 173 if (isset($this->_html_attribs[$key]) ||177 if (isset($this->_html_attribs[$key]) || 174 178 ($key == 'href' && preg_match('/^(http:|https:|ftp:|mailto:|#).+/i', $value))) 175 179 $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; 176 else if ($key == 'style' && ($style = $this->wash_style($value)))180 else if ($key == 'style' && ($style = $this->wash_style($value))) 177 181 $t .= ' style="' . $style . '"'; 178 else if ($key == 'background' || ($key == 'src' && strtolower($node->tagName) == 'img')) { //check tagName anyway179 if ($src = $this->config['cid_map'][$value]) {182 else if ($key == 'background' || ($key == 'src' && strtolower($node->tagName) == 'img')) { //check tagName anyway 183 if ($src = $this->config['cid_map'][$value]) { 180 184 $t .= ' ' . $key . '="' . htmlspecialchars($src, ENT_QUOTES) . '"'; 181 185 } 182 else if (preg_match('/^(http|https|ftp):.+/i', $value)) {183 if ($this->config['allow_remote'])186 else if (preg_match('/^(http|https|ftp):.+/i', $value)) { 187 if ($this->config['allow_remote']) 184 188 $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; 185 189 else { … … 188 192 $t .= ' ' . $key . '="' . htmlspecialchars($this->config['blocked_src'], ENT_QUOTES) . '"'; 189 193 } 194 } 195 else if (preg_match('/^data:.+/i', $value)) { // RFC2397 196 $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; 190 197 } 191 198 } else
Note: See TracChangeset
for help on using the changeset viewer.
