diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index ae4e34a59..619e91b44 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -170,6 +170,7 @@ class e107 'e_object' => '{e_HANDLER}model_class.php', 'e_online' => '{e_HANDLER}online_class.php', 'e_parse' => '{e_HANDLER}e_parse_class.php', + 'e_parser' => '{e_HANDLER}e_parse_class.php', 'e_parse_shortcode' => '{e_HANDLER}shortcode_handler.php', 'e_ranks' => '{e_HANDLER}e_ranks_class.php', 'e_shortcode' => '{e_HANDLER}shortcode_handler.php', diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 0070c4d0e..1b9cca412 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -2537,25 +2537,34 @@ class e_parse extends e_parser */ class e_parser { - public $domObj = null; - private $removedList = array(); - private $nodesToDelete = array(); - private $nodesToConvert = array(); - private $pathList = array(); - private $allowedAttributes = array( + /** + * @var DOMDocument + */ + public $domObj = null; + protected $removedList = array(); + protected $nodesToDelete = array(); + protected $nodesToConvert = array(); + protected $pathList = array(); + protected $allowedAttributes = array( 'default' => array('id', 'style', 'class'), 'img' => array('id', 'src', 'style', 'class', 'alt', 'title', 'width', 'height'), 'a' => array('id', 'href', 'style', 'class', 'title', 'target'), 'script' => array('type', 'src', 'language'), 'iframe' => array('id', 'src', 'frameborder', 'class', 'width', 'height', 'style') - ); - private $badAttrValues = array("javascript[\s]*?:","alert\(","vbscript[\s]*?:","data:text\/html", "mhtml[\s]*?:", "data:[\s]*?image"); - private $allowedTags = array('html', 'body','div','a','img','table','tr', 'td', 'th', 'tbody', 'thead', 'colgroup', 'b', + ); + + protected $badAttrValues = array('javascript[\s]*?:','alert\(','vbscript[\s]*?:','data:text\/html', 'mhtml[\s]*?:', 'data:[\s]*?image'); + + protected $replaceAttrValues = array( + 'default' => array() + ); + + protected $allowedTags = array('html', 'body','div','a','img','table','tr', 'td', 'th', 'tbody', 'thead', 'colgroup', 'b', 'i', 'pre','code', 'strong', 'u', 'em','ul','li','img','h1','h2','h3','h4','h5','h6','p', 'div','pre','section','article', 'blockquote','hgroup','aside','figure','span', 'video', 'br', 'small', 'caption', 'noscript' ); - private $scriptTags = array('script','applet','iframe'); //allowed whem $pref['post_script'] is enabled. + protected $scriptTags = array('script','applet','iframe'); //allowed when $pref['post_script'] is enabled. protected $blockTags = array('pre','div','h1','h2','h3','h4','h5','h6','blockquote'); // element includes its own line-break. @@ -2586,7 +2595,6 @@ class e_parser $this->allowedTags = $array; } - /** * Set Allowed Attributes. * @param $array @@ -2596,8 +2604,15 @@ class e_parser $this->allowedAttributes = $array; } + /** + * Set Script Tags. + * @param $array + */ + public function setScriptTags($array=array()) + { + $this->scriptTags = $array; + } - /** * Add leading zeros to a number. eg. 3 might become 000003 * @param $num integer @@ -2959,6 +2974,7 @@ class e_parser { // $tp = e107::getParser(); $sql = e107::getDb(); + $tp = e107::getParser(); $html = $this->getXss(); @@ -2970,17 +2986,17 @@ class e_parser echo "