diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/actions.php | 2 | ||||
-rw-r--r-- | inc/common.php | 2 | ||||
-rw-r--r-- | inc/html.php | 10 | ||||
-rw-r--r-- | inc/init.php | 2 | ||||
-rw-r--r-- | inc/media.php | 8 | ||||
-rw-r--r-- | inc/search.php | 16 |
6 files changed, 20 insertions, 20 deletions
diff --git a/inc/actions.php b/inc/actions.php index 4dbad1a32..240dce59a 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -733,7 +733,7 @@ function act_subscription($act){ } // any action given? if not just return and show the subscription page - if(!$params['action'] || !checkSecurityToken()) return $act; + if(empty($params['action']) || !checkSecurityToken()) return $act; // Handle POST data, may throw exception. trigger_event('ACTION_HANDLE_SUBSCRIBE', $params, 'subscription_handle_post'); diff --git a/inc/common.php b/inc/common.php index 9a53ee526..36bd32c4f 100644 --- a/inc/common.php +++ b/inc/common.php @@ -191,7 +191,7 @@ function pageinfo() { if($REV) { $revinfo = getRevisionInfo($ID, $REV, 1024); } else { - if(is_array($info['meta']['last_change'])) { + if(!empty($info['meta']['last_change']) && is_array($info['meta']['last_change'])) { $revinfo = $info['meta']['last_change']; } else { $revinfo = getRevisionInfo($ID, $info['lastmod'], 1024); diff --git a/inc/html.php b/inc/html.php index fcec29670..41f26e5cd 100644 --- a/inc/html.php +++ b/inc/html.php @@ -691,7 +691,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeOpenTag('div', array('class' => 'li'))); - if ($recent['media']) { + if (!empty($recent['media'])) { $form->addElement(media_printicon($recent['id'])); } else { $icon = DOKU_BASE.'lib/images/fileicons/file.png'; @@ -705,7 +705,7 @@ function html_recent($first=0, $show_changes='both'){ $diff = false; $href = ''; - if ($recent['media']) { + if (!empty($recent['media'])) { $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id']))); if ($diff) { $href = media_managerURL(array('tab_details' => 'history', @@ -715,7 +715,7 @@ function html_recent($first=0, $show_changes='both'){ $href = wl($recent['id'],"do=diff", false, '&'); } - if ($recent['media'] && !$diff) { + if (!empty($recent['media']) && !$diff) { $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />'); } else { $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => $href))); @@ -729,7 +729,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeCloseTag('a')); } - if ($recent['media']) { + if (!empty($recent['media'])) { $href = media_managerURL(array('tab_details' => 'history', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); } else { @@ -745,7 +745,7 @@ function html_recent($first=0, $show_changes='both'){ ))); $form->addElement(form_makeCloseTag('a')); - if ($recent['media']) { + if (!empty($recent['media'])) { $href = media_managerURL(array('tab_details' => 'view', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); $class = (file_exists(mediaFN($recent['id']))) ? 'wikilink1' : $class = 'wikilink2'; $form->addElement(form_makeOpenTag('a', array('class' => $class, 'href' => $href))); diff --git a/inc/init.php b/inc/init.php index 9b8465911..6fb27bd2a 100644 --- a/inc/init.php +++ b/inc/init.php @@ -176,7 +176,7 @@ if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0); $_REQUEST = array_merge($_GET,$_POST); // we don't want a purge URL to be digged -if(isset($_REQUEST['purge']) && $_SERVER['HTTP_REFERER']) unset($_REQUEST['purge']); +if(isset($_REQUEST['purge']) && !empty($_SERVER['HTTP_REFERER'])) unset($_REQUEST['purge']); // disable gzip if not available if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ diff --git a/inc/media.php b/inc/media.php index 4fff95d94..dc76521c6 100644 --- a/inc/media.php +++ b/inc/media.php @@ -1018,7 +1018,7 @@ function media_file_tags($meta) { foreach($fields as $key => $tag){ $t = array(); if (!empty($tag[0])) $t = array($tag[0]); - if(is_array($tag[3])) $t = array_merge($t,$tag[3]); + if(isset($tag[3]) && is_array($tag[3])) $t = array_merge($t,$tag[3]); $value = media_getTag($t, $meta); $tags[] = array('tag' => $tag, 'value' => $value); } @@ -1779,7 +1779,7 @@ function media_nstree_item($item){ global $INPUT; $pos = strrpos($item['id'], ':'); $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0); - if(!$item['label']) $item['label'] = $label; + if(empty($item['label'])) $item['label'] = $label; $ret = ''; if (!($INPUT->str('do') == 'media')) @@ -1841,7 +1841,7 @@ function media_resize_image($file, $ext, $w, $h=0){ if( $mtime > filemtime($file) || media_resize_imageIM($ext,$file,$info[0],$info[1],$local,$w,$h) || media_resize_imageGD($ext,$file,$info[0],$info[1],$local,$w,$h) ){ - if($conf['fperm']) @chmod($local, $conf['fperm']); + if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); return $local; } //still here? resizing failed @@ -1902,7 +1902,7 @@ function media_crop_image($file, $ext, $w, $h=0){ if( $mtime > @filemtime($file) || media_crop_imageIM($ext,$file,$info[0],$info[1],$local,$cw,$ch,$cx,$cy) || media_resize_imageGD($ext,$file,$cw,$ch,$local,$cw,$ch,$cx,$cy) ){ - if($conf['fperm']) @chmod($local, $conf['fperm']); + if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); return media_resize_image($local,$ext, $w, $h); } 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 |