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)
|