just taken from here : [url="http://www.torrenttrader.org/index.php?/topic/12808-new-textbbcode-function/page__hl__bbcode"]http://www.torrentt...age__hl__bbcode[/url]
cleaned and some adds
function.php
find
function format_urls($s){
.......................
.......................
}
change for
function format_urls($s){
return preg_replace(
"/(A|[^=]'"a-zA-Z0-9])((http|ftp|https|ftps|irc|www|blog|wiki|forum|forums)://[^<>s]+)/i",
"1<a href='http://kpaste.net/redir/2' target='_blank'>2</a>", $s);
}find
function format_comment($text) {
....................
....................
....................
}
change for
function format_comment($text) {
global $site_config, $smilies;
$s = $text;
$s = htmlspecialchars($s);
$s = format_urls($s);
//$s = preg_replace("/ /", "<li>", $s);
// Bold
$s = preg_replace("/((s|.)+?)/", "<b>1</b>", $s);
// Italic
$s = preg_replace("/((s|.)+?)/", "<i>1</i>", $s);
// Underline
$s = preg_replace("/((s|.)+?)/", "<u>1</u>", $s);
// Underline
$s = preg_replace("/((s|.)+?)/i", "<u>1</u>", $s);
//
$s = preg_replace("/+(.(gif|jpg|png)))]/i", "<img border='0' src='1' alt='' />", $s);
//
$s = preg_replace("/+(.(gif|jpg|png)))]/i", "<img src='1' alt='' />", $s);
// [imgw]http://www/image.gif[/imgw]
$s = preg_replace("/[imgw]((http|https)://[^s'"<>]+(.(jpg|gif|png)))[/imgw]/i","<a class='light' target='_blank' href='1'><img width='240' src='1' alt='' /></a><br /><font size='1' color='#FF2000' style='margin-left:5px'>Cliquez sur l'image pour la voir en taille réelle</font>", $s);
// [imgw=http://www/image.gif]
$s = preg_replace("/[imgw=((http|https)://[^s'"<>]+(.(jpg|gif|png)))]/i",
"<a class='light' target='_blank' href='1'><img width='240' src='1' alt='' /></a><br /><font size='1' color='#FF2000' style='margin-left:5px'>Cliquer sur l'image pour la voir en taille réelle.</font>", $s);
// Text
$s = preg_replace("/+)]((s|.)+?)/i", "<font color='1'>2</font>", $s);
// Text
$s = preg_replace("/[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])]((s|.)+?)/i", "<font color='1'>2</font>", $s);
// [url="http://www.example.com"]Text[/url]
$s = preg_replace("/[url="((http%7Cftp%7Chttps%7Cftps%7Circ%7Cwww%7Cblog%7Cwiki%7Cforum%7Cforums)%3A//%5B%5E"]+?)]((s|.)+?)[/url]/i",
"<a href='http://kpaste.net/redir/1' target='_blank'>3</a>", $s);
// [url="%7Boption%7D"]http://www.example.com[/url]
$s = preg_replace("/[url="%7Boption%7D"]((http|ftp|https|ftps|irc|www|blog|wiki|forum|forums)://[^<>s]+?)[/url]/i",
"<a href='http://kpaste.net/redir/1' target='_blank'>1</a>", $s);
// [size=14px]Text[/size]
$s = preg_replace("/)]((s|.)+?)/i", "<font size='1'>2</font>", $s);
// Text
$s = preg_replace("/+)]((s|.)+?)/i", "<font face='1'>2</font>", $s);
//
[spoiler]
[/spoiler]
[spoiler]
[/spoiler]
[spoiler]
[/spoiler]
[spoiler]
[/spoiler]
[spoiler]
[/spoiler]
[spoiler]
[/spoiler]
in each theme you have put this in theme.css & change colors to adapt
/* === Start BB_codes === */
.bb_holder {
border-collapse:collapse;
background:#ccc;
}
.bb_icon, .bb_icon:hover {
background:#999999;
border:1px solid #666666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
padding:1px;
min-width:16px;
cursor:pointer;
}
.bb_icon:hover {
border: 1px solid #dddddd;
}
/* === End BB_codes === */change bbcode.php with attach file
bbcodes button can be find on nikkbu's site [url="http://nikkbu.info/download.php?list.20"]http://nikkbu.info/download.php?list.20[/url]
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6606"]bbcode.php[/url]
[url="http://www.imagup.com/data/1176555532.html"]
[/url]
cleaned and some adds
function.php
find
function format_urls($s){
.......................
.......................
}
change for
function format_urls($s){
return preg_replace(
"/(A|[^=]'"a-zA-Z0-9])((http|ftp|https|ftps|irc|www|blog|wiki|forum|forums)://[^<>s]+)/i",
"1<a href='http://kpaste.net/redir/2' target='_blank'>2</a>", $s);
}find
function format_comment($text) {
....................
....................
....................
}
change for
function format_comment($text) {
global $site_config, $smilies;
$s = $text;
$s = htmlspecialchars($s);
$s = format_urls($s);
//
// Bold
$s = preg_replace("/((s|.)+?)/", "<b>1</b>", $s);
// Italic
$s = preg_replace("/((s|.)+?)/", "<i>1</i>", $s);
// Underline
$s = preg_replace("/((s|.)+?)/", "<u>1</u>", $s);
// Underline
$s = preg_replace("/((s|.)+?)/i", "<u>1</u>", $s);
//
$s = preg_replace("/+(.(gif|jpg|png)))]/i", "<img border='0' src='1' alt='' />", $s);
//
$s = preg_replace("/+(.(gif|jpg|png)))]/i", "<img src='1' alt='' />", $s);
// [imgw]http://www/image.gif[/imgw]
$s = preg_replace("/[imgw]((http|https)://[^s'"<>]+(.(jpg|gif|png)))[/imgw]/i","<a class='light' target='_blank' href='1'><img width='240' src='1' alt='' /></a><br /><font size='1' color='#FF2000' style='margin-left:5px'>Cliquez sur l'image pour la voir en taille réelle</font>", $s);
// [imgw=http://www/image.gif]
$s = preg_replace("/[imgw=((http|https)://[^s'"<>]+(.(jpg|gif|png)))]/i",
"<a class='light' target='_blank' href='1'><img width='240' src='1' alt='' /></a><br /><font size='1' color='#FF2000' style='margin-left:5px'>Cliquer sur l'image pour la voir en taille réelle.</font>", $s);
// Text
$s = preg_replace("/+)]((s|.)+?)/i", "<font color='1'>2</font>", $s);
// Text
$s = preg_replace("/[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])]((s|.)+?)/i", "<font color='1'>2</font>", $s);
// [url="http://www.example.com"]Text[/url]
$s = preg_replace("/[url="((http%7Cftp%7Chttps%7Cftps%7Circ%7Cwww%7Cblog%7Cwiki%7Cforum%7Cforums)%3A//%5B%5E"]+?)]((s|.)+?)[/url]/i",
"<a href='http://kpaste.net/redir/1' target='_blank'>3</a>", $s);
// [url="%7Boption%7D"]http://www.example.com[/url]
$s = preg_replace("/[url="%7Boption%7D"]((http|ftp|https|ftps|irc|www|blog|wiki|forum|forums)://[^<>s]+?)[/url]/i",
"<a href='http://kpaste.net/redir/1' target='_blank'>1</a>", $s);
// [size=14px]Text[/size]
$s = preg_replace("/)]((s|.)+?)/i", "<font size='1'>2</font>", $s);
// Text
$s = preg_replace("/+)]((s|.)+?)/i", "<font face='1'>2</font>", $s);
//
5451926149dbbf788b81e0d49afaaaf0:Text
while (preg_match("/5451926149dbbf788b81e0d49afaaaf0:s*((s|.)+?)s*
s*/i", $s))
$s = preg_replace("/5451926149dbbf788b81e0d49afaaaf0:s*((s|.)+?)s*
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);
//Author:Text
while (preg_match("/(.+?):s*((s|.)+?)s*
s*/i", $s))
$s = preg_replace("/(.+?):s*((s|.)+?)s*
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]
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++;
}
//Text[/code ]
$s = preg_replace("/[code]s*((s|.)+?)s*s*/i",
"<p class='sub'><b>Code:</b></p><table class='main' border='1' cellspacing='0' cellpadding='10'><tr><td style='border: 1px black dotted'>1</td></tr></table><br />", $s);
// defilement
$s = preg_replace("/((s|.)+?)/", "<marquee>1</marquee>", $s);
// [blink]clignotement[/blink]
$s = preg_replace("/[blink]((s|.)+?)[/blink]/", "<blink>1</blink>", $s);
// Text
$s = preg_replace("/((s|.)+?)/", "<center>1</center>", $s);
//[align=(left, center, right, justify)]Text[/align]
$s = preg_replace("/[align=([a-zA-Z]+)]((s|.)+?)[/align]/i","<div style='text-align:1'>2</div>", $s);
//
$s = preg_replace("//i", "<hr />", $s);
//
$s = preg_replace("/[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='640' height='480' 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='640' height='480' src='1'></embed>", $s);
//[swf width=XXX heigth=XXX]swf[/swf]
$s = preg_replace("/[swf (.*?),(.*?)]((www.|http://|https://)[^s]+(.swf))[/swf]/i",
"<param name='movie' value='3'/><embed width='1' height='2' src='3'></embed>", $s);
//YouTube Video URL
$s = preg_replace("/[^s'"<>]*youtube.com.*v=([^s'"<>]+)/ims",
"<object width='640' height='480'>
<param name='movie' value='http://www.youtube.com/watch?v=1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.youtube.com/watch?v=1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='640' height='480'></embed>
</object>", $s);
//Dailymotion Video URL
$s = preg_replace("/[^s'"<>]*dailymotion.com/video/([^s'"<>]+)/ims",
"<object width='640' height='480'>
<param name='movie' value='http://www.dailymotion.com/swf/1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'>
<embed src='http://www.dailymotion.com/swf/1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='640' height='480'></embed>
</object>", $s);
// YouTube Video
$s = preg_replace("/*youtube.com.*v=([^s'"<>]+)]/ims",
"<object width='640' height='480'>
<param name='movie' value='http://www.youtube.com/watch?v=1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.youtube.com/watch?v=1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='640' height='480'></embed>
</object>", $s);
// Dailymotion Video
$s = preg_replace("/*dailymotion.com/video/([^s'"<>]+)]/ims",
"<object width='640' height='480'>
<param name='movie' value='http://www.dailymotion.com/swf/1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.dailymotion.com/swf/1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='640' height='480'></embed>
</object>", $s);
//YouTube Small Video
$s = preg_replace("/[videow][^s'"<>]*youtube.com.*v=([^s'"<>]+)[/videow]/ims",
"<object width='320' height='240'>
<param name='movie' value='http://www.youtube.com/watch?v=1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.youtube.com/watch?v=1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='320' height='240'></embed>
</object>", $s);
//Dailymotion Small Video
$s = preg_replace("/[videow][^s'"<>]*dailymotion.com/video/([^s'"<>]+)[/videow]/ims",
"<object width='320' height='240'>
<param name='movie' value='http://www.dailymotion.com/swf/1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.dailymotion.com/swf/1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='320' height='240'></embed>
</object>", $s);
// YouTube Small Video [videow=URL]
$s = preg_replace("/[videow=[^s'"<>]*youtube.com.*v=([^s'"<>]+)]/ims",
"<object width='320' height='240'>
<param name='movie' value='http://www.youtube.com/watch?v=1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.youtube.com/watch?v=1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='320' height='240'></embed>
</object>", $s);
// Dailymotiion Small Video [videow=URL]
$s = preg_replace("/[videow=[^s'"<>]*dailymotion.com/video/([^s'"<>]+)]/ims",
"<object width='320' height='240'>
<param name='movie' value='http://www.dailymotion.com/swf/1'></param>
<param name='allowscriptaccess' value='never'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowNetworking' value='internal'></param>
<embed src='http://www.dailymotion.com/swf/1' type='application/x-shockwave-flash' allowscriptaccess='never' allowfullscreen='true' allowNetworking='internal' width='320' height='240'></embed>
</object>", $s);
//[audio]URL[/audio]
$s = preg_replace("/[audio]((www.|http://|https://)[^s]+(.mp3|wav|wma|aac|bwf|ogg|ac3|flac|alac))[/audio]/i",
"<embed autostart='false' loop='false' controller='true' width='220' height='18' src='1'></embed>", $s);
//[audio=URL]
$s = preg_replace("/[audio=((www.|http://|https://)[^s]+(.mp3|wav|wma|aac|bwf|ogg|ac3|flac|alac))]/i",
"<embed autostart='false' loop='false' controller='true' width='220' height='18' 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;
}in each theme you have put this in theme.css & change colors to adapt
/* === Start BB_codes === */
.bb_holder {
border-collapse:collapse;
background:#ccc;
}
.bb_icon, .bb_icon:hover {
background:#999999;
border:1px solid #666666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
padding:1px;
min-width:16px;
cursor:pointer;
}
.bb_icon:hover {
border: 1px solid #dddddd;
}
/* === End BB_codes === */change bbcode.php with attach file
bbcodes button can be find on nikkbu's site [url="http://nikkbu.info/download.php?list.20"]http://nikkbu.info/download.php?list.20[/url]
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6606"]bbcode.php[/url]
[url="http://www.imagup.com/data/1176555532.html"]
[/url]