diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-10-16 22:04:01 +0100 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-10-16 22:04:01 +0100 |
commit | 443e135d59e9d227eec818dabf9ee64d7a73d474 (patch) | |
tree | 14c649d0a1fade810971d7e6da53471b41484fdf /inc/search.php | |
parent | 4d8acaacee33f49d51c06f6dae1dbe245018a020 (diff) | |
download | rpg-443e135d59e9d227eec818dabf9ee64d7a73d474.tar.gz rpg-443e135d59e9d227eec818dabf9ee64d7a73d474.tar.bz2 |
replace boolean conditional checks on possibly uninitialized vars with \!empty/empty/isset as appropriate
Diffstat (limited to 'inc/search.php')
-rw-r--r-- | inc/search.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/inc/search.php b/inc/search.php index 884aa7b23..1853e72c0 100644 --- a/inc/search.php +++ b/inc/search.php @@ -110,7 +110,7 @@ function search_index(&$data,$base,$file,$type,$lvl,$opts){ $opts = array( 'pagesonly' => true, 'listdirs' => true, - 'listfiles' => !$opts['nofiles'], + 'listfiles' => empty($opts['nofiles']), 'sneakyacl' => $conf['sneaky_index'], // Hacky, should rather use recmatch 'depth' => preg_match('#^'.preg_quote($file, '#').'(/|$)#','/'.$opts['ns']) ? 0 : -1 @@ -367,7 +367,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ } // check ACL - if(!$opts['skipacl']){ + if(empty($opts['skipacl'])){ if($type == 'd'){ $item['perm'] = auth_quickaclcheck($item['id'].':*'); }else{ @@ -379,17 +379,17 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ // are we done here maybe? if($type == 'd'){ - if(!$opts['listdirs']) return $return; - if(!$opts['skipacl'] && $opts['sneakyacl'] && $item['perm'] < AUTH_READ) return false; //neither list nor recurse - if($opts['dirmatch'] && !preg_match('/'.$opts['dirmatch'].'/',$file)) return $return; - if($opts['nsmatch'] && !preg_match('/'.$opts['nsmatch'].'/',$item['ns'])) return $return; + if(empty($opts['listdirs'])) return $return; + if(empty($opts['skipacl']) && !empty($opts['sneakyacl']) && $item['perm'] < AUTH_READ) return false; //neither list nor recurse + if(!empty($opts['dirmatch']) && !preg_match('/'.$opts['dirmatch'].'/',$file)) return $return; + if(!empty($opts['nsmatch']) && !preg_match('/'.$opts['nsmatch'].'/',$item['ns'])) return $return; }else{ - if(!$opts['listfiles']) return $return; - if(!$opts['skipacl'] && $item['perm'] < AUTH_READ) return $return; - if($opts['pagesonly'] && (substr($file,-4) != '.txt')) return $return; - if(!$opts['showhidden'] && isHiddenPage($item['id'])) return $return; - if($opts['filematch'] && !preg_match('/'.$opts['filematch'].'/',$file)) return $return; - if($opts['idmatch'] && !preg_match('/'.$opts['idmatch'].'/',$item['id'])) return $return; + if(empty($opts['listfiles'])) return $return; + if(empty($opts['skipacl']) && $item['perm'] < AUTH_READ) return $return; + if(!empty($opts['pagesonly']) && (substr($file,-4) != '.txt')) return $return; + if(empty($opts['showhidden']) && isHiddenPage($item['id'])) return $return; + if(!empty($opts['filematch']) && !preg_match('/'.$opts['filematch'].'/',$file)) return $return; + if(!empty($opts['idmatch']) && !preg_match('/'.$opts['idmatch'].'/',$item['id'])) return $return; } // still here? prepare the item |