예제 #1
0
function parseubb($text, $selected = FALSE)
{
    global $bbcode_cache;
    if (!$bbcode_cache) {
        cache_bbcode();
    }
    if (is_array($bbcode_cache) && count($bbcode_cache)) {
        if ($selected) {
            $sel_bbcodes = explode("|", $selected);
        }
        foreach ($bbcode_cache as $bbcode) {
            if ($selected && in_array($bbcode, $sel_bbcodes)) {
                if (file_exists(INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php")) {
                    if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                    } elseif (file_exists(LOCALE . "English/bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . "English/bbcodes/" . $bbcode . ".php";
                    }
                    include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php";
                }
            } elseif (!$selected) {
                if (file_exists(INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php")) {
                    if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                    } elseif (file_exists(LOCALE . "English/bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . "English/bbcodes/" . $bbcode . ".php";
                    }
                    include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php";
                }
            }
        }
    }
    $text = descript($text, FALSE);
    return $text;
}
예제 #2
0
function strip_bbcodes($text)
{
    global $bbcode_cache, $p_data;
    $textarea_name = "";
    $inputform_name = "";
    if (!iADMIN) {
        if (!$bbcode_cache) {
            cache_bbcode();
        }
        if (is_array($bbcode_cache) && count($bbcode_cache)) {
            foreach ($bbcode_cache as $bbcode) {
                if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                    include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                }
                include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include_var.php";
            }
        }
        if (isset($__BBCODE_NOT_QUOTABLE__) && sizeof($__BBCODE_NOT_QUOTABLE__) != 0) {
            foreach ($__BBCODE_NOT_QUOTABLE__ as $key => $bbname) {
                $text = preg_replace('#\\[' . $bbname . '(.*?)\\](.*?)\\[/' . $bbname . '\\]#si', '', $text);
            }
            unset($__BBCODE_NOT_QUOTABLE__);
        }
    }
    return $text;
}
예제 #3
0
function strip_bbcodes($text)
{
    global $p_data;
    if (iADMIN) {
        return $text;
    }
    $textarea_name = "";
    $inputform_name = "";
    $bbcode_cache = cache_bbcode();
    foreach ($bbcode_cache as $bbcode) {
        if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
            include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
        }
        include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include_var.php";
    }
    if (!empty($__BBCODE_NOT_QUOTABLE__) and is_array($__BBCODE_NOT_QUOTABLE__)) {
        foreach ($__BBCODE_NOT_QUOTABLE__ as $bbname) {
            $text = preg_replace('#\\[' . $bbname . '(.*?)\\](.*?)\\[/' . $bbname . '\\]#si', '', $text);
        }
        unset($__BBCODE_NOT_QUOTABLE__);
    }
    return $text;
}
예제 #4
0
function display_bbcodes($width, $textarea_name = "message", $inputform_name = "inputform", $selected = false, $div = true)
{
    global $bbcode_cache, $p_data;
    if (!$bbcode_cache) {
        cache_bbcode();
    }
    if ($selected) {
        $sel_bbcodes = explode("|", $selected);
    }
    $__BBCODE__ = array();
    $bbcodes = "";
    if (is_array($bbcode_cache) && count($bbcode_cache)) {
        foreach ($bbcode_cache as $bbcode) {
            if ($selected && in_array($bbcode, $sel_bbcodes)) {
                if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                    include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                }
                include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include_var.php";
            } elseif (!$selected) {
                if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                    include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                }
                include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include_var.php";
            }
        }
    }
    if (sizeof($__BBCODE__) != 0) {
        foreach ($__BBCODE__ as $key => $bbdata) {
            if (file_exists(INCLUDES . "bbcodes/images/" . $bbdata['value'] . ".png")) {
                $type = "type='image' src='" . INCLUDES . "bbcodes/images/" . $bbdata['value'] . ".png' style='vertical-align:middle;'";
            } else {
                if (file_exists(INCLUDES . "bbcodes/images/" . $bbdata['value'] . ".gif")) {
                    $type = "type='image' src='" . INCLUDES . "bbcodes/images/" . $bbdata['value'] . ".gif' style='vertical-align:middle;'";
                } else {
                    if (file_exists(INCLUDES . "bbcodes/images/" . $bbdata['value'] . ".jpg")) {
                        $type = "type='image' src='" . INCLUDES . "bbcodes/images/" . $bbdata['value'] . ".jpg' style='vertical-align:middle;'";
                    } else {
                        $type = "type='button' value='" . $bbdata['value'] . "'";
                    }
                }
            }
            if (array_key_exists('onclick', $bbdata) && $bbdata['onclick'] != "") {
                $onclick = $bbdata['onclick'];
            } else {
                if (array_key_exists('bbcode_end', $bbdata) && $bbdata['bbcode_end'] != "") {
                    $onclick = "addText('" . $textarea_name . "','" . $bbdata['bbcode_start'] . "','" . $bbdata['bbcode_end'] . "','" . $inputform_name . "');return false;";
                } else {
                    $onclick = "insertText('" . $textarea_name . "','" . $bbdata['bbcode_start'] . "','" . $inputform_name . "');return false;";
                }
            }
            if (array_key_exists('onmouseover', $bbdata) && $bbdata['onmouseover'] != "") {
                $onmouseover = "onMouseOver=\"" . $bbdata['onmouseover'] . "\"";
            } else {
                $onmouseover = "";
            }
            if (array_key_exists('onmouseout', $bbdata) && $bbdata['onmouseout'] != "") {
                $onmouseout = "onMouseOut=\"" . $bbdata['onmouseout'] . "\"";
            } else {
                $onmouseout = "";
            }
            if (array_key_exists('phpfunction', $bbdata) && $bbdata['phpfunction'] != "") {
                $php = $bbdata['phpfunction'] . (substr($bbdata['phpfunction'], -1, 1) != ";" ? ";" : "");
                ob_start();
                eval($php);
                $phpfunction = ob_get_contents();
                ob_end_clean();
            } else {
                $phpfunction = "";
            }
            $bbcodes .= substr($bbdata['value'], 0, 1) != "!" ? "<input " . $type . " class='bbcode' onclick=\"" . $onclick . "\" " . $onmouseover . " " . $onmouseout . " title='" . $bbdata['description'] . "' />\n" : "";
            if (array_key_exists('html_start', $bbdata) && $bbdata['html_start'] != "") {
                $bbcodes .= $bbdata['html_start'] . "\n";
            }
            if (array_key_exists('includejscript', $bbdata) && $bbdata['includejscript'] != "") {
                $bbcodes .= "<script type='text/javascript' src='" . INCLUDES . "bbcodes/" . $bbdata['includejscript'] . "'></script>\n";
            }
            if (array_key_exists('calljscript', $bbdata) && $bbdata['calljscript'] != "") {
                $bbcodes .= "<script type='text/javascript'>\n<!--\n" . $bbdata['calljscript'] . "\n-->\n</script>\n";
            }
            if (array_key_exists('phpfunction', $bbdata) && $bbdata['phpfunction'] != "") {
                $bbcodes .= $phpfunction;
            }
            if (array_key_exists('html_middle', $bbdata) && $bbdata['html_middle'] != "") {
                $bbcodes .= $bbdata['html_middle'] . "\n";
            }
            if (array_key_exists('html_end', $bbdata) && $bbdata['html_end'] != "") {
                $bbcodes .= $bbdata['html_end'] . "\n";
            }
        }
    }
    unset($__BBCODE__);
    if ($div) {
        return "<div style='width:" . $width . "'>\n" . $bbcodes . "</div>\n";
    } else {
        return $bbcodes;
    }
}
function parseubb($text, $selected = false, $disable_lightbox = false)
{
    global $bbcode_cache, $settings;
    // Pimped: $settings added
    if (!$bbcode_cache) {
        cache_bbcode();
    }
    if (is_array($bbcode_cache) && count($bbcode_cache)) {
        if ($selected) {
            $sel_bbcodes = explode("|", $selected);
        }
        foreach ($bbcode_cache as $bbcode) {
            if ($selected && in_array($bbcode, $sel_bbcodes)) {
                if (file_exists(INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php")) {
                    if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                    } elseif (file_exists(LOCALE . "English/bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . "English/bbcodes/" . $bbcode . ".php";
                    }
                    include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php";
                }
            } elseif (!$selected) {
                if (file_exists(INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php")) {
                    if (file_exists(LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . LOCALESET . "bbcodes/" . $bbcode . ".php";
                    } elseif (file_exists(LOCALE . "English/bbcodes/" . $bbcode . ".php")) {
                        include LOCALE . "English/bbcodes/" . $bbcode . ".php";
                    }
                    include INCLUDES . "bbcodes/" . $bbcode . "_bbcode_include.php";
                }
            }
        }
    }
    $text = descript($text, false);
    return $text;
}
예제 #6
0
function load_editor_settings($user_level)
{
    require_once INCLUDES . "bbcodes/bbcode.inc.php";
    $cache = cache_bbcode();
    $enabled_bbcodes = array();
    $editor_settings = array();
    foreach ($cache as $arr => $bbdata) {
        $enabled_bbcodes[] = $bbdata['name'];
        $editor_settings[$bbdata['name']] = $bbdata;
    }
    $editor_config = "";
    // Auto Determine Mode.
    $mode = return_editor_access($user_level);
    foreach (editor_features() as $feature) {
        if (in_array($feature, $enabled_bbcodes)) {
            $edata = $editor_settings[$feature];
            if ($edata[$mode] == 1) {
                if (file_exists(LOCALE . LOCALESET . "bbcodes/{$feature}.php")) {
                    // varpath is infusions/bbcode_infusion/locale/bbcodes/ - this is locale
                    include LOCALE . LOCALESET . "bbcodes/{$feature}.php";
                    // load the locale
                } elseif (file_exists(LOCALE . "English/bbcodes/" . $feature . ".php")) {
                    include LOCALE . "English/bbcodes/" . $feature . ".php";
                    // load the default locale
                }
                include INCLUDES . "bbcodes/bbcode_libs/{$feature}/{$feature}.bbcode.var.php";
                $bbcode = $__BBCODE__['0'];
                if (array_key_exists("editor", $bbcode)) {
                    $editor_config .= $bbcode['editor'];
                }
                unset($__BBCODE__);
            }
        }
    }
    $editor_config .= "|source,maximize|";
    return $editor_config;
}