diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/auth.php | 4 | ||||
-rw-r--r-- | inc/common.php | 8 | ||||
-rw-r--r-- | inc/indexer.php | 3 | ||||
-rw-r--r-- | inc/init.php | 2 | ||||
-rw-r--r-- | inc/io.php | 2 | ||||
-rw-r--r-- | inc/pageutils.php | 2 | ||||
-rw-r--r-- | inc/parser/handler.php | 4 | ||||
-rw-r--r-- | inc/plugincontroller.class.php | 2 | ||||
-rw-r--r-- | inc/search.php | 24 | ||||
-rw-r--r-- | inc/subscription.php | 2 | ||||
-rw-r--r-- | inc/template.php | 10 |
11 files changed, 32 insertions, 31 deletions
diff --git a/inc/auth.php b/inc/auth.php index ac079c574..0d42c8673 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -139,10 +139,10 @@ function auth_loadACL() { $out = array(); foreach($acl as $line) { $line = trim($line); - if($line{0} == '#') continue; + if(empty($line) || ($line{0} == '#')) continue; // skip blank lines & comments list($id,$rest) = preg_split('/\s+/',$line,2); - // substitue user wildcard first (its 1:1) + // substitute user wildcard first (its 1:1) if(strstr($line, '%USER%')){ // if user is not logged in, this ACL line is meaningless - skip it if (!isset($_SERVER['REMOTE_USER'])) continue; diff --git a/inc/common.php b/inc/common.php index 866e0aadd..32771285b 100644 --- a/inc/common.php +++ b/inc/common.php @@ -64,7 +64,7 @@ function getSecurityToken() { */ function checkSecurityToken($token = null) { global $INPUT; - if(!$_SERVER['REMOTE_USER']) return true; // no logged in user, no need for a check + if(empty($_SERVER['REMOTE_USER'])) return true; // no logged in user, no need for a check if(is_null($token)) $token = $INPUT->str('sectok'); if(getSecurityToken() != $token) { @@ -474,13 +474,13 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) if(is_array($more)) { // add token for resized images - if($more['w'] || $more['h'] || $isexternalimage){ + if(!empty($more['w']) || !empty($more['h']) || $isexternalimage){ $more['tok'] = media_get_token($id,$more['w'],$more['h']); } // strip defaults for shorter URLs if(isset($more['cache']) && $more['cache'] == 'cache') unset($more['cache']); - if(!$more['w']) unset($more['w']); - if(!$more['h']) unset($more['h']); + if(empty($more['w'])) unset($more['w']); + if(empty($more['h'])) unset($more['h']); if(isset($more['id']) && $direct) unset($more['id']); $more = buildURLparams($more, $sep); } else { diff --git a/inc/indexer.php b/inc/indexer.php index 8f0ba7ec6..00b66239d 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -1017,8 +1017,9 @@ class Doku_Indexer { return false; } } - if ($conf['dperm']) + if (!empty($conf['dperm'])) { chmod($lock, $conf['dperm']); + } return $status; } diff --git a/inc/init.php b/inc/init.php index 30eb1b251..d96860e10 100644 --- a/inc/init.php +++ b/inc/init.php @@ -288,7 +288,7 @@ function init_files(){ $fh = @fopen($file,'a'); if($fh){ fclose($fh); - if($conf['fperm']) chmod($file, $conf['fperm']); + if(!empty($conf['fperm'])) chmod($file, $conf['fperm']); }else{ nice_die("$file is not writable. Check your permissions settings!"); } diff --git a/inc/io.php b/inc/io.php index 4bd7c3364..eff0279ac 100644 --- a/inc/io.php +++ b/inc/io.php @@ -393,7 +393,7 @@ function io_mkdir_p($target){ return io_mkdir_ftp($dir); }else{ $ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree - if($ret && $conf['dperm']) chmod($target, $conf['dperm']); + if($ret && !empty($conf['dperm'])) chmod($target, $conf['dperm']); return $ret; } } diff --git a/inc/pageutils.php b/inc/pageutils.php index bf79daa7d..60f326e04 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -396,7 +396,7 @@ function resolve_id($ns,$id,$clean=true){ // if the id starts with a dot we need to handle the // relative stuff - if($id{0} == '.'){ + if($id && $id{0} == '.'){ // normalize initial dots without a colon $id = preg_replace('/^(\.+)(?=[^:\.])/','\1:',$id); // prepend the current namespace diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 63a4104e2..bb284136f 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -653,8 +653,8 @@ function Doku_Handler_Parse_Media($match) { //parse width and height if(preg_match('#(\d+)(x(\d+))?#i',$param,$size)){ - ($size[1]) ? $w = $size[1] : $w = null; - ($size[3]) ? $h = $size[3] : $h = null; + !empty($size[1]) ? $w = $size[1] : $w = null; + !empty($size[3]) ? $h = $size[3] : $h = null; } else { $w = null; $h = null; diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index c825870cd..b8b678b4f 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -206,7 +206,7 @@ class Doku_Plugin_Controller { $backup = $file.'.bak'; if (@file_exists($backup)) @unlink($backup); if (!@copy($file,$backup)) return false; - if ($conf['fperm']) chmod($backup, $conf['fperm']); + if (!empty($conf['fperm'])) chmod($backup, $conf['fperm']); } //check if can open for writing, else restore return io_saveFile($file,$out); 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 diff --git a/inc/subscription.php b/inc/subscription.php index ecbc9ef19..ddf2f39e6 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -62,7 +62,7 @@ class Subscription { return false; } - if($conf['dperm']) chmod($lock, $conf['dperm']); + if(!empty($conf['dperm'])) chmod($lock, $conf['dperm']); return true; } diff --git a/inc/template.php b/inc/template.php index 868ef300c..b42c9d934 100644 --- a/inc/template.php +++ b/inc/template.php @@ -401,7 +401,7 @@ function tpl_metaheaders($alt = true) { // make $INFO and other vars available to JavaScripts $json = new JSON(); $script = "var NS='".$INFO['namespace']."';"; - if($conf['useacl'] && $_SERVER['REMOTE_USER']) { + if($conf['useacl'] && !empty($_SERVER['REMOTE_USER'])) { $script .= "var SIG='".toolbar_signature()."';"; } $script .= 'var JSINFO = '.$json->encode($JSINFO).';'; @@ -680,12 +680,12 @@ function tpl_get_action($type) { } break; case 'register': - if($_SERVER['REMOTE_USER']) { + if(!empty($_SERVER['REMOTE_USER'])) { return false; } break; case 'resendpwd': - if($_SERVER['REMOTE_USER']) { + if(!empty($_SERVER['REMOTE_USER'])) { return false; } break; @@ -1412,7 +1412,7 @@ function tpl_actiondropdown($empty = '', $button = '>') { echo '<div class="no">'; echo '<input type="hidden" name="id" value="'.$ID.'" />'; if($REV) echo '<input type="hidden" name="rev" value="'.$REV.'" />'; - if ($_SERVER['REMOTE_USER']) { + if (!empty($_SERVER['REMOTE_USER'])) { echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'; } @@ -1794,7 +1794,7 @@ function tpl_classes() { 'dokuwiki', 'mode_'.$ACT, 'tpl_'.$conf['template'], - $_SERVER['REMOTE_USER'] ? 'loggedIn' : '', + !empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '', $INFO['exists'] ? '' : 'notFound', ($ID == $conf['start']) ? 'home' : '', ); |