1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 09:04:38 +02:00

Issue #4757 Prevent infinite loop and possible PHP 8.1 errors.

This commit is contained in:
Cameron
2022-04-21 10:54:43 -07:00
parent cf20dfc36b
commit c2fc8fce0a
5 changed files with 20 additions and 12 deletions

View File

@@ -2140,6 +2140,7 @@ class e_user extends e_user_model
$this->set('last_ip', $this->get('user_ip'));
$current_ip = e107::getIPHandler()->getIP();
$update_ip = '';
$edata = [];
if($this->get('user_ip') != $current_ip)
{
@@ -2152,12 +2153,11 @@ class e_user extends e_user_model
'user_name' => $this->get('user_name'),
];
e107::getEvent()->trigger('user_ip_changed', $edata); // new v2.3.3
}
$update_ip = ($this->get('user_ip') != $current_ip) ? ", user_ip = '".$current_ip."'" : '';
$this->set('user_ip', $current_ip);
if($this->get('user_currentvisit') + 3600 < time() || !$this->get('user_lastvisit'))
{
$this->set('user_lastvisit', (integer) $this->get('user_currentvisit'));
@@ -2169,6 +2169,11 @@ class e_user extends e_user_model
$this->set('user_currentvisit', time());
$sql->update('user', "user_currentvisit = ".$this->get('user_currentvisit').$update_ip." WHERE user_id = ".$this->getId()." LIMIT 1 ");
}
if(!empty($edata))
{
e107::getEvent()->trigger('user_ip_changed', $edata); // new v2.3.3
}
}
}