".$matches[1]); return ob_get_clean(); } function php_execute($text) { return preg_replace_callback("/\[ExecPHP\](.*?)\[\/ExecPHP\]/is","exec_php",$text); } function bbcode_rot13($matches) { return str_rot13($matches[1]); } function bbcode_base64encode($matches) { return base64_encode($matches[1]); } function bbcode_base64decode($matches) { return base64_decode($matches[1]); } function bbcode_urlencode($matches) { return urlencode($matches[1]); } function bbcode_urldecode($matches) { return urldecode($matches[1]); } function bbcode_date_time($matches) { return $usercurtime->format($matches[1]); } function bbcode_random($matches) { if(!isset($matches[2])) { return rand(0,$matches[1]); } if(isset($matches[2])) { return rand($matches[1],$matches[2]); } } // Pre URL and IMG tags if(!function_exists("urlcheck2")) { function urlcheck2($matches) { global $BoardURL; $retnum = preg_match_all("/([a-zA-Z]+)\:\/\/([a-z0-9\-\.@\:]+)(\:[0-9]+)?\/([A-Za-z0-9\.\/%\?\!\$\(\)\*\-_\:;,\+\@~]+)?(\?)?([A-Za-z0-9\.\/%&\=\?\!\$\(\)\*\-_\:;,\+\@~]+)?(\#)?([A-Za-z0-9\.\/%&\=\?\!\$\(\)\*\-_\:;,\+\@~]+)?/is", $matches[1], $urlcheck); if(isset($urlcheck[0][0])) { $matches[0] = preg_replace("/\[URL\](.*?)\[\/URL\]/is", " \\1", $matches[0]); $matches[0] = preg_replace("/\[URL\=(.*?)\](.*?)\[\/URL\]/is", "\\2", $matches[0]); $matches[0] = preg_replace("/\[IMG](.*?)\[\/IMG\]/is", "\"user", $matches[0]); $matches[0] = preg_replace("/\[IMG\=(.*?)]([A-Za-z0-9\.\/%\?\!\$\(\)\*\-_\:;,\+\@~\s]+)\[\/IMG\]/is", "\"\\2\"", $matches[0]); } return $matches[0]; } } function bbcode_parser($text) { global $Settings; $usertz = new DateTimeZone($_SESSION['UserTimeZone']); $usercurtime = new DateTime(); $usercurtime->setTimezone($usertz); $text = preg_replace("/\[EmbedVideo\="([A-Za-z0-9\.\-_]+)"\]([A-Za-z0-9\.\-_]+)\[\/EmbedVideo\]/is", "[\\1]\\2[/\\1]", $text); $text = preg_replace("/\[EmbedVideo\=([A-Za-z0-9\.\-_]+)\]([A-Za-z0-9\.\-_]+)\[\/EmbedVideo\]/is", "[\\1]\\2[/\\1]", $text); $text = preg_replace("/\[EmbedMusic\="([A-Za-z0-9\.\-_]+)"\]([A-Za-z0-9\.\-_]+)\[\/EmbedMusic\]/is", "[\\1]\\2[/\\1]", $text); $text = preg_replace("/\[EmbedMusic\=([A-Za-z0-9\.\-_]+)\]([A-Za-z0-9\.\-_]+)\[\/EmbedMusic\]/is", "[\\1]\\2[/\\1]", $text); $text = preg_replace("/\[Kiwi6\]([A-Za-z0-9\.\-_]+)\[\/Kiwi6\]/is", "\n\n\n\n\n\n\n\n\n", $text); $text = preg_replace("/\[YouTube\]([A-Za-z0-9\.\-_]+)\[\/YouTube\]/is", "\n\n\n\n", $text); $text = preg_replace("/\[DailyMotion\]([A-Za-z0-9\.\-_]+)\[\/DailyMotion\]/is", "\n\n\n\n\n\n\n", $text); $text = preg_replace("/\[Vimeo\]([A-Za-z0-9\.\-_]+)\[\/Vimeo\]/is", "\n\n\n\n\n\n", $text); $text = preg_replace("/\[TinyPic\]([A-Za-z0-9\.\-_]+)\,([A-Za-z0-9\.\-_]+)\[\/TinyPic\]/is", "\"\\2\"", $text); $text = preg_replace("/\[BR\]/is", "
", $text); $text = preg_replace("/\[HR\]/is", "
", $text); $text = preg_replace("/\[SUP\](.*?)\[\/SUP\]/is", "\\1", $text); $text = preg_replace("/\[SUB\](.*?)\[\/SUB\]/is", "\\1", $text); $text = preg_replace("/\[BoardName\]/is", $Settings['board_name'], $text); $text = preg_replace("/\[BoardURL\]/is", $Settings['idburl'], $text); $text = preg_replace("/\[WebSiteURL\]/is", $Settings['weburl'], $text); $text = preg_replace("/\{BoardName\}/is", $Settings['board_name'], $text); $text = preg_replace("/\{BoardURL\}/is", $Settings['idburl'], $text); $text = preg_replace("/\{WebSiteURL\}/is", $Settings['weburl'], $text); $text = preg_replace("/\[DATE\]/is", $usercurtime->format('M j Y'), $text); //$text = preg_replace("/\[DATE\=(.*?)\]/is", $usercurtime->format("${1}"), $text); $text = preg_replace("/\[TIME\]/is", $usercurtime->format('g:i a'), $text); //$text = preg_replace("/\[TIME\=(.*?)\]/is", $usercurtime->format("${1}"), $text); $text = preg_replace_callback("/\[DATE\="(.*?)"\]/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\[TIME\="(.*?)"\]/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\[DATE\=(.*?)\]/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\[TIME\=(.*?)\]/is", "bbcode_date_time", $text); $text = preg_replace("/\{DATE\}/is", $usercurtime->format('g:i a'), $text); //$text = preg_replace("/\{DATE\=(.*?)\}/is", $usercurtime->format("${1}"), $text); $text = preg_replace("/\{TIME\}/is", $usercurtime->format('M j Y'), $text); //$text = preg_replace("/\{TIME\=(.*?)\}/is", $usercurtime->format("${1}"), $text); $text = preg_replace_callback("/\{DATE\="(.*?)\"\}/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\{TIME\="(.*?)\"\}/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\[RAND\="([\-]?[0-9]+)"\]/is", "bbcode_random", $text); $text = preg_replace_callback("/\[RAND\="([\-]?[0-9]+)","([\-]?[0-9]+)"\]/is", "bbcode_random", $text); $text = preg_replace_callback("/\[RAND\="([\-]?[0-9]+),([\-]?[0-9]+)"\]/is", "bbcode_random", $text); $text = preg_replace_callback("/\{RAND\="([\-]?[0-9]+)\"\}/is", "bbcode_random", $text); $text = preg_replace_callback("/\{RAND\="([\-]?[0-9]+),([\-]?[0-9]+)\"\}/is", "bbcode_random", $text); $text = preg_replace("/\[Entity\="([A-Za-z0-9\#]+)"\]/is", "&\\1;", $text); $text = preg_replace("/\{Entity\="([A-Za-z0-9\#]+)\"\}/is", "&\\1;", $text); $text = preg_replace_callback("/\{DATE\=(.*?)\}/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\{TIME\=(.*?)\}/is", "bbcode_date_time", $text); $text = preg_replace_callback("/\[RAND\=([\-]?[0-9]+)\]/is", "bbcode_random", $text); $text = preg_replace_callback("/\[RAND\=([\-]?[0-9]+),([\-]?[0-9]+)\]/is", "bbcode_random", $text); $text = preg_replace_callback("/\{RAND\=([\-]?[0-9]+)\}/is", "bbcode_random", $text); $text = preg_replace_callback("/\{RAND\=([\-]?[0-9]+),([\-]?[0-9]+)\}/is", "bbcode_random", $text); $text = preg_replace("/\[Entity\=([A-Za-z0-9\#]+)\]/is", "&\\1;", $text); $text = preg_replace("/\{Entity\=([A-Za-z0-9\#]+)\}/is", "&\\1;", $text); $text = preg_replace("/\[B\](.*?)\[\/B\]/is", "\\1", $text); $text = preg_replace("/\[BOLD\](.*?)\[\/BOLD\]/is", "\\1", $text); $text = preg_replace("/\[I\](.*?)\[\/I\]/is", "\\1", $text); $text = preg_replace("/\[ITALIC\](.*?)\[\/ITALIC\]/is", "\\1", $text); $text = preg_replace("/\[OBLIQUE\](.*?)\[\/OBLIQUE\]/is", "\\1", $text); $text = preg_replace("/\[S\](.*?)\[\/S\]/is", "\\1", $text); $text = preg_replace("/\[STRIKE\](.*?)\[\/STRIKE\]/is", "\\1", $text); $text = preg_replace("/\[U\](.*?)\[\/U\]/is", "\\1", $text); $text = preg_replace("/\[O\](.*?)\[\/O\]/is", "\\1", $text); $text = preg_replace("/\[CENTER\](.*?)\[\/CENTER\]/is", "\\1", $text); $text = preg_replace("/\[LTR\](.*?)\[\/LTR\]/is", "\\1", $text); $text = preg_replace("/\[FONT\="([A-Za-z0-9\,\s]+)"\](.*?)\[\/FONT\]/is", "\\2", $text); $text = preg_replace("/\[DIV\="([A-Za-z0-9,\.%\-_\:;~\(\)#\s]+)"\](.*?)\[\/DIV\]/is", "
\\2
", $text); $text = preg_replace("/\[SPAN\="([A-Za-z0-9,\.%\-_\:;~\(\)#\s]+)"\](.*?)\[\/SPAN\]/is", "\\2", $text); $text = preg_replace("/\[SIZE\="([0-9]+)"\](.*?)\[\/SIZE\]/is", "\\2", $text); $text = preg_replace("/\[SIZE\="([0-9]+)\%"\](.*?)\[\/SIZE\]/is", "\\2", $text); $text = preg_replace("/\[SIZE\="([0-9]+)(em|pt|px)"\](.*?)\[\/SIZE\]/is", "\\3", $text); $text = preg_replace("/\[COLOR\="([A-Za-z0-9]+)"\](.*?)\[\/COLOR\]/is", "\\2", $text); $text = preg_replace("/\[COLOR\="\#([A-Za-z0-9]+)"\](.*?)\[\/COLOR\]/is", "\\2", $text); $text = preg_replace("/\[COLOR\="rgb\(([0-9\,\s]+)\"\)\](.*?)\[\/COLOR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOR\="([A-Za-z0-9]+)"\](.*?)\[\/BGCOLOR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOR\="\#([A-Za-z0-9]+)"\](.*?)\[\/BGCOLOR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOR\="rgb\(([0-9\,\s]+)\"\)\](.*?)\[\/BGCOLOR\]/is", "\\2", $text); $text = preg_replace("/\[COLOUR\="([A-Za-z0-9]+)"\](.*?)\[\/COLOUR\]/is", "\\2", $text); $text = preg_replace("/\[COLOUR\="\#([A-Za-z0-9]+)"\](.*?)\[\/COLOUR\]/is", "\\2", $text); $text = preg_replace("/\[COLOUR\="rgb\(([0-9\,\s]+)\"\)\](.*?)\[\/COLOUR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOUR\="([A-Za-z0-9]+)"\](.*?)\[\/BGCOLOUR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOUR\="\#([A-Za-z0-9]+)"\](.*?)\[\/BGCOLOUR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOUR\="rgb\(([0-9\,\s]+)\"\)\](.*?)\[\/BGCOLOUR\]/is", "\\2", $text); $text = preg_replace("/\[ALIGN=\"(left|center|right|justify)"\](.*?)\[\/ALIGN\]/is", "
\\2
", $text); $text = preg_replace("/\[VALIGN=\"(.*?)"\](.*?)\[\/VALIGN\]/is", "
\\2
", $text); $text = preg_replace("/\[FLOAT=\"(left|right)"\](.*?)\[\/FLOAT\]/is", "
\\2
", $text); $text = preg_replace("/\[FONT\=([A-Za-z0-9\,\s]+)\](.*?)\[\/FONT\]/is", "\\2", $text); $text = preg_replace("/\[DIV\=([A-Za-z0-9,\.%\-_\:;~\(\)#\s]+)\](.*?)\[\/DIV\]/is", "
\\2
", $text); $text = preg_replace("/\[SPAN\=([A-Za-z0-9,\.%\-_\:;~\(\)#\s]+)\](.*?)\[\/SPAN\]/is", "\\2", $text); $text = preg_replace("/\[COMMENT\](.*?)\[COMMENT\]/is", "", $text); $text = preg_replace("/\[SIZE\=([0-9]+)\](.*?)\[\/SIZE\]/is", "\\2", $text); $text = preg_replace("/\[SIZE\=([0-9]+)\%\](.*?)\[\/SIZE\]/is", "\\2", $text); $text = preg_replace("/\[SIZE\=([0-9]+)(em|pt|px)\](.*?)\[\/SIZE\]/is", "\\3", $text); $text = preg_replace("/\[COLOR\=([A-Za-z0-9]+)\](.*?)\[\/COLOR\]/is", "\\2", $text); $text = preg_replace("/\[COLOR\=\#([A-Za-z0-9]+)\](.*?)\[\/COLOR\]/is", "\\2", $text); $text = preg_replace("/\[COLOR\=rgb\(([0-9\,\s]+)\)\](.*?)\[\/COLOR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOR\=([A-Za-z0-9]+)\](.*?)\[\/BGCOLOR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOR\=\#([A-Za-z0-9]+)\](.*?)\[\/BGCOLOR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOR\=rgb\(([0-9\,\s]+)\)\](.*?)\[\/BGCOLOR\]/is", "\\2", $text); $text = preg_replace("/\[COLOUR\=([A-Za-z0-9]+)\](.*?)\[\/COLOUR\]/is", "\\2", $text); $text = preg_replace("/\[COLOUR\=\#([A-Za-z0-9]+)\](.*?)\[\/COLOUR\]/is", "\\2", $text); $text = preg_replace("/\[COLOUR\=rgb\(([0-9\,\s]+)\)\](.*?)\[\/COLOUR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOUR\=([A-Za-z0-9]+)\](.*?)\[\/BGCOLOUR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOUR\=\#([A-Za-z0-9]+)\](.*?)\[\/BGCOLOUR\]/is", "\\2", $text); $text = preg_replace("/\[BGCOLOUR\=rgb\(([0-9\,\s]+)\)\](.*?)\[\/BGCOLOUR\]/is", "\\2", $text); $text = preg_replace("/\[ALIGN=(left|center|right|justify)\](.*?)\[\/ALIGN\]/is", "
\\2
", $text); $text = preg_replace("/\[VALIGN=(.*?)\](.*?)\[\/VALIGN\]/is", "
\\2
", $text); $text = preg_replace("/\[FLOAT=(left|right)\](.*?)\[\/FLOAT\]/is", "
\\2
", $text); // Sub URL and IMG tags $text = preg_replace_callback("/\[URL](.*?)\[\/URL\]/is", "urlcheck2", $text); $text = preg_replace("/\[URL\="(.*?)"\](.*?)\[\/URL\]/is", "[URL=\\1]\\2[/URL]", $text); $text = preg_replace_callback("/\[URL\=(.*?)\](.*?)\[\/URL\]/is", "urlcheck2", $text); $text = preg_replace_callback("/\[IMG](.*?)\[\/IMG\]/is", "urlcheck2", $text); $text = preg_replace("/\[IMG\="(.*?)"\](.*?)\[\/IMG\]/is", "[IMG=\\1]\\2[/IMG]", $text); $text = preg_replace_callback("/\[IMG\=(.*?)](.*?)\[\/IMG\]/is", "urlcheck2", $text); $text = preg_replace_callback("/\[URLENCODE\](.*?)\[\/URLENCODE\]/is","bbcode_urlencode",$text); $text = preg_replace_callback("/\[URLDECODE\](.*?)\[\/URLDECODE\]/is","bbcode_urldecode",$text); $text = preg_replace_callback("/\[BASE64\](.*?)\[\/BASE64\]/is","bbcode_base64encode",$text); $text = preg_replace_callback("/\[BASE64\=ENCODE\](.*?)\[\/BASE64\]/is","bbcode_base64encode",$text); $text = preg_replace_callback("/\[BASE64\=DECODE\](.*?)\[\/BASE64\]/is","bbcode_base64decode",$text); $text = preg_replace_callback("/\[ROT13\](.*?)\[\/ROT13\]/is","bbcode_rot13",$text); $text = preg_replace("/\[JavaScript\](.*?)\[\/JavaScript\]/is","[DoHTML]\n<script type="text/javascript">\n\\1\n</script>\n[/DoHTML]",$text); return $text; } function ibbcode_parser($text) { return bbcode_parser($text); } ?>