Default type is text, 2nd array defines 'other'

Changed the default type to 'text' so ICEcoder will want to open any
file in the editor to begin with.
This is overridden by the images array and the newly purposed 2nd array
which defines types to instead pop open in a window (doc, docx, ppt,
rtf, pdf ...etc).
This commit is contained in:
Matt Pass
2014-02-17 07:47:51 +00:00
parent cb5d3d8b1a
commit 7df2a8c0ac

View File

@@ -24,7 +24,7 @@ if ($_GET['action']=="load") {
echo 'action="load";';
if (file_exists($file)) {
$finfo = "";
$finfo = "text";
// Determine what to do based on mime type
if (function_exists('finfo_open')) {
$finfoMIME = finfo_open(FILEINFO_MIME);
@@ -33,8 +33,8 @@ if ($_GET['action']=="load") {
} else {
$fileExt = explode(" ",pathinfo($file, PATHINFO_EXTENSION));
$fileExt = $fileExt[0];
if (array_search($fileExt,array("coffee","css","htm","html","js","json","less","md","php","py","rb","ruby","sql","txt","xml"))!==false) {$finfo = "text";};
if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
if (array_search($fileExt,array("doc","docx","ppt","rtf","pdf","zip","tar","gz","swf","asx","asf","midi","mp3","wav","aiff","mov","qt","wmv","mp4","odt","odg","odp"))!==false) {$finfo = "other";};
}
if (strpos($finfo,"text")===0 || strpos($finfo,"empty")!==false) {
echo 'fileType="text";';