Commit 2cef11f485bc0a07bb4fb28bc53289d83aad8f8d

Authored by Conrad Vermeulen
1 parent 74f373cc

KTS-2828

"Mime types of Microsoft Office documents are being resolved incorrectly as binary files that cannot be indexed"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7982 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 19 additions and 25 deletions
lib/mime.inc.php
... ... @@ -5,32 +5,32 @@
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8   - *
  8 + *
9 9 * This program is free software; you can redistribute it and/or modify it under
10 10 * the terms of the GNU General Public License version 3 as published by the
11 11 * Free Software Foundation.
12   - *
  12 + *
13 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 16 * details.
17   - *
  17 + *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
  20 + *
21 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23   - *
  23 + *
24 24 * The interactive user interfaces in modified source and object code versions
25 25 * of this program must display Appropriate Legal Notices, as required under
26 26 * Section 5 of the GNU General Public License version 3.
27   - *
  27 + *
28 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 34 * Contributor( s): ______________________________________
35 35 *
36 36 */
... ... @@ -50,15 +50,9 @@ class KTMime {
50 50 function getMimeTypeID($sMimeType, $sFileName) {
51 51 global $default;
52 52 $sTable = KTUtil::getTableName('mimetypes');
53   - $lookupExtension = false;
54 53  
55   - if (in_array($sMimeType, array('application/x-zip','application/octet-stream', 'application/msword', 'text/plain')))
56   - {
57   - $lookupExtension = true;
58   - }
59 54  
60   - if ($lookupExtension || empty($sMimeType))
61   - {
  55 +
62 56 // check by file extension
63 57 $sExtension = KTMime::stripAllButExtension($sFileName);
64 58 $res = DBUtil::getOneResultKey(array("SELECT id FROM " . $sTable . " WHERE LOWER(filetypes) = ?", array($sExtension)),'id');
... ... @@ -69,7 +63,7 @@ class KTMime {
69 63 else {
70 64 return $res;
71 65 }
72   - }
  66 +
73 67  
74 68 // get the mime type id
75 69 if (isset($sMimeType)) {
... ... @@ -207,12 +201,12 @@ class KTMime {
207 201 function stripAllButExtension($sFileName) {
208 202 return strtolower(substr($sFileName, strrpos($sFileName, ".")+1, strlen($sFileName) - strrpos($sFileName, ".")));
209 203 }
210   -
  204 +
211 205 /**
212   - * getAllMimeTypesInformation is a staic function used to get a fuller set of
  206 + * getAllMimeTypesInformation is a staic function used to get a fuller set of
213 207 * information on the mime types held in the database.
214   - *
215   - */
  208 + *
  209 + */
216 210 function getAllMimeTypesInformation()
217 211 {
218 212 $sTable = KTUtil::getTableName('mimetypes');
... ... @@ -221,10 +215,10 @@ class KTMime {
221 215 $res = DBUtil::getResultArray($aQuery);
222 216 return $res;
223 217 }
224   -
  218 +
225 219 /**
226 220 * get all information on all the extractors in the database
227   - *
  221 + *
228 222 */
229 223 function getMimeExtractorInformation()
230 224 {
... ... @@ -232,11 +226,11 @@ class KTMime {
232 226 $res = DBUtil::getResultArray($aQuery);
233 227 return $res;
234 228 }
235   -
  229 +
236 230 /**
237 231 *give the mimetype name and get the friendly names and the extensions
238 232 *
239   - */
  233 + */
240 234 function getFriendlyNameAndExtension($sMimeType)
241 235 {
242 236 $sTable = KTUtil::getTableName('mimetypes');
... ...