summaryrefslogtreecommitdiff
path: root/inc/search.php
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2014-03-05 21:58:46 +0000
committerChristopher Smith <chris@jalakai.co.uk>2014-03-05 21:58:46 +0000
commit0e80bb5e347ff00c6f81627d8e39dafaaa923bc5 (patch)
tree19e8450aeef463ffe7278e3fb5e8888940113b4a /inc/search.php
parent17dd401e94c682034b7f3d9164ac3523ab01d825 (diff)
downloadrpg-0e80bb5e347ff00c6f81627d8e39dafaaa923bc5.tar.gz
rpg-0e80bb5e347ff00c6f81627d8e39dafaaa923bc5.tar.bz2
use empty() where array values might not be set
Diffstat (limited to 'inc/search.php')
-rw-r--r--inc/search.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/inc/search.php b/inc/search.php
index c2d31b959..840f70375 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -141,7 +141,7 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){
//we do nothing with directories
if($type == 'd') {
- if(!$opts['depth']) return true; // recurse forever
+ if(empty($opts['depth'])) return true; // recurse forever
$depth = substr_count($file,'/');
if($depth >= $opts['depth']) return false; // depth reached
return true;
@@ -157,12 +157,12 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){
//check ACL for namespace (we have no ACL for mediafiles)
$info['perm'] = auth_quickaclcheck(getNS($info['id']).':*');
- if(!$opts['skipacl'] && $info['perm'] < AUTH_READ){
+ if(empty($opts['skipacl']) && $info['perm'] < AUTH_READ){
return false;
}
//check pattern filter
- if($opts['pattern'] && !@preg_match($opts['pattern'], $info['id'])){
+ if(!empty($opts['pattern']) && !@preg_match($opts['pattern'], $info['id'])){
return false;
}
@@ -176,7 +176,7 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){
}else{
$info['isimg'] = false;
}
- if($opts['hash']){
+ if(!empty($opts['hash'])){
$info['hash'] = md5(io_readFile(mediaFN($info['id']),false));
}
@@ -361,7 +361,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){
if($type == 'd') {
// decide if to recursion into this directory is wanted
- if(!$opts['depth']){
+ if(empty($opts['depth'])){
$return = true; // recurse forever
}else{
$depth = substr_count($file,'/');
@@ -407,7 +407,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){
$item['level'] = $lvl;
$item['open'] = $return;
- if($opts['meta']){
+ if(!empty($opts['meta'])){
$item['file'] = utf8_basename($file);
$item['size'] = filesize($base.'/'.$file);
$item['mtime'] = filemtime($base.'/'.$file);
@@ -417,8 +417,8 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){
}
if($type == 'f'){
- if($opts['hash']) $item['hash'] = md5(io_readFile($base.'/'.$file,false));
- if($opts['firsthead']) $item['title'] = p_get_first_heading($item['id'],METADATA_DONT_RENDER);
+ if(!empty($opts['hash'])) $item['hash'] = md5(io_readFile($base.'/'.$file,false));
+ if(!empty($opts['firsthead'])) $item['title'] = p_get_first_heading($item['id'],METADATA_DONT_RENDER);
}
// finally add the item