mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 17:59:22 +02:00
Fix some 7.4 notices about OTS_Account bans
Example: Notice: Trying to access array offset on value of type bool in C:\UniServerZ\www\system\libs\pot\OTS_Account.php on line 784 (cherry picked from commit 259cda150decb912156a3740af85407ff277de5a)
This commit is contained in:
parent
8af9186098
commit
a7105d33f2
@ -755,7 +755,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
}
|
||||
if( !isset($this->data['banned']) )
|
||||
$this->loadBan();
|
||||
return ($this->data['banned'] == 1);
|
||||
return ($this->data['banned'] === true);
|
||||
}
|
||||
|
||||
public function getBanTime()
|
||||
@ -781,20 +781,24 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
if(tableExist('account_bans')) {
|
||||
$ban = $this->db->query('SELECT `expires_at` FROM `account_bans` WHERE `account_id` = ' . $this->data['id'] . ' AND (`expires_at` > ' . time() .' OR `expires_at` = -1) ORDER BY `expires_at` DESC')->fetch();
|
||||
$this->data['banned'] = isset($ban['expires_at']);
|
||||
$this->data['banned_time'] = $ban['expires_at'];
|
||||
$this->data['banned_time'] = isset($ban['expires_at']) ? $ban['expires_at'] : 0;
|
||||
}
|
||||
else if(tableExist('bans')) {
|
||||
if(fieldExist('active', 'bans')) {
|
||||
$ban = $this->db->query('SELECT `active`, `expires` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `active` = 1 AND `value` = ' . $this->data['id'] . ' AND (`expires` > ' . time() .' OR `expires` = -1) ORDER BY `expires` DESC')->fetch();
|
||||
$this->data['banned'] = $ban['active'];
|
||||
$this->data['banned_time'] = $ban['expires'];
|
||||
$this->data['banned'] = isset($ban['active']);
|
||||
$this->data['banned_time'] = isset($ban['expires']) ? $ban['expires'] : 0;
|
||||
}
|
||||
else { // tfs 0.2
|
||||
$ban = $this->db->query('SELECT `time` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `account` = ' . $this->data['id'] . ' AND (`time` > ' . time() .' OR `time` = -1) ORDER BY `time` DESC')->fetch();
|
||||
$this->data['banned'] = $ban['time'] == -1 || $ban['time'] > 0;
|
||||
$this->data['banned_time'] = $ban['time'];
|
||||
$this->data['banned'] = isset($ban['time']) && ($ban['time'] == -1 || $ban['time'] > 0);
|
||||
$this->data['banned_time'] = isset($ban['time']) ? $ban['time'] : 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->data['banned'] = false;
|
||||
$this->data['banned_time'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user