enhance filters; make them work on multiimage

This commit is contained in:
czaks 2014-08-08 21:35:00 +02:00
parent 57e80951d9
commit fa198e207f

View File

@ -97,19 +97,35 @@ class Filter {
case 'filehash': case 'filehash':
return $match === $post['filehash']; return $match === $post['filehash'];
case 'filename': case 'filename':
if (!$post['has_file']) if (!$post['files'])
return false;
foreach ($post['files'] as $file) {
if (preg_match($match, $file['filename'])) {
return true;
}
}
return false; return false;
return preg_match($match, $post['filename']);
case 'extension': case 'extension':
if (!$post['has_file']) if (!$post['files'])
return false;
foreach ($post['files'] as $file) {
if (preg_match($match, $file['extension'])) {
return true;
}
}
return false; return false;
return preg_match($match, $post['body']);
case 'ip': case 'ip':
return preg_match($match, $_SERVER['REMOTE_ADDR']); return preg_match($match, $_SERVER['REMOTE_ADDR']);
case 'op': case 'op':
return $post['op'] == $match; return $post['op'] == $match;
case 'has_file': case 'has_file':
return $post['has_file'] == $match; return $post['has_file'] == $match;
case 'board':
return $post['board'] == $match;
case 'password':
return $post['password'] == $match;
default: default:
error('Unknown filter condition: ' . $condition); error('Unknown filter condition: ' . $condition);
} }