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);
@ -164,13 +167,16 @@
$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())
{ {
$GLOBALS['phpgw']->log->message(array( if(is_object($GLOBALS['phpgw']->log))
'text' => 'W-VerifySession, account loginid %1 is expired', {
'p1' => $this->account_lid, $GLOBALS['phpgw']->log->message(array(
'line' => __LINE__, 'text' => 'W-VerifySession, account loginid %1 is expired',
'file' => __FILE__ 'p1' => $this->account_lid,
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -182,14 +188,17 @@
if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain']) if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain'])
{ {
$GLOBALS['phpgw']->log->message(array( if(is_object($GLOBALS['phpgw']->log))
'text' => 'W-VerifySession, the domains %1 and %2 don\t match', {
'p1' => $userid_array[1], $GLOBALS['phpgw']->log->message(array(
'p2' => $GLOBALS['phpgw_info']['user']['domain'], 'text' => 'W-VerifySession, the domains %1 and %2 don\'t match',
'line' => __LINE__, 'p1' => $userid_array[1],
'file' => __FILE__ 'p2' => $GLOBALS['phpgw_info']['user']['domain'],
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -198,15 +207,18 @@
{ {
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()))
{ {
// This needs some better wording if(is_object($GLOBALS['phpgw']->log))
$GLOBALS['phpgw']->log->message(array( {
'text' => 'W-VerifySession, IP %1 doesn\'t match IP %2 in session table', // This needs some better wording
'p1' => $this->getuser_ip(), $GLOBALS['phpgw']->log->message(array(
'p2' => $GLOBALS['phpgw_info']['user']['session_ip'], 'text' => 'W-VerifySession, IP %1 doesn\'t match IP %2 in session table',
'line' => __LINE__, 'p1' => $this->getuser_ip(),
'file' => __FILE__ 'p2' => $GLOBALS['phpgw_info']['user']['session_ip'],
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -219,13 +231,16 @@
if (! $this->account_lid) if (! $this->account_lid)
{ {
// This needs some better wording if(is_object($GLOBALS['phpgw']->log))
$GLOBALS['phpgw']->log->message(array( {
'text' => 'W-VerifySession, account_id is empty', // This needs some better wording
'line' => __LINE__, $GLOBALS['phpgw']->log->message(array(
'file' => __FILE__ 'text' => 'W-VerifySession, account_id is empty',
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -330,13 +345,16 @@
$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())
{ {
$GLOBALS['phpgw']->log->message(array( if(is_object($GLOBALS['phpgw']->log))
'text' => 'W-LoginFailure, account loginid %1 is expired', {
'p1' => $this->account_lid, $GLOBALS['phpgw']->log->message(array(
'line' => __LINE__, 'text' => 'W-LoginFailure, account loginid %1 is expired',
'file' => __FILE__ 'p1' => $this->account_lid,
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -432,14 +450,17 @@
if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain']) if ($userid_array[1] != $GLOBALS['phpgw_info']['user']['domain'])
{ {
$GLOBALS['phpgw']->log->message(array( if(is_object($GLOBALS['phpgw']->log))
'text' => 'W-VerifySession, the domains %1 and %2 don\t match', {
'p1' => $userid_array[1], $GLOBALS['phpgw']->log->message(array(
'p2' => $GLOBALS['phpgw_info']['user']['domain'], 'text' => 'W-VerifySession, the domains %1 and %2 don\t match',
'line' => __LINE__, 'p1' => $userid_array[1],
'file' => __FILE__ 'p2' => $GLOBALS['phpgw_info']['user']['domain'],
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -448,15 +469,18 @@
{ {
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()))
{ {
// This needs some better wording if(is_object($GLOBALS['phpgw']->log))
$GLOBALS['phpgw']->log->message(array( {
'text' => 'W-VerifySession, IP %1 doesn\'t match IP %2 in session table', // This needs some better wording
'p1' => $this->getuser_ip(), $GLOBALS['phpgw']->log->message(array(
'p2' => $GLOBALS['phpgw_info']['user']['session_ip'], 'text' => 'W-VerifySession, IP %1 doesn\'t match IP %2 in session table',
'line' => __LINE__, 'p1' => $this->getuser_ip(),
'file' => __FILE__ 'p2' => $GLOBALS['phpgw_info']['user']['session_ip'],
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }
@ -469,13 +493,16 @@
if (! $this->account_lid) if (! $this->account_lid)
{ {
// This needs some better wording if(is_object($GLOBALS['phpgw']->log))
$GLOBALS['phpgw']->log->message(array( {
'text' => 'W-VerifySession, account_id is empty', // This needs some better wording
'line' => __LINE__, $GLOBALS['phpgw']->log->message(array(
'file' => __FILE__ 'text' => 'W-VerifySession, account_id is empty',
)); 'line' => __LINE__,
$GLOBALS['phpgw']->log->commit(); 'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
}
return False; return False;
} }