function filedepot::checkFilter in filedepot 6
3 calls to filedepot::checkFilter()
File
- ./
filedepot.class.php, line 171 - filedepot.class.php Main class for the Filedepot module
Class
- filedepot
- @file filedepot.class.php Main class for the Filedepot module
Code
function checkFilter($filename, $mimetype) {
$ext = end(explode(".", $filename));
$filterdata = unserialize(variable_get('filedepot_filetype_filterdata', ''));
if (is_array($filterdata) and !empty($filterdata)) {
if (array_key_exists($mimetype, $filterdata) and is_array($filterdata[$mimetype])) {
if (in_array($ext, $filterdata[$mimetype])) {
// Match found - Mimetype and extension match defined settings
if (variable_get('filedepot_filter_mode', FILEDEPOT_FILTER_INCLUDEMODE) == FILEDEPOT_FILTER_INCLUDEMODE) {
return TRUE;
}
else {
return FALSE;
}
}
}
}
// If we get here, no match found. Return depends on the filtering mode
if (variable_get('filedepot_filter_mode', FILEDEPOT_FILTER_EXCLUDEMODE) == FILEDEPOT_FILTER_EXCLUDEMODE) {
return TRUE;
}
else {
return FALSE;
}
}