aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-01 19:19:17 -0700
committerredmatrix <git@macgirvin.com>2016-05-01 19:19:17 -0700
commitcd518625bf561f1ed42db0b78030b74c32435136 (patch)
treea0894903507417997833d6766d7ba6a1ffd23a30 /include/text.php
parent84d93cca6e2ac0b552a6f5c570fbcfce766200a1 (diff)
downloadvolse-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.php31
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);