From b74a2012658a14d7f1a102f478cdc05cbd6e64f5 Mon Sep 17 00:00:00 2001 From: Chris Chabot Date: Tue, 24 Feb 2009 00:33:39 +0000 Subject: [PATCH] Filled in a very basic content sanitizer that removes any script from the content git-svn-id: https://svn.apache.org/repos/asf/incubator/shindig/trunk@747237 13f79535-47bb-0310-9956-ffa450edef68 --- php/src/gadgets/rewrite/SanitizeRewriter.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/php/src/gadgets/rewrite/SanitizeRewriter.php b/php/src/gadgets/rewrite/SanitizeRewriter.php index fa946d9d..dc16ca7f 100644 --- a/php/src/gadgets/rewrite/SanitizeRewriter.php +++ b/php/src/gadgets/rewrite/SanitizeRewriter.php @@ -39,7 +39,18 @@ class SanitizeRewriter extends DomRewriter { } } - public function rewriteScript(DOMElement $node) { - //TODO: remove it + /** + * This is a proof of concept / semi dummy content sanitizer + * that removes any javascript from the content block + * + * @param DOMElement $node + */ + public function rewriteScript(DOMElement &$node) { + if (!empty($node->nodeValue)) { + $node->nodeValue = ''; + } + if ($node->getAttribute('src') != null) { + $node->setAttribute('src', ''); + } } } \ No newline at end of file -- 2.11.4.GIT