function format_comment($text, $strip_html = true) { global $smilies, $privatesmilies, $pic_base_url, $customsmilies, $CURUSER, $badwords, $DEFAULTBASEURL; $s = $text; // This fixes the extraneous ;) smilies problem. When there was an html escaped // char before a closing bracket - like >), "), ... - this would be encoded // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed // the ;) one, and replace all genuine ;) by :wink: before escaping the body. // (What took us so long? :blush:)- wyz $s = str_replace(";)", ":wink:", $s); if ($strip_html) { $s = htmlspecialchars($s); } // [php]php code[/php] $s = preg_replace_callback("/\\[php\\]((\\s|.)+?)\\[\\/php\\]/ims", "source_highlighter", $s); // [sql]sql code[/sql] $s = preg_replace_callback("/\\[sql\\]((\\s|.)+?)\\[\\/sql\\]/ims", "source_highlighter", $s); // [html]html code[/html] $s = preg_replace_callback("/\\[html\\]((\\s|.)+?)\\[\\/html\\]/ims", "source_highlighter", $s); // format urls $s = format_urls($s); // [url=http://www.example.com]Text[/url] $s = preg_replace_callback("/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/i", "islocal", $s); // [url]http://www.example.com[/url] $s = preg_replace_callback("/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/i", "islocal", $s); // [*] $s = preg_replace("/\\[\\*\\]/", "<li>", $s); // [b]Bold[/b] $s = preg_replace("/\\[b\\]((\\s|.)+?)\\[\\/b\\]/", "<b>\\1</b>", $s); // [i]Italic[/i] $s = preg_replace("/\\[i\\]((\\s|.)+?)\\[\\/i\\]/", "<i>\\1</i>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/", "<u>\\1</u>", $s); // [u]Underline[/u] // the [you] tag $s = preg_replace("/\\[you\\]/i", $CURUSER['username'], $s); // Dynamic Vars $s = dynamic_user_vars($s); $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/i", "<u>\\1</u>", $s); // YouTube Vids $s = preg_replace("/\\[video=[^\\s'\"<>]*youtube.com.*v=([^\\s'\"<>]+)\\]/ims", "<object width=\"500\" height=\"410\"><param name=\"movie\" value=\"http://www.youtube.com/v/\\1\"></param><embed src=\"http://www.youtube.com/v/\\1\" type=\"application/x-shockwave-flash\" width=\"500\" height=\"410\"></embed></object>", $s); // Google Vids $s = preg_replace("/\\[video=[^\\s'\"<>]*video.google.com.*docid=(-?[0-9]+).*\\]/ims", "<embed style=\"width:500px; height:410px;\" id=\"VideoPlayback\" align=\"middle\" type=\"application/x-shockwave-flash\" src=\"http://video.google.com/googleplayer.swf?docId=\\1\" allowScriptAccess=\"sameDomain\" quality=\"best\" bgcolor=\"#ffffff\" scale=\"noScale\" wmode=\"window\" salign=\"TL\" FlashVars=\"playerMode=embedded\"> </embed>", $s); // [highlight]Highlight text[/highlight] $s = preg_replace("/\\[highlight\\]((\\s|.)+?)\\[\\/highlight\\]/", "<table border=0 cellspacing=0 cellpadding=1>" . "<tr><td bgcolor=green><b>\\1</b></td></tr>" . "</table>", $s); // [marquee]Marquee[/marquee] $s = preg_replace("/\\[marquee\\]((\\s|.)+?)\\[\\/marquee\\]/", "<marquee>\\1</marquee>", $s); // [blink]blink[/blink] $s = preg_replace("/\\[blink\\]((\\s|.)+?)\\[\\/blink\\]/", "<blink>\\1</blink>", $s); // [mcom]Text[/mcom] $s = preg_replace("/\\[mcom\\]\\s*((\\s|.)+?)\\s*\\[\\/mcom\\]\\s*/i", "<span style=\"font-size: 18pt; line-height: 50%;\">\n <div style=\"border-color: red; background-color: red; color: white; text-align: center; font-weight: bold; font-size: large;\">\n <b>\\1</b>\n </div>\n </span>", $s); // [color=blue]Text[/color] $s = preg_replace("/\\[color=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color=\\1>\\2</font>", $s); // [color=#ffcc99]Text[/color] $s = preg_replace("/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color=\\1>\\2</font>", $s); // [size=4]Text[/size] $s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size=\\1>\\2</font>", $s); // [font=Arial]Text[/font] $s = preg_replace("/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/i", "<font face=\"\\1\">\\2</font>", $s); // Quotes $s = format_quotes($s); // URLs // $s = format_local_urls($s); // Linebreaks $s = nl2br($s); // [pre]Preformatted[/pre] $s = preg_replace("/\\[pre\\]((\\s|.)+?)\\[\\/pre\\]/i", "<tt><nobr>\\1</nobr></tt>", $s); // [nfo]NFO-preformatted[/nfo] $s = preg_replace("/\\[nfo\\]((\\s|.)+?)\\[\\/nfo\\]/i", "<tt><nobr><font face='MS Linedraw' size=2 style='font-size: 10pt; line-height: " . "10pt'>\\1</font></nobr></tt>", $s); // Maintain spacing $s = str_replace(" ", " ", $s); // ////////////////// $s = preg_replace("#<(\\s+?)?s(\\s+?)?c(\\s+?)?r(\\s+?)?i(\\s+?)?p(\\s+?)?t#is", "<script", $s); $s = preg_replace("#<(\\s+?)?/(\\s+?)?s(\\s+?)?c(\\s+?)?r(\\s+?)?i(\\s+?)?p(\\s+?)?t#is", "</script", $s); $s = preg_replace("/javascript/i", "javascript", $s); $s = preg_replace("/alert/i", "alert", $s); $s = preg_replace("/about:/i", "about:", $s); $s = preg_replace("/onmouseover/i", "onmouseover", $s); $s = preg_replace("/onclick/i", "onclick", $s); $s = preg_replace("/onsubmit/i", "onsubmit", $s); $s = preg_replace("/<body/i", "<body", $s); $s = preg_replace("/<html/i", "<html", $s); $s = preg_replace("/document\\./i", "document.", $s); // /////// $s = preg_replace_callback("/\\[img\\](http:\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png)))\\[\\/img\\]/i", "scale", $s); $s = preg_replace_callback("/\\[img=(http:\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png)))\\]/i", "scale", $s); // [hr=xxx]/[hr=xxx%]/[hr=xxxpt]/[hr=xxxpx] $s = preg_replace("/\\[hr(\\=([0-9]{1,4})(%|px|pt)?)\\]/i", "<hr align=center width=\"\\1\" />", $s); // [hr] $s = str_replace("[hr]", "<hr>", $s); // [center] $s = preg_replace("/\\[center\\]((\\s|.)+?)\\[\\/center\\]/i", "<div align='center'><tt><nobr><font face='Verdana' size=2 style='font-size: 10pt; line-height: " . "10pt'>\\1</font></nobr></tt></div>", $s); // [Spoiler]TEXT[/Spoiler] $s = preg_replace("/\\[spoiler\\]((\\s|.)+?)\\[\\/spoiler\\]/", "<div class=\"smallfont\" align=\"center\">\n <small><b><blink>Click the button to show/hide Spoiler.</blink><br></b></small><input type=\"button\" value=\"Show\" style=\"width:75px;font-size:10px;margin:0px;padding:0px;\" onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }\">\n <div style=\"margin: 10px; padding: 10px; border: 1px inset;\" align=\"left\"><div style=\"display: none;\">\\1</div></div></div>", $s); // [s]Stroke[/s] $s = preg_replace("/\\[s\\]((\\s|.)+?)\\[\\/s\\]/", "<s>\\1</s>", $s); //[align=(center|left|right|justify)]text[/align] $s = preg_replace("/\\[align=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/align\\]/i", "<div style=\"text-align:\\1\">\\2</div>", $s); //[mail]mail[/mail] $s = preg_replace("/\\[mail\\]((\\s|.)+?)\\[\\/mail\\]/i", "<a href=\"mailto:\\1\" targe=\"_blank\">\\1</a>", $s); // bad words $badwords_pattern = "/\\b(asshole|assshole|f**k|c**t|bastard|fcuk|f**k|tosser|fcck|cnut|bollocks|f****r|cunty|arseholes|f*****t|s******d|fuckface|m**********r|c**k|c********r|shag|w***e|dickhead|prick|f****t|crack|serial|keygen|tit|cvnt|bar steward|piss|fanny|bitch|arse|f****n|f*****g|fuckface|knob head|fuckhead|knob end|f**k|c**t|twat|wanker|bastard|shit|fvck|hoe|fookin|fooking|f**k|ass|ass wipe|ass wipes)\\b/i"; $badwords_replace = "<img src=pic/censored.png />"; $s = preg_replace($badwords_pattern, $badwords_replace, $s); reset($smilies); while (list($code, $url) = each($smilies)) { $s = str_replace($code, "<img border=0 src=\"{$pic_base_url}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } reset($privatesmilies); while (list($code, $url) = each($privatesmilies)) { $s = str_replace($code, "<img border=0 src=\"{$pic_base_url}smilies/{$url}\" />", $s); } reset($customsmilies); while (list($code, $url) = each($customsmilies)) { $s = str_replace($code, "<img border=0 src=\"/pic/smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } return $s; }
} if (curuser::$blocks['userdetails_page'] & block_userdetails::REPORT_USER && $BLOCKS['userdetails_report_user_on']) { require_once BLOCK_DIR . 'userdetails/report.php'; } if (curuser::$blocks['userdetails_page'] & block_userdetails::USERSTATUS && $BLOCKS['userdetails_user_status_on']) { require_once BLOCK_DIR . 'userdetails/userstatus.php'; } if (curuser::$blocks['userdetails_page'] & block_userdetails::SHOWPM && $BLOCKS['userdetails_showpm_on']) { require_once BLOCK_DIR . 'userdetails/showpm.php'; } $HTMLOUT .= "</table></div>"; $HTMLOUT .= "<div id='activity'>"; $HTMLOUT .= "<table align='center' width='100%' border='1' cellspacing='0' cellpadding='5'>\n"; //==where is user now if (!empty($user['where_is'])) { $HTMLOUT .= "<tr><td class='rowhead' width='1%'>{$lang['userdetails_location']}</td><td align='left' width='99%'>" . format_urls($user['where_is']) . "</td></tr>\n"; } //== $moodname = isset($mood['name'][$user['mood']]) ? htmlsafechars($mood['name'][$user['mood']]) : $lang['userdetails_neutral']; $moodpic = isset($mood['image'][$user['mood']]) ? htmlsafechars($mood['image'][$user['mood']]) : 'noexpression.gif'; $HTMLOUT .= '<tr><td class="rowhead">' . $lang['userdetails_currentmood'] . '</td><td align="left"><span class="tool"> <a href="javascript:;" onclick="PopUp(\'usermood.php\',\'' . $lang['userdetails_mood'] . '\',530,500,1,1);"> <img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . $moodpic . '" alt="' . $moodname . '" border="0" /> <span class="tip">' . htmlsafechars($user['username']) . ' ' . $moodname . ' !</span></a></span></td></tr>'; if (curuser::$blocks['userdetails_page'] & block_userdetails::SEEDBONUS && $BLOCKS['userdetails_seedbonus_on']) { require_once BLOCK_DIR . 'userdetails/seedbonus.php'; } if (curuser::$blocks['userdetails_page'] & block_userdetails::IRC_STATS && $BLOCKS['userdetails_irc_stats_on']) { require_once BLOCK_DIR . 'userdetails/irc.php'; } if (curuser::$blocks['userdetails_page'] & block_userdetails::REPUTATION && $BLOCKS['userdetails_reputation_on']) {
$HTMLOUT .= tr($lang['usercp_browse'], $categories, 1); $HTMLOUT .= tr($lang['usercp_clearnewtagmanually'], "<input type='checkbox' name='clear_new_tag_manually'" . ($CURUSER["clear_new_tag_manually"] == "yes" ? " checked='checked'" : "") . " /> {$lang['usercp_default_clearnewtagmanually']}", 1); $HTMLOUT .= tr($lang['usercp_scloud'], "<input type='checkbox' name='viewscloud'" . ($CURUSER["viewscloud"] == "yes" ? " checked='checked'" : "") . " /> {$lang['usercp_scloud1']}", 1); $HTMLOUT .= "<tr><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>"; $HTMLOUT .= end_table(); } elseif ($action == "personal") { $HTMLOUT .= begin_table(true); $HTMLOUT .= "<tr><td class='colhead' colspan='2' style='height:25px;' ><input type='hidden' name='action' value='personal' />Personal Options</td></tr>"; if ($CURUSER['class'] >= UC_VIP) { $HTMLOUT .= tr($lang['usercp_title'], "<input size='50' value='" . htmlspecialchars($CURUSER["title"]) . "' name='title' /><br />", 1); } //==status mod $CURUSER['archive'] = unserialize($CURUSER['archive']); $HTMLOUT .= "<tr><td class='rowhead'>Online status</td><td><fieldset><legend><strong>Status update</strong></legend>"; if (isset($CURUSER['last_status'])) { $HTMLOUT .= "<div id='current_holder'>\r\n <small style='font-weight:bold;'>Current status</small>\r\n <h2 id='current_status' title='Click to edit' onclick='status_pedit()'>" . format_urls($CURUSER["last_status"]) . "</h2></div>"; } $HTMLOUT .= "<small style='font-weight:bold;'>Update status</small>\r\n <textarea name='status' id='status' onkeyup='status_count()' cols='50' rows='4'></textarea>\r\n <div style='width:390px;'>\r\n <div style='float:left;padding-left:5px;'>NO bbcode or html allowed</div>\r\n <div style='float:right;font-size:12px;font-weight:bold;' id='status_count'>140</div>\r\n <div style='clear:both;'></div></div>"; if (count($CURUSER['archive'])) { $HTMLOUT .= "<div style='width:390px'>\r\n <div style='float:left;padding-left:5px;'><small style='font-weight:bold;'>Status archive</small></div>\r\n <div style='float:right;cursor:pointer' id='status_archive_click' onclick='status_slide()'>+</div>\r\n <div style='clear:both;'></div>\r\n <div id='status_archive' style='padding-left:15px;display:none;'>"; if (is_array($CURUSER['archive'])) { foreach (array_reverse($CURUSER['archive'], true) as $a_id => $sa) { $HTMLOUT .= '<div id="status_' . $a_id . '"> <div style="float:left">' . htmlspecialchars($sa['status']) . ' <small>added ' . get_date($sa['date'], '', 0, 1) . '</small></div> <div style="float:right;cursor:pointer;"><span onclick="status_delete(' . $a_id . ')"></span></div> <div style="clear:both;border:1px solid #222;border-width:1px 0 0 0;margin-bottom:3px;"></div></div>'; } } $HTMLOUT .= "</div></div>"; }
| http://www.tbdev.net | ============================================= | svn: http://sourceforge.net/projects/tbdevnet/ | Licence Info: GPL +------------------------------------------------ | $Date$ | $Revision$ | $Author$ | $URL$ +------------------------------------------------ */ require "include/bittorrent.php"; require "include/user_functions.php"; require "include/bbcode_functions.php"; dbconn(false); loggedinorreturn(); $lang = array_merge(load_language('global'), load_language('viewnfo')); $id = 0 + $_GET["id"]; if ($CURUSER['class'] < UC_POWER_USER || !is_valid_id($id)) { die; } $r = mysql_query("SELECT name,nfo FROM torrents WHERE id={$id}") or sqlerr(); $a = mysql_fetch_assoc($r) or die("{$lang['text_puke']}"); $nfo = htmlspecialchars($a["nfo"]); $HTMLOUT = ''; $HTMLOUT .= "<h1>{$lang['text_nfofor']}<a href='details.php?id={$id}'>{$a['name']}</a></h1>\n"; $HTMLOUT .= "<table border='1' cellspacing='0' cellpadding='5'><tr><td class='text'>\n"; $HTMLOUT .= "<pre>" . format_urls(htmlentities($nfo, ENT_QUOTES, 'UTF-8')) . "</pre>\n"; $HTMLOUT .= "</td></tr></table>\n"; $HTMLOUT .= "<p align='center'>{$lang['text_forbest']}" . "<a href='ftp://{$_SERVER['HTTP_HOST']}/misc/linedraw.ttf'>{$lang['text_linedraw']}</a>{$lang['text_font']}</p>\n"; print stdhead() . $HTMLOUT . stdfoot();
function format_comment($text, $strip_html = true) { global $smilies, $pic_base_url; $s = $text; unset($text); // This fixes the extraneous ;) smilies problem. When there was an html escaped // char before a closing bracket - like >), "), ... - this would be encoded // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed // the ;) one, and replace all genuine ;) by :wink: before escaping the body. // (What took us so long? :blush:)- wyz $s = str_replace(";)", ":wink:", $s); if ($strip_html) { $s = htmlentities($s, ENT_QUOTES); } // [*] $s = preg_replace("/\\[\\*\\]/", "<li>", $s); // [b]Bold[/b] $s = preg_replace("/\\[b\\]((\\s|.)+?)\\[\\/b\\]/", "<b>\\1</b>", $s); // [i]Italic[/i] $s = preg_replace("/\\[i\\]((\\s|.)+?)\\[\\/i\\]/", "<i>\\1</i>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/", "<u>\\1</u>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/i", "<u>\\1</u>", $s); // [img]http://www/image.gif[/img] $s = preg_replace("/\\[img\\](http:\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png)))\\[\\/img\\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s); // [img=http://www/image.gif] $s = preg_replace("/\\[img=(http:\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png)))\\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s); // [color=blue]Text[/color] $s = preg_replace("/\\[color=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color='\\1'>\\2</font>", $s); // [color=#ffcc99]Text[/color] $s = preg_replace("/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color='\\1'>\\2</font>", $s); // [url=http://www.example.com]Text[/url] $s = preg_replace("/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/i", "<a href=\"\\1\">\\2</a>", $s); // [url]http://www.example.com[/url] $s = preg_replace("/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/i", "<a href=\"\\1\">\\1</a>", $s); // [size=4]Text[/size] $s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size='\\1'>\\2</font>", $s); // [font=Arial]Text[/font] $s = preg_replace("/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/i", "<font face=\"\\1\">\\2</font>", $s); // //[quote]Text[/quote] // $s = preg_replace( // "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", // "<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s); // //[quote=Author]Text[/quote] // $s = preg_replace( // "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", // "<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s); // Quotes $s = format_quotes($s); // URLs $s = format_urls($s); // $s = format_local_urls($s); // Linebreaks $s = nl2br($s); // [pre]Preformatted[/pre] $s = preg_replace("/\\[pre\\]((\\s|.)+?)\\[\\/pre\\]/i", "<tt><span style=\"white-space: nowrap;\">\\1</span></tt>", $s); // [nfo]NFO-preformatted[/nfo] $s = preg_replace("/\\[nfo\\]((\\s|.)+?)\\[\\/nfo\\]/i", "<tt><span style=\"white-space: nowrap;\"><font face='MS Linedraw' size='2' style='font-size: 10pt; line-height: " . "10pt'>\\1</font></span></tt>", $s); // Maintain spacing $s = str_replace(" ", " ", $s); foreach ($smilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$pic_base_url}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } return $s; }
function format_comment($text, $strip_html = true, $urls = true, $images = true) { global $smilies, $staff_smilies, $customsmilies, $INSTALLER09, $CURUSER; $s = $text; unset($text); // This fixes the extraneous ;) smilies problem. When there was an html escaped // char before a closing bracket - like >), "), ... - this would be encoded // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed // the ;) one, and replace all genuine ;) by :wink: before escaping the body. // (What took us so long? :blush:)- wyz $s = str_replace(';)', ':wink:', $s); // fix messed up links $s = str_replace('&', '&', $s); if ($strip_html) { $s = htmlsafechars($s, ENT_QUOTES, charset()); } if (preg_match("#function\\s*\\((.*?)\\|\\|#is", $s)) { $s = str_replace(":", ":", $s); $s = str_replace("[", "[", $s); $s = str_replace("]", "]", $s); $s = str_replace(")", ")", $s); $s = str_replace("(", "(", $s); $s = str_replace("{", "{", $s); $s = str_replace("}", "}", $s); $s = str_replace("\$", "$", $s); } // BBCode to find... $bb_code_in = array('/\\[b\\]\\s*((\\s|.)+?)\\s*\\[\\/b\\]/i', '/\\[i\\]\\s*((\\s|.)+?)\\s*\\[\\/i\\]/i', '/\\[u\\]\\s*((\\s|.)+?)\\s*\\[\\/u\\]/i', '/\\[email\\](.*?)\\[\\/email\\]/i', '/\\[align=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/align\\]/i', '/\\[blockquote\\]\\s*((\\s|.)+?)\\s*\\[\\/blockquote\\]/i', '/\\[strike\\]\\s*((\\s|.)+?)\\s*\\[\\/strike\\]/i', '/\\[s\\]\\s*((\\s|.)+?)\\s*\\[\\/s\\]/i', '/\\[pre\\]\\s*((\\s|.)+?)\\s*\\[\\/pre\\]/i', '/\\[marquee\\](.*?)\\[\\/marquee\\]/i', '/\\[collapse=(.*?)\\]\\s*((\\s|.)+?)\\s*\\[\\/collapse\\]/i', '/\\[size=([1-7])\\]\\s*((\\s|.)+?)\\s*\\[\\/size\\]/i', '/\\[color=([a-zA-Z]+)\\]\\s*((\\s|.)+?)\\s*\\[\\/color\\]/i', '/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]\\s*((\\s|.)+?)\\s*\\[\\/color\\]/i', '/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/i', '/\\[spoiler\\]\\s*((\\s|.)+?)\\s*\\[\\/spoiler\\]/i', '/\\[video=[^\\s\'"<>]*youtube.com.*v=([^\\s\'"<>]+)\\]/ims', "/\\[video=[^\\s'\"<>]*video.google.com.*docid=(-?[0-9]+).*\\]/ims", '/\\[audio\\](http:\\/\\/[^\\s\'"<>]+(\\.(mp3|aiff|wav)))\\[\\/audio\\]/i', '/\\[list=([0-9]+)\\]((\\s|.)+?)\\[\\/list\\]/i', '/\\[list\\]((\\s|.)+?)\\[\\/list\\]/i', '/\\[\\*\\]\\s?(.*?)\\n/i', '/\\[li\\]\\s?(.*?)\\n/i', '/\\[hr\\]/'); // And replace them by... $bb_code_out = array('<span style="font-weight: bold;">\\1</span>', '<span style="font-style: italic;">\\1</span>', '<span style="text-decoration: underline;">\\1</span>', '<a class="altlink" href="mailto:\\1">\\1</a>', '<div style="text-align: \\1;">\\2</div>', '<blockquote class="style"><span>\\1</span></blockquote>', '<span style="text-decoration: line-through;">\\1</span>', '<span style="text-decoration: line-through;">\\1</span>', '<span style="white-space: nowrap;">\\1</span>', '<marquee class="style">\\1</marquee>', '<div style="padding-top: 2px; white-space: nowrap"><span style="cursor: hand; cursor: pointer; border-bottom: 1px dotted" onclick="if (document.getElementById(\'collapseobj\\1\').style.display==\'block\') {document.getElementById(\'collapseobj\\1\').style.display=\'none\' } else { document.getElementById(\'collapseobj\\1\').style.display=\'block\' }">\\1</span></div><div id="collapseobj\\1" style="display:none; padding-top: 2px; padding-left: 14px; margin-bottom:10px; padding-bottom: 2px; background-color: #FEFEF4;">\\2</div>', '<span class="size\\1">\\2</span>', '<span style="color:\\1;">\\2</span>', '<span style="color:\\1;">\\2</span>', '<span style="font-family:\'\\1\';">\\2</span>', '<table cellspacing="0" cellpadding="10"><tr><td class="forum_head_dark" style="padding:5px">Spoiler! to view, roll over the spoiler box.</td></tr><tr><td class="spoiler"><a href="#">\\1</a></td></tr></table><br />', '<object width="500" height="410"><param name="movie" value="http://www.youtube.com/v/\\1"></param><embed src="http://www.youtube.com/v/\\1" type="application/x-shockwave-flash" width="500" height="410"></embed></object>', "<embed style=\"width:500px; height:410px;\" id=\"VideoPlayback\" align=\"middle\" type=\"application/x-shockwave-flash\" src=\"http://video.google.com/googleplayer.swf?docId=\\1\" allowScriptAccess=\"sameDomain\" quality=\"best\" bgcolor=\"#ffffff\" scale=\"noScale\" wmode=\"window\" salign=\"TL\" FlashVars=\"playerMode=embedded\"> </embed>", '<span style="text-align: center;"><p>Audio From: \\1</p><embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=\\1" width="400" height="27" allowscriptaccess="never" quality="best" bgcolor="#ffffff" wmode="window" flashvars="playerMode=embedded" /></span>', '<ol class="style" start="\\1">\\2</ol>', '<ul class="style">\\1</ul>', '<li>\\1</li>', '<li>\\1</li>', '<hr />'); $s = preg_replace($bb_code_in, $bb_code_out, $s); if ($urls) { $s = format_urls($s); } if (stripos($s, '[url') !== false && $urls) { $s = preg_replace_callback("/\\[url=([^()<>\\s]+?)\\](.+?)\\[\\/url\\]/is", "islocal", $s); // [url]http://www.example.com[/url] $s = preg_replace_callback("/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/is", "islocal", $s); } // Linebreaks $s = nl2br($s); // Dynamic Vars $s = dynamic_user_vars($s); // [pre]Preformatted[/pre] if (stripos($s, '[pre]') !== false) { $s = preg_replace("/\\[pre\\]((\\s|.)+?)\\[\\/pre\\]/i", "<tt><span style=\"white-space: nowrap;\">\\1</span></tt>", $s); } // [nfo]NFO-preformatted[/nfo] if (stripos($s, '[nfo]') !== false) { $s = preg_replace("/\\[nfo\\]((\\s|.)+?)\\[\\/nfo\\]/i", "<tt><span style=\"white-space: nowrap;\"><font face='MS Linedraw' size='2' style='font-size: 10pt; line-height:" . "10pt'>\\1</font></span></tt>", $s); } //==Media tag if (stripos($s, '[media=') !== false) { $s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|vimeo|imdb)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s); } if (stripos($s, '[img') !== false && $images) { // [img=http://www/image.gif] $s = preg_replace("/\\[img\\]((http|https):\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png|bmp)))\\[\\/img\\]/i", "<a href=\"\\1\" rel=\"lightbox\"><img src=\"\\1\" border=\"0\" alt=\"\" style=\"max-width: 150px;\" /></a>", $s); // [img=http://www/image.gif] $s = preg_replace("/\\[img=((http|https):\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png|bmp)))\\]/i", "<a href=\"\\1\" rel=\"lightbox\"><img src=\"\\1\" border=\"0\" alt=\"\" style=\"max-width: 150px;\" /></a>", $s); } // [mcom]Text[/mcom] if (stripos($s, '[mcom]') !== false) { $s = preg_replace("/\\[mcom\\](.+?)\\[\\/mcom\\]/is", "<div style=\"font-size: 18pt; line-height: 50%;\">\r\n <div style=\"border-color: red; background-color: red; color: white; text-align: center; font-weight: bold; font-size: large;\"><b>\\1</b></div></div>", $s); } // the [you] tag if (stripos($s, '[you]') !== false) { $s = preg_replace("/\\[you\\]/i", $CURUSER['username'], $s); } // [php]code[/php] if (stripos($s, '[php]') !== false) { $s = preg_replace("#\\[(php|sql|html)\\](.+?)\\[\\/\\1\\]#ise", "source_highlighter('\\2','\\1')", $s); } // Maintain spacing $s = str_replace(' ', ' ', $s); if (isset($smilies)) { foreach ($smilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$INSTALLER09['pic_base_url']}smilies/{$url}\" alt=\"\" />", $s); //$s = str_replace($code, '<span id="'.$attr.'"></span>', $s); } } if (isset($staff_smilies)) { foreach ($staff_smilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$INSTALLER09['pic_base_url']}smilies/{$url}\" alt=\"\" />", $s); //$s = str_replace($code, '<span id="'.$attr.'"></span>', $s); } } if (isset($customsmilies)) { foreach ($customsmilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$INSTALLER09['pic_base_url']}smilies/{$url}\" alt=\"\" />", $s); //$s = str_replace($code, '<span id="'.$attr.'"></span>', $s); } } $s = format_quotes($s); $s = check_BBcode($s); return $s; }
} $nfo = ""; if ($view == "latin-1" || $view == "fonthack") { // Do not convert from ibm-437, read bytes as is. // NOTICE: TBSource specifies Latin-1 encoding in include/bittorrent.php: $nfo = htmlentities($a["nfo"]); } else { // Convert from ibm-437 to html unicode entities. // take special care of Swedish letters if in magic view. $nfo = code($a["nfo"], $view == "magic"); } $HTMLOUT = ''; $HTMLOUT .= "<h1>nfo for <a href='{$INSTALLER09['baseurl']}/details.php?id={$id}'>" . htmlentities($a["name"]) . "</a></h1>\n\r\n<table border='1' cellspacing='0' cellpadding='10' align='center'>\r\n<tr>\r\n<td align='center' width='50%'>\r\n<a href='{$INSTALLER09['baseurl']}/viewnfo.php?id=" . $id . "&view=magic' title='Magisk IBM-437'>\r\n<b>DOS-vy</b></a></td>\r\n<td align='center' width='50%'>\r\n<a href='{$INSTALLER09['baseurl']}/viewnfo.php?id=" . $id . "&view=latin-1' title='Latin-1'><b>Windows-vy</b></a></td>\r\n</tr>\r\n<tr>\r\n<td colspan='3'>\r\n<table border='1' cellspacing='0' cellpadding='5'><tr>\r\n<td class='text'>"; // -- About to output NFO data if ($view == "fonthack") { // Please notice: MS LineDraw's glyphs are included in the Courier New font // as of Courier New version 2.0, but uses the correct mappings instead. // [url="http://support.microsoft.com/kb/q179422/"]http://support.microsoft.com/kb/q179422/[/url] $HTMLOUT .= "<pre style=\"font-size:10pt; font-family: 'MS LineDraw', 'Terminal', monospace;\">"; } else { // IE6.0 need to know which font to use, Mozilla can figure it out in its own // (windows firefox at least) // Anything else than 'Courier New' looks pretty broken. // 'Lucida Console', 'FixedSys' $HTMLOUT .= "<pre style=\"font-size:10pt; font-family: 'Courier New', monospace;\">"; } // Writes the (eventually modified) NFO data to output, first formating urls. $HTMLOUT .= format_urls($nfo); $HTMLOUT .= "</pre>\n"; $HTMLOUT .= "</td></tr></table></td></tr></table>"; echo stdhead() . $HTMLOUT . stdfoot();
title="Strikt: Visar nfo-filen som den ser ut i teckentabellen IBM-437"> <b>Strikt DOS-vy</b></a></td>*/ ?> </tr> <tr> <td colspan="3"> <table border="1" cellspacing="0" cellpadding="5"> <tr> <td class="text"> <?php // -- About to output NFO data // Please notice: MS LineDraw's glyphs are included in the Courier New font // as of Courier New version 2.0, but uses the correct mappings instead. // http://support.microsoft.com/kb/q179422/ $font = $view == "fonthack" ? "font-1" : "font-2"; ?> <pre class="<?php echo $font; ?> "><?php echo format_urls($nfo); ?> </pre> </td> </tr> </table> </td> </tr> </table> <?php stdfoot();
function format_comment($text, $strip_html = true) { global $smilies, $CURUSER, $customsmilies, $TBDEV; $s = $text; $s = validate_imgs($s); $s = str_replace("][", "] [", $s); unset($text); // This fixes the extraneous ;) smilies problem. When there was an html escaped // char before a closing bracket - like >), "), ... - this would be encoded // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed // the ;) one, and replace all genuine ;) by :wink: before escaping the body. // (What took us so long? :blush:)- wyz $s = str_replace(";)", ":wink:", $s); if ($strip_html) { $s = htmlentities($s, ENT_QUOTES); } if (preg_match("#function\\s*\\((.*?)\\|\\|#is", $s)) { $s = str_replace(":", ":", $s); $s = str_replace("[", "[", $s); $s = str_replace("]", "]", $s); $s = str_replace(")", ")", $s); $s = str_replace("(", "(", $s); $s = str_replace("{", "{", $s); $s = str_replace("}", "}", $s); $s = str_replace("\$", "$", $s); } // [*] if (stripos($s, '[*]') !== false) { $s = preg_replace("/\\[\\*\\]/", "<img src=\"" . $TBDEV['pic_base_url'] . "list.gif\" alt=\"List\" title=\"List\" class=\"listitem\" />", $s); } // [b]Bold[/b] if (stripos($s, '[b]') !== false) { $s = preg_replace('/\\[b\\](.+?)\\[\\/b\\]/is', "<b>\\1</b>", $s); } // [i]Italic[/i] if (stripos($s, '[i]') !== false) { $s = preg_replace('/\\[i\\](.+?)\\[\\/i\\]/is', "<i>\\1</i>", $s); } // [u]Underline[/u] if (stripos($s, '[u]') !== false) { $s = preg_replace('/\\[u\\](.+?)\\[\\/u\\]/is', "<span style='text-decoration:underline;'>\\1</span>", $s); } // [color=blue]Text[/color] if (stripos($s, '[color=') !== false) { $s = preg_replace('/\\[color=([a-zA-Z]+)\\](.+?)\\[\\/color\\]/is', '<span style="color: \\1">\\2</span>', $s); // [color=#ffcc99]Text[/color] $s = preg_replace('/\\[color=(#[a-f0-9]{6})\\](.+?)\\[\\/color\\]/is', '<span style="color: \\1">\\2</span>', $s); } //==Media tag if (stripos($s, '[media=') !== false) { $s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|imdb)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s); $s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|vimeo)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s); } //--img if (stripos($s, '[img') !== false) { $s = preg_replace_callback("/\\[img\\](http:\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png)))\\[\\/img\\]/i", "scale", $s); $s = preg_replace_callback("/\\[img=(http:\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png)))\\]/i", "scale", $s); } // [size=4]Text[/size] if (stripos($s, '[size=') !== false) { $s = preg_replace('/\\[size=([1-7])\\](.+?)\\[\\/size\\]/is', "<span class='size\\1'>\\2</span>", $s); } // [font=Arial]Text[/font] if (stripos($s, '[font=') !== false) { $s = preg_replace('/\\[font=([a-zA-Z ,]+)\\](.+?)\\[\\/font\\]/is', '<span style="font-family: \\1">\\2</span>', $s); } // [s]Stroke[/s] if (stripos($s, '[s]') !== false) { $s = preg_replace("/\\[s\\](.+?)\\[\\/s\\]/is", "<s>\\1</s>", $s); } // the [you] tag if (stripos($s, '[you]') !== false) { $s = preg_replace("/\\[you\\]/i", $CURUSER['username'], $s); } // Dynamic Vars $s = dynamic_user_vars($s); // [Spoiler]TEXT[/Spoiler] if (stripos($s, '[spoiler]') !== false) { $s = preg_replace("/\\[spoiler\\](.+?)\\[\\/spoiler\\]/is", "<div class=\"smallfont\" align=\"left\">\r\n <input type=\"button\" value=\"Show\" style=\"width:75px;font-size:10px;margin:0px;padding:0px;\" onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }\" />\r\n <div style=\"margin: 10px; padding: 10px; border: 1px inset;\" align=\"left\"><div style=\"display: none;\">\\1</div></div></div>", $s); } // [mcom]Text[/mcom] if (stripos($s, '[mcom]') !== false) { $s = preg_replace("/\\[mcom\\](.+?)\\[\\/mcom\\]/is", "<div style=\"font-size: 18pt; line-height: 50%;\">\r\n <div style=\"border-color: red; background-color: red; color: white; text-align: center; font-weight: bold; font-size: large;\"><b>\\1</b></div></div>", $s); } // [php]php code[/php] if (stripos($s, '[php]') !== false) { $s = preg_replace_callback("/\\[php\\](.+?)\\[\\/php\\]/ims", "source_highlighter", $s); } // [sql]sql code[/sql] if (stripos($s, '[sql]') !== false) { $s = preg_replace_callback("/\\[sql\\](.+?)\\[\\/sql\\]/ims", "source_highlighter", $s); } // [html]html code[/html] if (stripos($s, '[html]') !== false) { $s = preg_replace_callback("/\\[html\\](.+?)\\[\\/html\\]/ims", "source_highlighter", $s); } //[mail]mail[/mail] if (stripos($s, '[mail]') !== false) { $s = preg_replace("/\\[mail\\](.+?)\\[\\/mail\\]/is", "<a href=\"mailto:\\1\" targe=\"_blank\">\\1</a>", $s); } //[align=(center|left|right|justify)]text[/align] if (stripos($s, '[align=') !== false) { $s = preg_replace("/\\[align=([a-zA-Z]+)\\](.+?)\\[\\/align\\]/is", "<div style=\"text-align:\\1\">\\2</div>", $s); } // Quotes $s = format_quotes($s); // URLs $s = format_urls($s); // $s = format_local_urls($s); // [url=http://www.example.com]Text[/url] if (stripos($s, '[url') !== false) { $s = preg_replace_callback("/\\[url=([^()<>\\s]+?)\\](.+?)\\[\\/url\\]/is", "islocal", $s); // [url]http://www.example.com[/url] $s = preg_replace_callback("/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/is", "islocal", $s); } // Linebreaks $s = nl2br($s); // [pre]Preformatted[/pre] if (stripos($s, '[pre]') !== false) { $s = preg_replace("/\\[pre\\](.+?)\\[\\/pre\\]/is", "<tt><span style=\"white-space: nowrap;\">\\1</span></tt>", $s); } // [nfo]NFO-preformatted[/nfo] if (stripos($s, '[nfo]') !== false) { $s = preg_replace("/\\[nfo\\](.+?)\\[\\/nfo\\]/i", "<tt><span style=\"white-space: nowrap;\"><font face='MS Linedraw' size='2' style='font-size: 10pt; line-height: " . "10pt'>\\1</font></span></tt>", $s); } // Maintain spacing $s = str_replace(" ", " ", $s); //==Smilies if (isset($smilies)) { foreach ($smilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } } if (isset($customsmilies)) { foreach ($customsmilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } } return $s; }
<?php require "include/bittorrent.php"; require_once "include/user_functions.php"; require_once "include/bbcode_functions.php"; dbconn(false); maxcoder(); if (!logged_in()) { header("HTTP/1.0 404 Not Found"); // moddifed logginorreturn by retro//Remember to change the following line to match your server print "<html><h1>Not Found</h1><p>The requested URL /{$_SERVER['PHP_SELF']} was not found on this server.</p><hr /><address>Apache/1.1.11 " . $SITENAME . " Server at " . $_SERVER['SERVER_NAME'] . " Port 80</address></body></html>\n"; die; } $id = 0 + $_GET["id"]; if (get_user_class() < UC_POWER_USER || !is_valid_id($id)) { die; } $r = mysql_query("SELECT name,nfo FROM torrents WHERE id={$id}") or sqlerr(); $a = mysql_fetch_assoc($r) or die("Puke"); $nfo = htmlspecialchars($a["nfo"]); stdhead(); print "<h1>NFO for <a href=details.php?id={$id}>{$a['name']}</a></h1>\n"; print "<table border=1 cellspacing=0 cellpadding=5><tr><td class=text>\n"; print "<pre><font face='MS Linedraw' size=2 style='font-size: 10pt; line-height: 10pt'>" . format_urls($nfo) . "</font></pre>\n"; print "</td></tr></table>\n"; print "<p align=center>For best visual result, install the " . "<a href=ftp://{$_SERVER['HTTP_HOST']}/misc/linedraw.ttf>MS Linedraw</a> font!</p>\n"; stdfoot();
title="Strikt: Visar nfo-filen som den ser ut i teckentabellen IBM-437"> <b>Strikt DOS-vy</b></a></td>*/ ?> </tr> <tr> <td colspan="3"> <table border=1 cellspacing=0 cellpadding=5><tr><td class=text> <?php // -- About to output NFO data if ($view == "fonthack") { // Please notice: MS LineDraw's glyphs are included in the Courier New font // as of Courier New version 2.0, but uses the correct mappings instead. // http://support.microsoft.com/kb/q179422/ print "<pre style=\"font-size:10pt; font-family: 'MS LineDraw', 'Terminal', monospace;\">"; } else { // IE6.0 need to know which font to use, Mozilla can figure it out in its own // (windows firefox at least) // Anything else than 'Courier New' looks pretty broken. // 'Lucida Console', 'FixedSys' print "<pre style=\"font-size:10pt; font-family: 'Courier New', monospace;\">"; } // Writes the (eventually modified) nfo data to output, first formating urls. print format_urls($nfo); print "</pre>\n"; ?> </td></tr></table> </td> </tr> </table> <?php stdfoot();
function format_comment($text) { global $site_config, $smilies; $s = $text; $s = htmlspecialchars($s); $s = format_urls($s); // [*] $s = preg_replace("/\\[\\*\\]/", "<li>", $s); // [b]Bold[/b] $s = preg_replace("/\\[b\\]((\\s|.)+?)\\[\\/b\\]/", "<b>\\1</b>", $s); // [i]Italic[/i] $s = preg_replace("/\\[i\\]((\\s|.)+?)\\[\\/i\\]/", "<i>\\1</i>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/", "<u>\\1</u>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/i", "<u>\\1</u>", $s); // [img]http://www/image.gif[/img] $s = preg_replace("/\\[img\\]((http|https):\\/\\/[^\\s'\"<>]+(\\.gif|\\.jpg|\\.png|\\.bmp|\\.jpeg))\\[\\/img\\]/i", "<img border='0' src=\"\\1\" alt='' />", $s); // [img=http://www/image.gif] $s = preg_replace("/\\[img=((http|https):\\/\\/[^\\s'\"<>]+(\\.gif|\\.jpg|\\.png|\\.bmp|\\.jpeg))\\]/i", "<img border='0' src=\"\\1\" alt='' />", $s); // [color=blue]Text[/color] $s = preg_replace("/\\[color=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color='\\1'>\\2</font>", $s); // [color=#ffcc99]Text[/color] $s = preg_replace("/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color='\\1'>\\2</font>", $s); // [url=http://www.example.com]Text[/url] $s = preg_replace("/\\[url=((http|ftp|https|ftps|irc):\\/\\/[^<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/i", "<a href='\$1' target='_blank'>\\1</a>", $s); // [url]http://www.example.com[/url] $s = preg_replace("/\\[url\\]((http|ftp|https|ftps|irc):\\/\\/[^<>\\s]+?)\\[\\/url\\]/i", "<a href='\$3' target='_blank'>\\3</a>", $s); // [size=4]Text[/size] $s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size='\\1'>\\2</font>", $s); // [font=Arial]Text[/font] $s = preg_replace("/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/i", "<font face=\"\\1\">\\2</font>", $s); //[quote]Text[/quote] while (preg_match("/\\[quote\\]\\s*((\\s|.)+?)\\s*\\[\\/quote\\]\\s*/i", $s)) { $s = preg_replace("/\\[quote\\]\\s*((\\s|.)+?)\\s*\\[\\/quote\\]\\s*/i", "<p class='sub'><b>Quote:</b></p><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s); } //[quote=Author]Text[/quote] while (preg_match("/\\[quote=(.+?)\\]\\s*((\\s|.)+?)\\s*\\[\\/quote\\]\\s*/i", $s)) { $s = preg_replace("/\\[quote=(.+?)\\]\\s*((\\s|.)+?)\\s*\\[\\/quote\\]\\s*/i", "<p class='sub'><b>\\1 wrote:</b></p><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s); } // [spoiler]Text[/spoiler] $r = substr(md5($text), 0, 4); $i = 0; while (preg_match("/\\[spoiler\\]\\s*((\\s|.)+?)\\s*\\[\\/spoiler\\]\\s*/i", $s)) { $s = preg_replace("/\\[spoiler\\]\\s*((\\s|.)+?)\\s*\\[\\/spoiler\\]\\s*/i", "<br /><img src='images/plus.gif' id='pic{$r}{$i}' title='Spoiler' onclick='klappe_torrent(\"{$r}{$i}\")' alt='' /><div id='k{$r}{$i}' style='display: none;'>\\1<br /></div>", $s); $i++; } // [spoiler=Heading]Text[/spoiler] while (preg_match("/\\[spoiler=(.+?)\\]\\s*((\\s|.)+?)\\s*\\[\\/spoiler\\]\\s*/i", $s)) { $s = preg_replace("/\\[spoiler=(.+?)\\]\\s*((\\s|.)+?)\\s*\\[\\/spoiler\\]\\s*/i", "<br /><img src='images/plus.gif' id='pic{$r}{$i}' title='Spoiler' onclick='klappe_torrent(\"{$r}{$i}\")' alt='' /><b>\\1</b><div id='k{$r}{$i}' style='display: none;'>\\2<br /></div>", $s); $i++; } //[hr] $s = preg_replace("/\\[hr\\]/i", "<hr />", $s); //[hr=#ffffff] [hr=red] $s = preg_replace("/\\[hr=((#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])|([a-zA-z]+))\\]/i", "<hr color=\"\\1\"/>", $s); //[swf]http://somesite.com/test.swf[/swf] $s = preg_replace("/\\[swf\\]((www.|http:\\/\\/|https:\\/\\/)[^\\s]+(\\.swf))\\[\\/swf\\]/i", "<param name='movie' value='\\1'/><embed width='470' height='310' src='\\1'></embed>", $s); //[swf=http://somesite.com/test.swf] $s = preg_replace("/\\[swf=((www.|http:\\/\\/|https:\\/\\/)[^\\s]+(\\.swf))\\]/i", "<param name='movie' value='\\1'/><embed width='470' height='310' src='\\1'></embed>", $s); // Linebreaks $s = nl2br($s); // Maintain spacing $s = str_replace(" ", " ", $s); // Smilies require_once "smilies.php"; reset($smilies); while (list($code, $url) = each($smilies)) { $s = str_replace($code, '<img border="0" src="' . $site_config["SITEURL"] . '/images/smilies/' . $url . '" alt="' . $code . '" title="' . $code . '" />', $s); } if ($site_config["OLD_CENSOR"]) { $r = SQL_Query_exec("SELECT * FROM censor"); while ($rr = mysql_fetch_row($r)) { $s = preg_replace("/" . preg_quote($rr[0]) . "/i", $rr[1], $s); } } else { $f = @fopen("censor.txt", "r"); if ($f && filesize("censor.txt") != 0) { $bw = fread($f, filesize("censor.txt")); $badwords = explode("\n", $bw); for ($i = 0; $i < count($badwords); ++$i) { $badwords[$i] = trim($badwords[$i]); } $s = str_replace($badwords, "<img src='images/censored.png' border='0' alt='Censored' title='Censored' />", $s); } @fclose($f); } return $s; }
function format_comment($text, $strip_html = true) { global $smilies, $privatesmilies, $customsmilies, $TBDEV; // 09 Seeding Bonus by Bigjoos changed $s = $text; unset($text); // This fixes the extraneous ;) smilies problem. When there was an html escaped // char before a closing bracket - like >), "), ... - this would be encoded // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed // the ;) one, and replace all genuine ;) by :wink: before escaping the body. // (What took us so long? :blush:)- wyz $s = str_replace(";)", ":wink:", $s); if ($strip_html) { $s = htmlentities($s, ENT_QUOTES); } if (preg_match("#function\\s*\\((.*?)\\|\\|#is", $s)) { $s = str_replace(":", ":", $s); $s = str_replace("[", "[", $s); $s = str_replace("]", "]", $s); $s = str_replace(")", ")", $s); $s = str_replace("(", "(", $s); $s = str_replace("{", "{", $s); $s = str_replace("}", "}", $s); $s = str_replace("\$", "$", $s); } // [*] $s = preg_replace("/\\[\\*\\]/", "<li>", $s); // [b]Bold[/b] $s = preg_replace("/\\[b\\]((\\s|.)+?)\\[\\/b\\]/", "<b>\\1</b>", $s); // [i]Italic[/i] $s = preg_replace("/\\[i\\]((\\s|.)+?)\\[\\/i\\]/", "<i>\\1</i>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/", "<u>\\1</u>", $s); // [u]Underline[/u] $s = preg_replace("/\\[u\\]((\\s|.)+?)\\[\\/u\\]/i", "<u>\\1</u>", $s); // [img]http://www/image.gif[/img] $s = preg_replace("/\\[img\\](http:\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png)))\\[\\/img\\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s); // [img=http://www/image.gif] $s = preg_replace("/\\[img=(http:\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png)))\\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s); // [color=blue]Text[/color] $s = preg_replace("/\\[color=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color='\\1'>\\2</font>", $s); // [color=#ffcc99]Text[/color] $s = preg_replace("/\\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\\]((\\s|.)+?)\\[\\/color\\]/i", "<font color='\\1'>\\2</font>", $s); // [url=http://www.example.com]Text[/url] $s = preg_replace("/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/i", "<a href=\"\\1\">\\2</a>", $s); // [url]http://www.example.com[/url] $s = preg_replace("/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/i", "<a href=\"\\1\">\\1</a>", $s); // [size=4]Text[/size] $s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size='\\1'>\\2</font>", $s); // [font=Arial]Text[/font] $s = preg_replace("/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/i", "<font face=\"\\1\">\\2</font>", $s); // //[quote]Text[/quote] // $s = preg_replace( // "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", // "<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s); // //[quote=Author]Text[/quote] // $s = preg_replace( // "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", // "<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s); // Quotes $s = format_quotes($s); // URLs $s = format_urls($s); // $s = format_local_urls($s); // Linebreaks $s = nl2br($s); // [pre]Preformatted[/pre] $s = preg_replace("/\\[pre\\]((\\s|.)+?)\\[\\/pre\\]/i", "<tt><span style=\"white-space: nowrap;\">\\1</span></tt>", $s); // [nfo]NFO-preformatted[/nfo] $s = preg_replace("/\\[nfo\\]((\\s|.)+?)\\[\\/nfo\\]/i", "<tt><span style=\"white-space: nowrap;\"><font face='MS Linedraw' size='2' style='font-size: 10pt; line-height: " . "10pt'>\\1</font></span></tt>", $s); // Maintain spacing $s = str_replace(" ", " ", $s); // 09 Seeding Bonus by Bigjoos // start // modded by cybernet2u // support - http://bit.ly/8jd6WH // http://xList.ro/ // http://tbdev.xlist.ro/ foreach ($smilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } foreach ($privatesmilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } foreach ($customsmilies as $code => $url) { $s = str_replace($code, "<img border='0' src=\"{$TBDEV['pic_base_url']}smilies/{$url}\" alt=\"" . htmlspecialchars($code) . "\" />", $s); } return $s; //[align=(center|left|right|justify)]text[/align] $s = preg_replace("/\\[align=([a-zA-Z]+)\\]((\\s|.)+?)\\[\\/align\\]/i", "<div style=\"text-align:\\1\">\\2</div>", $s); //[s]strike[/s] $s = preg_replace("/\\[s\\]((\\s|.)+?)\\[\\/s\\]/i", "<s>\\1</s>", $s); //[mail]mail[/mail] $s = preg_replace("/\\[mail\\]((\\s|.)+?)\\[\\/mail\\]/i", "<a href=\"mailto:\\1\" targe=\"_blank\">\\1</a>", $s); }
function format_comment($text, $strip_html = true) { global $smilies, $privatesmilies, $pic_base_url; $smiliese = $smilies; $s = $text; // This fixes the extraneous ;) smilies problem. When there was an html escaped // char before a closing bracket - like >), "), ... - this would be encoded // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed // the ;) one, and replace all genuine ;) by :wink: before escaping the body. // (What took us so long? :blush:)- wyz $s = str_replace(";)", ":wink:", $s); $s = preg_replace_callback("#\\[code\\](.*?)\\[/code\\]#si", "code_nobb", $s); if ($strip_html) { $s = htmlspecialchars_uni($s); } $bb[] = "#\\[img\\](?!javascript:)([^?](?:[^\\[]+|\\[(?!url))*?)\\[/img\\]#i"; $html[] = "<img class=\"linked-image\" src=\"\\1\" border=\"0\" alt=\"\\1\" title=\"\\1\" />"; $bb[] = "#\\[img=([a-zA-Z]+)\\](?!javascript:)([^?](?:[^\\[]+|\\[(?!url))*?)\\[/img\\]#is"; $html[] = "<img class=\"linked-image\" src=\"\\2\" align=\"\\1\" border=\"0\" alt=\"\\2\" title=\"\\2\" />"; $bb[] = "#\\[img\\ alt=([a-zA-Zа-яА-Я0-9\\_\\-\\. ]+)\\](?!javascript:)([^?](?:[^\\[]+|\\[(?!url))*?)\\[/img\\]#is"; $html[] = "<img class=\"linked-image\" src=\"\\2\" align=\"\\1\" border=\"0\" alt=\"\\1\" title=\"\\1\" />"; $bb[] = "#\\[img=([a-zA-Z]+) alt=([a-zA-Zа-яА-Я0-9\\_\\-\\. ]+)\\](?!javascript:)([^?](?:[^\\[]+|\\[(?!url))*?)\\[/img\\]#is"; $html[] = "<img class=\"linked-image\" src=\"\\3\" align=\"\\1\" border=\"0\" alt=\"\\2\" title=\"\\2\" />"; $bb[] = "#\\[kp=([0-9]+)\\]#is"; $html[] = "<a href=\"http://www.kinopoisk.ru/level/1/film/\\1/\" rel=\"nofollow\"><img src=\"http://www.kinopoisk.ru/rating/\\1.gif/\" alt=\"Кинопоиск\" title=\"Кинопоиск\" border=\"0\" /></a>"; $bb[] = "#\\[url\\]([\\w]+?://([\\w\\#\$%&~/.\\-;:=,?@\\]+]+|\\[(?!url=))*?)\\[/url\\]#is"; $html[] = "<a href=\"\\1\" title=\"\\1\">\\1</a>"; $bb[] = "#\\[url\\]((www|ftp)\\.([\\w\\#\$%&~/.\\-;:=,?@\\]+]+|\\[(?!url=))*?)\\[/url\\]#is"; $html[] = "<a href=\"http://\\1\" title=\"\\1\">\\1</a>"; $bb[] = "#\\[url=([\\w]+?://[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*?)\\]([^?\n\r\t].*?)\\[/url\\]#is"; $html[] = "<a href=\"\\1\" title=\"\\1\">\\2</a>"; $bb[] = "#\\[url=((www|ftp)\\.[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*?)\\]([^?\n\r\t].*?)\\[/url\\]#is"; $html[] = "<a href=\"http://\\1\" title=\"\\1\">\\3</a>"; $bb[] = "/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/i"; $html[] = "<a href=\"\\1\">\\2</a>"; $bb[] = "/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/i"; $html[] = "<a href=\"\\1\">\\1</a>"; $bb[] = "#\\[mail\\](\\S+?)\\[/mail\\]#i"; $html[] = "<a href=\"mailto:\\1\">\\1</a>"; $bb[] = "#\\[mail\\s*=\\s*([\\.\\w\\-]+\\@[\\.\\w\\-]+\\.[\\w\\-]+)\\s*\\](.*?)\\[\\/mail\\]#i"; $html[] = "<a href=\"mailto:\\1\">\\2</a>"; $bb[] = "#\\[color=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/color\\]#si"; $html[] = "<span style=\"color: \\1\">\\2</span>"; $bb[] = "#\\[(font|family)=([A-Za-z ]+)\\](.*?)\\[/\\1\\]#si"; $html[] = "<span style=\"font-family: \\2\">\\3</span>"; $bb[] = "#\\[size=([0-9]+)\\](.*?)\\[/size\\]#si"; $html[] = "<span style=\"font-size: \\1\">\\2</span>"; $bb[] = "#\\[(left|right|center|justify)\\](.*?)\\[/\\1\\]#is"; $html[] = "<div align=\"\\1\">\\2</div>"; $bb[] = "#\\[b\\](.*?)\\[/b\\]#si"; $html[] = "<b>\\1</b>"; $bb[] = "#\\[i\\](.*?)\\[/i\\]#si"; $html[] = "<i>\\1</i>"; $bb[] = "#\\[u\\](.*?)\\[/u\\]#si"; $html[] = "<u>\\1</u>"; $bb[] = "#\\[s\\](.*?)\\[/s\\]#si"; $html[] = "<s>\\1</s>"; $bb[] = "#\\[li\\]#si"; $html[] = "<li>"; $bb[] = "#\\[hr\\]#si"; $html[] = "<hr>"; $bb[] = "#\\[youtube=([[:alnum:]]+)\\]#si"; $html[] = '<iframe width="640" height="360" src="//www.youtube.com/embed/\\1?rel=0" frameborder="0" allowfullscreen></iframe>'; $s = preg_replace($bb, $html, $s); // Linebreaks $s = nl2br($s); // URLs $s = format_urls($s); //$s = format_local_urls($s); // Maintain spacing //$s = str_replace(" ", " ", $s); foreach ($smiliese as $code => $url) { $s = str_replace($code, "<img border=\"0\" src=\"{$pic_base_url}/smilies/{$url}\">", $s); } foreach ($privatesmilies as $code => $url) { $s = str_replace($code, "<img border=\"0\" src=\"{$pic_base_url}/smilies/{$url}\">", $s); } while (preg_match("#\\[quote\\](.*?)\\[/quote\\]#si", $s)) { $s = encode_quote($s); } while (preg_match("#\\[quote=(.+?)\\](.*?)\\[/quote\\]#si", $s)) { $s = encode_quote_from($s); } while (preg_match("#\\[hide\\](.*?)\\[/hide\\]#si", $s)) { $s = encode_spoiler($s); } while (preg_match("#\\[hide=(.+?)\\](.*?)\\[/hide\\]#si", $s)) { $s = encode_spoiler_from($s); } if (preg_match("#\\[code\\](.*?)\\[/code\\]#si", $s)) { $s = encode_code($s); } if (preg_match("#\\[php\\](.*?)\\[/php\\]#si", $s)) { $s = encode_php($s); } return $s; }
function format_comment($text, $strip_html = true, $xssclean = false, $newtab = false, $imageresizer = true, $image_max_width = 700, $enableimage = true, $enableflash = true, $imagenum = -1, $image_max_height = 0, $adid = 0) { global $lang_functions; global $CURUSER, $SITENAME, $BASEURL, $enableattach_attachment; global $tempCode, $tempCodeCount; $tempCode = array(); $tempCodeCount = 0; $imageresizer = $imageresizer ? 1 : 0; $s = $text; if ($strip_html) { $s = htmlspecialchars($s); } // Linebreaks $s = nl2br($s); if (strpos($s, "[code]") !== false && strpos($s, "[/code]") !== false) { $s = preg_replace("/\\[code\\](.+?)\\[\\/code\\]/eis", "formatCode('\\1')", $s); } $originalBbTagArray = array('[siteurl]', '[site]', '[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[pre]', '[/pre]', '[/color]', '[/font]', '[/size]', " "); $replaceXhtmlTagArray = array(get_protocol_prefix() . $BASEURL, $SITENAME, '<img class="listicon listitem" src="pic/trans.gif" alt="list" />', '<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<pre>', '</pre>', '</span>', '</font>', '</font>', ' '); $s = str_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); $originalBbTagArray = array("/\\[font=([^\\[\\(&\\;]+?)\\]/is", "/\\[color=([#0-9a-z]{1,15})\\]/is", "/\\[color=([a-z]+)\\]/is", "/\\[size=([1-7])\\]/is"); $replaceXhtmlTagArray = array("<font face=\"\\1\">", "<span style=\"color: \\1;\">", "<span style=\"color: \\1;\">", "<font size=\"\\1\">"); $s = preg_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); if ($enableattach_attachment == 'yes' && $imagenum != 1) { $limit = 20; $s = preg_replace("/\\[attach\\]([0-9a-zA-z][0-9a-zA-z]*)\\[\\/attach\\]/ies", "print_attachment('\\1', " . ($enableimage ? 1 : 0) . ", " . ($imageresizer ? 1 : 0) . ")", $s, $limit); } if ($enableimage) { $s = preg_replace("/\\[img\\]([^\\<\r\n\"']+?)\\[\\/img\\]/ei", "formatImg('\\1'," . $imageresizer . "," . $image_max_width . "," . $image_max_height . ")", $s, $imagenum, $imgReplaceCount); $s = preg_replace("/\\[img=([^\\<\r\n\"']+?)\\]/ei", "formatImg('\\1'," . $imageresizer . "," . $image_max_width . "," . $image_max_height . ")", $s, $imagenum != -1 ? max($imagenum - $imgReplaceCount, 0) : -1); } else { $s = preg_replace("/\\[img\\]([^\\<\r\n\"']+?)\\[\\/img\\]/i", '', $s, -1); $s = preg_replace("/\\[img=([^\\<\r\n\"']+?)\\]/i", '', $s, -1); } // [flash,500,400]http://www/image.swf[/flash] if (strpos($s, "[flash") !== false) { //flash is not often used. Better check if it exist before hand if ($enableflash) { $s = preg_replace("/\\[flash(\\,([1-9][0-9]*)\\,([1-9][0-9]*))?\\]((http|ftp):\\/\\/[^\\s'\"<>]+(\\.(swf)))\\[\\/flash\\]/ei", "formatFlash('\\4', '\\2', '\\3')", $s); } else { $s = preg_replace("/\\[flash(\\,([1-9][0-9]*)\\,([1-9][0-9]*))?\\]((http|ftp):\\/\\/[^\\s'\"<>]+(\\.(swf)))\\[\\/flash\\]/i", '', $s); } } //[flv,320,240]http://www/a.flv[/flv] if (strpos($s, "[flv") !== false) { //flv is not often used. Better check if it exist before hand if ($enableflash) { $s = preg_replace("/\\[flv(\\,([1-9][0-9]*)\\,([1-9][0-9]*))?\\]((http|ftp):\\/\\/[^\\s'\"<>]+(\\.(flv)))\\[\\/flv\\]/ei", "formatFlv('\\4', '\\2', '\\3')", $s); } else { $s = preg_replace("/\\[flv(\\,([1-9][0-9]*)\\,([1-9][0-9]*))?\\]((http|ftp):\\/\\/[^\\s'\"<>]+(\\.(flv)))\\[\\/flv\\]/i", '', $s); } } // [url=http://www.example.com]Text[/url] if ($adid) { $s = preg_replace("/\\[url=([^\\[\\s]+?)\\](.+?)\\[\\/url\\]/ei", "formatAdUrl(" . $adid . " ,'\\1', '\\2', " . ($newtab == true ? 1 : 0) . ", 'faqlink')", $s); } else { $s = preg_replace("/\\[url=([^\\[\\s]+?)\\](.+?)\\[\\/url\\]/ei", "formatUrl('\\1', " . ($newtab == true ? 1 : 0) . ", '\\2', 'faqlink')", $s); } // [url]http://www.example.com[/url] $s = preg_replace("/\\[url\\]([^\\[\\s]+?)\\[\\/url\\]/ei", "formatUrl('\\1', " . ($newtab == true ? 1 : 0) . ", '', 'faqlink')", $s); $s = format_urls($s, $newtab); // Quotes if (strpos($s, "[quote") !== false && strpos($s, "[/quote]") !== false) { //format_quote is kind of slow. Better check if [quote] exists beforehand $s = format_quotes($s); } $s = preg_replace("/\\[em([1-9][0-9]*)\\]/ie", "(\\1 < 192 ? '<img src=\"pic/smilies/\\1.gif\" alt=\"[em\\1]\" />' : '[em\\1]')", $s); reset($tempCode); $j = 0; while (count($tempCode) || $j > 5) { foreach ($tempCode as $key => $code) { $s = str_replace("<tempCode_{$key}>", $code, $s, $count); if ($count) { unset($tempCode[$key]); $i = $i + $count; } } $j++; } return $s; }
$r = sql_query("SELECT id FROM blocks WHERE userid={$user['id']} AND blockid={$CURUSER['id']}") or sqlerr(__FILE__, __LINE__); $showpmbutton = mysql_num_rows($r) == 1 ? 0 : 1; } elseif ($user["acceptpms"] == "friends") { $r = sql_query("SELECT id FROM friends WHERE userid={$user['id']} AND friendid={$CURUSER['id']}") or sqlerr(__FILE__, __LINE__); $showpmbutton = mysql_num_rows($r) == 1 ? 1 : 0; } } if (isset($showpmbutton)) { $HTMLOUT .= "<tr>\r\n <td colspan='2' align='center'>\r\n <form method='get' action='sendmessage.php'>\r\n <input type='hidden' name='receiver' value='{$user["id"]}' />\r\n <input type='submit' value='{$lang['userdetails_msg_btn']}' class='btn' />\r\n </form>\r\n </td></tr>"; } //==Report User $HTMLOUT .= tr("Report User", "<form method='post' action='report.php?type=User&id={$id}'><input type='submit' value='Report User' class='button' /> Click to Report this user for Breaking the rules.</form>", 1); //==End if ($user['paranoia'] < 1 || $CURUSER['id'] == $id || $CURUSER['class'] >= UC_STAFF) { if (isset($user['last_status'])) { $HTMLOUT .= "<tr valign='top'><td class='rowhead'>Status</td><td align='left'>" . format_urls($user['last_status']) . "<br/><small>added " . get_date($user['last_update'], '', 0, 1) . "</small></td></tr>\n"; } } $HTMLOUT .= "</table>\n"; $HTMLOUT .= "<script type='text/javascript'>\r\n /*<![CDATA[*/\r\n function togglepic(bu, picid, formid){\r\n\t var pic = document.getElementById(picid);\r\n\t var form = document.getElementById(formid);\r\n\t\r\n\t if(pic.src == bu + '/pic/plus.gif')\t{\r\n\t\tpic.src = bu + '/pic/minus.gif';\r\n\t\tform.value = 'minus';\r\n\t }else{\r\n\t\tpic.src = bu + '/pic/plus.gif';\r\n\t\tform.value = 'plus';\r\n\t }\r\n }\r\n /*]]>*/\r\n </script>"; if ($CURUSER['class'] >= UC_STAFF && $user["class"] < $CURUSER['class']) { $HTMLOUT .= begin_frame("Edit User", true); $HTMLOUT .= "<form method='post' action='modtask.php'>\n"; require_once CLASS_DIR . 'validator.php'; $HTMLOUT .= validatorForm("ModTask_{$user['id']}"); $HTMLOUT .= "<input type='hidden' name='action' value='edituser' />\n"; $HTMLOUT .= "<input type='hidden' name='userid' value='{$id}' />\n"; $HTMLOUT .= "<input type='hidden' name='returnto' value='userdetails.php?id={$id}' />\n"; $HTMLOUT .= "\r\n <table class='main' border='1' cellspacing='0' cellpadding='5'>\n"; $HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_title']}</td><td colspan='2' align='left'><input type='text' size='60' name='title' value='" . htmlspecialchars($user['title']) . "' /></td></tr>\n"; $avatar = htmlspecialchars($user["avatar"]);
require_once __DIR__ . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'bittorrent.php'; require_once INCL_DIR . 'user_functions.php'; require_once INCL_DIR . 'bbcode_functions.php'; dbconn(false); loggedinorreturn(); $lang = array_merge(load_language('global'), load_language('viewnfo')); /* $stdhead = array( /** include css **/ /* 'css' => array( 'viewnfo' ) ); */ $id = (int) $_GET["id"]; if ($CURUSER['class'] < UC_POWER_USER || !is_valid_id($id)) { die; } $r = sql_query("SELECT name, nfo FROM torrents WHERE id=" . sqlesc($id)) or sqlerr(__FILE__, __LINE__); $a = mysqli_fetch_assoc($r) or die("{$lang['text_puke']}"); $HTMLOUT = ''; $HTMLOUT .= "\n<div class='row'>\n<div class='col-md-12 text-center'><h2>{$lang['text_nfofor']}<a href='{$INSTALLER09['baseurl']}/details.php?id={$id}'>" . htmlsafechars($a['name']) . "</a></h2></div>\n<div class='col-md-12 text-center'><h2>{$lang['text_forbest']}<a href='ftp://{$_SERVER['HTTP_HOST']}/misc/linedraw.ttf'>{$lang['text_linedraw']}</a>{$lang['text_font']}</h2></div>\n<div class='row'><div class='col-md-12'>\n<table class='table table-bordered'>\n<tr>\n<td class='text'>\n"; $HTMLOUT .= " <pre>" . format_urls(htmlsafechars($a['nfo'])) . "</pre>\n"; $HTMLOUT .= " </td>\n</tr>\n</table>\n"; $HTMLOUT .= " </div>\n</div></div>"; // , true, $stdhead echo stdhead($lang['text_stdhead']) . $HTMLOUT . stdfoot(); ?>
function format_comment($text, $strip_html = true) { global $smilies; $s = $text; unset($text); $s = str_replace(";)", ":wink:", $s); if ($strip_html) { $s = htmlentities($s, ENT_QUOTES, 'UTF-8'); } $f = @fopen("badwords.txt", "r"); if ($f && filesize("badwords.txt") != 0) { $bw = fread($f, filesize("badwords.txt")); $badwords = explode("\n", $bw); for ($i = 0; $i < count($badwords); ++$i) { $badwords[$i] = trim($badwords[$i]); } $s = str_replace($badwords, "*Censored*", $s); } @fclose($f); if (preg_match("#function\\s*\\((.*?)\\|\\|#is", $s)) { $s = str_replace(":", ":", $s); $s = str_replace("[", "[", $s); $s = str_replace("]", "]", $s); $s = str_replace(")", ")", $s); $s = str_replace("(", "(", $s); $s = str_replace("{", "{", $s); $s = str_replace("}", "}", $s); $s = str_replace("\$", "$", $s); } //-- [*] --// if (utf8::stripos($s, '[*]') !== false) { $s = preg_replace("/\\[\\*\\]/", "<img src=\"images/list.gif\" alt=\"List\" title=\"List\" class=\"listitem\" />", $s); } //-- [b]Bold[/b] --// if (utf8::stripos($s, '[b]') !== false) { $s = preg_replace('/\\[b\\](.+?)\\[\\/b\\]/is', "<span style='font-weight:bold;'>\\1</span>", $s); } //-- [i]Italic[/i] --// if (utf8::stripos($s, '[i]') !== false) { $s = preg_replace('/\\[i\\](.+?)\\[\\/i\\]/is', "<span style='font-style: italic;'>\\1</span>", $s); } //-- [u]Underline[/u] --// if (utf8::stripos($s, '[u]') !== false) { $s = preg_replace('/\\[u\\](.+?)\\[\\/u\\]/is', "<span style='text-decoration:underline;'>\\1</span>", $s); } //-- [color=blue]Text[/color] --// if (utf8::stripos($s, '[color=') !== false) { $s = preg_replace('/\\[color=([a-zA-Z]+)\\](.+?)\\[\\/color\\]/is', '<span style="color: \\1">\\2</span>', $s); //-- [color=#ffcc99]Text[/color] --// $s = preg_replace('/\\[color=(#[a-f0-9]{6})\\](.+?)\\[\\/color\\]/is', '<span style="color: \\1">\\2</span>', $s); } //-- Media Tag --// if (utf8::stripos($s, '[media=') !== false) { $s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|imdb)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s); $s = preg_replace("#\\[media=(youtube|liveleak|GameTrailers|vimeo)\\](.+?)\\[/media\\]#ies", "_MediaTag('\\2','\\1')", $s); } //-- Img Using Lightbox --// //-- [img=http://www/image.gif] --// if (utf8::stripos($s, '[img') !== false) { $s = preg_replace("/\\[img\\]((http|https):\\/\\/[^\\s'\"<>]+(\\.(jpg|gif|png|bmp|jpeg)))\\[\\/img\\]/i", "<img src=\"\\1\" alt=\"\" />", $s); $s = preg_replace("/\\[img=((http|https):\\/\\/[^\\s'\"<>]+(\\.(gif|jpg|png|bmp|jpeg)))\\]/i", "<img src=\"\\1\" alt=\"\" />", $s); } //-- [size=4]Text[/size] --// if (utf8::stripos($s, '[size=') !== false) { $s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size=\\1>\\2</font>", $s); } //-- [font=Arial]Text[/font] --// if (utf8::stripos($s, '[face=') !== false) { $s = preg_replace('/\\[face=([a-zA-Z ,]+)\\](.+?)\\[\\/face\\]/is', '<span style="font-family: \\1">\\2</span>', $s); } //-- [s]Stroke[/s] --// if (utf8::stripos($s, '[s]') !== false) { $s = preg_replace("/\\[s\\](.+?)\\[\\/s\\]/is", "<s>\\1</s>", $s); } //-- Dynamic Vars --// //-- [Spoiler]TEXT[/Spoiler] --// if (utf8::stripos($s, '[spoiler]') !== false) { $s = preg_replace("/\\[spoiler\\](.+?)\\[\\/spoiler\\]/is", "<div class=\"smallfont\" align=\"left\"><input type=\"button\" value=\"Show\" style=\"width:75px;font-size:10px;margin:0px;padding:0px;\" onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') {this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }\" /><div style=\"margin: 10px; padding: 10px; border: 1px inset;\" align=\"left\"><div style=\"display: none;\">\\1</div></div></div>", $s); } //-- [mcom]Text[/mcom] --// if (utf8::stripos($s, '[mcom]') !== false) { $s = preg_replace("/\\[mcom\\](.+?)\\[\\/mcom\\]/is", "<div style=\"font-size: 18pt; line-height: 50%;\"><div style=\"border-color: red; background-color: red; color: white; text-align: center; font-weight: bold; font-size: large;\"><strong>\\1</strong></div></div>", $s); } //-- The [you] Tag --// if (utf8::stripos($s, '[you]') !== false) { $s = preg_replace("/\\[you\\]/i", user::$current['username'], $s); } //-- [mail]Mail[/mail] --// if (stripos($s, '[mail]') !== false) { $s = preg_replace("/\\[mail\\](.+?)\\[\\/mail\\]/is", "<a href=\"mailto:\\1\" target=\"_blank\">\\1</a>", $s); } //--[Align=(center|left|right|justify)]Text[/align] --// if (utf8::stripos($s, '[align=') !== false) { $s = preg_replace("/\\[align=([a-zA-Z]+)\\](.+?)\\[\\/align\\]/is", "<div style=\"text-align:\\1\">\\2</div>", $s); } //-- Quotes --// $s = format_quotes($s); //-- URLs --// $s = format_urls($s); if (utf8::stripos($s, '[url') !== false) { //-- [url=http://www.example.com]Text[/url] --// $s = preg_replace("/\\[url=([^()<>\\s]+?)\\]((\\s|.)+?)\\[\\/url\\]/i", "<a target=_blank href=redir.php?url=\\1>\\2</a>", $s); //-- [url]http://www.example.com[/url] --// $s = preg_replace("/\\[url\\]([^()<>\\s]+?)\\[\\/url\\]/i", "<a target=_blank href=redir.php?url=\\1>\\1</a>", $s); } //-- Linebreaks --// $s = nl2br($s); //-- [pre]Preformatted[/pre] --// if (utf8::stripos($s, '[pre]') !== false) { $s = preg_replace("/\\[pre\\](.+?)\\[\\/pre\\]/is", "<tt><span style=\"white-space: nowrap;\">\\1</span></tt>", $s); } //-- [nfo]NFO-preformatted[/nfo] --// if (utf8::stripos($s, '[nfo]') !== false) { $s = preg_replace("/\\[nfo\\](.+?)\\[\\/nfo\\]/i", "<tt><span style=\"white-space: nowrap;\"><font face='MS Linedraw' size='2' style='font-size: 10pt; line-height: " . "10pt'>\\1</font></span></tt>", $s); } //-- Maintain Spacing --// $s = str_replace(utf8::NBSP, ' ', $s); $s = str_replace(' ', ' ' . utf8::NBSP, $s); reset($smilies); while (list($code, $url) = each($smilies)) { $s = str_replace($code, "<img src='images/smilies/{$url}' border='0' alt='" . security::html_safe($code) . "' title='" . security::html_safe($code) . "' />", $s); } return $s; }
function format_comment($text, $strip_html = true) { global $smilies, $privatesmilies; $s = $text; if ($strip_html) $s = htmlspecialchars($s); // Quotes $s = format_quotes($s); // [nfo]NFO-preformatted[/nfo] $s = preg_replace("/\[nfo\]((\s|.)+?)\[\/nfo\]/i", "<tt><nobr><font face=\"MS Linedraw\" size=\"2\" style=\"font-size: 10pt; line-height: ". "10pt\">\\1</font></nobr></tt>", $s); //[CODE]stuff[ /CODE] $s = preg_replace("/\[CODE\]\s*((\s|.)+?)\s*\[\/CODE\]\s*/i","<p class=sub><b>Kóði:</b></p><table class=\"main\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\"><tr><td style=\"border: 1px black dotted\"><PRE><CODE CLASS=\"PHP\">\\1</CODE></PRE></td></tr></table><br />", $s); // [*] $s = preg_replace("/\[\*\]/", "<li>", $s); // [b]Bold[/b] $s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\\1</b>", $s); // [i]Italic[/i] $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\\1</i>", $s); // [u]Underline[/u] $s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\\1</u>", $s); // [u]Underline[/u] $s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/i", "<u>\\1</u>", $s); // [img]http://www/image.gif[/img] $s = preg_replace("/\[img\](http:\/\/torrent\.is\/myndir\.php\?id=[0-9](.*))\[\/img\]/i", "<img border=\"0\" src=\"\\1\">", $s); $s = preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "<img border=\"0\" src=\"\\1\">", $s); // [img=http://www/image.gif] $s = preg_replace("/\[img=(http:\/\/torrent\.is\/myndir\.php\?id\=[0-9](.*))]/i", "<img border=\"0\" src=\"\\1\">", $s); $s = preg_replace("/\[img=(http:\/\/[^\s'\"<>]+(\.(gif|jpg|png)))\]/i", "<img border=\"0\" src=\"\\1\">", $s); // [color=blue]Text[/color] $s = preg_replace( "/\[color=([a-zA-Z]+)\]((\s|.)+?)\[\/color\]/i", "<font color=\\1>\\2</font>", $s); // [color=#ffcc99]Text[/color] $s = preg_replace( "/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/i", "<font color=\\1>\\2</font>", $s); // [url=http://www.example.com]Text[/url] $s = preg_replace( "/\[url=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i", "<a href=\"\\1\">\\2</a>", $s); // [url]http://www.example.com[/url] $s = preg_replace( "/\[url\]([^()<>\s]+?)\[\/url\]/i", "<a href=\"\\1\">\\1</a>", $s); // [size=4]Text[/size] $s = preg_replace( "/\[size=([1-7])\]((\s|.)+?)\[\/size\]/i", "<font size=\\1>\\2</font>", $s); // [font=Arial]Text[/font] $s = preg_replace( "/\[font=([a-zA-Z ,]+)\]((\s|.)+?)\[\/font\]/i", "<font face=\"\\1\">\\2</font>", $s); // //[quote]Text[/quote] // $s = preg_replace( // "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", // "<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s); // //[quote=Author]Text[/quote] // $s = preg_replace( // "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i", // "<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s); // URLs $s = format_urls($s); // $s = format_local_urls($s); // Linebreaks $s = nl2br($s); // [pre]Preformatted[/pre] $s = preg_replace("/\[pre\]((\s|.)+?)\[\/pre\]/i", "<tt><nobr>\\1</nobr></tt>", $s); // Maintain spacing $s = str_replace(" ", " ", $s); // [hr] $s = str_replace ("[hr]", "<hr>", $s); // [center] $s = preg_replace("/\[center\]((\s|.)+?)\[\/center\]/i", "<div align='center'><tt><nobr><font face='Verdana' size=2 style='font-size: 10pt; line-height: " . "10pt'>\\1</font></nobr></tt></div>", $s); reset($smilies); while (list($code, $url) = each($smilies)) $s = str_replace($code, "<img border=0 src=\"/pic/smilies/$url\" alt=\"" . htmlspecialchars($code) . "\">", $s); reset($privatesmilies); while (list($code, $url) = each($privatesmilies)) $s = str_replace($code, "<img border=0 src=\"/pic/smilies/$url\" alt=\"" . htmlspecialchars($code) . "\">", $s); if (stristr("$s", '<PRE><CODE CLASS="PHP">')) return $s; return $s; }