diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index f8696e0c8..80d5dcdde 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -735,6 +735,7 @@ class e_bbcode print_a($arr); } + $arr['img'] = isset($arr['img']) && is_array($arr['img']) ? $arr['img'] : []; foreach($arr['img'] as $img) { if(/*substr($img['src'],0,4) == 'http' ||*/ strpos($img['src'], e_IMAGE_ABS.'emotes/')!==false) // dont resize external images or emoticons. diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index dd8a93748..903d00381 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -2914,7 +2914,7 @@ class e_parse extends e_parser */ function thumbUrlDecode($src) { - list($url,$qry) = explode("?",$src); + list($url,$qry) = array_pad(explode("?",$src), 2, null); $ret = array(); diff --git a/e107_plugins/tinymce4/plugins/e107/parser.php b/e107_plugins/tinymce4/plugins/e107/parser.php index 8cbd6101d..b343404ae 100644 --- a/e107_plugins/tinymce4/plugins/e107/parser.php +++ b/e107_plugins/tinymce4/plugins/e107/parser.php @@ -19,7 +19,7 @@ $_E107['no_menus'] = true; $_E107['no_forceuserupdate'] = true; $_E107['no_maintenance'] = true; -define('e_ADMIN_AREA', true); +if (!defined('e_ADMIN_AREA')) define('e_ADMIN_AREA', true); if(!defined('TINYMCE_DEBUG') && !defined('TINYMCE_UNIT_TEST')) { require_once("../../../../class2.php"); @@ -42,6 +42,9 @@ class e107TinyMceParser */ function __construct() { + $_POST['mode'] = isset($_POST['mode']) ? $_POST['mode'] : 'tohtml'; + $_POST['content'] = isset($_POST['content']) ? $_POST['content'] : ''; + $html = ''; if(defined('TINYMCE_DEBUG') || defined('TINYMCE_UNIT_TEST')) @@ -70,7 +73,6 @@ class e107TinyMceParser TEMPL; } $_POST['content'] = $text; - $_POST['mode'] = 'tohtml'; } else { @@ -119,7 +121,7 @@ TEMPL; $content = stripslashes($content); // $content = e107::getBB()->htmltoBBcode($content); //XXX This breaks inserted images from media-manager. :/ - e107::getBB()->setClass($_SESSION['media_category']); + e107::getBB()->setClass($this->getMediaCategory()); if(check_class($pref['post_html'])) // raw HTML within [html] tags. { @@ -197,7 +199,7 @@ TEMPL; $pref = e107::getPref(); // $tp = e107::getParser(); - e107::getBB()->setClass($_SESSION['media_category']); + e107::getBB()->setClass($this->getMediaCategory()); $content = stripslashes($content); @@ -231,6 +233,14 @@ TEMPL; } + /** + * @return mixed|null + */ + private function getMediaCategory() + { + return isset($_SESSION['media_category']) ? $_SESSION['media_category'] : null; + } + diff --git a/e107_tests/tests/unit/plugins/e107TinyMceParserTest.php b/e107_tests/tests/unit/plugins/e107TinyMceParserTest.php index 6d6e97fee..e2e98b70b 100644 --- a/e107_tests/tests/unit/plugins/e107TinyMceParserTest.php +++ b/e107_tests/tests/unit/plugins/e107TinyMceParserTest.php @@ -17,7 +17,7 @@ protected function _before() { - define('TINYMCE_UNIT_TEST', true); + @define('TINYMCE_UNIT_TEST', true); require_once(e_PLUGIN."tinymce4/plugins/e107/parser.php"); try {