enhance filters; make them work on multiimage
This commit is contained in:
parent
57e80951d9
commit
fa198e207f
@ -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;
|
return false;
|
||||||
return preg_match($match, $post['filename']);
|
|
||||||
|
foreach ($post['files'] as $file) {
|
||||||
|
if (preg_match($match, $file['filename'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
case 'extension':
|
case 'extension':
|
||||||
if (!$post['has_file'])
|
if (!$post['files'])
|
||||||
return false;
|
return false;
|
||||||
return preg_match($match, $post['body']);
|
|
||||||
|
foreach ($post['files'] as $file) {
|
||||||
|
if (preg_match($match, $file['extension'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user