// YOUTUBE START
//use glype 0.4 b2 with hotlinking enabled just to play the videos due to on the fly curl output
if ( ereg( 'youtube', $_url ) && ereg( 'watch\?', $_url ) )
{
//if (preg_match('/\/player2\.swf\?(.*?)", "movie_player"/', $_response_body, $match))
if( preg_match( '#video_id=(.*?)title#is', $_response_body, $match ) )
{
//get the t=value from the whole video line regexed
$array1 = explode ("&t=", $match[1]);
$array2 = explode ('&', $array1[1]);
$t = $array2[0];
/*
$array3 = explode ("?", $match[1]);
$array4 = explode ('&', $array3[1]);
$v = $array4[0];
*/
//recreate the whole video line and get just the video id value and call it $video
preg_match( '#video_id=(.*?)&t#is', $_response_body, $video );
//rebuild the video location using video id and t values
$file = base64_encode( 'http://youtube.com/get_video?video_id=' . $video[1] .'&t=' . $t );
}
$s = '/var v = "7";(.*?)player_div\);/is';
$t = '#\/\/ \<\!\[(.*?)\/\/ \]\]\>#is';
$r = "
var p = new SWFObject('/player.swf','single','450','370','7');
p.addParam('allowfullscreen','true');
p.addVariable('file','/player/browse.php?u={$file}');
p.addVariable('backcolor','0x000000');
p.addVariable('frontcolor','0xCCCCCC');
p.addVariable('lightcolor','0x996600');
p.addVariable('overstretch','true');
p.addVariable('type','flv');
p.addVariable('volume','50');
p.write('playerDiv');";
$_response_body = preg_replace( $s, $r, $_response_body );
$_response_body = preg_replace( $t, $r, $_response_body );
}