<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
function str_rf($s){
	$s=str_replace(
		array('\\','\\\\','&quot;','&#39;','&lt;','&gt;','',' ','&nbsp;'),
		array('','','"','\'','<','>','\r','&nbsp;',' '),$s);
	return $s;
}

function showFile($act, $w, $h, $url){
	global $arrdb;
	if (intval($act) === 1)
	{
		$GetDBText = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'.$w.'" height="'.$h.'"><param name=movie value="'.$url.'"><PARAM NAME=wmode VALUE=opaque><param name=quality value=autolow><embed src="'.$url.'" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'.$w.'" height="'.$h.'" wmode="opaque"></embed></object>';
	}
	elseif (intval($act) === 2)
	{
		if (!empty($arrdb[DB_linkurl]) and $arrdb[DB_linkurl]!='http://')$GetDBText .= '<A HREF="'.$arrdb[DB_linkurl].'" target="_blank">';
		$GetDBText .= '<img  src="'.$url.'" height="'.$h.'" widht="'.$w.'" border="0" alt="'.$arrdb[DB_name].'" >';
		if (!empty($arrdb[DB_linkurl]) and $arrdb[DB_linkurl]!='http://')$GetDBText .= '</A>';
	}
	return $GetDBText;
}
if (intval($arrdb[DB_type]) === 1)
{
	if (strtolower($arrdb[DB_File_type]) == 'swf'){
		$act = 1;
	}elseif (strtolower($arrdb[DB_File_type]) == 'gif' || strtolower($arrdb[DB_File_type]) == 'jpg'){
		$act = 2;
	}
	$DB_HTML=showFile($act,$arrdb[DB_width],$arrdb[DB_height],$arrdb[DB_File]);
}
else if(intval($arrdb[DB_type]) === 2) 
{
	$DB_HTML = str_rf($arrdb[DB_HTML]);
	if (false!==strpos($DB_HTML,'[/img]')){
		$DB_HTML=preg_replace('/\[img=(.+?),(.+?)\](.+?)\[\/img\]/ise','showFile("2","$1","$2","$3")',$DB_HTML);
	}
	if (false!==strpos($DB_HTML,'[/flash]')){
		$DB_HTML=preg_replace('/\[flash=(.+?),(.+?)\](.+?)\[\/flash\]/ise','showFile("1","$1","$2","$3")',$DB_HTML);
	}
}
?>
<div style="padding: 4px;margin:0;width:<?=$arrdb[DB_width]?>px;height:<?=$arrdb[DB_height]?>px;">
<?=$DB_HTML?>
</div>

<script language=javascript> 
this.window.opener = null; 
setTimeout("window.close()",<?=$arrdb[DB_second]*1000?>);
</script>


