Correct MIME-type when viewing, add option for viewing files with unknown MIME-type as text/plain

This commit is contained in:
uid30988 2001-07-05 00:41:45 +00:00
parent fa69a38255
commit 4b94acadaa
3 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@ $pref->change ("phpwebhosting", "modifiedby_id", "True");
$pref->change ("phpwebhosting", "comment", "True");
//$pref->change ("phpwebhosting", "viewinnewwin", "False");
//$pref->change ("phpwebhosting", "viewonserver", "False");
$pref->change ("phpwebhosting", "viewtextplain", True);
//$pref->change ("phpwebhosting", "dotdot", "False");
//$pref->change ("phpwebhosting", "dotfiles", "False");

View File

@ -247,6 +247,18 @@ if ($download)
if ($op == "view" && $file)
{
$ls_array = $phpgw->vfs->ls ($file, array (RELATIVE_ALL), False, False, True);
if ($ls_array[0]["mime_type"])
{
$mime_type = $ls_array[0]["mime_type"];
}
elseif ($settings["viewtextplain"])
{
$mime_type = "text/plain";
}
header('Content-type: ' . $mime_type);
echo $phpgw->vfs->read ($file);
$phpgw->common->phpgw_exit ();
}

View File

@ -17,7 +17,7 @@
/*
To add a preference, just add it here. Key is internal name, value is displayed name
*/
$other_checkboxes = array ("viewinnewwin" => "View documents in new window", "viewonserver" => "View documents on server (if available)", "dotdot" => "Show ..", "dotfiles" => "Show .files");
$other_checkboxes = array ("viewinnewwin" => "View documents in new window", "viewonserver" => "View documents on server (if available)", "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", "dotdot" => "Show ..", "dotfiles" => "Show .files");
if ($submit)
{