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':
return $match === $post['filehash'];
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 preg_match($match, $post['filename']);
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 preg_match($match, $post['body']);
case 'ip':
return preg_match($match, $_SERVER['REMOTE_ADDR']);
case 'op':
return $post['op'] == $match;
case 'has_file':
return $post['has_file'] == $match;
case 'board':
return $post['board'] == $match;
case 'password':
return $post['password'] == $match;
default:
error('Unknown filter condition: ' . $condition);
}