vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   AnyMedia BBCode for 3.5.x (https://vborg.vbsupport.ru/showthread.php?t=106239)

Crist 01-23-2006 10:00 PM

AnyMedia BBCode for 3.5.x
 
###############################
# Jun.7th, 2006 17:00 GMT+8 #
# AnyMedia BBCode 3.0.4 Release #
###############################

@ Overview
---------------------------------
Products to Import: 1
Template Modifications: 4
File to Upload: 7 (2 swf, 1 gif, 3 php, 1 js)

@ Description
---------------------------------
Use only ONE bbcode to post almost 60 kinds of file,
and flash videos from more than 10 sites.

@ Credits
---------------------------------
Author of the Hack -- Crist Chsu
Author of Flash Single MP3 Player -- Jeroenwijering.COM
Author of Flash Video Player -- Jeroenwijering.COM
Author of PHP BEncode Library -- Gerard Krijgsman
Special thanks to Andreas's great suggestion, which made the mod become a plugin.

@ Translations
---------------------------------
Simplified Chinese by Crist Chsu (http://www.QuChao.com)
Traditional Chinese by Crist Chsu (http://www.QuChao.com)
German by Oberguru (http://www.webgurus.de)
Arabic by Coffee (http://www.shinqit.net)
Hebrew by Dacho (http://www.dacho.co.il)
Italian by Fulvio di Stefano (http://www.internetdiffusion.com)

@ Supported Extensions
---------------------------------
Adobe Flash:
swf, spl, flv

Quick Time:
mov, qt, mqv, mpeg, mpg, m1s, m1v, m1a, m75, m15, mp2, mpm, mpv, mpa, flc, fli, cel, rtsp, rts, 3gp, 3gpp, 3g2, 3gp2, sdv, amc, mp4, sdp

Real Media:
rm, rmvb, ra, rv, ram, smil

Windows Media:
mp3, wma, wav, ogg, ape, mid, midi, asf, asx, wm, wmv, wsx, wax, wvx, avi

Adobe PDF:
pdf, fdf, xfdf, xdp, xfd

Image File:
gif, jpg, jpeg, bmp, png, xpm

P2P File:
torrent, emule, foxy, pplive

@ Supported Flash Video Sites
---------------------------------
Google (http://video.google.com/)
Youtube (http://www.youtube.com/)
vSocial (http://www.vsocial.com/)
iFilm (http://www.ifilm.com/)
MetaCafe (http://www.metacafe.com/)
DailyMotion (http://www.dailymotion.com/video/)
CurrentTV (http://www.current.tv/studio/)
Vimeo (http://www.vimeo.com/)
Sharkle (http://www.sharkle.com/video/)
FreeVideoBlog (http://video.freevideoblog.com/)
MyVideoDe (http://www.myvideo.de/)

@ Features
---------------------------------
You're allowed to ...
1. Custom the tag name;
2. Custom the title of the player;
3. Decide which usergroup could see the download link;
4. Use Flash Single Mp3 Player to play the mp3 file;
5. Custom the width & height of the media;
6. Decide whether to make the media autostart by default;
7. Decide whether to collapse the player box by default;
8. Play the Google Videos via proxy;
9. Auto-detect the attachment type;
10. Use AnyMedia player to play attachments;
11. Custom the default value of loop;
12. Filter the AnyMedia BBCodes in Quote tags;
13. Choose which extension could be supported;
14. Choose whether to use AnyMedia Player or not for each supported video site;

@ How to Use
---------------------------------
Tag without options:
[MEDIA]url_of_the_file[/MEDIA]

ex.
[MEDIA]http://server/file.mp3[/MEDIA]
Shown as a mp3 player (Use the flash mp3 player by default).

Tag with options:
[MEDIA="width, height, autostart, loop, extension"]url_of_the_file[/MEDIA]
[MEDIA="width, height, autostart, loop"]url_of_the_file[/MEDIA]
[MEDIA="width, height, autostart"]url_of_the_file[/MEDIA]
[MEDIA="width, height"]url_of_the_file[/MEDIA]

ex.
[MEDIA="300,380,yes,2,rm"]http://server/file.mp3[/MEDIA]
It will use the real player to play the file.mp3,
the object is 300px width, 380px height,
it will autostart and will repeat for twice.

[MEDIA=250,150,0,3]http://server/file.flv[/MEDIA]
It will use the flash player to play the file.flv,
the object is 250px width, 150px height,
it'll NOT autostart but will repeat for 3 times.

[MEDIA=400,480,false]http://server/file.swf[/MEDIA]
It will use the flash player to play the file.swf,
the object is 400px width, 480px height,
and it'll NOT autostart.

[MEDIA=421,211]http://server/file.pdf[/MEDIA]
It will post the pdf object on the page,
the object is 421px width, 211px height.

Other Rules:
1.WIDTH and HEIGHT are both required if you want to add options;
2.Available values for the AUTOSTART option: 1, true & yes.
3.Separate the options with commas.

@ Change Logs
---------------------------------
[1.1.0]
[BUG] Hide the "download link" will show a warning
[NEW] Usergroup Permission Restriction

[1.2.0]
[DEL] Codes Modifications (Thanks to Andreas's suggestion)
[CHG] Allow every group to use anymedia by default
[NEW] Cache the Templates

[1.3.0]
[CHG] Use Google Video Player to play the Google's.
[NEW] Allow to play the wsx, wav and the flv files from google, youtube, vsocial .
[NEW] Allow you to custom the tag name.
[NEW] Allow you to set the title for the player box.
[NEW] Allow you to collapse the player box by default.
[BUG] Playing a WMV file with no pictures.

[2.0.0]
[CHG] Change the method of loading, Fix the "Bug" that long loading.
[NEW] "Fix" the 'Activating Active Content' issues in the new IE Update. (It means that, if you've installed the new IE update, there's no need to Click the media object before you want to play it :D )

[2.1.0]
[BUG] Fix the bug that cannot autoplay a wmv (& etc.) file.
[BUG] Fix the bug that when custom the video size of google/youtube/vsocial will get a non-supportted error.
[NEW] Let you to choose whether to play a google video through a proxy. It's useful for Chinese users.

[2.2.0]
[BUG] Fix the bug that cannot autoplay a wmv on Firefox.
[BUG] Fix the bug that auto play a google/youtube/vsocial video when disable it.

[2.3.0]
[BUG] Fix a tiny bug with bt parsing.
[NEW] Support the attachments from your own forum, and you could switch it off.

[3.0.0]
[CHG] Rebuild the code of the whole AnyMedia.
[CHG] Use flvplayer to play Google Video again.
[BUG] Fix the bug that error with parsing when allow_url_fopen's off.
[BUG] Fix a bug with url parsing.
[BUG] Fix the parsing error of youtube video.
[NEW] eMule & foxy types added.
[NEW] loop option added.
[NEW] Use AnyMedia Player to play the attachment when upload one.
[NEW] 8 More flash video sites supported.
[NEW] Chinese versions added.

[3.0.1]
[BUG] Fixed the bug that cannot autoplay a wmv (& etc.) file.
[BUG] Fixed the bug that always insert a tag named [media].
[CHG] Hide AnyMedia button in editor when disable it.
[CHG] Hide AnyMedia Player for unsupported attachment.
[NEW] Multi-Language Documents added. It will auto-detect the language when you open it.
[LAN] German version by Oberguru (http://www.webgurus.de) added.
[LAN] Arabic version by Coffee (http://shinqit.net) added.

[3.0.2]
[BUG] Fixed the bug that cannot disable extensions in admincp .
[BUG] Fixed the bug with youtube playing session.
[CHG] Used a special player to play youtube video.
[NEW] Added an option to switch the youtube video playing method.
[NEW] You could use 'Ctrl + wheel' to resize the image now.
[NEW] New option added in admincp, you could choose whether to disable AnyMedia BBCode in Quote tags.

[3.0.3]
[BUG] Fixed the bug with mp3's (flash player) autoplay issue.
[BUG] Fixed the bug with flv's autoplay issue.
[BUG] Fixed the bug with 3gp files' parsing error.
[BUG] Fixed the bug with iamges' resize issue.
[BUG] Fixed the bug with attachments' autoplay issue.
[NEW] Support the latest Google Movie Preview (http://video.google.com/movietrailers.html).
[LAN] Hebrew version by Dacho (http://www.dacho.co.il) added.

[3.0.4]
[BUG] Get Google Video back to work again.
[NEW] PPLive supported. You could watch the World Cup Live on your board with your members now. Which team will be the biggest winner this time? :banana: (It can only work with IE, sigh...:surprised: )
[NEW] New option group added in admincp, you could choose whether to use build-in player for each supported sites.


@ Frequently Asked Questions
---------------------------------
Q: I got white screen when playing a google video.
A: AnyMedia fetch the correct video url, but there's sth wrong with the flvplayer.swf, try to refresh the page to solve it.

Q: When using mp3player.swf to play mp3, it's played fast/slowly.
A: Flash doesn't support vbr (variable bit rate) mp3 files.It only support a mp3 with a fixed bitrate of 64/96/128 kbps ,a sample frequency of 22.05kHz and joint stereo. To solve it, turn the option off in admincp to make it be played by WMP.

Q: I have to click play button twice to play a google video.
A: Emmm... Even using the google player, you also have to click twice. I don't know why, and I'm trying to fixed it. If you know, just tell me. :)

Q: The supported extensions checkbox are always unchecked even if I check them all.
A: The permission cache is not updated. Overwrite the 'includes/xml/bitfield_anymedia.xml' file, and log into your admincp to visit 'admincp/index.php?do=buildbitfields' to rebuild the permission cache.

Q: When I use build-in player to play Youtube, it will be loading all the time.
A: To use the build-in player to play Youtube videos, your server have to enable the 'allow_url_fopen' option, or enable the 'fsockopen / curl_init' functions. If failed, turn the 'Use AnyMedia Player for Youtube Video' option off in admincp.

Q: I cannot get the PPLive working with my Firefox or etc.
A: As far as I know, the pplive object can only work with IE. And if you know how to embed it on FireFox, just tell me. :)

@ Todo
---------------------------------
1. Add a Playlist.
2. Integrate it with CMPS, Link & Download Sys, and etc.
3. read ID3 tag.

@ Notes
---------------------------------
1. We need other translations, if you made one, just PM me.

If you like the hack, Please click https://vborg.vbsupport.ru/ .

I DO NOT know whether I should update the hack.
I'm not a coder of vBulletin-Chinese Team now, as I left there weeks ago.
Sorry about this, and I'll tell you how the update's going if it's really on the way.

nitro 01-24-2006 10:19 PM

Looks interesting :)
I try to stay away from file edits but this one may well be worth it when I get round to using it live.

Is there a way to restrict the media tag per forum id's ?

Mastar 01-24-2006 10:21 PM

I have installed! You can only use caps wid the tags?

sinoeu 01-24-2006 10:55 PM

A MUST to include in the official vbb version! Crist, you rock!!! :up:

Guest210212002 01-24-2006 11:04 PM

Hm, installed, but not working - nothing at all shows up in the post. Files uploaded, changes made, product imported.

What am I missing?

I thought the template compressor might be hosing it, but it makes no difference.

If I view my source, there's no reference to it at all. :(

Barakat 01-24-2006 11:12 PM

just Great Great > installed

ChurchMedia 01-24-2006 11:47 PM

Installed but not working.

nhacso 01-25-2006 12:09 AM

Crist, you can edit code make the end user (as me, you or someone) can easily choose the other tag name (not only the tag call is "media", so the end user can edit to diffence name they like).

For simple more, Can you make the option call example is "abc" include the name tag to run all media type (put in Vbulletin Options in AdminCP)?. After, the end user go to AdminCP/Vbulletin Options/abc will check & fill the fied name tag. Default name tag is "media" as the author is Crist written the code, the end user as me when install & using mod hack will change the tag is "media" to "music" for suitable of my forum. After, the "music" tag will become the main tag to run all media type instead of the "media" tag.

mightyb 01-25-2006 12:10 AM

I have installed it but it does not work here either.

Guest210212002 01-25-2006 12:51 AM

Mighty cool mod too, especially for my site, which is music related.

I hope this gets sorted out.

/me can't wait

plateau 01-25-2006 03:57 AM

cool !

jlkimball11 01-25-2006 05:34 AM

Quote:

Originally Posted by ChurchMedia
Installed but not working.

yeah ! Installed but not working in site for me. :ermm:

70age 01-25-2006 05:53 AM

very good!!

Crist 01-25-2006 07:58 AM

Quote:

Originally Posted by nitro
Is there a way to restrict the media tag per forum id's ?

It's in the ToDos.
It'll come true in next version.
:rolleyes:

Crist 01-25-2006 08:10 AM

Quote:

Originally Posted by Mastar
I have installed! You can only use caps wid the tags?

[media] or [MEDIA] are both right.
:nervous:

Crist 01-25-2006 08:55 AM

Quote:

Originally Posted by Chris-777
Hm, installed, but not working - nothing at all shows up in the post. Files uploaded, changes made, product imported.

What am I missing?

I thought the template compressor might be hosing it, but it makes no difference.

If I view my source, there's no reference to it at all. :(



Quote:

Originally Posted by ChurchMedia
Installed but not working.



Quote:

Originally Posted by mightyb
I have installed it but it does not work here either.



Quote:

Originally Posted by jlkimball11
yeah ! Installed but not working in site for me.

Sorry for my lapsus...
I used the Chinese Product ID write the Code Mods of the English Version.

Now I've Updated the zip pack already,
One who failed to install the hack may download the new pack,
and Redo the Code Modifications. (Just redo this step,others are right.)


:surprised:

Snake 01-25-2006 09:27 AM

You da man! :D

Thanks!

sensimilla 01-25-2006 09:51 AM

outstanding hack! works like a charm, that download function is just perfect!

thanks Crist

EasyTarget 01-25-2006 10:03 AM

does this let you choose which of the media types you allow on your board or does it allow all of them?

kadafi_alive 01-25-2006 10:58 AM

Flash doesn't work in IE but it does on Firefox

imported_yesonline 01-25-2006 10:59 AM

Excellent work, just the one I am looking for. :)

nitro 01-25-2006 11:16 AM

Works great on my test install, I am wondering tho should there be a first post restricion at all as a page full of say swf's added with the media tag is going take quite some time to load. I just added 3 in firefox and as they are cached each time no real problem but then I opened the same page in IE which of course wasnt cached and it took some loading time to completely load the page.

I think it should be conditionaled to certain forum ids so it cannot be used where its not wanted and restriced to first post of the thread. Im sure this can be covered with an if /if around the template edit. :)

jlkimball11 01-25-2006 11:28 AM

Quote:

Originally Posted by Crist
Sorry for my lapsus...
I used the Chinese Product ID write the Code Mods of the English Version.

Now I've Updated the zip pack already,
One who failed to install the hack may download the new pack,
and Redo the Code Modifications. (Just redo this step,others are right.)


:surprised:

OK! Done. Thanks you. Very cool :nervous:

yack 01-25-2006 12:55 PM

Quote:

Originally Posted by sinoeu
A MUST to include in the official vbb version! Crist, you rock!!! :up:

A MUST to include in the official vbb version.

凉鞋,俺挺你,就是挺你,挺着你。

Guest210212002 01-25-2006 02:15 PM

Thank you Crist, that worked perfectly. :D

Great hack!

Mastar 01-25-2006 04:10 PM

I did the update but now when I make a post with the [media][/media] tags, the thread doesn't show.

Can you please come to the site and see for yourself and see what is wrong?

www.thebedrocktavern.com


Code:

  }

    /**
  * Handles a match of the [media] tag that will be displayed as an media object
  *
  * Author    Crist Chsu @ VBZH
  *
  * @param  string  The URL to the media.
  *
  * @param  string  If tag has option, the width, height, and whether to autoplay.
  *
  * @return  string  Object code of the contain media.
  */
  function handle_bbcode_media($text, $options='')
  {
    global $vbulletin, $vbphrase, $stylevar;
    if(!$this -> is_wysiwyg())
    {
      $media['url'] = $media['link'] = htmlspecialchars_uni( strip_bbcode( strip_tags( $text ) ) );
      $extensions = explode( ',' , trim( $this->registry->options['anymediasupport'] ) );
      $extensions = iif( is_array( $extensions ) , $extensions , array() );
      if ( !empty( $options ) )
      {
        $option_array=explode( ',' , $options );
        if (  count( $option_array ) > 1 AND count( $option_array ) < 5 )
        {
          $media['width'] = iif( isset( $option_array[0] ) AND !empty( $option_array[0] ) AND ereg( '^[0-9]{1,3}$' , $option_array[0] ), $option_array[0] , $this->registry->options['anymediawidth'] );
          $media['height'] = iif( isset( $option_array[1] ) AND !empty( $option_array[1] ) AND ereg( '^[0-9]{1,3}$' , $option_array[1] ), $option_array[1] , $this->registry->options['anymediaheight'] );
          $media['autoplay'] = iif( isset( $option_array[2] ) AND !empty( $option_array[2] ) AND in_array( $option_array[2] , array( 'true' , 'yes' , '1' ) ) , 'true' , 'false' );
          $media['extension'] = iif( isset( $option_array[3] ) AND !empty( $option_array[3] ) AND in_array( $option_array[3] , $extensions ) , $option_array[3] );
        }
      }
      $media['width'] = iif( isset( $media['width'] ) AND !empty( $media['width'] ) , $media['width'] , $this->registry->options['anymediawidth'] );
      $media['height'] = iif( isset( $media['height'] ) AND !empty( $media['height'] ) , $media['height'] , $this->registry->options['anymediaheight'] );
      $media['autoplay'] = iif( isset( $media['autoplay'] ) AND !empty( $media['autoplay'] ) , $media['autoplay'] , iif($this->registry->options['anymediaautoplay'],'true','false') );
      $media['extension'] = iif( isset( $media['extension'] ) AND !empty( $media['extension'] ) , $media['extension'] , strtolower( file_extension( $text ) ) );
      if ( in_array( $media['extension'] , $extensions ) )
      {
        switch ( $media['extension'] )
        {
          // MP3
          case 'mp3':
            if ( $this->registry->options['anymediamp3player'] )
            {
              $media['url'] = $this->registry->options['bburl'].'/players/mp3player.swf?file=' . htmlentities( urlencode( $media['url'] ) ) . '&autoPlay=' . $media['autoplay'];
              $media['autoplay'] = "true";
              $media['height'] = 20;
              $media['mime']='application/x-shockwave-flash';
              $media['type']='adobe_flash';
            }
            else
            {
              $media['height']=45;
              $media['mime']='application/x-mplayer2';
              $media['type']='windows_media';
            }
            break;
          // Adobe Flash
          case 'flv':
            $media['url'] = $this->registry->options['bburl'].'/players/flvplayer.swf?videoUrl=' . htmlentities( urlencode( $media['url'] ) ) . '&thumbnailUrl=' . urlencode( $this->registry->options['bburl'].'/clear.gif' ) . '&playerMode=embedded';
            $media['autoplay'] = "true";
            $media['height'] += 27;
          case 'swf':
            $media['mime']='application/x-shockwave-flash';
            $media['type']='adobe_flash';
            break;
          case 'spl':
            $media['mime']='application/futuresplash';
            $media['type']='adobe_flash';
            break;
          // Quick Time
          case 'mov':
          case 'qt':
          case 'mqv':
            $media['mime']='video/quicktime';
            $media['type']='quick_time';
            break;
          case 'mpeg':
          case 'mpg':
          case 'm1s':
          case 'm1v':
          case 'm1a':
          case 'm75':
          case 'm15':
          case 'mp2':
          case 'mpm':
          case 'mpv':
          case 'mpa':
            $media['mime']='video/x-mpeg';
            $media['type']='quick_time';
            break;
          case 'flc':
          case 'fli':
          case 'cel':
            $media['mime']='video/flc';
            $media['type']='quick_time';
            break;
          case 'rtsp':
          case 'rts':
            $media['mime']='application/x-rtsp';
            $media['type']='quick_time';
            break;
          case '3gp':
          case '3gpp':
            $media['mime']='video/3gpp';
            $media['type']='quick_time';
            break;
          case '3g2':
          case '3gp2':
            $media['mime']='video/3gpp2';
            $media['type']='quick_time';
            break;
          case 'sdv':
            $media['mime']='video/sd-video';
            $media['type']='quick_time';
            break;
          case 'amc':
            $media['mime']='application/x-mpeg';
            $media['type']='quick_time';
            break;
          case 'mp4':
            $media['mime']='video/mp4';
            $media['type']='quick_time';
            break;
          case 'sdp':
            $media['mime']='application/sdp';
            $media['type']='quick_time';
            break;
          // Real Media
          case 'rm':
          case 'rmvb':
          case 'ra':
          case 'rv':
          case 'ram':
          case 'smil':
            $media['mime']='audio/x-pn-realaudio-plugin';
            $media['type']='real_media';
            break;
          // Windows Media
          case 'wma':
          case 'ogg':
          case 'ape':
          case 'mid':
          case 'midi':
            $media['height']=45;
          case 'asf':
          case 'asx':
          case 'wm':
          case 'wmv':
          case 'wax':
          case 'wvx':
          case 'avi':
            $media['mime']='application/x-mplayer2';
            $media['type']='windows_media';
            break;
          // Adobe PDF
          case 'pdf':
            $media['mime']='application/pdf';
            $media['type']='adobe_pdf';
            break;
          case 'fdf':
            $media['mime']='application/vnd.fdf';
            $media['type']='adobe_pdf';
            break;
          case 'xfdf':
            $media['mime']='application/vnd.adobe.xfdf';
            $media['type']='adobe_pdf';
            break;
          case 'xdp':
            $media['mime']='application/vnd.adobe.xdp+xml';
            $media['type']='adobe_pdf';
            break;
          case 'xfd':
            $media['mime']='application/vnd.adobe.xfd+xml';
            $media['type']='adobe_pdf';
            break;
          // Images
          case 'gif':
          case 'jpg':
          case 'jpeg':
          case 'bmp':
          case 'png':
          case 'xpm':
            $media['type']='image';
            break;
          // Torrent
          case 'torrent':
            include_once("bencode.php");
            $content = @file_get_contents( $media['url'] );
            if ( $content )
            {
              $bencode = new BEncodeLib();
              $torrent = $bencode->bdecode($content);
              if ( is_array( $torrent ) )
              {
                $media['announce'] = $torrent['announce'];
                $media['created_by'] = $torrent['created by'];
                $media['creation_date'] = iif( $torrent['creation date'] , vbdate( $vbulletin->options['dateformat'], $torrent['creation date'], true ) . " <span class=\"time\">" . vbdate( $vbulletin->options['timeformat'], $torrent['creation date'], true )."</span>" );
                $media['encoding'] = $torrent['encoding'];
                $media['codepage'] = $torrent['codepage'];
                $media['name'] = iif( $torrent['info']['name.utf-8'] , $torrent['info']['name.utf-8'] , $torrent['info']['name']);
                $media['length'] = iif( $torrent['info']['length'] , $this -> format_size( $torrent['info']['length'] ) );
                $media['piece_length'] = iif( $torrent['info']['piece length'] , $this -> format_size( $torrent['info']['piece length'] ) );
                $media['publisher'] = iif( $torrent['info']['publisher.utf-8'] , $torrent['info']['publisher.utf-8'] , $torrent['info']['publisher']);
                $media['publisher_url'] = iif( $torrent['info']['publisher-url.utf-8'] , $torrent['info']['publisher-url.utf-8'] , $torrent['info']['publisher-url']);
                if ( is_array( $torrent['nodes'] ) )
                {
                  foreach ( $torrent['nodes'] as $key => $value )
                  {
                    $media['nodes'] .= $torrent['nodes'][$key][0] . ":" . $torrent['nodes'][$key][1] . "<br />";
                  }
                }
                if ( is_array( $torrent['info']['files'] ) )
                {
                  foreach ( $torrent['info']['files'] as $key => $value )
                  {
                    $media['files'] .= iif( $torrent['info']['files'][$key]['path'] , implode( '/' , $torrent['info']['files'][$key]['path.utf-8'] ) , implode( '/' , $torrent['info']['files'][$key]['path'] ) ) . " ( " . $this -> format_size( $torrent['info']['files'][$key]['length'] ) . " ) <br />";
                  }
                }
                $media['type']='torrent';
              }
              else
              {
                $media['type'] = 'torrent_error';
              }
            }
            else
            {
              $media['type'] = 'torrent_error';
            }
            break;
          default:
            $media['type'] = 'unknown';
        }
      }
      else
      {
        $media['type']="unknown";
      }
      $media['id']=rand();
      $media['layout']=$media['width']+$stylevar['cellpadding']*2+$stylevar['cellspacing']*4;
      eval('$text = "' . fetch_template('anymedia') . '";');
    }
    else
    {
      if ( !empty( $options ) )
      {
        $text = "[MEDIA=".$options."]" . $text . "[/MEDIA]" ;
      }
      else
      {
        $text = "[MEDIA]" . $text . "[/MEDIA]" ;
      }
    }
    return $text;
  }

  /**
  * Formatted a size.
  *
  * Author    Crist Chsu @ VBZH
  *
  * @param  integer  The size in byte.
  *
  * @return  string  The formatted size.
  */
  function format_size($size)
  {
    if ( $size < 1024000 )
    {
      return vb_number_format( $size / 1024 ) . " KB";
    }
    elseif ( $size < 1048576000 )
    {
      return vb_number_format( $size / 1048576 ) . " MB";
    }
    elseif ( $size < 1073741824000 )
    {
      return vb_number_format( $size / 1073741824 ) . " GB";
    }
    else
    {
      return vb_number_format( $size / 1099511627776 ) . " TB";
    }
  }
  /**
  * Emulates the behavior of a pre tag in HTML. Tabs and multiple spaces
  * are replaced with spaces mixed with non-breaking spaces. Usually combined
  * with code tags. Note: this still allows the browser to wrap lines.
  *
  * @param  string  Text to convert. Should not have <br> tags!
  *
  * @param  string  Converted text
  */
  function emulate_pre_tag($text)


Guest210212002 01-25-2006 04:21 PM

I had to reimport the product to get it to work, in addition to the new code edit.

Also, depending on how you have it configured, the template compressor hack breaks this.

Mastar 01-25-2006 05:00 PM

Quote:

Originally Posted by Chris-777
I had to reimport the product to get it to work, in addition to the new code edit.

Also, depending on how you have it configured, the template compressor hack breaks this.

I reimported the product also & I don't have the template compressor installed

whatelse counld be wrong?

imported_predatorkill 01-25-2006 06:42 PM

In IE works perfectly but in Firefox it says "Install Missing Plugins"

When i click on that is says "Unknown plugin" :ermm: :ermm:

Great hack tho!It wont stream the video,it will just cache it all and play it,right?

nitro 01-25-2006 07:50 PM

Im streaming avi in FF right now with it on my testbed accross my home network its running fine.

@imported_predatorkill What type of media file you put in ?

My question now is it seem there is no restriction. Someone could load the first page of a thread with 10 1.5 GB avi's and it will sit there loading each one eventually. You can even use the ftp:// protocol in the tags :o One avi will load quickly but how is a thread page going to handle multiple posts with media tages or even a single post with multiple media tags. :D

Crist 01-26-2006 01:38 AM

Quote:

Originally Posted by EasyTarget
does this let you choose which of the media types you allow on your board or does it allow all of them?

YES,
You could choose what you need in admincp...

Crist 01-26-2006 01:47 AM

Quote:

Originally Posted by yack
A MUST to include in the official vbb version.

凉鞋,俺挺你,就是挺你,挺着你。

Thanks for the icon you made for the hack...
LOL

Crist 01-26-2006 02:14 AM

Quote:

Originally Posted by Mastar
I did the update but now when I make a post with the [media][/media] tags, the thread doesn't show.

Can you please come to the site and see for yourself and see what is wrong?

www.thebedrocktavern.com


Code:

  }

    /**
  * Handles a match of the [media] tag that will be displayed as an media object
  *
  * Author    Crist Chsu @ VBZH
  *
  * @param  string  The URL to the media.
  *
  * @param  string  If tag has option, the width, height, and whether to autoplay.
  *
  * @return  string  Object code of the contain media.
  */
  function handle_bbcode_media($text, $options='')
  {
    global $vbulletin, $vbphrase, $stylevar;
    if(!$this -> is_wysiwyg())
    {
      $media['url'] = $media['link'] = htmlspecialchars_uni( strip_bbcode( strip_tags( $text ) ) );
      $extensions = explode( ',' , trim( $this->registry->options['anymediasupport'] ) );
      $extensions = iif( is_array( $extensions ) , $extensions , array() );
      if ( !empty( $options ) )
      {
        $option_array=explode( ',' , $options );
        if (  count( $option_array ) > 1 AND count( $option_array ) < 5 )
        {
          $media['width'] = iif( isset( $option_array[0] ) AND !empty( $option_array[0] ) AND ereg( '^[0-9]{1,3}$' , $option_array[0] ), $option_array[0] , $this->registry->options['anymediawidth'] );
          $media['height'] = iif( isset( $option_array[1] ) AND !empty( $option_array[1] ) AND ereg( '^[0-9]{1,3}$' , $option_array[1] ), $option_array[1] , $this->registry->options['anymediaheight'] );
          $media['autoplay'] = iif( isset( $option_array[2] ) AND !empty( $option_array[2] ) AND in_array( $option_array[2] , array( 'true' , 'yes' , '1' ) ) , 'true' , 'false' );
          $media['extension'] = iif( isset( $option_array[3] ) AND !empty( $option_array[3] ) AND in_array( $option_array[3] , $extensions ) , $option_array[3] );
        }
      }
      $media['width'] = iif( isset( $media['width'] ) AND !empty( $media['width'] ) , $media['width'] , $this->registry->options['anymediawidth'] );
      $media['height'] = iif( isset( $media['height'] ) AND !empty( $media['height'] ) , $media['height'] , $this->registry->options['anymediaheight'] );
      $media['autoplay'] = iif( isset( $media['autoplay'] ) AND !empty( $media['autoplay'] ) , $media['autoplay'] , iif($this->registry->options['anymediaautoplay'],'true','false') );
      $media['extension'] = iif( isset( $media['extension'] ) AND !empty( $media['extension'] ) , $media['extension'] , strtolower( file_extension( $text ) ) );
      if ( in_array( $media['extension'] , $extensions ) )
      {
        switch ( $media['extension'] )
        {
          // MP3
          case 'mp3':
            if ( $this->registry->options['anymediamp3player'] )
            {
              $media['url'] = $this->registry->options['bburl'].'/players/mp3player.swf?file=' . htmlentities( urlencode( $media['url'] ) ) . '&autoPlay=' . $media['autoplay'];
              $media['autoplay'] = "true";
              $media['height'] = 20;
              $media['mime']='application/x-shockwave-flash';
              $media['type']='adobe_flash';
            }
            else
            {
              $media['height']=45;
              $media['mime']='application/x-mplayer2';
              $media['type']='windows_media';
            }
            break;
          // Adobe Flash
          case 'flv':
            $media['url'] = $this->registry->options['bburl'].'/players/flvplayer.swf?videoUrl=' . htmlentities( urlencode( $media['url'] ) ) . '&thumbnailUrl=' . urlencode( $this->registry->options['bburl'].'/clear.gif' ) . '&playerMode=embedded';
            $media['autoplay'] = "true";
            $media['height'] += 27;
          case 'swf':
            $media['mime']='application/x-shockwave-flash';
            $media['type']='adobe_flash';
            break;
          case 'spl':
            $media['mime']='application/futuresplash';
            $media['type']='adobe_flash';
            break;
          // Quick Time
          case 'mov':
          case 'qt':
          case 'mqv':
            $media['mime']='video/quicktime';
            $media['type']='quick_time';
            break;
          case 'mpeg':
          case 'mpg':
          case 'm1s':
          case 'm1v':
          case 'm1a':
          case 'm75':
          case 'm15':
          case 'mp2':
          case 'mpm':
          case 'mpv':
          case 'mpa':
            $media['mime']='video/x-mpeg';
            $media['type']='quick_time';
            break;
          case 'flc':
          case 'fli':
          case 'cel':
            $media['mime']='video/flc';
            $media['type']='quick_time';
            break;
          case 'rtsp':
          case 'rts':
            $media['mime']='application/x-rtsp';
            $media['type']='quick_time';
            break;
          case '3gp':
          case '3gpp':
            $media['mime']='video/3gpp';
            $media['type']='quick_time';
            break;
          case '3g2':
          case '3gp2':
            $media['mime']='video/3gpp2';
            $media['type']='quick_time';
            break;
          case 'sdv':
            $media['mime']='video/sd-video';
            $media['type']='quick_time';
            break;
          case 'amc':
            $media['mime']='application/x-mpeg';
            $media['type']='quick_time';
            break;
          case 'mp4':
            $media['mime']='video/mp4';
            $media['type']='quick_time';
            break;
          case 'sdp':
            $media['mime']='application/sdp';
            $media['type']='quick_time';
            break;
          // Real Media
          case 'rm':
          case 'rmvb':
          case 'ra':
          case 'rv':
          case 'ram':
          case 'smil':
            $media['mime']='audio/x-pn-realaudio-plugin';
            $media['type']='real_media';
            break;
          // Windows Media
          case 'wma':
          case 'ogg':
          case 'ape':
          case 'mid':
          case 'midi':
            $media['height']=45;
          case 'asf':
          case 'asx':
          case 'wm':
          case 'wmv':
          case 'wax':
          case 'wvx':
          case 'avi':
            $media['mime']='application/x-mplayer2';
            $media['type']='windows_media';
            break;
          // Adobe PDF
          case 'pdf':
            $media['mime']='application/pdf';
            $media['type']='adobe_pdf';
            break;
          case 'fdf':
            $media['mime']='application/vnd.fdf';
            $media['type']='adobe_pdf';
            break;
          case 'xfdf':
            $media['mime']='application/vnd.adobe.xfdf';
            $media['type']='adobe_pdf';
            break;
          case 'xdp':
            $media['mime']='application/vnd.adobe.xdp+xml';
            $media['type']='adobe_pdf';
            break;
          case 'xfd':
            $media['mime']='application/vnd.adobe.xfd+xml';
            $media['type']='adobe_pdf';
            break;
          // Images
          case 'gif':
          case 'jpg':
          case 'jpeg':
          case 'bmp':
          case 'png':
          case 'xpm':
            $media['type']='image';
            break;
          // Torrent
          case 'torrent':
            include_once("bencode.php");
            $content = @file_get_contents( $media['url'] );
            if ( $content )
            {
              $bencode = new BEncodeLib();
              $torrent = $bencode->bdecode($content);
              if ( is_array( $torrent ) )
              {
                $media['announce'] = $torrent['announce'];
                $media['created_by'] = $torrent['created by'];
                $media['creation_date'] = iif( $torrent['creation date'] , vbdate( $vbulletin->options['dateformat'], $torrent['creation date'], true ) . " <span class=\"time\">" . vbdate( $vbulletin->options['timeformat'], $torrent['creation date'], true )."</span>" );
                $media['encoding'] = $torrent['encoding'];
                $media['codepage'] = $torrent['codepage'];
                $media['name'] = iif( $torrent['info']['name.utf-8'] , $torrent['info']['name.utf-8'] , $torrent['info']['name']);
                $media['length'] = iif( $torrent['info']['length'] , $this -> format_size( $torrent['info']['length'] ) );
                $media['piece_length'] = iif( $torrent['info']['piece length'] , $this -> format_size( $torrent['info']['piece length'] ) );
                $media['publisher'] = iif( $torrent['info']['publisher.utf-8'] , $torrent['info']['publisher.utf-8'] , $torrent['info']['publisher']);
                $media['publisher_url'] = iif( $torrent['info']['publisher-url.utf-8'] , $torrent['info']['publisher-url.utf-8'] , $torrent['info']['publisher-url']);
                if ( is_array( $torrent['nodes'] ) )
                {
                  foreach ( $torrent['nodes'] as $key => $value )
                  {
                    $media['nodes'] .= $torrent['nodes'][$key][0] . ":" . $torrent['nodes'][$key][1] . "<br />";
                  }
                }
                if ( is_array( $torrent['info']['files'] ) )
                {
                  foreach ( $torrent['info']['files'] as $key => $value )
                  {
                    $media['files'] .= iif( $torrent['info']['files'][$key]['path'] , implode( '/' , $torrent['info']['files'][$key]['path.utf-8'] ) , implode( '/' , $torrent['info']['files'][$key]['path'] ) ) . " ( " . $this -> format_size( $torrent['info']['files'][$key]['length'] ) . " ) <br />";
                  }
                }
                $media['type']='torrent';
              }
              else
              {
                $media['type'] = 'torrent_error';
              }
            }
            else
            {
              $media['type'] = 'torrent_error';
            }
            break;
          default:
            $media['type'] = 'unknown';
        }
      }
      else
      {
        $media['type']="unknown";
      }
      $media['id']=rand();
      $media['layout']=$media['width']+$stylevar['cellpadding']*2+$stylevar['cellspacing']*4;
      eval('$text = "' . fetch_template('anymedia') . '";');
    }
    else
    {
      if ( !empty( $options ) )
      {
        $text = "[MEDIA=".$options."]" . $text . "[/MEDIA]" ;
      }
      else
      {
        $text = "[MEDIA]" . $text . "[/MEDIA]" ;
      }
    }
    return $text;
  }

  /**
  * Formatted a size.
  *
  * Author    Crist Chsu @ VBZH
  *
  * @param  integer  The size in byte.
  *
  * @return  string  The formatted size.
  */
  function format_size($size)
  {
    if ( $size < 1024000 )
    {
      return vb_number_format( $size / 1024 ) . " KB";
    }
    elseif ( $size < 1048576000 )
    {
      return vb_number_format( $size / 1048576 ) . " MB";
    }
    elseif ( $size < 1073741824000 )
    {
      return vb_number_format( $size / 1073741824 ) . " GB";
    }
    else
    {
      return vb_number_format( $size / 1099511627776 ) . " TB";
    }
  }
  /**
  * Emulates the behavior of a pre tag in HTML. Tabs and multiple spaces
  * are replaced with spaces mixed with non-breaking spaces. Usually combined
  * with code tags. Note: this still allows the browser to wrap lines.
  *
  * @param  string  Text to convert. Should not have <br> tags!
  *
  * @param  string  Converted text
  */
  function emulate_pre_tag($text)


Maybe you could contact me with msn messenger or other IM.
My contacts are on the install guide page of the hack.

Crist 01-26-2006 02:21 AM

Quote:

Originally Posted by nitro
Im streaming avi in FF right now with it on my testbed accross my home network its running fine.

@imported_predatorkill What type of media file you put in ?

My question now is it seem there is no restriction. Someone could load the first page of a thread with 10 1.5 GB avi's and it will sit there loading each one eventually. You can even use the ftp:// protocol in the tags :o One avi will load quickly but how is a thread page going to handle multiple posts with media tages or even a single post with multiple media tags. :D

In next version I'll do some restriction work on it.
:devious:

Crist 01-26-2006 02:24 AM

Quote:

Originally Posted by imported_predatorkill
In IE works perfectly but in Firefox it says "Install Missing Plugins"

When i click on that is says "Unknown plugin" :ermm: :ermm:

Great hack tho!It wont stream the video,it will just cache it all and play it,right?

I think you should install the plugin for the FF yourself.
the hack won't install it automatically.

4number8 01-26-2006 02:43 AM

Thank you sir, what a great feature to have, running to click install :)

Guest210212002 01-26-2006 03:10 AM

/me puts in the early nomination for hack of the month

Crist 01-26-2006 05:36 AM

Quote:

Originally Posted by Chris-777
[high]* Chris-777 puts in the early nomination for hack of the month[/high]

Yeah,that's what I wanna it to be.
LoL.. :nervous:

ericgtr 01-26-2006 12:34 PM

This looks like a great mod! Is there an option to disallow it for guests?

Crist 01-26-2006 01:09 PM

Quote:

Originally Posted by ericgtr
This looks like a great mod! Is there an option to disallow it for guests?

No.......
But i'm gonna restrict it with the usergroup permissions..


All times are GMT. The time now is 01:25 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05608 seconds
  • Memory Usage 2,016KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (17)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete