summaryrefslogtreecommitdiff
path: root/program/include/rcube_content_filter.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-12-28 09:21:21 +0000
committeralecpl <alec@alec.pl>2011-12-28 09:21:21 +0000
commita267c6ccd20ea835a398211063b550ef49591b82 (patch)
tree820bc51d953f4b81f12652020eae98ef3cc646ff /program/include/rcube_content_filter.php
parentf547424c75a270aac64075a3d1e0c6cdbef83dc8 (diff)
- PHPCS
Diffstat (limited to 'program/include/rcube_content_filter.php')
-rw-r--r--program/include/rcube_content_filter.php55
1 files changed, 28 insertions, 27 deletions
diff --git a/program/include/rcube_content_filter.php b/program/include/rcube_content_filter.php
index 430defec6..cde02ebdb 100644
--- a/program/include/rcube_content_filter.php
+++ b/program/include/rcube_content_filter.php
@@ -23,33 +23,34 @@
*/
class rcube_content_filter extends php_user_filter
{
- private $buffer = '';
- private $cutoff = 2048;
-
- function onCreate()
- {
- $this->cutoff = rand(2048, 3027);
- return true;
- }
-
- function filter($in, $out, &$consumed, $closing)
- {
- while ($bucket = stream_bucket_make_writeable($in)) {
- $this->buffer .= $bucket->data;
-
- // check for evil content and abort
- if (preg_match('/<(script|iframe|object)/i', $this->buffer))
- return PSFS_ERR_FATAL;
-
- // keep buffer small enough
- if (strlen($this->buffer) > 4096)
- $this->buffer = substr($this->buffer, $this->cutoff);
-
- $consumed += $bucket->datalen;
- stream_bucket_append($out, $bucket);
+ private $buffer = '';
+ private $cutoff = 2048;
+
+ function onCreate()
+ {
+ $this->cutoff = rand(2048, 3027);
+ return true;
}
- return PSFS_PASS_ON;
- }
-}
+ function filter($in, $out, &$consumed, $closing)
+ {
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $this->buffer .= $bucket->data;
+
+ // check for evil content and abort
+ if (preg_match('/<(script|iframe|object)/i', $this->buffer)) {
+ return PSFS_ERR_FATAL;
+ }
+
+ // keep buffer small enough
+ if (strlen($this->buffer) > 4096) {
+ $this->buffer = substr($this->buffer, $this->cutoff);
+ }
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+
+ return PSFS_PASS_ON;
+ }
+}