summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2007-06-27 21:49:10 +0200
committerAndreas Gohr <andi@splitbrain.org>2007-06-27 21:49:10 +0200
commit6957b2ea013b27781cc1ccce8b94267006cb917d (patch)
tree966e5f969d03c55e405088e878736b8dbb3b1b84 /inc
parent83666c1bae18becc7f41053ac3ac80444e3681c4 (diff)
downloadrpg-6957b2ea013b27781cc1ccce8b94267006cb917d.tar.gz
rpg-6957b2ea013b27781cc1ccce8b94267006cb917d.tar.bz2
check for auth object at certain functions
This is a follow up on the previous patch to disable authtentication without disabling ACL on backend problems. It fixes a few errors that might occour in this rare situation. darcs-hash:20070627194910-7ad00-de5ac10e0d36ecf8906c080e1d3dc1b2fd85b45d.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/html.php4
-rw-r--r--inc/infoutils.php2
-rw-r--r--inc/template.php12
3 files changed, 9 insertions, 9 deletions
diff --git a/inc/html.php b/inc/html.php
index 42457670b..7c7d78ee7 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -82,14 +82,14 @@ function html_login(){
</fieldset>
</form>
<?php
- if($auth->canDo('addUser') && actionOK('register')){
+ if($auth && $auth->canDo('addUser') && actionOK('register')){
print '<p>';
print $lang['reghere'];
print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>';
print '</p>';
}
- if ($auth->canDo('modPass') && actionOK('resendpwd')) {
+ if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) {
print '<p>';
print $lang['pwdforget'];
print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>';
diff --git a/inc/infoutils.php b/inc/infoutils.php
index 255b49ed4..6da344d81 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -168,7 +168,7 @@ function check(){
global $auth;
msg('You are currently logged in as '.$_SESSION[DOKU_COOKIE]['auth']['user'].' ('.$INFO['userinfo']['name'].')',0);
- $info = $auth->getUserData($_SESSION[DOKU_COOKIE]['auth']['user']);
+ if($auth) $info = $auth->getUserData($_SESSION[DOKU_COOKIE]['auth']['user']);
msg('You are part of the groups '.implode($info['grps'],', '),0);
}else{
msg('You are currently not logged in',0);
diff --git a/inc/template.php b/inc/template.php
index 3bf9be114..c941a64f4 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -435,7 +435,7 @@ function tpl_button($type){
print html_topbtn();
return true;
case 'login':
- if($conf['useacl']){
+ if($conf['useacl'] && $auth){
if($_SERVER['REMOTE_USER']){
print html_btn('logout',$ID,'',array('do' => 'logout',));
}else{
@@ -451,7 +451,7 @@ function tpl_button($type){
}
return false;
case 'subscription':
- if($conf['useacl'] && $ACT == 'show' && $conf['subscribers'] == 1){
+ if($conf['useacl'] && $auth && $ACT == 'show' && $conf['subscribers'] == 1){
if($_SERVER['REMOTE_USER']){
if($INFO['subscribed']){
print html_btn('unsubscribe',$ID,'',array('do' => 'unsubscribe',));
@@ -466,7 +466,7 @@ function tpl_button($type){
print html_btn('backlink',$ID,'',array('do' => 'backlink'));
return true;
case 'profile':
- if($conf['useacl'] && $_SERVER['REMOTE_USER'] &&
+ if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $auth &&
$auth->canDo('Profile') && ($ACT!='profile')){
print html_btn('profile',$ID,'',array('do' => 'profile'));
return true;
@@ -564,7 +564,7 @@ function tpl_actionlink($type,$pre='',$suf=''){
}
return false;
case 'login':
- if($conf['useacl']){
+ if($conf['useacl'] && $auth){
if($_SERVER['REMOTE_USER']){
tpl_link(wl($ID,'do=logout'),$pre.$lang['btn_logout'].$suf,'class="action logout" rel="nofollow"');
}else{
@@ -581,7 +581,7 @@ function tpl_actionlink($type,$pre='',$suf=''){
return false;
case 'subscribe':
case 'subscription':
- if($conf['useacl'] && $ACT == 'show' && $conf['subscribers'] == 1){
+ if($conf['useacl'] && $auth && $ACT == 'show' && $conf['subscribers'] == 1){
if($_SERVER['REMOTE_USER']){
if($INFO['subscribed']) {
tpl_link(wl($ID,'do=unsubscribe'),$pre.$lang['btn_unsubscribe'].$suf,'class="action unsubscribe" rel="nofollow"');
@@ -596,7 +596,7 @@ function tpl_actionlink($type,$pre='',$suf=''){
tpl_link(wl($ID,'do=backlink'),$pre.$lang['btn_backlink'].$suf, 'class="action backlink" rel="nofollow"');
return true;
case 'profile':
- if($conf['useacl'] && $_SERVER['REMOTE_USER'] &&
+ if($conf['useacl'] && $auth && $_SERVER['REMOTE_USER'] &&
$auth->canDo('Profile') && ($ACT!='profile')){
tpl_link(wl($ID,'do=profile'),$pre.$lang['btn_profile'].$suf, 'class="action profile" rel="nofollow"');
return true;