Esempio n. 1
0
/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $only_smileys = false, $censor = true, $acro_autolinks = false, $forum_id = '999999')
{
    global $bbcode, $config, $user;
    if (empty($text)) {
        return '';
    }
    if (defined('IS_ICYPHOENIX') && $censor) {
        $text = censor_text($text);
    }
    if (!class_exists('bbcode') || empty($bbcode)) {
        include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
    }
    if (empty($bbcode)) {
        $bbcode = new bbcode();
        if (!$user->data['session_logged_in']) {
            $user->data['user_allowhtml'] = $config['allow_html'] ? true : false;
            $user->data['user_allowbbcode'] = $config['allow_bbcode'] ? true : false;
            $user->data['user_allowsmile'] = $config['allow_smilies'] ? true : false;
        }
        $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? true : false;
        $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? true : false;
        $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? true : false;
    }
    if ($only_smileys) {
        $text = $bbcode->parse_only_smilies($text);
    } else {
        $text = $bbcode->parse($text);
        if ($acro_autolinks) {
            $text = $bbcode->acronym_pass($text);
            $text = $bbcode->autolink_text($text, $forum_id);
        }
    }
    return $text;
}
Esempio n. 2
0
 function parseMessage($text, $enable_bbcode, $enable_html, $enable_smilies, $enable_autolinks_acronyms)
 {
     global $db, $cache, $config, $user, $bbcode, $lofi;
     if (!class_exists('bbcode')) {
         include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
     }
     if (empty($bbcode)) {
         $bbcode = new bbcode();
     }
     if (!empty($text)) {
         $text = censor_text($text);
         // Parse message and/or sig for BBCode if reqd
         $bbcode->allow_html = $this->config['allow_html'] == true && $enable_html == true ? true : false;
         $bbcode->allow_bbcode = $this->config['allow_bbcode'] == true && $enable_bbcode == true ? true : false;
         $bbcode->allow_smilies = $this->config['allow_smilies'] == true && !$lofi == true && $enable_smilies == true ? true : false;
         $text = $bbcode->parse($text);
         if ($enable_autolinks_acronyms) {
             $text = $bbcode->acronym_pass($text);
             $text = $bbcode->autolink_text($text, '999999');
         }
     } else {
         $text = '';
     }
     // Strip out the <!--break--> delimiter.
     $delim = htmlspecialchars('<!--break-->');
     $pos = strpos($text, $delim);
     if ($pos !== false && $pos < strlen($text)) {
         $text = substr_replace($text, html_entity_decode($delim), $pos, strlen($delim));
     }
     return $text;
 }