Wrap log object in is_object for apps that can't use this for some reason

This commit is contained in:
Miles Lott 2001-12-06 17:56:38 +00:00
parent 8e8b68bea7
commit fa7193d2d4

View File

@ -149,7 +149,10 @@
$userid_array = explode('@',$db->f('session_lid')); $userid_array = explode('@',$db->f('session_lid'));
// Thinking this might solve auth_http problems // Thinking this might solve auth_http problems
if(@$userid_array[1] == '') { $userid_array[1] = 'default'; } if(@$userid_array[1] == '')
{
$userid_array[1] = 'default';
}
$this->account_lid = $userid_array[0]; $this->account_lid = $userid_array[0];
$this->update_dla(); $this->update_dla();
$this->account_id = $GLOBALS['phpgw']->accounts->name2id($this->account_lid); $this->account_id = $GLOBALS['phpgw']->accounts->name2id($this->account_lid);
@ -163,6 +166,8 @@
$this->read_repositories(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info']); $this->read_repositories(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info']);
if ($this->user['expires'] != -1 && $this->user['expires'] < time()) if ($this->user['expires'] != -1 && $this->user['expires'] < time())
{
if(is_object($GLOBALS['phpgw']->log))
{ {
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
'text' => 'W-VerifySession, account loginid %1 is expired', 'text' => 'W-VerifySession, account loginid %1 is expired',
@ -171,6 +176,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -181,15 +187,18 @@
$GLOBALS['phpgw_info']['user']['passwd'] = base64_decode($this->appsession('password','phpgwapi')); $GLOBALS['phpgw_info']['user']['passwd'] = base64_decode($this->appsession('password','phpgwapi'));
if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain']) if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain'])
{
if(is_object($GLOBALS['phpgw']->log))
{ {
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
'text' => 'W-VerifySession, the domains %1 and %2 don\t match', 'text' => 'W-VerifySession, the domains %1 and %2 don\'t match',
'p1' => $userid_array[1], 'p1' => $userid_array[1],
'p2' => $GLOBALS['phpgw_info']['user']['domain'], 'p2' => $GLOBALS['phpgw_info']['user']['domain'],
'line' => __LINE__, 'line' => __LINE__,
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -197,6 +206,8 @@
if (@$GLOBALS['phpgw_info']['server']['sessions_checkip']) if (@$GLOBALS['phpgw_info']['server']['sessions_checkip'])
{ {
if (PHP_OS != 'Windows' && (! $GLOBALS['phpgw_info']['user']['session_ip'] || $GLOBALS['phpgw_info']['user']['session_ip'] != $this->getuser_ip())) if (PHP_OS != 'Windows' && (! $GLOBALS['phpgw_info']['user']['session_ip'] || $GLOBALS['phpgw_info']['user']['session_ip'] != $this->getuser_ip()))
{
if(is_object($GLOBALS['phpgw']->log))
{ {
// This needs some better wording // This needs some better wording
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
@ -207,6 +218,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -218,6 +230,8 @@
$GLOBALS['phpgw']->applications->applications($this->account_id); $GLOBALS['phpgw']->applications->applications($this->account_id);
if (! $this->account_lid) if (! $this->account_lid)
{
if(is_object($GLOBALS['phpgw']->log))
{ {
// This needs some better wording // This needs some better wording
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
@ -226,6 +240,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -329,6 +344,8 @@
$this->read_repositories(False); $this->read_repositories(False);
if ($this->user['expires'] != -1 && $this->user['expires'] < time()) if ($this->user['expires'] != -1 && $this->user['expires'] < time())
{
if(is_object($GLOBALS['phpgw']->log))
{ {
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
'text' => 'W-LoginFailure, account loginid %1 is expired', 'text' => 'W-LoginFailure, account loginid %1 is expired',
@ -337,6 +354,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -431,6 +449,8 @@
$GLOBALS['phpgw_info']['user']['passwd'] = base64_decode($this->appsession('password','phpgwapi')); $GLOBALS['phpgw_info']['user']['passwd'] = base64_decode($this->appsession('password','phpgwapi'));
if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain']) if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain'])
{
if(is_object($GLOBALS['phpgw']->log))
{ {
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
'text' => 'W-VerifySession, the domains %1 and %2 don\t match', 'text' => 'W-VerifySession, the domains %1 and %2 don\t match',
@ -440,6 +460,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -447,6 +468,8 @@
if (@$GLOBALS['phpgw_info']['server']['sessions_checkip']) if (@$GLOBALS['phpgw_info']['server']['sessions_checkip'])
{ {
if (PHP_OS != 'Windows' && (! $GLOBALS['phpgw_info']['user']['session_ip'] || $GLOBALS['phpgw_info']['user']['session_ip'] != $this->getuser_ip())) if (PHP_OS != 'Windows' && (! $GLOBALS['phpgw_info']['user']['session_ip'] || $GLOBALS['phpgw_info']['user']['session_ip'] != $this->getuser_ip()))
{
if(is_object($GLOBALS['phpgw']->log))
{ {
// This needs some better wording // This needs some better wording
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
@ -457,6 +480,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -468,6 +492,8 @@
$GLOBALS['phpgw']->applications->applications($this->account_id); $GLOBALS['phpgw']->applications->applications($this->account_id);
if (! $this->account_lid) if (! $this->account_lid)
{
if(is_object($GLOBALS['phpgw']->log))
{ {
// This needs some better wording // This needs some better wording
$GLOBALS['phpgw']->log->message(array( $GLOBALS['phpgw']->log->message(array(
@ -476,6 +502,7 @@
'file' => __FILE__ 'file' => __FILE__
)); ));
$GLOBALS['phpgw']->log->commit(); $GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }