thebaby
22/06/2007, 11h41
Bonjours, j'ai un forum vBulletin 3.6.7 et j'ai quelques problèmes niveau modifs d'un hack.
J'ai installé le hack "BBCode Tous Média", et il marche parfaitement. Il permet de voir des vidéos en streaming.
J'ai aussi installé les balises , mais cependant, lorsque je fais [spoiler]URL DE LA VIDEO cela ne marche pas (je ne vois pas la vidéo) !
Je voudrais savoir si quelqu'un pourrait alors m'introduire le code du spoiler dans le hack, pour que le spoiler soit automatisé lorsque je met : URL DE LA VIDEO
Voici le code du hack :
if ($this->registry->options['anymediaenable'] && ($this->registry->userinfo['permissions']['anymediapermissions'] & $this->registry->bf_ugp_anymediapermissions['canuse']) )
{
//
$this->tag_list['option'][$this->registry->options['anymediatag']] = array(
'callback' => 'handle_external',
'strip_empty' => true,
'stop_parse' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1,
'external_callback' => 'handle_bbcode_media'
);
$this->tag_list['no_option'][$this->registry->options['anymediatag']] = array(
'callback' => 'handle_external',
'strip_empty' => true,
'stop_parse' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1,
'external_callback' => 'handle_bbcode_media'
);
if (!function_exists('handle_bbcode_media'))
{
/**
* Handles a match of the [media] tag that will be displayed as an media object
*
* Author Crist Chsu @ VBZH
*
* @param object A reference to this BB code parser.
*
* @param string code of the media.
*
* @param string option of the media.
*
* @return string HTML representation of the media
*/
function handle_bbcode_media( &$parser, $text, $options='' )
{
global $vbphrase, $stylevar;
if(!$parser -> is_wysiwyg())
{
$media['url'] = $media['link'] = htmlspecialchars_uni( strip_bbcode( strip_tags( $text ) ) );
$extensions = explode( ',' , 'error,'.'ggv,'.trim( $parser->registry->options['anymediasupport'] ) );
$extensions = iif( is_array( $extensions ) , $extensions , array() );
if((strpos(strtolower($media['url']), 'http://video.google') === 0) AND in_array( 'google' , $extensions ) )
{
if (preg_match('/videoUrl=([^(\&|$)]*)/', $media['url'], $match)) {
if($parser->registry->options['anymediaproxy']) {
$media['url'] = 'http://www.anonymization.org/-' . substr(urldecode($match[1]), 7);
} else {
$media['url'] = urldecode($match[1]);
}
$media['extension'] = "ggv";
}
elseif(preg_match('/docid=([^(\&|$)]*)/', $media['url'], $match))
{
$docid = $match[1];
$content = @file_get_contents( "http://www.anonymization.org/-video.google.com/videoplay?docid=" . $docid );
if (preg_match('/videoUrl=([^(\&)]*)/', $content, $match)) {
if($parser->registry->options['anymediaproxy']) {
$media['url'] = 'http://www.anonymization.org/-' . substr(urldecode($match[1]), 7);
} else {
$media['url'] = urldecode($match[1]);
}
$media['extension'] = "ggv";
}
else
{
$media['extension'] = "error";
}
}
else
{
$media['extension'] = "error";
}
}
elseif ((strpos(strtolower($media['url']), 'http://www.youtube') === 0) || (strpos(strtolower($media['url']), 'http://youtube') === 0) AND in_array( 'youtube' , $extensions ) )
{
if (preg_match('/v=([^(\&|$)]*)/', $media['url'], $match) ||
preg_match('/video_id=([^(\&|$)]*)/', $media['url'], $match) ||
preg_match('/youtube\.com\/v\/([^(\&|$)]*)/', $media['url'], $match)) {
$media['url'] = "http://youtube.com/get_video.php?video_id=".$match[1];
$media['extension'] = "flv";
}
else
{
$media['extension'] = "error";
}
}
elseif ((strpos(strtolower($media['url']), 'http://www.vsocial.com') === 0) || (strpos(strtolower($media['url']), 'http://vsocial.com') === 0) AND in_array( 'vsocial' , $extensions ) )
{
if (preg_match('/v=([^(\&|$)]*)/', $media['url'], $match) ||
preg_match('/vsocial\.com\/v\/([^(\&|$)]*)/', $media['url'], $match)) {
$media['url'] = "http://www.vsocial.com/varmedia/vsocial/flv/".$match[1]."_out.flv";
$media['extension'] = "flv";
}
elseif(preg_match('/d=([^(\&|$)]*)/', $media['url'], $match))
{
$docid = $match[1];
$content = @file_get_contents( "http://vsocial.com/video/?d=" . $docid );
if (preg_match('/vp\.swf\?v=([^(\')]*)/', $content, $match)) {
$media['url'] = "http://www.vsocial.com/varmedia/vsocial/flv/".$match[1]."_out.flv";
$media['extension'] = "flv";
}
else
{
$media['extension'] = "error";
}
}
else
{
$media['extension'] = "error";
}
}
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] , $parser->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] , $parser->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['extension'] );
}
}
$media['width'] = iif( isset( $media['width'] ) AND !empty( $media['width'] ) , $media['width'] , $parser->registry->options['anymediawidth'] );
$media['height'] = iif( isset( $media['height'] ) AND !empty( $media['height'] ) , $media['height'] , $parser->registry->options['anymediaheight'] );
$media['autoplay'] = iif( isset( $media['autoplay'] ) AND !empty( $media['autoplay'] ) , $media['autoplay'] , iif($parser->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 ( $parser->registry->options['anymediamp3player'] )
{
$media['url'] = $parser->registry->options['bburl'].'/players/mp3player.swf?file=' . htmlentities( urlencode( $media['url'] ) ) . '&autoStart=' . $media['autoplay'] . '&showDownload=false';
$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;
// Google Video
case 'ggv':
$media['url'] = $parser->registry->options['bburl'].'/players/googleplayer.swf?videoUrl=' . htmlentities( urlencode( $media['url'] ) ) . '&thumbnailUrl=' . urlencode( $parser->registry->options['bburl'].'/clear.gif' ) . '&playerMode=embedded';
$media['autoplay'] = 'true';
$media['height'] += 27;
$media['mime']='application/x-shockwave-flash';
$media['type']='adobe_flash';
break;
// Adobe Flash
case 'flv':
$media['url'] = $parser->registry->options['bburl'].'/players/flvplayer.swf?file=' . $media['url'] . '&autoStart=' . $media['autoplay'];
$media['autoplay'] = 'true';
$media['height'] += 20;
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 'wsx':
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( $parser->registry->options['dateformat'], $torrent['creation date'], true ) . " <span class=\"time\">" . vbdate( $parser->registry->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'] , vb_number_format($torrent['info']['length'], 1, true) );
$media['piece_length'] = iif( $torrent['info']['piece length'] , vb_number_format($torrent['info']['piece length'], 1, true) );
$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'] ) ) . " ( " . vb_number_format($torrent['info']['files'][$key]['length'], 1, true) . " ) <br />";
}
}
$media['type']='torrent';
}
else
{
$media['type'] = 'torrent_error';
}
}
else
{
$media['type'] = 'torrent_error';
}
break;
// Error
case 'error':
$media['type'] = '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 . "" ;
}
else
{
$text = "" . $text . "" ;
}
}
return $text;
}
}
}
Voici le code du spoiler :
<div>
<div class="pre-spoiler">
<span style="float:left; padding-top: 2px;">Spoiler</span> <input type="button" value="Voir" style="width:80px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName(' div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Cacher'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Show';}">
</div>
<div>
<div class="spoiler" style="display: none;">{param}</div>
</div>
</div>
Merci d'avance !
J'ai installé le hack "BBCode Tous Média", et il marche parfaitement. Il permet de voir des vidéos en streaming.
J'ai aussi installé les balises , mais cependant, lorsque je fais [spoiler]URL DE LA VIDEO cela ne marche pas (je ne vois pas la vidéo) !
Je voudrais savoir si quelqu'un pourrait alors m'introduire le code du spoiler dans le hack, pour que le spoiler soit automatisé lorsque je met : URL DE LA VIDEO
Voici le code du hack :
if ($this->registry->options['anymediaenable'] && ($this->registry->userinfo['permissions']['anymediapermissions'] & $this->registry->bf_ugp_anymediapermissions['canuse']) )
{
//
$this->tag_list['option'][$this->registry->options['anymediatag']] = array(
'callback' => 'handle_external',
'strip_empty' => true,
'stop_parse' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1,
'external_callback' => 'handle_bbcode_media'
);
$this->tag_list['no_option'][$this->registry->options['anymediatag']] = array(
'callback' => 'handle_external',
'strip_empty' => true,
'stop_parse' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1,
'external_callback' => 'handle_bbcode_media'
);
if (!function_exists('handle_bbcode_media'))
{
/**
* Handles a match of the [media] tag that will be displayed as an media object
*
* Author Crist Chsu @ VBZH
*
* @param object A reference to this BB code parser.
*
* @param string code of the media.
*
* @param string option of the media.
*
* @return string HTML representation of the media
*/
function handle_bbcode_media( &$parser, $text, $options='' )
{
global $vbphrase, $stylevar;
if(!$parser -> is_wysiwyg())
{
$media['url'] = $media['link'] = htmlspecialchars_uni( strip_bbcode( strip_tags( $text ) ) );
$extensions = explode( ',' , 'error,'.'ggv,'.trim( $parser->registry->options['anymediasupport'] ) );
$extensions = iif( is_array( $extensions ) , $extensions , array() );
if((strpos(strtolower($media['url']), 'http://video.google') === 0) AND in_array( 'google' , $extensions ) )
{
if (preg_match('/videoUrl=([^(\&|$)]*)/', $media['url'], $match)) {
if($parser->registry->options['anymediaproxy']) {
$media['url'] = 'http://www.anonymization.org/-' . substr(urldecode($match[1]), 7);
} else {
$media['url'] = urldecode($match[1]);
}
$media['extension'] = "ggv";
}
elseif(preg_match('/docid=([^(\&|$)]*)/', $media['url'], $match))
{
$docid = $match[1];
$content = @file_get_contents( "http://www.anonymization.org/-video.google.com/videoplay?docid=" . $docid );
if (preg_match('/videoUrl=([^(\&)]*)/', $content, $match)) {
if($parser->registry->options['anymediaproxy']) {
$media['url'] = 'http://www.anonymization.org/-' . substr(urldecode($match[1]), 7);
} else {
$media['url'] = urldecode($match[1]);
}
$media['extension'] = "ggv";
}
else
{
$media['extension'] = "error";
}
}
else
{
$media['extension'] = "error";
}
}
elseif ((strpos(strtolower($media['url']), 'http://www.youtube') === 0) || (strpos(strtolower($media['url']), 'http://youtube') === 0) AND in_array( 'youtube' , $extensions ) )
{
if (preg_match('/v=([^(\&|$)]*)/', $media['url'], $match) ||
preg_match('/video_id=([^(\&|$)]*)/', $media['url'], $match) ||
preg_match('/youtube\.com\/v\/([^(\&|$)]*)/', $media['url'], $match)) {
$media['url'] = "http://youtube.com/get_video.php?video_id=".$match[1];
$media['extension'] = "flv";
}
else
{
$media['extension'] = "error";
}
}
elseif ((strpos(strtolower($media['url']), 'http://www.vsocial.com') === 0) || (strpos(strtolower($media['url']), 'http://vsocial.com') === 0) AND in_array( 'vsocial' , $extensions ) )
{
if (preg_match('/v=([^(\&|$)]*)/', $media['url'], $match) ||
preg_match('/vsocial\.com\/v\/([^(\&|$)]*)/', $media['url'], $match)) {
$media['url'] = "http://www.vsocial.com/varmedia/vsocial/flv/".$match[1]."_out.flv";
$media['extension'] = "flv";
}
elseif(preg_match('/d=([^(\&|$)]*)/', $media['url'], $match))
{
$docid = $match[1];
$content = @file_get_contents( "http://vsocial.com/video/?d=" . $docid );
if (preg_match('/vp\.swf\?v=([^(\')]*)/', $content, $match)) {
$media['url'] = "http://www.vsocial.com/varmedia/vsocial/flv/".$match[1]."_out.flv";
$media['extension'] = "flv";
}
else
{
$media['extension'] = "error";
}
}
else
{
$media['extension'] = "error";
}
}
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] , $parser->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] , $parser->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['extension'] );
}
}
$media['width'] = iif( isset( $media['width'] ) AND !empty( $media['width'] ) , $media['width'] , $parser->registry->options['anymediawidth'] );
$media['height'] = iif( isset( $media['height'] ) AND !empty( $media['height'] ) , $media['height'] , $parser->registry->options['anymediaheight'] );
$media['autoplay'] = iif( isset( $media['autoplay'] ) AND !empty( $media['autoplay'] ) , $media['autoplay'] , iif($parser->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 ( $parser->registry->options['anymediamp3player'] )
{
$media['url'] = $parser->registry->options['bburl'].'/players/mp3player.swf?file=' . htmlentities( urlencode( $media['url'] ) ) . '&autoStart=' . $media['autoplay'] . '&showDownload=false';
$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;
// Google Video
case 'ggv':
$media['url'] = $parser->registry->options['bburl'].'/players/googleplayer.swf?videoUrl=' . htmlentities( urlencode( $media['url'] ) ) . '&thumbnailUrl=' . urlencode( $parser->registry->options['bburl'].'/clear.gif' ) . '&playerMode=embedded';
$media['autoplay'] = 'true';
$media['height'] += 27;
$media['mime']='application/x-shockwave-flash';
$media['type']='adobe_flash';
break;
// Adobe Flash
case 'flv':
$media['url'] = $parser->registry->options['bburl'].'/players/flvplayer.swf?file=' . $media['url'] . '&autoStart=' . $media['autoplay'];
$media['autoplay'] = 'true';
$media['height'] += 20;
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 'wsx':
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( $parser->registry->options['dateformat'], $torrent['creation date'], true ) . " <span class=\"time\">" . vbdate( $parser->registry->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'] , vb_number_format($torrent['info']['length'], 1, true) );
$media['piece_length'] = iif( $torrent['info']['piece length'] , vb_number_format($torrent['info']['piece length'], 1, true) );
$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'] ) ) . " ( " . vb_number_format($torrent['info']['files'][$key]['length'], 1, true) . " ) <br />";
}
}
$media['type']='torrent';
}
else
{
$media['type'] = 'torrent_error';
}
}
else
{
$media['type'] = 'torrent_error';
}
break;
// Error
case 'error':
$media['type'] = '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 . "" ;
}
else
{
$text = "" . $text . "" ;
}
}
return $text;
}
}
}
Voici le code du spoiler :
<div>
<div class="pre-spoiler">
<span style="float:left; padding-top: 2px;">Spoiler</span> <input type="button" value="Voir" style="width:80px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName(' div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Cacher'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Show';}">
</div>
<div>
<div class="spoiler" style="display: none;">{param}</div>
</div>
</div>
Merci d'avance !