Location: PHPKode > projects > Wexplorer > weXplorer/binary.php
<?php
require_once ('mime.php');
require_once ('config.inc.php');
require_once ('session.php');
require_once (ACCESS_MANAGER.'.php');


function standardHeaders($filename) {
	header("Connection: keep-alive");

	setlocale(LC_TIME, "C");
	//$ft = filemtime($filename);
	$ft = time();
	$localt = mktime();
	$gmtt = gmmktime();
	$ft = $ft - $gmtt + $localt;
	$modified = strftime("%a, %d %b %Y %H:%M:%S GMT", $ft);

	header("Last-Modified: $modified");
	header("Content-Length: ".filesize($filename));
	if (!isInline($filename))
		header('Content-Disposition: attachment; filename="'.basename($filename).'"');
}
function sendBinary($path){
		ini_set("zlib.output_compression", "0");
		ini_set("implicit_flush", "1");
		if(LOGGER!=""){
			$user = getUser();
			if (LOGDATE != "")
				$date = date(LOGDATE);
			require_once(LOGGER.'.php');
			_log($date, $user, $path,$_SERVER['REMOTE_ADDR']);	
		}
		$binarytypes = array ('htm' => 'text/html', 'tml' => 'text/html', 'xml' => 'text/xml', 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'tif' => 'image/tiff', 'png' => 'image/png', '.js' => 'text/plain', 'css' => 'text/css', 'pdf' => 'application/pdf', 'mpg' => 'video/mpeg', 'mov' => 'video/quicktime ', 'wav' => 'audio/x-wav ', 'rtf' => 'application/rtf', '.ps' => 'application/postscript', 'eps' => 'application/postscript');
		$type = 'text/plain';
		if (isset ($binarytypes[substr($path, -3)]))
			$type = $binarytypes[substr($path, -3)];
		header("Content-Type: $type");
		standardHeaders($path);
		$fp = fopen($path, 'rb');
		while (!feof($fp)) {
			echo fgets($fp, 65536);
		}
}
?>
Return current item: Wexplorer