1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-14 02:24:08 +02:00

Convert images back to bbcode when using TinyMce to keep image src urls dynamic. Parse bbcode inside [html] in toHtml()

This commit is contained in:
Cameron
2017-12-27 12:28:29 -08:00
parent b1a2e65a9b
commit 66cb38cb85
3 changed files with 82 additions and 19 deletions

View File

@@ -1479,6 +1479,34 @@ class e_parse extends e_parser
}
function parseBBCodes($text, $postID)
{
if (!is_object($this->e_bb))
{
require_once(e_HANDLER.'bbcode_handler.php');
$this->e_bb = new e_bbcode;
}
$text = $this->e_bb->parseBBCodes($text, $postID);
return $text;
}
/**
* Converts the text (presumably retrieved from the database) for HTML output.
*
@@ -1687,10 +1715,14 @@ class e_parse extends e_parser
$html_start = "<!-- bbcode-html-start -->"; // markers for html-to-bbcode replacement.
$html_end = "<!-- bbcode-html-end -->";
$full_text = str_replace(array("[html]","[/html]"), "",$code_text); // quick fix.. security issue?
$full_text =$this->replaceConstants($full_text,'abs');
$full_text = $this->parseBBCodes($full_text, $postID); // parse any embedded bbcodes eg. [img]
$full_text = $this->replaceConstants($full_text,'abs'); // parse any other paths using {e_....
$full_text = $html_start.$full_text.$html_end;
$full_text = $this->parseBBTags($full_text); // strip <bbcode> tags.
$opts['nobreak'] = true;
$parseBB = false; // prevent further bbcode processing.
break;
@@ -2764,6 +2796,8 @@ class e_parse extends e_parser
$staticFile = $this->thumbCacheFile($url, $opts);
if(!empty($staticFile) && is_readable(e_CACHE_IMAGE.$staticFile))
{
$staticImg = $this->staticUrl(e_CACHE_IMAGE_ABS.$staticFile);
@@ -2771,6 +2805,8 @@ class e_parse extends e_parser
return $staticImg;
}
// echo "<br />static-not-found: ".$staticFile;
$options['nosef'] = true;
$options['x'] = null;
// file_put_contents(e_LOG."thumb.log", "\n++++++++++++++++++++++++++++++++++\n\n", FILE_APPEND);