function preparse_bbcode($text, &$errors, $is_signature = false) { global $pun_config, $lang_common, $lang_post, $re_list; if ($is_signature) { global $lang_profile; if (preg_match('%\\[/?(?:quote|code|list|h)\\b[^\\]]*\\]%i', $text)) { $errors[] = $lang_profile['Signature quote/code/list/h']; } } // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) { list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); $text = implode("", $outside); } // Tidy up lists $temp = preg_replace($re_list, 'preparse_list_tag(\'$2\', \'$1\', $errors)', $text); // If the regex failed if ($temp === null) { $errors[] = $lang_common['BBCode list size error']; } else { $text = str_replace('*' . "" . ']', '*]', $temp); } if ($pun_config['o_make_links'] == '1') { $text = do_clickable($text); } // If we split up the message before we have to concatenate it together again (code tags) if (isset($inside)) { $outside = explode("", $text); $text = ''; $num_tokens = count($outside); for ($i = 0; $i < $num_tokens; ++$i) { $text .= $outside[$i]; if (isset($inside[$i])) { $text .= '[code]' . $inside[$i] . '[/code]'; } } unset($inside); } $temp_text = false; if (empty($errors)) { $temp_text = preparse_tags($text, $errors, $is_signature); } if ($temp_text !== false) { $text = $temp_text; } // Remove empty tags while (($new_text = strip_empty_bbcode($text, $errors)) !== false) { if ($new_text != $text) { $text = $new_text; if ($new_text == '') { $errors[] = $lang_post['Empty after strip']; break; } } else { break; } } return pun_trim($text); }
function parse_signature($text) { global $pun_config, $lang_common, $pun_user; if ($pun_config['o_censoring'] == '1') { $text = censor_words($text); } $text = pun_htmlspecialchars($text); if ($pun_config['o_make_links'] == '1') { $text = do_clickable($text); } if ($pun_config['o_smilies_sig'] == '1' && $pun_user['show_smilies'] != '0') { $text = do_smilies($text); } if ($pun_config['p_sig_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) { $text = do_bbcode($text); if ($pun_config['p_sig_img_tag'] == '1') { // $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\.(jpg|jpeg|png|gif)\[/img\]#e', 'handle_img_tag(\'$1$3.$4\', true)', $text); $text = preg_replace('#\\[img\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]#e', 'handle_img_tag(\'$1$3\', true)', $text); } } // Deal with newlines, tabs and multiple spaces $pattern = array("\n", "\t", ' ', ' '); $replace = array('<br />', ' ', ' ', ' '); $text = str_replace($pattern, $replace, $text); return $text; }
function Parser($x) { return do_clickable($x); }
function parse_message($text, $html = 'off') { if ($html != 'on') { // Convert applicable characters to HTML entities $text = pun_htmlspecialchars($text); } // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) { list($inside, $outside) = split_text($text, '[code]', '[/code]'); $outside = array_map('ltrim', $outside); $text = implode('<">', $outside); } $text = do_clickable($text); if (strpos($text, '[') !== false && strpos($text, ']') !== false) { $text = do_bbcode($text); $text = preg_replace('#\\[img\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]#e', 'handle_img_tag(\'$1$3\')', $text); } // Deal with newlines, tabs and multiple spaces $pattern = array("\n", "\t", ' ', ' '); $replace = array('<br />', ' ', ' ', ' '); $text = str_replace($pattern, $replace, $text); // If we split up the message before we have to concatenate it together again (code tags) if (isset($inside)) { $outside = explode('<">', $text); $text = ''; $num_tokens = count($outside); for ($i = 0; $i < $num_tokens; ++$i) { $text .= $outside[$i]; if (isset($inside[$i])) { $num_lines = (substr_count($inside[$i], "\n") + 3) * 1.5; $height_str = $num_lines > 35 ? '35em' : $num_lines . 'em'; $text .= '</p><div class="codebox"><div class="incqbox"><h4>Kod:</h4><div class="scrollbox" style="height: ' . $height_str . '"><pre>' . $inside[$i] . '</pre></div></div></div><p>'; } } } // Add paragraph tag around post, but make sure there are no empty paragraphs $text = str_replace('<p></p>', '', '<p class="IE_wrap">' . $text . '</p>'); $pattern = '/@([0-9a-zA-Z_\\-åäöÅÄÖ]+)@/'; $replacement = '<div style="font-weight: bold; font-style: italic;">Svarar till <a href="/traffa/quicksearch.php?username=$1">$1</a></div>'; $text = preg_replace($pattern, $replacement, $text); $pattern = '/@([0-9a-zA-Z_\\-åäöÅÄÖ]+):([0-9]+)@/'; function fix_postid($matches) { $query = 'SELECT timestamp FROM forum_posts, login WHERE forum_posts.id = ' . $matches[2] . ' AND login.username LIKE "' . $matches[1] . '" AND login.id = forum_posts.user'; $result = mysql_query($query); $data = mysql_fetch_assoc($result); if (mysql_num_rows($result) > 0) { $extra_text .= '<strong><i> <a href="javascript: void(0);" onclick="window.open(\'read_post_popup.php?id=' . $matches[2] . '\''; $extra_text .= ', \'_blank\', \'width=600, height=450, scrollbars=yes\');">'; $extra_text .= 'Svarar på inlägg skrivet av ' . $matches[1] . ', ' . date('Y-m-d H:i', $data['timestamp']) . '</a></strong></i>'; } return $extra_text; } $text = preg_replace_callback($pattern, "fix_postid", $text); return $text; }
function bbcode_parse($text, $brfix = 1, $emoticons = 1, $wow = 1) { // By BlackWizard, http://www.phpcs.com/codes/BBCODE-SIMPLEMENT_17638.aspx global $forum_lang, $userid; $text = preg_replace("#\\[img\\]((ht|f)tp://)([^\r\n\t<\"]*?)\\[/img\\]#sie", "'<img border=\"0\" src=\\1' . str_replace(' ', '%20', '\\3') . '>'", $text); $text = preg_replace("#\\[url\\]((ht|f)tp://)([^\r\n\t<\"]*?)\\[/url\\]#sie", "'<a href=\"\\1' . str_replace(' ', '%20', '\\3') . '\" target=blank>\\1\\3</a>'", $text); $text = preg_replace("/\\[url=(.+?)\\](.+?)\\[\\/url\\]/", "<a href=\"\$1\" target=\"blank\">\$2</a>", $text); $text = preg_replace("/\\[b\\](.+?)\\[\\/b\\]/", "<b>\$1</b>", $text); $text = preg_replace("/\\[i\\](.+?)\\[\\/i\\]/", "<i>\$1</i>", $text); $text = preg_replace("/\\[u\\](.+?)\\[\\/u\\]/", "<u>\$1</u>", $text); $text = preg_replace("/\\[center\\](.+?)\\[\\/center\\]/", "<center>\$1</center>", $text); $text = preg_replace("/\\[left\\](.+?)\\[\\/left\\]/", "<span align='left'>\$1</span>", $text); //these don't work, but at least you don't get bbcode junk $text = preg_replace("/\\[right\\](.+?)\\[\\/right\\]/", "<span align='right'>\$1</span>", $text); //these don't work, but at least you don't get bbcode junk $text = preg_replace("/\\[code\\](.+?)\\[\\/code\\]/", "<table width=100%><tr><th align=left>Code :</th></tr><tr><td align=left><code>\$1</code></td></tr></table>", $text); $text = preg_replace("/\\[quote\\](.+?)\\[\\/quote\\]/", "<table width=100%><tr><th align=left>" . $forum_lang["quote"] . " :</th></tr><tr><td align=left>\$1</td></tr></table>", $text); $text = preg_replace("/\\[quote=(.+?)\\](.+?)\\[\\/quote\\]/", "<table width=100%><tr><th align=left>\$1 " . $forum_lang["wrote"] . " :</th></tr><tr><td align=left>\$2</td></tr></table>", $text); $text = preg_replace("/\\[color=(.+?)\\](.+?)\\[\\/color\\]/", "<font color=\$1>\$2</font>", $text); $uid = $userid; $text = preg_replace("#\\[youtube\\](.*?)\\[/youtube\\]#si", "[youtube:" . $uid . "]\\1[/youtube:" . $uid . "]", $text); $text = preg_replace("#\\[media\\](([a-z]+?)://([^, \n\r]+))\\[/media\\]#si", "[media:" . $uid . "]\\1[/media:" . $uid . "]", $text); if ($wow == 1) { $text = preg_replace_callback("/\\[wow\\](.+?)\\[\\/wow\\]/", "bbcode_callbacks_wow", $text); } // Emoticons. if ($emoticons == 1) { // Emoticons from PunBB $text = str_replace(":)", '<img src="img/emoticons/smile.gif" />', $text); $text = str_replace("=)", '<img src="img/emoticons/smile.gif" />', $text); $text = str_replace(":|", '<img src="img/emoticons/neutral.gif" />', $text); $text = str_replace("=|", '<img src="img/emoticons/neutral.gif" />', $text); $text = str_replace(":(", '<img src="img/emoticons/sad.gif" />', $text); $text = str_replace("=(", '<img src="img/emoticons/sad.gif" />', $text); $text = str_replace(":D", '<img src="img/emoticons/razz.gif" />', $text); $text = str_replace("=D", '<img src="img/emoticons/razz.gif" />', $text); $text = str_replace(":o", '<img src="img/emoticons/yikes.gif" />', $text); $text = str_replace(":0", '<img src="img/emoticons/yikes.gif" />', $text); $text = str_replace(";)", '<img src="img/emoticons/wink.gif" />', $text); $text = preg_replace("/([^p|s])\\:\\//", '$1<img src="img/emoticons/hmm.gif" />', $text); $text = str_replace(":P", '<img src="img/emoticons/tongue.gif" />', $text); $text = str_replace(":p", '<img src="img/emoticons/tongue.gif" />', $text); $text = str_replace(":lol:", '<img src="img/emoticons/lol.gif" />', $text); $text = str_replace(":mad:", '<img src="img/emoticons/angry.gif" />', $text); $text = str_replace(":rolleyes:", '<img src="img/emoticons/roll.gif" />', $text); $text = str_replace(":cool:", '<img src="img/emoticons/cool.gif" />', $text); } if ($brfix == 1) { $text = str_replace("<br />", "<br /> ", $text); } else { $text = str_replace("<br />", "<br /> ", $text); } // no comment :) $text = do_clickable(htmlspecialchars_decode($text)); //WindowMediaPlayer $text = preg_replace("#\\[media:" . $uid . "\\](.*?)\\[/media:" . $uid . "\\]#si", "<object id=\"WMP\" type=\"video/x-ms-asf\" data=\"video.asx\" src=\"\\1\" width=\"450\" height=\"350\"><param name=\"AutoStart\" value=\"0\"> <embed width=\"450\" height=\"350\" AutoStart=\"0\" src=\"\\1\" ShowTracker=\"true\" ShowControls=\"true\" ShowGotoBar=\"true\" ShowDisplay=\"true\" ShowStatusBar=\"true\" AutoSize=\"true\" pluginspage=\"http://www.microsoft.com/windows/windowsmedia/download/\"></embed></OBJECT>", $text); $text = str_replace("[/win:" . $uid . "]", "", $text); //youtube $text = preg_replace("#\\[youtube:" . $uid . "\\](.*?)\\[/youtube:" . $uid . "\\]#si", "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"\\1\"></param><embed src=\"\\1\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"350\"></embed></object>" . "[/youtube:" . $uid . "]", $text); $text = str_replace("[/youtube:" . $uid . "]", "", $text); $text = str_replace("http://www.youtube.com/watch?v=", "http://www.youtube.com/v/", $text); $text = str_replace("http://www.youtube.com", "http://youtube.com", $text); $text = str_replace("http://www.youtube.com", "http://fr.youtube.com", $text); return $text; }
function preparse_bbcode($text, &$errors, $is_signature = false) { global $luna_config, $re_list; // Remove empty tags while (($new_text = strip_empty_bbcode($text)) !== false) { if ($new_text != $text) { $text = $new_text; if ($new_text == '') { $errors[] = __('It seems your post consisted of empty BBCodes only. It is possible that this happened because e.g. the innermost quote was discarded because of the maximum quote depth level.', 'luna'); return ''; } } else { break; } } if ($is_signature) { if (preg_match('%\\[/?(?:quote|code|video|list|h)\\b[^\\]]*\\]%i', $text)) { $errors[] = __('The quote, code, list, video, and heading BBCodes are not allowed in signatures.', 'luna'); } } // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) { list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); } // Tidy up lists $temp = preg_replace_callback($re_list, create_function('$matches', 'return preparse_list_tag($matches[2], $matches[1]);'), $text); // If the regex failed if (is_null($temp)) { $errors[] = __('Your list was too long to parse, please make it smaller!', 'luna'); } else { $text = str_replace('*' . "" . ']', '*]', $temp); } if ($luna_config['o_make_links'] == '1') { $text = do_clickable($text); } $temp_text = false; if (empty($errors)) { $temp_text = preparse_tags($text, $errors, $is_signature); } if ($temp_text !== false) { $text = $temp_text; } // If we split up the message before we have to concatenate it together again (code tags) if (isset($inside)) { $outside = explode("", $text); $text = ''; $num_tokens = count($outside); for ($i = 0; $i < $num_tokens; ++$i) { $text .= $outside[$i]; if (isset($inside[$i])) { $text .= '[code]' . $inside[$i] . '[/code]'; } } unset($inside); } // Remove empty tags while (($new_text = strip_empty_bbcode($text)) !== false) { if ($new_text != $text) { $text = $new_text; if ($new_text == '') { $errors[] = __('It seems your post consisted of empty BBCodes only. It is possible that this happened because e.g. the innermost quote was discarded because of the maximum quote depth level.', 'luna'); break; } } else { break; } } return luna_trim($text); }
function preparse_bbcode($text, &$errors, $is_signature = false) { global $forum_config; $return = ($hook = get_hook('ps_preparse_bbcode_start')) ? eval($hook) : null; if ($return != null) { return $return; } if ($is_signature) { global $lang_profile; if (preg_match('#\\[quote(=("|"|\'|)(.*)\\1)?\\]|\\[/quote\\]|\\[code\\]|\\[/code\\]|\\[list(=([1a\\*]))?\\]|\\[/list\\]#i', $text)) { $errors[] = $lang_profile['Signature quote/code/list']; } } if ($forum_config['p_sig_bbcode'] == '1' && $is_signature || $forum_config['p_message_bbcode'] == '1' && !$is_signature) { // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) { list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); $text = implode("", $outside); } // Tidy up lists $pattern_callback = '%\\[list(?:=([1a*]))?+\\]((?:(?>.*?(?=\\[list(?:=[1a*])?+\\]|\\[/list\\]))|(?R))*)\\[/list\\]%is'; $replace_callback = 'preparse_list_tag($matches[2], $matches[1], $errors)'; $text = preg_replace_callback($pattern_callback, create_function('$matches', 'return ' . $replace_callback . ';'), $text); $text = str_replace('*' . "" . ']', '*]', $text); if ($forum_config['o_make_links'] == '1') { $text = do_clickable($text, defined('FORUM_SUPPORT_PCRE_UNICODE')); } // If we split up the message before we have to concatenate it together again (code tags) if (isset($inside)) { $outside = explode("", $text); $text = ''; $num_tokens = count($outside); for ($i = 0; $i < $num_tokens; ++$i) { $text .= $outside[$i]; if (isset($inside[$i])) { $text .= '[code]' . $inside[$i] . '[/code]'; } } } $temp_text = false; if (empty($errors)) { $temp_text = preparse_tags($text, $errors, $is_signature); } if ($temp_text !== false) { $text = $temp_text; } // Remove empty tags while ($new_text = preg_replace('/\\[(b|u|i|h|colou?r|quote|code|img|url|email|list)(?:\\=[^\\]]*)?\\]\\[\\/\\1\\]/', '', $text)) { if ($new_text != $text) { $text = $new_text; } else { break; } } } $return = ($hook = get_hook('ps_preparse_bbcode_end')) ? eval($hook) : null; if ($return != null) { return $return; } return forum_trim($text); }
function markup_parse($text, $options) { $options['use_funny'] = isset($options['use_funny']) ? $options['use_funny'] : true; $tags_allowed = array('<strong>', '<em>', '<u>', '<ul>', '<ol>', '<li>', '<sup>', '<p>', '<h1>', '<h2>', '<br />'); $tags_temporary = array('[*strong*]', '[*em*]', '[*u*]', '[*ul*]', '[*ol*]', '[*li*]', '[*sup*]', '[*p*]', '[*h1*]', '[*h2*]', '[*br*]'); $tags_allowed_end = array('</strong>', '</em>', '</u>', '</ul>', '</ol>', '</li>', '</sup>', '</p>', '</h1>', '</h2>'); $tags_temporary_end = array('[*/strong*]', '[*/em*]', '[*/u*]', '[*/ul*]', '[*/ol*]', '[*/li*]', '[*/sup*]', '[*/p*]', '[*/h1*]', '[*/h2*]'); $text = str_replace($tags_allowed, $tags_temporary, $text); $text = str_replace($tags_allowed_end, $tags_temporary_end, $text); $text = strip_tags($text); $text = str_replace($tags_temporary, $tags_allowed, $text); $text = str_replace($tags_temporary_end, $tags_allowed_end, $text); // if(644314 == $_SESSION['login']['id']) // { // $text = str_replace('<br />', "\n", $text); // } //$text = preg_replace('(<\/p><p>)+', '</p><p>', $text); //$text = preg_replace('(<br \/>)+', 'hejsan', $text); if (array_key_exists('spelling', $options)) { $words_string = preg_replace('/[^[:alpha:]åäö]/i', ' ', strip_tags(html_entity_decode($text))); preg_match_all('/& ([[:alpha:]åäö]+) \\d+ \\d+: ((([[:alpha:]åäö]+),?\\s?)+)/mi', shell_exec('echo "' . $words_string . '" | aspell --lang=sv -a --sug-mode=ultra'), $matches); $words_misspelled_array = $matches[1]; for ($i = 0; $i < count($words_misspelled_array); $i++) { $spelling_suggestions_array[$words_misspelled_array[$i]] = preg_split('/[, ]+/', $matches[2][$i]); } } //Answer tags preg_match_all('/\\[svar:([\\w-]+)=(\\d*)\\](.*)\\[\\/svar\\]/mU', $text, $matches); $text = preg_replace('/\\[svar:([\\w-]+)=(\\d*)\\](.*)\\[\\/svar\\]/mU', '<span class="post_reference" id="post_reference_$2-' . (isset($options['post_recursive_id']) ? $options['post_recursive_id'] : $options['post_id']) . '"><h3 class="answer_header">Svar till $1s inlägg.</h3></span>' . "\n" . '<div class="post_referred" id="post_referred_$2-' . (isset($options['post_recursive_id']) ? $options['post_recursive_id'] : $options['post_id']) . '"></div>' . "\n" . '<div class="answer_text">$3</div>', $text); // $text = preg_replace( '/\[svar:([\w-]+)\]([^(\[\/svar)]*)\[\/svar\]/m', // '<h3 class="answer_header">Svar till $1s inlägg.</h3><div class="answer_text">$2</div>', // $text); //Quotes $text = preg_replace('/\\[citat:([\\w-]+)=(\\d*)\\]([^\\[]*)\\[\\/citat\\]/m', '<h3 class="quote_header">Citerar ur inlägg av $1.</h3><div class="quote_text">$3</div>', $text); //Censur if ($_SESSION['login']['userlevel'] >= CENSOR_TEXT_LEVEL) { $text = preg_replace('/\\[censur:([\\w-]+)\\]\\s*(.*)\\[\\/censur\\]/mU', '<span class="censored">$2</span>', $text); $text = preg_replace('/\\[censur\\]\\s*(.*)\\[\\/censur\\]/mU', '<span class="censored">$1</span>', $text); } else { $text = preg_replace('/\\[censur:([\\w-]+)\\]\\s*(.*)\\[\\/censur\\]/mU', '<span class="censored">-------</span>', $text); $text = preg_replace('/\\[censur\\]\\s*(.*)\\[\\/censur\\]/mU', '<span class="censored">-------</span>', $text); } //Additions $text = preg_replace('/\\[tillagg:([\\w-]+)\\]\\s*(.*)\\[\\/tillagg\\]/mU', '<h3 class="addition_header">Tillägg av $1:</h3><div class="addition_text">$2</div>', $text); //replace tags $tags_orig = array('<h1>', '</h1>', '<h2>', '</h2>'); $tags_repl = array('<h3>', '</h3>', '<h4>', '</h4>'); $text = str_replace($tags_orig, $tags_repl, $text); //Replace image tags $text = preg_replace('/!http:\\/\\/(\\S+)!/', '<img src="http://$1" />', $text); $text = preg_replace('/!www\\.(\\S+)!/', '<img src="http://www.$1" />', $text); $text = preg_replace('/!(\\S+\\.(se|nu|org|com|net)\\/\\S+)!/', '<img src="http://$1" />', $text); if (array_key_exists('spelling', $options) && isset($words_misspelled_array)) { $j = 0; foreach ($words_misspelled_array as $word) { $text = preg_replace('/(\\s)' . $word . '([\\s\\.!\\?:])/m', '$1<miss>' . $j . '<miss_end>$2', $text); $j++; } $j = 0; foreach ($words_misspelled_array as $word) { $text = preg_replace('/<miss>' . $j . '<miss_end>/m', '<span onclick="javascript:show_misspelling(\'suggestion_' . $j . '\');" class="misspelling" id="misspelling_' . $j . '">' . $word . '</span>', $text); $j++; } $result['words_misspelled'] = $words_misspelled_array; $result['spelling_suggestions'] = $spelling_suggestions_array; } for ($i = 0; $i < count($links1); $i++) { $text = str_replace('##bild' . $i . '##', '<img src="http://' . $links1[1][$i] . '" />', $text); } //Lustiga utbyten if ($options['use_funny']) { $boring = array('pannkakor'); $funny = array('pangkakor'); $text = str_replace($boring, $funny, $text); } if ($options['short_and_clean']) { $text = strip_tags($text); } $text = do_clickable($text); $text = parse_promoe($text); if (array_key_exists('spelling', $options) && isset($words_misspelled_array)) { $result['text'] = $text; return $result; } else { return $text; } }
function parse_signature($text) { global $pun_config, $pun_user, $lang_common, $lang_topic; if ($pun_config['o_censoring'] == '1') { $text = censor_words($text); } if ($pun_config['o_make_links'] == '1') { $text = do_clickable($text); } $text = pun_htmlspecialchars($text); if ($pun_config['o_smilies_sig'] == '1' && $pun_user['show_smilies'] != '0') { $text = do_smilies($text); } if ($pun_config['p_sig_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) { $text = do_bbcode($text, true); } // Deal with newlines, tabs and multiple spaces $pattern = array("\n", "\t", ' ', ' ', '<p><br />'); $replace = array('<br />', ' ', ' ', ' ', '<p>'); $text = str_replace($pattern, $replace, $text); return $text; }
function parse_signature($text) { global $pun_config, $lang_common, $pun_user; if ($pun_config['o_censoring'] == 1) { $text = censor_words($text); } $text = pun_htmlspecialchars($text); if ($pun_config['o_make_links'] == 1) { $text = do_clickable($text); } if ($pun_config['o_smilies_sig'] == 1 && $pun_user['show_smilies']) { $text = do_smilies($text); } if ($pun_config['p_sig_bbcode'] && strpos($text, '[') !== false && strpos($text, ']') !== false) { $text = do_bbcode($text); if ($pun_config['p_sig_img_tag']) { $text = preg_replace_callback('#\\[img\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]#', '_replace_signature_img', $text); } } // Deal with newlines, tabs and multiple spaces return str_replace(array("\n", "\t", ' ', ' '), array('<br />', '    ', '  ', '  '), $text); }
## Image Award Mod if (count($user_info)) { echo "\t\t\t\t\t" . implode('</dd>' . "\n\t\t\t\t\t", $user_info) . '</dd>' . "\n"; } ?> <?php // !! This was added for Easy Profile Fields !! $sql = "SELECT p.name, p.lang_entry, e.value FROM " . $db->prefix . "profile_fields AS p INNER JOIN " . $db->prefix . "profile_field_entries AS e ON p.id=e.f_id WHERE e.u_id=" . $cur_post['uid'] . " ORDER BY p.order ASC"; // echo $sql; $ef_result = $db->query($sql); // affichage des profile fields while ($ef_row = $db->fetch_assoc($ef_result)) { $ef_name = $ef_row['lang_entry'] ? $lang_common[$ef_row['lang_entry']] ? $lang_common[$ef_row['lang_entry']] : $ef_row['name'] : $ef_row['name']; if ($pun_config['o_make_links'] == '1') { $text = do_clickable($ef_row['value']); } // echo '<dd><strong>'.$ef_name.':</strong> '.$ef_row['value'].' </dd>'; echo '<dd><strong>' . $ef_name . ':</strong> ' . $text . ' </dd>'; } ?> <?php require PUN_ROOT . 'include/reputation/rep_viewtopic.php'; if (count($user_contacts)) { echo "\t\t\t\t\t" . '<dd class="usercontacts">' . implode(' ', $user_contacts) . '</dd>' . "\n"; } ?> </dl> </div> <div class="postright">
function parse_message($text, $hide_smilies) { // Convert applicable characters to HTML entities $text = htmlspecialchars($text); $text = do_clickable($text); //buat link $text = do_smilies($text); //alwais show smilies // Deal with newlines, tabs and multiple spaces $pattern = array("\n", "\t", ' ', ' '); $replace = array('<br />', ' ', ' ', ' '); $text = str_replace($pattern, $replace, $text); // Add paragraph tag around post, but make sure there are no empty paragraphs $text = str_replace('<p></p>', '', '<p>' . $text . '</p>'); $text = content_parser($text); return $text; }
function comment_format($str) { global $conf; $links_target = $conf['comments_links_target'] ? ' target="_blank"' : ''; $links_nofollow = $conf['comments_links_nofollow'] ? ' rel="nofollow"' : ''; if ($conf['comments_links_auto']) { $str = do_clickable($str); } $bb_search = array('#\\[code\\](.*?)\\[\\/code\\]#ie', '/\\[br\\]/is', '/\\[b\\](.*)\\[\\/b\\]/isU', '/\\[i\\](.*)\\[\\/i\\]/isU', '/\\[u\\](.*)\\[\\/u\\]/isU', '/\\[s\\](.*)\\[\\/s\\]/isU', '/\\[url\\=(.*?)\\](.*?)\\[\\/url\\]/is', '/\\[url\\](.*?)\\[\\/url\\]/is', '/\\[email\\=(.*?)\\](.*?)\\[\\/email\\]/is', '/\\[email\\](.*?)\\[\\/email\\]/is', '/\\[color\\=(.*?)\\](.*?)\\[\\/color\\]/is', '/\\[quote\\](.*?)\\[\\/quote\\]/is'); $bb_replace = array('mn_highlight_string(\'$1\')', '<br />', '<strong>$1</strong>', '<em>$1</em>', '<span style="text-decoration: underline;">$1</span>', '<span style="text-decoration: line-through;">$1</span>', '<a href="$1"' . $links_target . $links_nofollow . '>$2</a>', '<a href="$1"' . $links_target . $links_nofollow . '>$1</a>', '<a href="mailto:$1">$2</a>', '<a href="mailto:$1">$1</a>', '<span style="color: $1;">$2</span>', '<blockquote>$1</blockquote>'); $bb_no_replace = array('str_replace(\'\', \'\', \'$1\')', '<br />', '$1', '$1', '$1', '$1', '$2: $1', '$1', '$2: $1', '$1', '$2', '$1'); $smiles_search = array('/:-?\\[/is', '/:beer:/is', '/8-?\\)/is', '/[^ehopt][;:],-?\\(/is', '/\\]:-?[\\)D]/is', '/:f**k:/is', '/[^ehopt];-?D+/is', '/:jokingly:/is', '/:-?\\*/is', '/:-?D+/is', '/:love:/is', '/:ninja:/is', '/:no:/is', '/:pirate:/is', '/:-?\\(/is', '/:-?\\)/is', '/:stop:/is', '/[:8]-?O/is', '/[^ehopt][;:]-?P/is', '/:-\\//is', '/:-?\\?/is', '/:whistle:/is', '/[^ehopt];-?\\)/is', '/:yes:/is', '/:zzz:/is'); $smiles_replace = array('<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-angry.gif" width="16" height="16" alt=":-[" title="Angry" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-beer.gif" width="16" height="16" alt="beer" title="Beer" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-cool.gif" width="16" height="16" alt="8-)" title="Cool" />', ' <img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-cry.gif" width="16" height="16" alt=";,(" title="Crying" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-evil.gif" width="16" height="16" alt="evil" title="Evil" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-f**k.gif" width="16" height="16" alt="f**k" title="F**k" />', ' <img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-grin.gif" width="16" height="16" alt=";-D" title="Grin" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-jokingly.gif" width="16" height="16" alt="jokingly" title="Jokingly" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-kiss.gif" width="16" height="16" alt=":-*" title="Kiss" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-lol.gif" width="16" height="16" alt=":-D" title="Laughing out loud" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-love.gif" width="16" height="16" alt="love" title="In love" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-ninja.gif" width="16" height="16" alt="ninja" title="Ninja" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-no.gif" width="16" height="16" alt="no!" title="No!" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-pirate.gif" width="16" height="16" alt="pirate" title="Pirate" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-sad.gif" width="16" height="16" alt=":-(" title="Sad" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-smile.gif" width="16" height="16" alt=":-)" title="Smile" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-stop.gif" width="16" height="16" alt="stop" title="Stop" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-surprised.gif" width="16" height="16" alt=":-O" title="Surprised" />', ' <img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-tongue.gif" width="16" height="16" alt=":-P" title="Tongue out" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-undecided.gif" width="16" height="16" alt=":-/" title="Undecided" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-what.gif" width="16" height="16" alt=":-?" title="What?" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-whistle.gif" width="16" height="16" alt="whistle" title="Whistle" />', ' <img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-wink.gif" width="16" height="16" alt=";-)" title="Wink" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-yes.gif" width="16" height="16" alt="yes" title="Yes" />', '<img src="' . $conf['admin_url'] . '/stuff/img/smiles/smiley-zzz.gif" width="16" height="16" alt="zzz" title="Zzzz" />'); if ($conf['comments_bb']) { $str = preg_replace($bb_search, $bb_replace, $str); } else { $str = preg_replace($bb_search, $bb_no_replace, $str); } if ($conf['comments_smiles']) { $str = preg_replace($smiles_search, $smiles_replace, $str); } return strip_slashes($str); }
function parse_message($text, $hide_smilies) { global $pun_config, $lang_common, $pun_user; if ($pun_config['o_censoring'] == '1') { $text = censor_words($text); } // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched) if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) { list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); } $Parsedown = new Parsedown(); $text = $Parsedown->setMarkupEscaped(true)->setUrlsLinked(false)->text($text); if ($pun_config['o_make_links'] == '1') { $text = do_clickable($text); } // If the message contains code in Markdown if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) { // If we have code from BBCode, put them back into the text if (isset($inside)) { $parts = explode("", $text); $text = ''; foreach ($parts as $i => $part) { $text .= $part . (isset($inside[$i]) ? '[code]' . $inside[$i] . '[/code]' : ''); } } // And take them out again. list($inside, $text) = extract_blocks($text, '[code]', '[/code]'); } if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) { $text = do_bbcode($text); } if ($pun_config['o_smilies'] == '1' && $pun_user['show_smilies'] == '1' && $hide_smilies == '0') { $text = do_smilies($text); } // Deal with newlines, tabs and multiple spaces $pattern = array("\n", "\t", ' ', ' '); $replace = array('<br />', '    ', '  ', '  '); $text = str_replace($pattern, $replace, $text); // If we split up the message before we have to concatenate it together again (code tags) if (isset($inside)) { $parts = explode("", $text); $text = ''; foreach ($parts as $i => $part) { $text .= $part; if (isset($inside[$i])) { $num_lines = substr_count($inside[$i], "\n"); $text .= '</p><div class="codebox"><pre' . ($num_lines > 28 ? ' class="vscroll"' : '') . '><code>' . pun_trim(pun_htmlspecialchars($inside[$i]), "\n\r") . '</code></pre></div><p>'; } } } return clean_paragraphs($text); }