Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1808 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Page php pour autoriser tous types de vidéos dans les forums phpbb

 



 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Page php pour autoriser tous types de vidéos dans les forums phpbb

n°2195261
super_newb​ie_pro
A ta dispoition frère geek :P
Posté le 23-06-2013 à 07:21:28  profilanswer
 

Bonjour
 
Pour les forums phpbb, il y a un fichier php qui a été créé permettant d'insérer tous types de vidéo. Il suffit de le placer à la racine de votre forum (là ou se trouve le fichier config.php) puis il suffira de créer le bbcode comme suit:
 
Utilisation du BBCode

Code :
  1. [video]{TEXT}[/video]


 
Code HTML de remplacement

Code :
  1. <script type="text/javascript" src="video.php?link={TEXT}"></script>


 
Ligne d'aide

Code :
  1. [video]URL (ou permalien) de la vidéo[/video]


 
Voici le code du fichier PHP :
 

Code :
  1. <?php
  2. /***
  3. * Author:   Fraev  
  4. * Last update: 06/09/2011
  5. **/
  6. foreach ($_GET as $key => $item)
  7. {
  8. if ($key != 'link' and $key != 'debug')
  9. {
  10.  $_GET['link'].= '&' . $key . '=' . $item;
  11. }
  12. }
  13. if (isset($_GET['link']))
  14. {
  15. if (isset($_GET['debug']))
  16. {
  17.  echo '<script>';
  18. }
  19. echo "window.document.write('".preg_replace('/<\/script>/', '</scr\'+\'ipt>', addslashes(get_video($_GET['link'])))."');";
  20. if (isset($_GET['debug']))
  21. {
  22.  echo '</script>';
  23. }
  24. }
  25. function get_video($link)
  26. {
  27. $values = array (
  28.  //http://www.youtube.com/watch?v=OygxkgewEhU
  29.  array('/youtube\.com.*v=([^&]*)/i', '<iframe width="560" height="345" src="http://www.youtube.com/embed/{ID_VIDEO}" frameborder="0" allowfullscreen></iframe>'),
  30.  //http://video.google.it/videoplay?docid=-1807566009355608301
  31.  array('/video.google.*docid=([^&]*)/i', '<embed id="VideoPlayback" style="width:400px;height:326px" allowFullScreen="true" flashvars="fs=true" src="http://video.google.com/googleplayer.swf?docid={ID_VIDEO}" type="application/x-shockwave-flash"></embed>'),
  32.  //http://dailymotion.alice.it/video/x3gvg0_baby-break-dance_fun
  33.  array ('/dailymotion\.com\/video\/(.*?)_/i', '<object width="480" height="293"><param name="movie" value="http://www.dailymotion.com/swf/{ID_VIDEO}"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/{ID_VIDEO}" type="application/x-shockwave-flash" width="480" height="293" allowFullScreen="true" allowScriptAccess="always"></embed></object>'),
  34.  //http://www.metacafe.com/watch/976183/amazing_denver_zoo_lights_2007/
  35.  array('/metacafe\.com\/watch\/(.*)\//i', '<embed src="http://www.metacafe.com/fplayer/{ID_VIDEO}.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'),
  36.  //http://www.starsclips.net/videos.aspx/video~two_awesome_brothers_free_running/
  37.  array('/starsclips\.net\/videos\.aspx\/(.*)/i', '<object width="400" height="320"><param name="movie" value="http://www.starsclips.net/emb.aspx/{ID_VIDEO}"></param><param name="wmode" value="transparent"></param><embed src="http://www.starsclips.net/emb.aspx/{ID_VIDEO}" type="application/x-shockwave-flash" wmode="transparent" width="400" height="320"></embed></object>'),
  38.  //http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoID=1590276358
  39.  array('/vids\.myspace\.com.*?videoID=([^&]*)/i', '<object width="430px" height="386px"><param name="wmode" value="transparent"/><param name="allowscriptaccess" value="always"/><param name="movie" value="http://lads.myspace.com/videos/vplayer.swf"/><param name="flashvars" value="m={ID_VIDEO}"/><embed src="http://lads.myspace.com/videos/vplayer.swf" width="430" height="386" flashvars="m={ID_VIDEO}" type="application/x-shockwave-flash" allowscriptaccess="always" /></object>'),
  40.  array('/myspacetv\.com.*?videoID=([^&]*)/i', '<object width="430px" height="386px"><param name="wmode" value="transparent"/><param name="allowscriptaccess" value="always"/><param name="movie" value="http://lads.myspace.com/videos/vplayer.swf"/><param name="flashvars" value="m={ID_VIDEO}"/><embed src="http://lads.myspace.com/videos/vplayer.swf" width="430" height="386" flashvars="m={ID_VIDEO}" type="application/x-shockwave-flash" allowscriptaccess="always" /></object>'),
  41.  //http://video.yahoo.com/video/play?vid=1845135&fr=&cache=1
  42.  array('/video\.yahoo.*vid=([^&]*)/i','<object width="512" height="323"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.2" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="id={DOWNLOAD%/so\.addVariable\("id", "(.*?)"\);/%}&vid={ID_VIDEO}&thumbUrl={DOWNLOAD%/so\.addVariable\("thumbUrl", "(.*?)"\);/%}&embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.2" type="application/x-shockwave-flash" width="512" height="323" allowFullScreen="true" flashVars="id={DOWNLOAD%/so\.addVariable\("id", "(.*?)"\);/%}&vid={ID_VIDEO}&thumbUrl={DOWNLOAD%/so\.addVariable\("thumbUrl", "(.*?)"\);/%}&embed=1" ></embed></object>'),
  43.  //http://photobucket.com/video/recent/imaan_sygku/22533661.flv?o=10
  44.  array ('/(photobucket\.com)/i', '{DOWNLOAD%/<input name="txtThumbTag2" id="txtThumbTag2".*?value="(.*?)"/ism%html_entity_decode}'),
  45.  //http://files.filefront.com/Enemy+Territory+Quake+Wars+Island+Trailer+HD/;10527364;/fileinfo.html
  46.  array ('/(filefront\.com)/i','{DOWNLOAD%/<input type"text" id="embedSrc" value=\'(.*?)\'/ism%}'),
  47.  //http://www.veoh.com/videos/v14162290wNDAzzyh?rank=16&order=mr
  48.  array ('/veoh\.com\/videos\/([^\?]*)/i', '<embed src="http://www.veoh.com/videodetails2.swf?permalinkId={ID_VIDEO}&id=anonymous&player=videodetailsembedded&videoAutoPlay=0" allowFullScreen="true" width="540" height="438" bgcolor="#000000" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'),
  49.  //http://www.vidilife.com/video_play_1125851_Not_Karate.htm?hmtrk=Not_Karate
  50.  array ('/(vidilife\.com)/i','{DOWNLOAD%/<input type="text" name="url1" value="(.*?)"/%}'),
  51.  //http://www.gametrailers.com/player/30032.html
  52.  array ('/gametrailers\.com\/player\/(.*?).html/i', '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="gtembed" width="480" height="392">      <param name="allowScriptAccess" value="sameDomain" />   <param name="allowFullScreen" value="true" /> <param name="movie" value="http://www.gametrailers.com/remote_wrap.php?mid={ID_VIDEO}"/> <param name="quality" value="high" /> <embed src="http://www.gametrailers.com/remote_wrap.php?mid={ID_VIDEO}" swLiveConnect="true" name="gtembed" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="480" height="392"></embed> </object>'),
  53.  //http://www.vidiac.com/video/7fd7de8b-67e8-4ffb-a5bd-991900422e1a.htm
  54.  array ('/vidiac\.com\/video\/(.*?)\.htm/i', '<embed src="http://www.vidiac.com/vidiac.swf" FlashVars="video={ID_VIDEO}" 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>'),
  55.  //http://www.gamespot.com/video/938343/6185167/videoplayerpop?
  56.  array ('/gamespot\.com\/video\//i', '<embed id="mymovie" width="432" height="362" flashvars="playerMode=embedded&movieAspect=4.3&flavor=EmbeddedPlayerVersion&skin=http://image.com.com/gamespot/images/cne_flash/production/media_player/proteus/one/skins/gamespot.png&paramsURI={DOWNLOAD%/so\.addVariable\(\'paramsURI\', \'(.*?)\'\);/ism%}" wmode="transparent" allowscriptaccess="always" quality="high" name="mymovie" style="" src="http://image.com.com/gamespot/images/cne_flash/production/media_player/proteus/one/proteus2.swf" type="application/x-shockwave-flash"/>'),
  57.  //http://www.megavideo.com/?v=QZ4O9C8P
  58.  array ('/(megavideo\.com)/i', '{DOWNLOAD%/<input type="text" value=\'(.*?)\'/%}'),
  59.  //http://www.vimeo.com/173714
  60.  array ('/vimeo\.com\/([^&]*)/i', '<object class="swf_holder" type="application/x-shockwave-flash" width="506" height="380" data="http://www.vimeo.com/moogaloop_local.swf?clip_id={ID_VIDEO}&amp;server=www.vimeo.com&amp;autoplay=0&amp;fullscreen=1&amp;show_portrait=0&amp;show_title=0&amp;show_byline=0&amp;md5=&amp;color="><param name="quality" value="high" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop_local.swf?clip_id={ID_VIDEO}&amp;server=www.vimeo.com&amp;autoplay=0&amp;fullscreen=1&amp;show_portrait=0&amp;show_title=0&amp;show_byline=0&amp;md5=&amp;color=" /></object>'),
  61.  //http://www.gamevideos.com/video/id/17281
  62.  array ('/(gamevideos\.com)/i', '{DOWNLOAD%/Embed: <input.*value="(.*?)"/%html_entity_decode}'),
  63.  //http://www.tu.tv/videos/nuco-diga-no-a-una-mujer
  64.  array ('/(tu\.tv)/i', '{DOWNLOAD%/<input name="html".*value=\'(.*?)\'/%}'),
  65.  //http://www.godtube.com/view_video.php?viewkey=8cf08faca5dd9ea45513
  66.  array ('/godtube\.com.*viewkey=([^&]*)/i', '<embed src="http://godtube.com/flvplayer.swf" FlashVars="viewkey={ID_VIDEO}" wmode="transparent" quality="high" width="330" height="270" name="godtube" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>'),
  67.  //http://www.myvideo.de/watch/4276644/Handys_boese
  68.  array ('/myvideo.de\/watch\/(.*?)\//i', "<object style='width:470px;height:406px;' width='470' height='406' type='application/x-shockwave-flash' data='http://www.myvideo.de/movie/{ID_VIDEO}'><param name='movie' value='http://www.myvideo.de/movie/{ID_VIDEO}'/><param name='AllowFullscreen' value='true' /><embed src='http://www.myvideo.de/movie/{ID_VIDEO}' width='470' height='406'></embed></object>" ),
  69.  //http://www.collegehumor.com/video:1819139
  70.  array ('/collegehumor.*video:(.*)/i', '<object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1819139&fullscreen=1" width="480" height="360" ><param name="allowfullscreen" value="true" /><param name="movie" quality="best" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id={ID_VIDEO}&fullscreen=1" /></object>'),
  71.  //http://www.comedycentral.com/videos/index.jhtml?videoId=173093
  72.  array ('/comedycentral.*videoId=([^&]*)/i', "<embed FlashVars='videoId={ID_VIDEO}' src='http://www.comedycentral.com/sitewide/video_player/view/default/swf.jhtml' quality='high' bgcolor='#cccccc' width='332' height='316' name='comedy_central_player' align='middle' allowScriptAccess='always' allownetworking='external' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>" ),
  73.  //http://www.slideshare.net/ewan.mcintosh/unleasing-the-tribe/
  74.  array ('/(slideshare\.net)/i', '{DOWNLOAD%/<input.*?id="embedded_code" value="(.*?)"/%html_entity_decode}'),
  75.  //http://www.revver.com/video/129859/poker-player/
  76.  array ('/revver\.com\/video\/(.*?)\//i', '<script src="http://flash.revver.com/player/1.0/player.js?mediaId:{ID_VIDEO};width:480;height:392;" type="text/javascript"></script>'),
  77.  //http://de.sevenload.com/videos/7oREPw6-Simpsons-Intro-mit-Schauspielern
  78.  array ('/sevenload\.com\/videos\/(.*?)-/i', '<script type="text/javascript" src="http://de.sevenload.com/pl/{ID_VIDEO}/500x408"></script>'),
  79.  //http://www.clipfish.de/player.php?videoid=MTMyNzg4fDI0NTY3MzM%3D&tl=4712&utm_source=ft&utm_medium=ft_2&utm_term=ft_2_unset&utm_content=ft_2_unset_video&utm_campaign=cf
  80.  array ('/clipfish\.de.*?videoid=([^&]*)/i', "<object width='464' height='380'><param name='movie' value='http://www.clipfish.de/videoplayer.swf?videoid={ID_VIDEO}' /><param name='allowFullScreen' value='true' /><embed src='http://www.clipfish.de/videoplayer.swf?videoid=MTMyNzg4fDI0NTY3MzM' width='464' height='380' name='player' allowFullScreen='true' type='application/x-shockwave-flash'></embed></object>" ),
  81. );
  82. foreach ($values as $value)
  83. {
  84.  if (preg_match($value[0], $link, $matches))
  85.  {
  86.   $id_video=$matches[1];
  87.   return preg_replace_callback('/{.*?}/', create_function('$matches', 'switch (true){
  88.   case preg_match("/\{ID_VIDEO\}/", $matches[0]):
  89.   return "'.$id_video.'";
  90.   break;
  91.   case preg_match("/\{LINK\}/", $matches[0]):
  92.   return "'.$link.'";
  93.   break;
  94.   case preg_match("/\{DOWNLOAD(.*?)%(.*?)%(.*?)\}/", $matches[0], $matches2):
  95.   if (empty($matches2[1])) $matches2[1]="'.$link.'";
  96.   preg_match($matches2[2], file_get_contents(str_replace(" ","+",$matches2[1])), $matches3);
  97.   if (empty($matches2[3])){
  98.   return $matches3[1];
  99.   }else{
  100.   $t=$matches3[1];
  101.   foreach(explode("|", $matches2[3]) as $e){
  102.   eval(\'$t=\'.$e.\'($t);\');
  103.   }
  104.   return $t;
  105.   }
  106.   break;
  107.   }
  108.   return $matches[0];'), $value[1]);
  109.  }
  110. }
  111. return 'Error, site not recognized';
  112. }
  113. ?>


 
==> Il ne prend cependant pas en charge le commencement d'une vidéo youtube à un moment précis. Par exemple : http://www.youtube.com/watch?v=dPQ [...] w&t=10m26s
==> Il ne prend cependant pas en charge non plus le nouveau format des vidéos youtube qu'on peut parfois rencontrer. Par exemple : http://youtu.be/HAfZcvY4SeU
==> Il ne doit donc pas non plus prendre en charge le nouveau format des vidéos youtube qu'on peut parfois rencontrer, combiné à un timer de démarrage.  Par exemple : http://youtu.be/HAfZcvY4SeU?t=12m20s
 
Accepteriez-vous d'indiquer le code nécessaire à rajouter ou à modifier pour autoriser tous ces cas de figure ? D'avance merci.


---------------
~ Camping thématique LA RESSOURCE sur l'autonomie ~
mood
Publicité
Posté le 23-06-2013 à 07:21:28  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Page php pour autoriser tous types de vidéos dans les forums phpbb

 

Sujets relatifs
[vba] numéro de la page de la cellule sélectionnéeCréer une pub pleine page à l'accueil
menu déroulant au dessus de la page HTMLpage web hotmail blanche
[SHELL] Appel script .sh dans page httpRafraichir page
Intégrer une page GLPI + zoomproblème avec l'affichage de mas page php
[Divers] Injecter du HTML dans une page deja generee 
Plus de sujets relatifs à : Page php pour autoriser tous types de vidéos dans les forums phpbb


Copyright © 1997-2018 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR