From 937ef030475826a4ceebaec203a189e8b140de34 Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Thu, 9 Aug 2018 14:05:06 +0200 Subject: [PATCH] fixes #3317 added bbcode template "forum" Fixed issue with bbcode youtube to display the mediamanager only if the current user is an admin. Otherwise it will just add the plain bbcode string "[youtube]dkhkj[/youtube]" to the textarea. --- .../shortcodes/batch/bbcode_shortcodes.php | 19 ++++++++++++++----- e107_core/templates/bbcode_template.php | 8 ++++++++ e107_handlers/bbcode_handler.php | 4 +++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/e107_core/shortcodes/batch/bbcode_shortcodes.php b/e107_core/shortcodes/batch/bbcode_shortcodes.php index 74778802c..a3bf00d63 100644 --- a/e107_core/shortcodes/batch/bbcode_shortcodes.php +++ b/e107_core/shortcodes/batch/bbcode_shortcodes.php @@ -131,8 +131,17 @@ class bbcode_shortcodes extends e_shortcode { list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } - - $text = ""; + + if (ADMIN) + { + $text = ""; + } + else + { + $data = "[youtube=tiny | small | medium | big | huge | width,height]6kYjxJmk0wc[/youtube]"; + $event = $this->getEvent('addtext',$data,LANHELP_48); + $text = ""; + } $text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48); $text .= ""; @@ -152,7 +161,7 @@ class bbcode_shortcodes extends e_shortcode } - $text = ""; + $text = ""; $text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48); $text .= ""; @@ -211,7 +220,7 @@ class bbcode_shortcodes extends e_shortcode { list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } - $text = ""; + $text = ""; $text .= $this->button(e_IMAGE_ABS."bbcode/preimage.png",'picture-o'); // $text .= ""; @@ -229,7 +238,7 @@ class bbcode_shortcodes extends e_shortcode { list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } - $text = ""; + $text = ""; $text .= $this->button(e_IMAGE_ABS."bbcode/prefile.png", 'file'); // $text .= ""; diff --git a/e107_core/templates/bbcode_template.php b/e107_core/templates/bbcode_template.php index d1e7666a7..16cf357d2 100644 --- a/e107_core/templates/bbcode_template.php +++ b/e107_core/templates/bbcode_template.php @@ -50,6 +50,14 @@ $BBCODE_TEMPLATE_SUBMITNEWS = " "; +$BBCODE_TEMPLATE_FORUM = " +
+ {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=left}{BB=center}{BB=right}{BB=justify} + {BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=youtube} +
+"; + + // -------- Admin Templates ---------------------- $BBCODE_TEMPLATE_ADMIN = " diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index 199f82a9d..cd5ef5c3f 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -547,6 +547,7 @@ class e_bbcode $BBCODE_TEMPLATE_ADMIN = ''; $BBCODE_TEMPLATE_COMMENT = ''; $BBCODE_TEMPLATE_SIGNATURE = ''; + $BBCODE_TEMPLATE_FORUM = ''; require(e107::coreTemplatePath('bbcode')); //correct way to load a core template. @@ -574,7 +575,8 @@ class e_bbcode $temp['maintenance']= $BBCODE_TEMPLATE_ADMIN; $temp['comment'] = $BBCODE_TEMPLATE_COMMENT; $temp['signature'] = $BBCODE_TEMPLATE_SIGNATURE; - + $temp['forum'] = $BBCODE_TEMPLATE_FORUM; + if(isset($temp[$template])) { $BBCODE_TEMPLATE = $temp[$template];