From bb01287e256ee87694486a5e20e6b2ae07e351ed Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 29 Jan 2015 17:01:52 -0800 Subject: [PATCH] Fixes #803 - TinyMce Image paths issue. --- e107_core/bbcodes/bb_img.php | 3 ++- e107_plugins/tinymce4/plugins/e107/parser.php | 26 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/e107_core/bbcodes/bb_img.php b/e107_core/bbcodes/bb_img.php index 184cec6d4..51d5da0de 100644 --- a/e107_core/bbcodes/bb_img.php +++ b/e107_core/bbcodes/bb_img.php @@ -41,6 +41,7 @@ class bb_img extends e_bb_base // Replace the bbcode path with a real one. $code_text = str_replace('{e_MEDIA}','{e_MEDIA_IMAGE}',$code_text); //BC 0.8 fix. $code_text = str_replace('{e_MEDIA_IMAGE}', e_HTTP."thumb.php?src=e_MEDIA_IMAGE/", $code_text); + $code_text = str_replace('{e_THEME}', e_HTTP."thumb.php?src=e_THEME/", $code_text); $imgParms = $this->processParm($code_text, $parm); foreach($imgParms as $k => $v) @@ -124,7 +125,7 @@ class bb_img extends e_bb_base if (trim($code_text) == "") return ""; // Do nothing on empty file - if(substr($code_text,0,15) == '{e_MEDIA_IMAGE}') // Image from Media-Manager. + if(substr($code_text,0,15) == '{e_MEDIA_IMAGE}' || substr($code_text,0,9) == '{e_MEDIA}' || substr($code_text,0,9) == '{e_THEME}') // Image from Media-Manager. { return $this->mediaImage($code_text, $parm); } diff --git a/e107_plugins/tinymce4/plugins/e107/parser.php b/e107_plugins/tinymce4/plugins/e107/parser.php index d878c5f5b..e8dc0204c 100644 --- a/e107_plugins/tinymce4/plugins/e107/parser.php +++ b/e107_plugins/tinymce4/plugins/e107/parser.php @@ -38,6 +38,9 @@ if($_POST['mode'] == 'tohtml') if(check_class($pref['post_html'])) // raw HTML within [html] tags. { + + // $content = $tp->replaceConstants($content,'abs'); + if(strstr($content,"[html]") === false) // BC - convert old BB code text to html. { e107::getBB()->clearClass(); @@ -46,12 +49,22 @@ if($_POST['mode'] == 'tohtml') $content = nl2br($content, true); $content = $tp->toHtml($content, true); } - - $content = str_replace("{e_BASE}","",$content); // We want {e_BASE} in the final data going to the DB, but not the editor. + + + + $content = str_replace("{e_BASE}",e_HTTP,$content); // We want {e_BASE} in the final data going to the DB, but not the editor. $srch = array("","","[html]","[/html]"); $content = str_replace($srch,"",$content); $content = e107::getBB()->parseBBCodes($content); // parse the tag so we see the HTML equivalent while editing! - echo $content; + + if(!empty($content) && E107_DEBUG_LEVEL > 0) + { + $content = "-- DEBUG MODE ACTIVE -- \n".$content; + echo htmlentities($content)."\n"; + exit; + } + + echo $content; } else // bbcode Mode. { @@ -63,6 +76,13 @@ if($_POST['mode'] == 'tohtml') $content = $tp->toHtml($content, true); $content = str_replace(e_MEDIA_IMAGE,"{e_MEDIA_IMAGE}",$content); + if(!empty($content) && E107_DEBUG_LEVEL > 0) + { + echo ""; + //print_r(htmlentities($content))."\n"; + //exit; + } + echo $content; }