|
From: FlorinCB <ory...@us...> - 2008-06-18 11:05:39
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27703 Modified Files: mx_functions_bbcode.php mx_functions_tools.php Log Message: fixes to bbcode/smilies and upgrade Index: mx_functions_tools.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_tools.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** mx_functions_tools.php 17 Jun 2008 15:54:53 -0000 1.32 --- mx_functions_tools.php 18 Jun 2008 11:05:28 -0000 1.33 *************** *** 18,25 **** --- 18,27 ---- // This 'include' is needed for the mx_text class // + /* if ((PORTAL_BACKEND !== 'phpbb3') && !function_exists('bbencode_second_pass')) { mx_page::load_file('bbcode'); } + */ /** *************** *** 144,148 **** if ((PORTAL_BACKEND !== 'phpbb3') && !function_exists('bbencode_second_pass')) { ! mx_page::load_file('bbcode'); } --- 146,150 ---- if ((PORTAL_BACKEND !== 'phpbb3') && !function_exists('bbencode_second_pass')) { ! //mx_page::load_file('bbcode'); } *************** *** 407,411 **** if( $this->bbcode_on ) { ! $text = bbencode_second_pass($text, $bbcode_uid); } --- 409,413 ---- if( $this->bbcode_on ) { ! $text = mx_bbencode_second_pass($text, $bbcode_uid); } Index: mx_functions_bbcode.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_bbcode.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mx_functions_bbcode.php 16 Jun 2008 08:30:25 -0000 1.6 --- mx_functions_bbcode.php 18 Jun 2008 11:05:27 -0000 1.7 *************** *** 105,108 **** --- 105,123 ---- $bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']); + + //Start more bbcode + $bbcode_tpl['stream'] = str_replace('{URL}', '\\1', $bbcode_tpl['stream']); + $bbcode_tpl['web'] = str_replace('{URL}', '\\1', $bbcode_tpl['web']); + $bbcode_tpl['flash'] = str_replace('{WIDTH}', '\\1', $bbcode_tpl['flash']); + $bbcode_tpl['flash'] = str_replace('{HEIGHT}', '\\2', $bbcode_tpl['flash']); + $bbcode_tpl['flash'] = str_replace('{URL}', '\\3', $bbcode_tpl['flash']); + $bbcode_tpl['video'] = str_replace('{URL}', '\\3', $bbcode_tpl['video']); + $bbcode_tpl['video'] = str_replace('{WIDTH}', '\\1', $bbcode_tpl['video']); + $bbcode_tpl['video'] = str_replace('{HEIGHT}', '\\2', $bbcode_tpl['video']); + $bbcode_tpl['GVideo'] = str_replace('{GVIDEOID}', '\\1', $bbcode_tpl['GVideo']); + $bbcode_tpl['GVideo'] = str_replace('{GVIDEOLINK}', $lang['GVideo_link'], $bbcode_tpl['GVideo']); + $bbcode_tpl['youtube'] = str_replace('{YOUTUBEID}', '\\1', $bbcode_tpl['youtube']); + $bbcode_tpl['youtube'] = str_replace('{YOUTUBELINK}', $lang['youtube_link'], $bbcode_tpl['youtube']); + //Stop more bbcode define("BBCODE_TPL_READY", true); *************** *** 216,219 **** --- 231,259 ---- $replacements[] = $bbcode_tpl['email']; + //Strat more bbcode + + // [stream]Sound URL[/stream] code.. + $patterns[] = "#\[stream:$uid\](.*?)\[/stream:$uid\]#si"; + $replacements[] = $bbcode_tpl['stream']; + + // [flash width=X height=X]Flash URL[/flash] code.. + $patterns[] = "#\[flash width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9]):$uid\](.*?)\[/flash:$uid\]#si"; + $replacements[] = $bbcode_tpl['flash']; + + // [video width=X height=X]Video URL[/video] code.. + $patterns[] = "#\[video width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9]):$uid\](.*?)\[/video:$uid\]#si"; + $replacements[] = $bbcode_tpl['video']; + $text = preg_replace($patterns, $replacements, $text); + + // [GVideo]GVideo URL[/GVideo] code.. + $patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is"; + $replacements[] = $bbcode_tpl['GVideo']; + + // [youtube]YouTube URL[/youtube] code.. + $patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is"; + $replacements[] = $bbcode_tpl['youtube']; + + //Stop more bbcode + $text = preg_replace($patterns, $replacements, $text); *************** *** 282,285 **** --- 322,338 ---- $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text); + //Start more bbcode + + // [stream]Sound URL[/stream] code.. + $text = preg_replace("#\[stream\](.*?)\[/stream\]#si", "[stream:$uid]\\1[/stream:$uid]", $text); + + // [flash width=X height=X]Flash URL[/flash] code.. + $text = preg_replace("#\[flash width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9])\](([a-z]+?)://([^, \n\r]+))\[\/flash\]#si","[flash width=\\1 height=\\2:$uid\]\\3[/flash:$uid]", $text); + + // [video width=X height=X]Video URL[/video] code.. + $text = preg_replace("#\[video width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9])\](([a-z]+?)://([^, \n\r]+))\[\/video\]#si","[video width=\\1 height=\\2:$uid\]\\3[/video:$uid]", $text); + + //Stop more bbcode + // Remove our padding from the string.. return substr($text, 1);; *************** *** 729,743 **** case 'internal': $smiley_path_url = PHPBB_URL; //change this to PORTAL_URL when shared folder will be removed $smiley_url = 'smile_url'; ! break; case 'phpbb2': $smiley_path_url = PHPBB_URL; $smiley_url = 'smile_url'; ! break; case 'phpbb3': $smiley_path_url = PHPBB_URL; $smiley_url = 'smiley_url'; $board_config['smilies_path'] = str_replace("smiles", "smilies", $board_config['smilies_path']); ! break; } --- 782,805 ---- case 'internal': $smiley_path_url = PHPBB_URL; //change this to PORTAL_URL when shared folder will be removed + $smiley_root_path = $phpbb_root_path; //same here $smiley_url = 'smile_url'; ! $smiley_id = 'smilies_id'; ! $emotion = 'emoticon'; ! break; case 'phpbb2': $smiley_path_url = PHPBB_URL; + $smiley_root_path = $phpbb_root_path; $smiley_url = 'smile_url'; ! $smiley_id = 'smilies_id'; ! $emotion = 'emoticon'; ! break; case 'phpbb3': $smiley_path_url = PHPBB_URL; + $smiley_root_path = $phpbb_root_path; $smiley_url = 'smiley_url'; + $smiley_id = 'smiley_id'; + $emotion = 'emotion'; $board_config['smilies_path'] = str_replace("smiles", "smilies", $board_config['smilies_path']); ! break; } *************** *** 766,770 **** { $orig[] = "/(?<=.\W|\W.|^\W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/"; ! $repl[] = '<img src="' . $smiley_path_url . $board_config['smilies_path'] . '/' . $smilies[$i][$smiley_url] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />'; } } --- 828,832 ---- { $orig[] = "/(?<=.\W|\W.|^\W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/"; ! $repl[] = '<img src="' . $smiley_path_url . $board_config['smilies_path'] . '/' . $smilies[$i][$smiley_url] . '" alt="' . $smilies[$i][$emotion] . '" border="0" />'; } } |