From 7ce7c374989aee6473858dfca4cfd2ae1c97c0bd Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 11 Nov 2013 12:03:35 +0000 Subject: [PATCH] prevent php errors for potentially uninitialised var Conflicts: tpl_functions.php --- main.php | 4 ++-- tpl_functions.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.php b/main.php index 30bb9a3..05a6959 100644 --- a/main.php +++ b/main.php @@ -11,7 +11,7 @@ if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */ @require_once(dirname(__FILE__).'/tpl_functions.php'); /* include hook for template functions */ header('X-UA-Compatible: IE=edge,chrome=1'); -$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER['REMOTE_USER'] ); +$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) ); $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show'); ?> would be: tpl_action('edit', 0, 'li') */ - if ($_SERVER['REMOTE_USER']) { + if (!empty($_SERVER['REMOTE_USER'])) { echo '
  • '; tpl_userinfo(); /* 'Logged in as ...' */ echo '
  • '; diff --git a/tpl_functions.php b/tpl_functions.php index 7573b15..97644e2 100644 --- a/tpl_functions.php +++ b/tpl_functions.php @@ -47,7 +47,7 @@ function _tpl_discussion($discussionPage, $title, $backTitle, $link=0, $wrapper= * @author Anika Henke */ function _tpl_userpage($userPage, $title, $link=0, $wrapper=0) { - if (!$_SERVER['REMOTE_USER']) return; + if (empty($_SERVER['REMOTE_USER'])) return; global $conf; $userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage); @@ -93,7 +93,7 @@ if (!function_exists('tpl_classes')) { 'dokuwiki', 'mode_'.$ACT, 'tpl_'.$conf['template'], - $_SERVER['REMOTE_USER'] ? 'loggedIn' : '', + !empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '', $INFO['exists'] ? '' : 'notFound', ($ID == $conf['start']) ? 'home' : '', );