Browse Source

prevent php errors for potentially uninitialised var

master
Anika Henke 11 years ago
parent
commit
cdfbeeb1d2
  1. 4
      main.php
  2. 6
      tpl_functions.php

4
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 */ @require_once(dirname(__FILE__).'/tpl_functions.php'); /* include hook for template functions */
header('X-UA-Compatible: IE=edge,chrome=1'); 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'); $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
?><!DOCTYPE html> ?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>" <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>"
@ -65,7 +65,7 @@ $showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
<ul> <ul>
<?php /* the optional second parameter of tpl_action() switches between a link and a button, <?php /* the optional second parameter of tpl_action() switches between a link and a button,
e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */ e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */
if ($_SERVER['REMOTE_USER']) {
if (!empty($_SERVER['REMOTE_USER'])) {
echo '<li class="user">'; echo '<li class="user">';
tpl_userinfo(); /* 'Logged in as ...' */ tpl_userinfo(); /* 'Logged in as ...' */
echo '</li>'; echo '</li>';

6
tpl_functions.php

@ -47,7 +47,7 @@ function _tpl_discussion($discussionPage, $title, $backTitle, $link=0, $wrapper=
* @author Anika Henke <anika@selfthinker.org> * @author Anika Henke <anika@selfthinker.org>
*/ */
function _tpl_userpage($userPage, $title, $link=0, $wrapper=0) { function _tpl_userpage($userPage, $title, $link=0, $wrapper=0) {
if (!$_SERVER['REMOTE_USER']) return;
if (empty($_SERVER['REMOTE_USER'])) return;
global $conf; global $conf;
$userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage); $userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage);
@ -74,7 +74,7 @@ function _tpl_register($link=0, $wrapper=0) {
global $ID; global $ID;
$lang_register = !empty($lang['btn_register']) ? $lang['btn_register'] : $lang['register']; $lang_register = !empty($lang['btn_register']) ? $lang['btn_register'] : $lang['register'];
if ($_SERVER['REMOTE_USER'] || !$conf['useacl'] || !actionOK('register')) return;
if (!empty($_SERVER['REMOTE_USER']) || !$conf['useacl'] || !actionOK('register')) return;
if ($wrapper) echo "<$wrapper>"; if ($wrapper) echo "<$wrapper>";
@ -265,7 +265,7 @@ if (!function_exists('tpl_classes')) {
'dokuwiki', 'dokuwiki',
'mode_'.$ACT, 'mode_'.$ACT,
'tpl_'.$conf['template'], 'tpl_'.$conf['template'],
$_SERVER['REMOTE_USER'] ? 'loggedIn' : '',
!empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '',
$INFO['exists'] ? '' : 'notFound', $INFO['exists'] ? '' : 'notFound',
($ID == $conf['start']) ? 'home' : '', ($ID == $conf['start']) ? 'home' : '',
); );

Loading…
Cancel
Save