Serve only valid mime types
This commit is contained in:
parent
1ae5e0b8a1
commit
4340b14067
15
index.php
15
index.php
@ -62,6 +62,7 @@
|
||||
|
||||
if (is_file($strTargetFilePath))
|
||||
{
|
||||
$intValid = 0;
|
||||
$varMimeTypes = array(
|
||||
array("/\.css$/", "text/css"),
|
||||
array("/\.js$/", "application/javascript"),
|
||||
@ -72,12 +73,18 @@
|
||||
|
||||
foreach ($varMimeTypes as $varMimeType)
|
||||
if (preg_match($varMimeType[0], $strTargetFilePath))
|
||||
{
|
||||
header("Content-Type: {$varMimeType[1]}");
|
||||
$intValid = 1;
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo file_get_contents($strTargetFilePath);
|
||||
ob_end_flush();
|
||||
exit;
|
||||
if ($intValid)
|
||||
{
|
||||
ob_clean();
|
||||
echo file_get_contents($strTargetFilePath);
|
||||
ob_end_flush();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user