From 76377251828dc5c643fd83dadaa4dbe7369c1b62 Mon Sep 17 00:00:00 2001 From: Kazuki Przyborowski Date: Tue, 3 May 2011 09:10:35 +0000 Subject: [PATCH] Small bug fix to iBBCode / iBBTags. git-svn-id: svn://svn.code.sf.net/p/intdb/svn/trunk@647 2b68903e-0b30-0410-9a39-a2e4f3c5be39 --- inc/misc/ibbcode.php | 72 ++++++++++++++++++++++++++++++++-------------------- inc/versioninfo.php | 6 ++--- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/inc/misc/ibbcode.php b/inc/misc/ibbcode.php index 8f8dc5b..30d8f97 100644 --- a/inc/misc/ibbcode.php +++ b/inc/misc/ibbcode.php @@ -12,7 +12,7 @@ Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/ iBBCode / iBBTags by Kazuki Przyborowski - http://idb.berlios.net/ - $FileInfo: ibbcode.php - Last Update: 05/02/2011 SVN 646 - Author: cooldude2k $ + $FileInfo: ibbcode.php - Last Update: 05/02/2011 SVN 647 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="ibbcode.php"||$File3Name=="/ibbcode.php") { @@ -25,29 +25,30 @@ Thanks for the Help of czambran at: http://www.phpfreaks.com/forums/index.php?action=profile;u=15535 */ $BoardCharSet = $Settings['charset']; -function do_html_bbcode($text) -{ -$text = preg_replace_callback("/\[DoHTML\](.*?)\[\/DoHTML\]/is","html_decode",$text); -return $text; -} -function html_decode($matches) -{ -global $BoardCharSet; -$matches[1] = str_replace(array("\r", "\r\n", "\n"), " ", $matches[1]); -return html_entity_decode($matches[1], ENT_QUOTES, $BoardCharSet); -} -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 GMTimeGet($matches[1],$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']); } +function do_html_bbcode($text) { + $text = preg_replace_callback("/\[DoHTML\](.*?)\[\/DoHTML\]/is","html_decode",$text); + return $text; } +function html_decode($matches) { + global $BoardCharSet; + $matches[1] = str_replace(array("\r", "\r\n", "\n"), " ", $matches[1]); + return html_entity_decode($matches[1], ENT_QUOTES, $BoardCharSet); } +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 GMTimeGet($matches[1],$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']); } +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) { @@ -59,8 +60,7 @@ $matches[0] = preg_replace("/\[URL\=(.*?)\](.*?)\[\/URL\]/is", " $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) -{ +function bbcode_parser($text) { global $Settings; $text = preg_replace("/\[EmbedVideo\=([A-Za-z0-9\.\-_]+)\]([A-Za-z0-9\.\-_]+)\[\/EmbedVideo\]/is", "[\\1]\\2[/\\1]", $text); $text = preg_replace("/\[YouTube\]([A-Za-z0-9\.\-_]+)\[\/YouTube\]/is", "\n\n\n\n", $text); @@ -80,6 +80,9 @@ $text = preg_replace("/\[TIME\]/is", GMTimeGet('g:i a',$_SESSION['UserTimeZone'] //$text = preg_replace("/\[TIME\=(.*?)\]/is", GMTimeGet("${1}",$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']), $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("/\[Entity\=([A-Za-z0-9\#]+)\]/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); @@ -89,6 +92,9 @@ $text = preg_replace("/\{TIME\}/is", GMTimeGet('M j Y',$_SESSION['UserTimeZone'] //$text = preg_replace("/\{TIME\=(.*?)\}/is", GMTimeGet("${1}",$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']), $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("/\{Entity\=([A-Za-z0-9\#]+)\}/is", "&\\1;", $text); $text = preg_replace("/\[B\](.*?)\[\/B\]/is", "\\1", $text); $text = preg_replace("/\[I\](.*?)\[\/I\]/is", "\\1", $text); $text = preg_replace("/\[S\](.*?)\[\/S\]/is", "\\1", $text); @@ -100,6 +106,16 @@ $text = preg_replace("/\[SIZE\=([0-9]+)\%\](.*?)\[\/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=(.*?)\](.*?)\[\/ALIGN\]/is", "\\2", $text); // Sub URL and IMG tags $text = preg_replace_callback("/\[URL](.*?)\[\/URL\]/is", "urlcheck2", $text); @@ -112,6 +128,6 @@ $text = preg_replace_callback("/\[BASE64\](.*?)\[\/BASE64\]/is","bbcode_base64en $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); -return $text; -} +return $text; } +function ibbcode_parser($text) { return bbcode_parser($text); } ?> \ No newline at end of file diff --git a/inc/versioninfo.php b/inc/versioninfo.php index 58fc139..1d09845 100644 --- a/inc/versioninfo.php +++ b/inc/versioninfo.php @@ -11,7 +11,7 @@ Copyright 2004-2011 iDB Support - http://idb.berlios.de/ Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/ - $FileInfo: versioninfo.php - Last Update: 05/02/2011 SVN 646 - Author: cooldude2k $ + $FileInfo: versioninfo.php - Last Update: 05/03/2011 SVN 647 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="versioninfo.php"||$File3Name=="/versioninfo.php") { @@ -27,8 +27,8 @@ function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) { return $return_var; } // Version number and date stuff. :P $VER1[0] = 0; $VER1[1] = 4; $VER1[2] = 4; $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2]; -$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 646; -$SVNDay[0] = 05; $SVNDay[1] = 02; $SVNDay[2] = 2011; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2]; +$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 647; +$SVNDay[0] = 05; $SVNDay[1] = 03; $SVNDay[2] = 2011; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2]; $AltName = "RDB"; $AltName2 = "ReneeDB"; $RName = "iDB"; $SFName = "IntDB"; $RFullName = "Internet Discussion Boards"; $AltFullName = "Renee Discussion Boards"; if(!isset($Settings['usealtname'])) { $Settings['usealtname'] = "no"; } -- 2.11.4.GIT