1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-12 05:24:38 +02:00

Backward Compatibility fix for TinyMce editing.

This commit is contained in:
Cameron
2013-03-18 02:16:41 -07:00
parent 86d77fa58b
commit 53b84b91f9
3 changed files with 15 additions and 4 deletions

View File

@@ -32,6 +32,16 @@ if($_POST['mode'] == 'tohtml')
if(check_class($pref['post_html'])) // raw HTML within [html] tags.
{
if(strstr($content,"[img]") || strstr($content, "[b]") || strstr($content, "[link")) // BC - convert old BB code text to html.
{
e107::getBB()->clearClass();
$content = str_replace('\r\n',"<br />",$content);
$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.
$srch = array("<!-- bbcode-html-start -->","<!-- bbcode-html-end -->","[html]","[/html]");
@@ -61,11 +71,11 @@ if($_POST['mode'] == 'tobbcode')
if(check_class($pref['post_html'])) // Plain HTML mode.
{
$srch = array('src="'.e_HTTP.'thumb.php?');
$repl = array('src="{e_BASE}thumb.php?');
$srch = array('src="'.e_HTTP.'thumb.php?','src="/{e_MEDIA_IMAGE}');
$repl = array('src="{e_BASE}thumb.php?','src="{e_BASE}thumb.php?src={e_MEDIA_IMAGE}');
$content = str_replace($srch, $repl, $content);
// resize the thumbnail to match wysiwyg width/height.
$psrch = '/<img[^>]*src="{e_BASE}thumb.php\?src=([\S]*)w=([\d]*)&amp;h=([\d]*)"(.*)width="([\d]*)" height="([\d]*)"/i';