Commit 7fc02b01a8f1424e90da179ad55d67fe75d90408
1 parent
36ac1edc
fix for KTS-1127 *on IE, Windows*
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5952 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
16 additions
and
4 deletions
config/config.ini
| @@ -96,6 +96,11 @@ automaticRefresh = default | @@ -96,6 +96,11 @@ automaticRefresh = default | ||
| 96 | ; use a condensed admin ui | 96 | ; use a condensed admin ui |
| 97 | condensedAdminUI = default | 97 | condensedAdminUI = default |
| 98 | 98 | ||
| 99 | +; allow "open" from downloads. Changing this to "true" will prevent (most) | ||
| 100 | +; browsers from giving users the "open" option. | ||
| 101 | +; fakeMimetype = false | ||
| 102 | +fakeMimetype = default | ||
| 103 | + | ||
| 99 | [i18n] | 104 | [i18n] |
| 100 | ; Default language for the interface | 105 | ; Default language for the interface |
| 101 | defaultLanguage = en | 106 | defaultLanguage = en |
lib/storage/ondiskhashedstoragemanager.inc.php
| @@ -129,14 +129,21 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { | @@ -129,14 +129,21 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { | ||
| 129 | return; | 129 | return; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | - function download($oDocument) { | 132 | + function download($oDocument, $bIsCheckout = false) { |
| 133 | //get the path to the document on the server | 133 | //get the path to the document on the server |
| 134 | $oConfig =& KTConfig::getSingleton(); | 134 | $oConfig =& KTConfig::getSingleton(); |
| 135 | $sPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oDocument)); | 135 | $sPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oDocument)); |
| 136 | + $mimetype = KTMime::getMimeTypeName($oDocument->getMimeTypeID()); | ||
| 137 | + | ||
| 138 | + if ($bIsCheckout && $oConfig->get('ui/fakeMimetype' ,false)) { | ||
| 139 | + $mimetype = 'application/x-download'; | ||
| 140 | + // note this does not work for "image" types in some browsers | ||
| 141 | + // go web. | ||
| 142 | + } | ||
| 143 | + | ||
| 136 | if (file_exists($sPath)) { | 144 | if (file_exists($sPath)) { |
| 137 | //set the correct headers | 145 | //set the correct headers |
| 138 | - header("Content-Type: " . | ||
| 139 | - KTMime::getMimeTypeName($oDocument->getMimeTypeID())); | 146 | + header("Content-Type: " . $mimetype); |
| 140 | header("Content-Length: ". $oDocument->getFileSize()); | 147 | header("Content-Length: ". $oDocument->getFileSize()); |
| 141 | header("Content-Disposition: attachment; filename=\"" . $oDocument->getFileName() . "\""); | 148 | header("Content-Disposition: attachment; filename=\"" . $oDocument->getFileName() . "\""); |
| 142 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | 149 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
plugins/ktcore/KTDocumentActions.php
| @@ -371,7 +371,7 @@ class KTDocumentCheckOutAction extends KTDocumentAction { | @@ -371,7 +371,7 @@ class KTDocumentCheckOutAction extends KTDocumentAction { | ||
| 371 | 371 | ||
| 372 | 372 | ||
| 373 | $oStorage =& KTStorageManagerUtil::getSingleton(); | 373 | $oStorage =& KTStorageManagerUtil::getSingleton(); |
| 374 | - $oStorage->download($this->oDocument); | 374 | + $oStorage->download($this->oDocument, true); |
| 375 | exit(0); | 375 | exit(0); |
| 376 | } | 376 | } |
| 377 | } | 377 | } |