| version 1.2, 2005/10/01 23:59:47 |
version 1.3, 2024/11/20 15:48:04 |
|
|
| * file.php |
* file.php |
| * |
* |
| * This is a plugin for phpWebFileManager that allows you to restrict |
* This is a plugin for phpWebFileManager that allows you to restrict |
| * access to View files. |
* access to View files. |
| * |
* |
| * Although it wouldn't technically be required, it works best to set up a |
* Although it wouldn't technically be required, it works best to set up a |
| * mod_rewrite rule in apache so that when a user choses to download a file |
* mod_rewrite rule in apache so that when a user choses to download a file |
|
|
| * Tony J. White, tjw@tjw.org, 2002-04-15 |
* Tony J. White, tjw@tjw.org, 2002-04-15 |
| **************************************************************************/ |
**************************************************************************/ |
| |
|
| /* $Platon: phpWebFileManager/plugins/file.php,v 1.8 2004/07/13 16:52:02 nepto Exp $ */ |
/* $Platon: Metafox/lib/phpWebFileManager/plugins/file.php,v 1.2 2005-10-01 23:59:47 nepto Exp $ */ |
| |
|
| /* |
/* |
| * phpWebFileManager initialization |
* phpWebFileManager initialization |
| Line 72 function fm_parse_apache_mime_types($fil |
|
| Line 72 function fm_parse_apache_mime_types($fil |
|
| $mime_types = file($file); |
$mime_types = file($file); |
| |
|
| if (is_array($mime_types)) { |
if (is_array($mime_types)) { |
| while (list(,$line) = each($mime_types)) { |
foreach ($mime_types as $line) { |
| if ($line[0] == '#') |
if ($line[0] == '#') |
| continue; |
continue; |
| |
|
| $parts = preg_split('/(\s+)/', $line); |
$parts = preg_split('/(\s+)/', $line); |
| if (is_array($parts) && sizeof($parts) > 2) { |
if (is_array($parts) && sizeof($parts) > 2) { |
| list(,$mime) = each($parts); |
$mime = array_shift($parts); |
| while (list(,$ext) = each($parts)) { |
foreach ($parts as $ext) { |
| if (trim($ext) != '') |
if (trim($ext) != '') |
| $mimes_by_ext[$ext] = $mime; |
$mimes_by_ext[$ext] = $mime; |
| } |
} |
| Line 111 function fm_main() |
|
| Line 111 function fm_main() |
|
| if (! isset($HTTP_GET_VARS[$fm_cfg['cgi'].'path'])) { |
if (! isset($HTTP_GET_VARS[$fm_cfg['cgi'].'path'])) { |
| echo 'CGI variable "'.$fm_cfg['cgi'].'path" is not present.'; |
echo 'CGI variable "'.$fm_cfg['cgi'].'path" is not present.'; |
| return false; |
return false; |
| } |
} |
| |
|
| $file = $HTTP_GET_VARS[$fm_cfg['cgi'].'path']; |
$file = $HTTP_GET_VARS[$fm_cfg['cgi'].'path']; |
| if ($file{0} != '/') { |
if ($file{0} != '/') { |