Kind of weird that I don't find any other reference in CMSmadesimple or in any of it's module to GetMimetype() yet none of the files of NMS 2.3 contains this function. I checked other installations of CMSms with NMS but I even there I didn't find anything about GetMimetype() .
In order to get NMS 2.3 to work I came up with a temporary and hackish solution:
1.) As the CMS ist hosted at a crappy managed host site that doesn't provide me PECL or mime magic, I uploaded a Apache mime types file on the webserver itself, outside the document root.
2.) I included my own Getmimetype() function as a workaround in NMS.module.php
Code: Select all
/*---------------------------------------------------------
Getmimetype
-
Retrieves the mim type of a given file.
$mimePath must include path to Apache 2 mime types file
---------------------------------------------------------*/
function GetMimetype($filename, $mimePath = '/kunden/200654_22609') {
$fileext = substr(strrchr($filename, '.'), 1);
if (empty($fileext)) return (false);
$regex = "/^([\w\+\-\.\/]+)\s+(\w+\s)*($fileext\s)/i";
$lines = file("$mimePath/mime.types");
foreach($lines as $line) {
if (substr($line, 0, 1) == '#') continue; // skip comments
$line = rtrim($line) . " ";
if (!preg_match($regex, $line, $matches)) continue; // no match to the extension
return ($matches[1]);
}
return (false); // no match at all
}
3.) Profit
I am aware that something must be wrong in a completely different place. Why would NMS 2.3 have missing functions? But for the time being this hack job above works surprisingly well and fixes the problem for now. (note to self: do some more Django again).