diff options
author | redmatrix <git@macgirvin.com> | 2016-05-01 19:19:17 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-01 19:19:17 -0700 |
commit | cd518625bf561f1ed42db0b78030b74c32435136 (patch) | |
tree | a0894903507417997833d6766d7ba6a1ffd23a30 /include/text.php | |
parent | 84d93cca6e2ac0b552a6f5c570fbcfce766200a1 (diff) | |
download | volse-hubzilla-cd518625bf561f1ed42db0b78030b74c32435136.tar.gz volse-hubzilla-cd518625bf561f1ed42db0b78030b74c32435136.tar.bz2 volse-hubzilla-cd518625bf561f1ed42db0b78030b74c32435136.zip |
some much needed work on oembed security
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php index c61c5fbd4..cf2f777aa 100644 --- a/include/text.php +++ b/include/text.php @@ -122,7 +122,7 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') { -function purify_html($s) { +function purify_html($s, $allow_position) { require_once('library/HTMLPurifier.auto.php'); require_once('include/html2bbcode.php'); @@ -202,6 +202,35 @@ function purify_html($s) { $def->addElement('header', 'Block', 'Flow', 'Common'); $def->addElement('footer', 'Block', 'Flow', 'Common'); + + if($allow_position) { + $cssDefinition = $config->getCSSDefinition(); + + $cssDefinition->info['position'] = new HTMLPurifier_AttrDef_Enum(array('absolute', 'fixed', 'relative', 'static', 'inherit'), false); + + $cssDefinition->info['left'] = new HTMLPurifier_AttrDef_CSS_Composite(array( + new HTMLPurifier_AttrDef_CSS_Length(), + new HTMLPurifier_AttrDef_CSS_Percentage() + )); + + $cssDefinition->info['right'] = new HTMLPurifier_AttrDef_CSS_Composite(array( + new HTMLPurifier_AttrDef_CSS_Length(), + new HTMLPurifier_AttrDef_CSS_Percentage() + )); + + $cssDefinition->info['top'] = new HTMLPurifier_AttrDef_CSS_Composite(array( + new HTMLPurifier_AttrDef_CSS_Length(), + new HTMLPurifier_AttrDef_CSS_Percentage() + )); + + $cssDefinition->info['bottom'] = new HTMLPurifier_AttrDef_CSS_Composite(array( + new HTMLPurifier_AttrDef_CSS_Length(), + new HTMLPurifier_AttrDef_CSS_Percentage() + )); + + } + + $purifier = new HTMLPurifier($config); return $purifier->purify($s); |