diff options
| author | czaks <marcin@6irc.net> | 2014-08-08 21:35:00 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-08-08 21:35:00 +0200 |
| commit | fa198e207f44c56a9ae48bbc432ea2303dd0deee (patch) | |
| tree | 090b3d8ba6dfde7f4407559d342102a5aa9d0626 | |
| parent | 57e80951d9f14f4d53f9f93e1a670618f4eea59b (diff) | |
enhance filters; make them work on multiimage
| -rw-r--r-- | inc/filters.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/inc/filters.php b/inc/filters.php index 5071353a..22843f10 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -97,19 +97,35 @@ class Filter { case 'filehash': return $match === $post['filehash']; case 'filename': - if (!$post['has_file']) + if (!$post['files']) 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': - if (!$post['has_file']) + if (!$post['files']) 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': 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); } |
