From cfd0ffb7b8319cf9fbe94fb9d3ee2212fb88b3bd Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 22 Apr 2013 20:46:06 -0700 Subject: [PATCH] Emoticon BBcode Fix --- .../shortcodes/batch/bbcode_shortcodes.php | 72 +++++++++++++++++-- e107_handlers/e_parse_class.php | 11 +++ e107_handlers/form_handler.php | 2 +- 3 files changed, 77 insertions(+), 8 deletions(-) diff --git a/e107_core/shortcodes/batch/bbcode_shortcodes.php b/e107_core/shortcodes/batch/bbcode_shortcodes.php index adf996190..b97e16c35 100644 --- a/e107_core/shortcodes/batch/bbcode_shortcodes.php +++ b/e107_core/shortcodes/batch/bbcode_shortcodes.php @@ -187,15 +187,13 @@ class bbcode_shortcodes extends e_shortcode // Legacy BC Support - $data = "size"; $formid = $id."_"; $event = $this->getEvent('expandit',$formid, LANHELP_22); $text = "var['tagid']}')\" data-function='show' href='#{$this->var['tagid']}' title='".LANHELP_22."' data-bbcode='{$data}'> "; - - + $text .="
"; $text .="
"; @@ -209,15 +207,75 @@ class bbcode_shortcodes extends e_shortcode { $text .= "\n"; } - $text .=" - - - \n
+ $text .="
\n"; return $text; } + function bb_emotes($id) + { + $pref = e107::getPref(); + + if ($pref['comments_emoticons'] && $pref['smiley_activate'] && !defsettrue('e_WYSIWYG')) + { + if(deftrue('e_BOOTSTRAP')) + { + $text = '
'; + $text .= ''; + $text .= ""; + $text .= ''; + $text .= ""; + $text .= "
"; + + return $text; + } + + // Legacy BC version. + $text = ''; + $text .= ""; + $text .= ''; + $text .=" + \n\n"; + + return $text; + } + } + + + function renderEmotes() + { + $emotes = e107::getParser()->getEmotes(); + $pref = e107::getPref(); + + foreach($emotes as $key=>$value) + { + $key = str_replace("!", ".", $key); // Usually '.' was replaced by '!' when saving + $key = preg_replace("#_(\w{3})$#", ".\\1", $key); // '_' followed by exactly 3 chars is file extension + $key = e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" .$key; // Add in the file path + $value2 = substr($value, 0, strpos($value, " ")); + $value = ($value2 ? $value2 : $value); + $value = ($value == '&|') ? ':((' : $value; + $text .= "\n"; + + } + + return $text; + } + + + function bb_fontcol($id) // JS in this breaks ajax loading. diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index cf662d175..88b34cc2b 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -538,6 +538,7 @@ class e_parse extends e_parser */ function htmlAbuseFilter($data, $tagList = '') { + if ($tagList == '') { $checkTags = array('textarea', 'input', 'td', 'tr', 'table'); @@ -587,11 +588,14 @@ class e_parse extends e_parser /** + * XXX TODO Remove this horrible thing which adds junk to a db. * Checks a string for potentially dangerous HTML tags, including malformed tags * */ public function dataFilter($data, $mode='bbcode') { + + $ans = ''; $vetWords = array('e_emote->emotes; + } + + /** * Replace e107 path constants * Note: only an ADMIN user can convert {e_ADMIN} diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index c2d75ea4a..1c07d3aee 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -346,7 +346,7 @@ class e_form $title = "Media Manager : ".$category; // $ret = "".$label.""; // using colorXXXbox. - $ret = "".$label.""; // using bootstrap. + $ret = "".$label.""; // using bootstrap. // $footer = "
Save
";