29 lines
718 B
PHP
29 lines
718 B
PHP
<?
|
|
|
|
$types['DS_Store'] = "text/binary";
|
|
$types['txt'] = "text/plain";
|
|
$types['log'] = "text/plain";
|
|
$types['csv'] = "text/plain";
|
|
$types['webloc'] = "application/xml";
|
|
$types['svg'] = "image/svg+xml";
|
|
//$types['rtf'] = "application/rtf";
|
|
$types['rtfd'] = "application/rtf";
|
|
$types['doc'] = "application/msword";
|
|
$types['docx'] = "application/msword";
|
|
|
|
require "togggle.php";
|
|
|
|
$zip = new ZipArchive;
|
|
$zip->open($_GET['file']);
|
|
$stat = $zip->statIndex(0);
|
|
|
|
if (!$mime = $types[pathinfo($stat['name'],PATHINFO_EXTENSION)]) {
|
|
$mime = "text/plain";
|
|
}
|
|
|
|
header("Content-Disposition: inline; filename=".$stat['name']);
|
|
header("Content-Type: ".$mime);
|
|
header("Content-Length: ".$stat['size']);
|
|
echo $zip->getFromIndex(0);
|
|
|
|
?>
|