| copyright header is strictly prohibited without | written permission from the original author(s). +--------------------------------------------------------*/ require_once dirname(__FILE__) . "../../../../../maincore.php"; $text = stripinput($_POST['text']); // filter to relative path conversion echo "<div class='preview-response clearfix p-20'>\n"; // Set get_image paths based on URI. This is ajax request file. It doesn't return a standard BASEDIR. $prefix_ = ""; if (!fusion_get_settings("site_seo") && isset($_POST['url'])) { $uri = pathinfo($_POST['url']); $count = substr($_POST['url'], -1) == "/" ? substr_count($uri['dirname'], "/") : substr_count($uri['dirname'], "/") - 1; $prefix_ = str_repeat("../", $count); foreach (cache_smileys() as $smiley) { $smiley_path = "./" . $prefix_ . "images/smiley/" . $smiley['smiley_image']; \PHPFusion\ImageRepo::setImage("smiley_" . $smiley['smiley_text'], $smiley_path); } } if ($_POST['editor'] == 'html') { $text = parsesmileys(nl2br(html_entity_decode(stripslashes($text)))); if (isset($_POST['mode']) && $_POST['mode'] == 'admin') { $images = str_replace('../../../', '', IMAGES); $text = str_replace(IMAGES, $images, $text); $text = str_replace(IMAGES_N, $images, $text); $text = parse_imageDir($text, $prefix_ . "images/"); } echo html_entity_decode($text, ENT_QUOTES, $locale['charset']) ?: "<p class='text-center'>" . $locale['nopreview'] . "</p>\n"; } elseif ($_POST['editor'] == 'bbcode') { $text = parseubb(parsesmileys($text)); if (isset($_POST['mode']) && $_POST['mode'] == 'admin') { $images = str_replace('../../../', '', IMAGES);
/** * Replace a part in each path * * @param string $source * @param string $target */ function redirect_img_dir($source, $target) { ImageRepo::replaceInAllPath($source, $target); }