############################################################################### # MediaCenter.pm # # $Date: 01.09.2026 $ # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBBForum 3.1 # # Packaged: 01 Sep, 2026 # # Distributed by: https://yabbforum.nz # # =========================================================================== # # Copyright (c) 2000-2026 YaBB (yabbforum.nz) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### our $VERSION = '3.1'; $mediacenterpmver = 'YaBBForum 3.1'; if ( $action eq 'detailedversion' ) { return 1; } sub embed { if ( $guest_media_disallowed && $iamguest ) { if ($enable_ubbc) { $video = q~[oops]~; } else { $video = qq~$maintxt{'40'}  ~; $video .= qq~$maintxt{'41'} $img{'login'}~; if ($regtype) { $video .= qq~ $maintxt{'42'} $img{'register'} !!~; } } } elsif ( $action =~ /^RSS/xsm ) { $video = qq~$maintxt{'40a'}  ~; $video .= qq~$maintxt{'41'} $img{'login'}~; if ($regtype) { $video .= qq~ $maintxt{'42'} $img{'register'} !!~; } } else { if ( !$player_version ) { $player_version = 6; } my ( $media_url, $play_pars ) = @_; if ( $media_url !~ m/^http(s)?:\/\//xsm ) { $media_url = 'media://' . $media_url; } else { $media_url =~ s/http$1:/media:/gxsm; } ToHTML($media_url); ## convert url to html # file extensions that open windows media player for video if ( $media_url =~ m/(\.wmv|\.wpl|\.asf|\.avi|\.mpg|\.mpeg|\.divx|\.xdiv)$/ixsm ) { if ( $player_version == 6 ) { $video = $embed_wmv6; } elsif ( $player_version == 10 ) { $video = $embed_wmv10; } else { $video = $embed_wmv6; } $controlheight = 45; # file extensions that open windows media player for audio } elsif ( $media_url =~ m/(\.wma|\.wax|\.asx|\.mp3|\.mid|\.wav|\.kar|\.rmi)$/ixsm ) { if ( $player_version == 6 ) { $video = $embed_wma6; } elsif ( $player_version == 10 ) { $video = $embed_wma10; } else { $video = $embed_wma6; } # file extensions that open flash player } elsif ( $media_url =~ m/(\.ra|\.ram|\.rm)$/ixsm ) { $video = $embed_ra; } elsif ( $media_url =~ m/\.swf$/ixsm ) { $video = $embed_flash; } elsif ( $media_url =~ m/\.flv$/ixsm ) { $video = $embed_flv; } elsif ( $media_url =~ m/[\/\.]myvideo\./ixsm ) { $media_url =~ s/\/watch\//\/movie\//gxsm; $video = $embed_flash; $controlheight = 46; } elsif ( $media_url =~ m/[\/\.]myspace.*videoid=/ixsm ) { $media_url =~ /videoid=(\d+)/xsm; $media_url = qq~https://mediaservices.myspace.com/services/media/embed.aspx/m=$1,t=1,mt=video~; $video = $embed_flash; $controlheight = 42; } elsif ( $media_url =~ m/youtube\.com/ixsm ) { ( undef, $media_in ) = split /\?/xsm, $media_url; @media_in = split /\&/xsm, $media_in; foreach my $i (@media_in) { if ( $i =~ m/v=/sm ) { $i =~ s/amp;//gsm; $i =~ s/v=//gsm; $media_url = qq~https://www.youtube.com/v/$i~; } } $video = $embed_youtube; $controlheight = 36; } elsif ( $media_url =~ m/youtu\.be/ixsm ) { $media_url =~ s/youtu\.be\//www\.youtube\.com\/v\//gxsm; $video = $embed_youtube; $controlheight = 36; } elsif ( $media_url =~ m/facebook\.com/ixsm ) { ( undef, $media_in ) = split /\?/xsm, $media_url; @media_in = split /\&/gxsm, $media_in; foreach my $i (@media_in) { if ( $i =~ m/v=/sm ) { $i =~ s/amp;//gsm; $i =~ s/v=//gsm; $media_url = $i; } } $video = $iframe_facebook; } # added Clipfish video url support elsif ( $media_url =~ m/clipfish\.de/ixsm ) { ( undef, $temp ) = split /video\//xsm, $media_url; ( $videoid, undef ) = split /\//xsm, $temp; $media_url = qq~https://www.clipfish.de/cfng/flash/clipfish_player_3.swf?as=0&vid=$videoid&r=1&angebot=extern&c=990000~; $video = $embed_flash; $controlheight = 36; # GameTrailers.com START # added Gametrailers.com url support (user video with .html at the end) } elsif ($media_url =~ m/gametrailers\.com/ixsm && $media_url =~ m/user/ixsm && $media_url =~ m/\.html/ixsm ) { ( undef, $temp ) = split /gametrailers.com\//xsm, $media_url; ( undef, undef, $temp ) = split /\//xsm, $temp; ( $mid, undef ) = split /\./xsm, $temp; $media_url = qq~https://www.gametrailers.com/remote_wrap.php?umid=$mid~; $video = $embed_flash; $controlheight = 36; # added GameTrailers.com video url support (user video without .html at the end) } elsif ($media_url =~ m/gametrailers\.com/ixsm && $media_url =~ m/user/ixsm ) { ( undef, $temp ) = split /gametrailers.com\//xsm, $media_url; ( $mid, undef ) = split /\./xsm, $temp; ( undef, undef, $mid ) = split /\//xsm, $temp; $media_url = qq~https://www.gametrailers.com/remote_wrap.php?umid=$mid~; $video = $embed_flash; $controlheight = 36; # added Gametrailers.com url support (normal video with .html at the end) } elsif ($media_url =~ m/gametrailers\.com/ixsm && $media_url =~ m/\.html/ixsm ) { ( undef, $temp ) = split /gametrailers.com\//xsm, $media_url; ( undef, $temp ) = split /\//xsm, $temp; ( $mid, undef ) = split /\./xsm, $temp; $media_url = qq~https://www.gametrailers.com/remote_wrap.php?mid=$mid~; $video = $embed_flash; $controlheight = 36; # added GameTrailers.com video url support (normal video without .html at the end) } elsif ( $media_url =~ m/gametrailers\.com/ixsm ) { ( undef, $temp ) = split /gametrailers.com\//xsm, $media_url; ( $mid, undef ) = split /\./xsm, $temp; ( undef, undef, $mid ) = split /\//xsm, $temp; $media_url = qq~https://www.gametrailers.com/remote_wrap.php?mid=$mid~; $video = $embed_flash; $controlheight = 36; # GameTrailers.com END } # added Google video url support elsif ( $media_url =~ m/video\.google/ixsm ) { ( undef, $docid ) = split /=/xsm, $media_url; $media_url = qq~media://video.google.com/googleplayer.swf?docId=$docid~; $video = $embed_flash; $controlheight = 36; } # added dailymotion video url support elsif ( $media_url =~ m/dailymotion\.com/ixsm ) { $video = $iframe_dailymotion; } # added vimeo video url support elsif ( $media_url =~ m/vimeo\.com/ixsm ) { $video = $iframe_vimeo; } # added hulu video url support elsif ( $media_url =~ m/hulu\.com/ixsm ) { $video = $embed_flash; $controlheight = 0; # file extensions that open apple QuickTime player } elsif ( $media_url =~ m/(\.qt|\.qtm|\.mov|\.mp4|\.3gp)$/ixsm ) { $video = $embed_qt; $controlheight = 15; } # added thenutz videos elsif ( $media_url =~ m/thenutz\.tv.+?(\d+)/ixsm ) { $media_url = $1; $video = $iframe_thenutz; } if ( $play_pars =~ m/loop/sm ) { $pl_loop = 'true'; } else { $pl_loop = 'false'; } if ( $play_pars =~ m/hide/sm || $play_pars =~ m/hidden/sm ) { $pl_controls = 'false'; $pl_controlheight = 0; $pl_controlwidth = 0; } else { $pl_controls = 'true'; $pl_controlheight = 45; $pl_controlwidth = 320; } if ( $play_pars =~ m/autostart/sm ) { $pl_start = 'true'; } else { $pl_start = 'false'; } if ( $play_pars =~ m/width\=(\d{2,3})/ixsm ) { $tempwidth = $1; if ( $tempwidth >= 180 || $tempwidth <= 800 ) { $pl_width = int $tempwidth; $pl_height = int( ( $pl_width * 3 ) / 4 ) + $controlheight; } else { $pl_width = 320; $pl_height = 240 + $controlheight; } } else { $pl_width = 320; $pl_height = 240 + $controlheight; } $video =~ s/[\t\r\n]//gxsm; $video =~ s/_width_/$pl_width/igxsm; $video =~ s/_controls_/$pl_controls/igxsm; $video =~ s/_height_/$pl_height/igxsm; $video =~ s/_controlheight_/$pl_controlheight/igxsm; $video =~ s/_controlwidth_/$pl_controlwidth/igxsm; $video =~ s/_media_/$media_url/igxsm; $video =~ s/_loop_/$pl_loop/igxsm; $video =~ s/_autostart_/$pl_start/igxsm; } return $video; } sub flashconvert { my ( $fl_url, $fl_size ) = @_; $fl_size =~ s/ //gsm; my ( $fl_width, undef ) = split /\,/xsm, $fl_size; return "\[media width\=$fl_width\]$fl_url\[/media\]"; } ## Windows Media Player 6.4 Video $embed_wmv6 = q~ ~; ## Windows Media Player 6.4 Audio $embed_wma6 = q~ ~; ## Windows Media Player 7,9 or 10 Video $embed_wmv10 = q~ ~; ## Windows Media Player 7,9 or 10 Audio $embed_wma10 = q~ ~; $embed_ra = q~ ~; $embed_qt = q~ ~; $embed_flash = q~ ~; $embed_youtube = q~ ~; $iframe_facebook = q~ ~; $iframe_vimeo = q~ ~; $iframe_dailymotion = q~ ~; $embed_flv = qq~ ~; $iframe_thenutz = q~ ~; 1;