##############################################################
## MOD Title: Videos in posts
##
## MOD Author: mgutt (Marc Gutt) www.phpbb-de.com
## MOD Description: video urls are redirect to embed flash players
## MODIFIED by kman at mreinfo.com
##
## MOD Version: 1.0.2
##
## Installation Level: Easy
## Installation Time: 2 minutes
##
## Files To Edit:   1
##                  includes/bbcode.php
##
## Included Files:  0
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
############################################################## 
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes:
##
##           Video urls in signatures aren't rewritted
##           You only need to paste the url of the video f.e.
##           "http://www.youtube.com/watch?v=pYak2F1hUYA".
##           To avoid rewriting the video url use the [url] bbcode.
##
############################################################## 
## MOD History:
##
##           Version 1.0.0:
##           - Mod released:
##		http://www.phpbb-de.com/videos-in-beitraegen-t536.html
##           Version 1.0.1:
##           - Mod updated for generic phpBB:
##		http://www.phpbb-de.com/class-message-fehlt-mod-fuer-das-standard-phpbb-t631.html
##           Version 1.0.0:
##		Additions by kman: added support for jp. and de. youtube URLs.
##		Changed the "Jump_to" link to show the actual name of
##		the link to the video. Moved original author site credit to
##		comment tag at the beginning of the mod.
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
# 
#-----[ FIND ]------------------------------------------ 
# 
   $ret = ' ' . $text; 
   # 
   #-----[ AFTER, ADD ]------------------------------------------ 
   # 

   //-- mod : videos in posts ----------------------------------------------------- 
   //-- add 
   // standard video table - plugin from http://www.phpbb-de.com
   global $lang; 
   $directurl = '<table border="0" cellpadding="0" cellspacing="2"><tr><td align="left"><a href="'; 
   $object = '</td></tr><tr><td colspan="2">'; 
   $tableend = '</td></tr></table>'; 
   // match a google video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://video\.google\.[\w\.]+?/videoplay\?docid=)([\w-]+)([&][\w=+&;-]*)*(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4" target="_blank" class="postlink">' . '\\2\\3\\4' . '</a>' . $object . '<object><param name="wmode" value="transparent"></param><embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" wmode="transparent" src="http://video.google.com/googleplayer.swf?docId=\\3" flashvars=""></embed></object>' . $tableend, $ret); 
   // match a youtube video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://)(www\.youtube|youtube|jp\.youtube|de\.youtube)(\.[\w\.]+?/watch\?v=)([\w-]+)([&][\w=+&;%]*)*(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4\\5\\6" target="_blank" class="postlink">' . '\\2\\3\\4\\5\\6' . '</a>' . $object . '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\\5"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\\5" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>' . $tableend, $ret); 
   // match a myvideo video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://)(www\.myvideo|myvideo)(\.[\w\.]+?/watch/)([\w]+)(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4\\5" target="_blank" class="postlink">' . '\\2\\3\\4\\5' . '</a>' . $object . '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="470" height="406"><param name="movie" value="http://www.myvideo.de/movie/\\5"></param><param name="wmode" value="transparent"></param><embed src="http://www.myvideo.de/movie/\\5" width="470" height="406" type="application/x-shockwave-flash" wmode="transparent"></embed></object>' . $tableend, $ret); 
   // match a clipfish video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://)(www\.clipfish|clipfish)(\.[\w\.]+?/player\.php\?videoid=)([\w%]+)([&][\w=+&;]*)*(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4\\5\\6" target="_blank" class="postlink">' . '\\2\\3\\4\\5\\6' . '</a>' . $object . '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="464" height="380" id="player" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.clipfish.de/videoplayer.swf?as=0&videoid=\\5&r=1" /><param name="wmode" value="transparent"><embed src="http://www.clipfish.de/videoplayer.swf?as=0&videoid=\\5&r=1" width="464" height="380" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>' . $tableend, $ret); 
   // match a sevenload video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://[\w.]+?\.sevenload\.com/videos/)([\w]+?)(/[\w-]+)(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4" target="_blank" class="postlink">' . '\\2\\3\\4' . '</a>' . $object . '<object width="425" height="350"><param name="FlashVars" value="slxml=de.sevenload.com"/><param name="movie" value="http://de.sevenload.com/pl/\\3/425x350/swf" /><embed src="http://de.sevenload.com/pl/\\3/425x350/swf" type="application/x-shockwave-flash" width="425" height="350" FlashVars="slxml=de.sevenload.com"></embed></object>' . $tableend, $ret); 
   // match a metacafe video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://)(www\.metacafe|metacafe)(\.com/watch/)([\w]+?)(/)([\w-]+?)(/)(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4\\5\\6\\7" target="_blank" class="postlink">' . '\\2\\3\\4\\5\\6\\7' . '</a>' . $object . '<embed src="http://www.metacafe.com/fplayer/\\5/\\7.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' . $tableend, $ret); 
   // match a streetfire video URL and replace it 
   $ret = preg_replace("#(^|[\n ])([\w]+?://videos\.streetfire\.net/.*?/)([\w-]+?)(\.htm)(^[\t <\n\r\]\[])*#is", '\\1' . $directurl . '\\2\\3\\4" target="_blank" class="postlink">' . '\\2\\3\\4' . '</a>' . $object . '<embed src="http://videos.streetfire.net/vidiac.swf" FlashVars="video=\\3" quality="high" bgcolor="#ffffff" width="428" height="352" name="ePlayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>' . $tableend, $ret); 
   //-- fin mod : videos in posts -------------------------------------------------