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-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 04:10 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.02276 seconds
  • Memory Usage 1,811KB
  • 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
  • (1)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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