alecpl
2010-05-22 0b7f3a8ab26f992ebd83e8b9ab1deabab6d51957
- Add support for data URI scheme [RFC2397] (#1486740)


2 files modified
12 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/lib/washtml.php 11 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
- Add support for data URI scheme [RFC2397] (#1486740)
- Added 'actionbefore', 'actionafter', 'responsebefore', 'responseafter' events
- Removed response.callbacks feature
- Fix double-addition of e-mail domain to content ID in HTML images
program/lib/washtml.php
@@ -73,6 +73,7 @@
 * Roundcube Changes:
 * - added $block_elements
 * - changed $ignore_elements behaviour
 * - added RFC2397 support
 */
class washtml
@@ -144,12 +145,15 @@
                 ')\s*/i', $str, $match)) {
          if($match[2]) {
            if($src = $this->config['cid_map'][$match[2]])
              $value .= ' url(\''.htmlspecialchars($src, ENT_QUOTES) . '\')';
              $value .= ' url('.htmlspecialchars($src, ENT_QUOTES) . ')';
            else if(preg_match('/^(http|https|ftp):.*$/i', $match[2], $url)) {
              if($this->config['allow_remote'])
                $value .= ' url(\''.htmlspecialchars($url[0], ENT_QUOTES).'\')';
                $value .= ' url('.htmlspecialchars($url[0], ENT_QUOTES).')';
              else
                $this->extlinks = true;
            }
            else if (preg_match('/^data:.+/i', $url)) { // RFC2397
              $value .= ' url('.htmlspecialchars($url, ENT_QUOTES).')';
            }
          } else if($match[0] != 'url' && $match[0] != 'rbg')//whitelist ?
            $value .= ' ' . $match[0];
@@ -188,6 +192,9 @@
              $t .= ' ' . $key . '="' . htmlspecialchars($this->config['blocked_src'], ENT_QUOTES) . '"';
          }
        }
        else if (preg_match('/^data:.+/i', $value)) { // RFC2397
          $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"';
        }
      } else
        $washed .= ($washed?' ':'') . $key;
    }