aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/filestore.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index e33730021..67330c4e5 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -1247,6 +1247,44 @@
}
}
+ /**
+ * Returns an overall file type from the mimetype
+ *
+ * @param string $mimetype The MIME type
+ * @return string The overall type
+ */
+ function get_general_file_type($mimetype) {
+
+ switch($mimetype) {
+
+ case "application/msword":
+ return "document";
+ break;
+ case "application/pdf":
+ return "document";
+ break;
+
+ }
+
+ if (substr_count($mimetype,'text/'))
+ return "document";
+
+ if (substr_count($mimetype,'audio/'))
+ return "audio";
+
+ if (substr_count($mimetype,'image/'))
+ return "image";
+
+ if (substr_count($mimetype,'video/'))
+ return "video";
+
+ if (substr_count($mimetype,'opendocument'))
+ return "document";
+
+ return "general";
+
+ }
+
/// Variable holding the default datastore
$DEFAULT_FILE_STORE = NULL;