diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2014-03-05 22:04:14 +0000 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2014-03-05 22:04:14 +0000 |
commit | f87b5dbbbad408da775ac4c60ceb9f9666280527 (patch) | |
tree | 53e023772e7ebeb53bad6f13e867483bbed6a683 | |
parent | 6d2af55dde922ac10a288b4195b1bf338e7bc5a9 (diff) | |
download | rpg-f87b5dbbbad408da775ac4c60ceb9f9666280527.tar.gz rpg-f87b5dbbbad408da775ac4c60ceb9f9666280527.tar.bz2 |
use isset() + ?: or error suppression where value may not be set
-rw-r--r-- | inc/auth.php | 2 | ||||
-rw-r--r-- | inc/init.php | 8 | ||||
-rw-r--r-- | inc/search.php | 2 | ||||
-rw-r--r-- | inc/template.php | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/inc/auth.php b/inc/auth.php index 6c4636b2f..e44e837a7 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -325,7 +325,7 @@ function auth_browseruid() { $uid = ''; $uid .= $_SERVER['HTTP_USER_AGENT']; $uid .= $_SERVER['HTTP_ACCEPT_ENCODING']; - $uid .= $_SERVER['HTTP_ACCEPT_CHARSET']; + $uid .= @$_SERVER['HTTP_ACCEPT_CHARSET']; $uid .= substr($ip, 0, strpos($ip, '.')); $uid = strtolower($uid); return md5($uid); diff --git a/inc/init.php b/inc/init.php index 6fb27bd2a..bcd96e5e4 100644 --- a/inc/init.php +++ b/inc/init.php @@ -441,12 +441,12 @@ function getBaseURL($abs=null){ //split hostheader into host and port if(isset($_SERVER['HTTP_HOST'])){ $parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']); - $host = $parsed_host['host']; - $port = $parsed_host['port']; + $host = isset($parsed_host['host']) ? $parsed_host['host'] : null; + $port = isset($parsed_host['port']) ? $parsed_host['port'] : null; }elseif(isset($_SERVER['SERVER_NAME'])){ $parsed_host = parse_url('http://'.$_SERVER['SERVER_NAME']); - $host = $parsed_host['host']; - $port = $parsed_host['port']; + $host = isset($parsed_host['host']) ? $parsed_host['host'] : null; + $port = isset($parsed_host['port']) ? $parsed_host['port'] : null; }else{ $host = php_uname('n'); $port = ''; diff --git a/inc/search.php b/inc/search.php index 840f70375..ee4eef534 100644 --- a/inc/search.php +++ b/inc/search.php @@ -351,7 +351,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ $return = true; // get ID and check if it is a valid one - $item['id'] = pathID($file,($type == 'd' || $opts['keeptxt'])); + $item['id'] = pathID($file,($type == 'd' || @$opts['keeptxt'])); if($item['id'] != cleanID($item['id'])){ if($opts['showmsg']) msg(hsc($item['id']).' is not a valid file name for DokuWiki - skipped',-1); diff --git a/inc/template.php b/inc/template.php index 0a6a9e4aa..d9aa8863f 100644 --- a/inc/template.php +++ b/inc/template.php @@ -210,7 +210,7 @@ function tpl_toc($return = false) { } else { $tocok = true; } - $toc = $meta['description']['tableofcontents']; + $toc = isset($meta['description']['tableofcontents']) ? $meta['description']['tableofcontents'] : null; if(!$tocok || !is_array($toc) || !$conf['tocminheads'] || count($toc) < $conf['tocminheads']) { $toc = array(); } |