mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
allow perl regular expression as mime-type filter
This commit is contained in:
parent
94ea53a688
commit
b6a83398a4
@ -417,7 +417,7 @@ class egw_vfs extends vfs_stream_wrapper
|
||||
* - name,path => pattern with *,? wildcards, eg. "*.php"
|
||||
* - name_preg,path_preg => preg regular expresion, eg. "/(vfs|wrapper)/"
|
||||
* - uid,user,gid,group,nouser,nogroup file belongs to user/group with given name or (numerical) id
|
||||
* - mime => type[/subtype]
|
||||
* - mime => type[/subtype] or perl regular expression starting with a "/" eg. "/^(image|video)\\//i"
|
||||
* - empty,size => (+|-|)N
|
||||
* - cmin/mmin => (+|-|)N file/dir create/modified in the last N minutes
|
||||
* - ctime/mtime => (+|-|)N file/dir created/modified in the last N days
|
||||
@ -666,6 +666,15 @@ class egw_vfs extends vfs_stream_wrapper
|
||||
return; // wrong user or group
|
||||
}
|
||||
if (isset($options['mime']) && $options['mime'] != $stat['mime'])
|
||||
{
|
||||
if ($options['mime'][0] == '/') // perl regular expression given
|
||||
{
|
||||
if (!preg_match($options['mime'], $stat['mime']))
|
||||
{
|
||||
return; // wrong mime-type
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list($type,$subtype) = explode('/',$options['mime']);
|
||||
// no subtype (eg. 'image') --> check only the main type
|
||||
@ -674,6 +683,7 @@ class egw_vfs extends vfs_stream_wrapper
|
||||
return; // wrong mime-type
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($options['size']) && !self::_check_num($stat['size'],$options['size']) ||
|
||||
(isset($options['empty']) && !!$options['empty'] !== !$stat['size']))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user