well, i pasted it before that and it resulted in an error, where my forum page wouldnt load. i'll post my bbcode so you can see how it looks, maybe there's an inconsistency.
-------------HOW MY FILE IS RIGHT NOW (NO YOUTUBE ALTERATIONS------
<?php
/*
This file is part of miniBB. miniBB is free discussion forums/message board software, without any warranty. See COPYING file for more details. Copyright (C) 2004 Paul Puzyrev, Sergei Larionov.
www.minibb.comLatest File Update: 2006-Apr-10
*/
$imgsWidth=150; //static width for shrinking images
function enCodeBB($msg,$admin) {
$pattern=array(); $replacement=array();
$pattern[]="/\[url[=]?\](.+
?)\[\/url\]/i";
$replacement[]="<a href=\"\\1\" target=\"_blank\" rel=\"nofollow\">\\1</a>";
$pattern[]="/\[url=((f|ht)tp[s]?:\/\/[^<> \n]+?)\](.*?)\[\/url\]/i";
$replacement[]="<a href=\"\\1\" target=\"_blank\" rel=\"nofollow\">\\3</a>";
/* New [IMG] tag code - with fixed width */
$pattern[]="/\[imgs\](http:\/\/([^<> \n]+?)\.?(gif|jpg|jpeg|png)?)\[\/imgs\]/i";
$replacement[]='<a href="\\1" target="_blank" rel="nofollow"><img src="\\1" alt="" style="width:'.$GLOBALS['imgsWidth'].'px" /></a>';
/* Old [IMG] tag code - without fixed width. */
$pattern[]="/\[img\](http:\/\/([^<> \n]+?)\.?(gif|jpg|jpeg|png)?)\[\/img\]/i";
$replacement[]='<img src="\\1" alt="" />';
$pattern[]="/\[[bB]\](.+?)\[\/[bB]\]/s";
$replacement[]='<strong>\\1</strong>';
$pattern[]="/\[[iI]\](.+?)\[\/[iI]\]/s";
$replacement[]='<em>\\1</em>';
$pattern[]="/\[[uU]\](.+?)\[\/[uU]\]/s";
$replacement[]='<u>\\1</u>';
$pattern[]="/\[align(left|right|center)](.+?)\[\/align\]/is";
$replacement[]='<div style=\"text-align:\\1\">\\2</div>';
if($admin==1) {
$pattern[]="/\[font(#[A-F0-9]{6})\](.+?)\[\/font\]/is";
$replacement[]='<span style="color:\\1">\\2</font>';
}
if($admin==1 or $GLOBALS['isMod']==1){
$pattern[]="/\[urlc=((f|ht)tp[s]?:\/\/[^<> \n]+?)\](.*?)\[\/url\]/i";
$replacement[]="<a href=\"\\1\" target=\"_blank\">\\3</a>";
}
$msg=preg_replace($pattern, $replacement, $msg);
if(substr_count($msg,'<img')>0) $msg=str_replace('align=""', '', $msg);
if(substr_count($msg,'"nofollow"></a>')>0) $msg=str_replace('"nofollow"></a>', '"nofollow">URL</a>', $msg);
return $msg;
}
//--------------->
function deCodeBB($msg) {
$pattern=array(); $replacement=array();
/* New [IMGs] tag code - with fixed width */
$pattern[]="/<a href=\"([^<>\n\r ]+?)\" target=\"_blank\" rel=\"nofollow\">[ ]<img src=\"(.+?)\" alt=\"\" style=\"width:[0-9]+px\" \/><\/a>/i";
$replacement[]="[imgs]\\1[/imgs]";
/* Old [IMG] tag code - without fixed width. */
$pattern[]="/<img src=\"(.+?)\" alt=\"\" \/>/i";
$replacement[]="[img]\\1[/img]";
$pattern[]="/<a href=\"([^<>\n\r ]+?)\" target=\"(_new|_blank)\"( rel=\"nofollow\")?>(.+?)<\/a>/i";
$replacement[]="[url=\\1]\\4[/url]";
$pattern[]="/<strong>(.+?)<\/strong>/is";
$replacement[]="\\1";
$pattern[]="/<em>(.+?)<\/em>/is";
$replacement[]="\\1";
$pattern[]="/<[uU]>(.+?)<\/[uU]>/s";
$replacement[]="\\1";
$pattern[]="/<span style=\"color:\"(#[A-F0-9]{6})\">(.+?)<\/span>/is";
$replacement[]='[font\\1]\\2[/font]';
$pattern[]="/<div style=\"text-align:(left|right|center)\">(.+?)<\/div>/is";
$replacement[]='[align\\1]\\2[/align]';
$msg=preg_replace($pattern, $replacement, $msg);
$msg=str_replace ('<br />', "\n", $msg);
if(substr_count($msg, '[img\\2]')>0) $msg=str_replace('[img\\2]', '[img]', $msg);
if(function_exists('smileThis')) $msg=smileThis(FALSE,TRUE,$msg);
return $msg;
}
?>
-------------HOW IT WAS WHEN I FOLLOWED THE INSTRUCTIONS------
<?php
/*
This file is part of miniBB. miniBB is free discussion forums/message board software, without any warranty. See COPYING file for more details. Copyright (C) 2004 Paul Puzyrev, Sergei Larionov. www.minibb.com
Latest File Update: 2006-Apr-10
*/
$imgsWidth=150; //static width for shrinking images
function enCodeBB($msg,$admin) {
$pattern=array(); $replacement=array();
$pattern[]="/\[url[=]?\](.+?)\[\/url\]/i";
$replacement[]="<a href=\"\\1\" target=\"_blank\" rel=\"nofollow\">\\1</a>";
$pattern[]="/\[url=((f|ht)tp[s]?:\/\/[^<> \n]+?)\](.*?)\[\/url\]/i";
$replacement[]="<a href=\"\\1\" target=\"_blank\" rel=\"nofollow\">\\3</a>";
/* New [IMG] tag code - with fixed width */
$pattern[]="/\[imgs\](http:\/\/([^<> \n]+?)\.?(gif|jpg|jpeg|png)?)\[\/imgs\]/i";
$replacement[]='<a href="\\1" target="_blank" rel="nofollow"><img src="\\1" alt="" style="width:'.$GLOBALS['imgsWidth'].'px" /></a>';
/* Old [IMG] tag code - without fixed width. */
$pattern[]="/\[img\](http:\/\/([^<> \n]+?)\.?(gif|jpg|jpeg|png)?)\[\/img\]/i";
$replacement[]='<img src="\\1" alt="" />';
$pattern[]="/\[[bB]\](.+?)\[\/[bB]\]/s";
$replacement[]='<strong>\\1</strong>';
$pattern[]="/\[[iI]\](.+?)\[\/[iI]\]/s";
$replacement[]='<em>\\1</em>';
$pattern[]="/\[[uU]\](.+?)\[\/[uU]\]/s";
$replacement[]='<u>\\1</u>';
$pattern[]="/\[align(left|right|center)](.+?)\[\/align\]/is";
$replacement[]='<div style=\"text-align:\\1\">\\2</div>';
if($admin==1) {
$pattern[]="/\[font(#[A-F0-9]{6})\](.+?)\[\/font\]/is";
$replacement[]='<span style="color:\\1">\\2</font>';
}
if($admin==1 or $GLOBALS['isMod']==1){
$pattern[]="/\[urlc=((f|ht)tp[s]?:\/\/[^<> \n]+?)\](.*?)\[\/url\]/i";
$replacement[]="<a href=\"\\1\" target=\"_blank\">\\3</a>";
}
enCodeBB() function:
/* YouTube code */
$pattern[]="/\[youtube=http:\/\/www\.youtube\.com\/([\/a-zA-Z0-9-]+)\] /i";
$replacement[]="<object width=\"297\" height=\"245\"><param name=\"movie\" value=\"http://www.youtube.com/\\1\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/\\1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"297\" height=\"245\"></embed></object>";
/* --YouTube code */
deCodeBB() function:
/* YouTube code */
$pattern[]="/<object width=\"297\" height=\"245\"><param name=\"movie\" value=\"http:\/\/www\.youtube\.com\/([\/a-zA-Z0-9-]+)\"><\/param><para m name=\"wmode\" value=\"transparent\"><\/param><embed src=\"http:\/\/www\.youtube\.com\/([\/a-zA-Z0-9-]+)\" type=\"application\/x-shockwave-flash\" wmode=\"transparent\" width=\"297\" height=\"245\"><\/embed><\/object>/i";
$replacement[]="[youtube=http://www.youtube.com/\\1]";
/* --YouTube code */
$msg=preg_replace($pattern, $replacement, $msg);
if(substr_count($msg,'<img')>0) $msg=str_replace('align=""', '', $msg);
if(substr_count($msg,'"nofollow"></a>')>0) $msg=str_replace('"nofollow"></a>', '"nofollow">URL</a>', $msg);
return $msg;
}
//--------------->
function deCodeBB($msg) {
$pattern=array(); $replacement=array();
/* New [IMGs] tag code - with fixed width */
$pattern[]="/<a href=\"([^<>\n\r ]+?)\" target=\"_blank\" rel=\"nofollow\">[ ]<img src=\"(.+?)\" alt=\"\" style=\"width:[0-9]+px\" \/><\/a>/i";
$replacement[]="[imgs]\\1[/imgs]";
/* Old [IMG] tag code - without fixed width. */
$pattern[]="/<img src=\"(.+?)\" alt=\"\" \/>/i";
$replacement[]="[img]\\1[/img]";
$pattern[]="/<a href=\"([^<>\n\r ]+?)\" target=\"(_new|_blank)\"( rel=\"nofollow\")?>(.+?)<\/a>/i";
$replacement[]="[url=\\1]\\4[/url]";
$pattern[]="/<strong>(.+?)<\/strong>/is";
$replacement[]="\\1";
$pattern[]="/<em>(.+?)<\/em>/is";
$replacement[]="\\1";
$pattern[]="/<[uU]>(.+?)<\/[uU]>/s";
$replacement[]="\\1";
$pattern[]="/<span style=\"color:\"(#[A-F0-9]{6})\">(.+?)<\/span>/is";
$replacement[]='[font\\1]\\2[/font]';
$pattern[]="/<div style=\"text-align:(left|right|center)\">(.+?)<\/div>/is";
$replacement[]='[align\\1]\\2[/align]';
$msg=preg_replace($pattern, $replacement, $msg);
$msg=str_replace ('<br />', "\n", $msg);
if(substr_count($msg, '[img\\2]')>0) $msg=str_replace('[img\\2]', '[img]', $msg);
if(function_exists('smileThis')) $msg=smileThis(FALSE,TRUE,$msg);
return $msg;
}
?>