mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-15 07:41:00 +00:00
+12
-3
@@ -4018,9 +4018,18 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
function getUnreadMessagesCount($uid) {
|
function getUnreadMessagesCount($uid) {
|
||||||
$uid = (int) $uid;
|
$uid = (int) $uid;
|
||||||
|
|
||||||
return mysqli_fetch_array(mysqli_query($this->dblink, '
|
$ids = [$uid];
|
||||||
SELECT Count(*) as numUnread FROM '.TB_PREFIX.'mdata WHERE target = '.$uid.' AND viewed = 0'
|
|
||||||
), MYSQLI_ASSOC)['numUnread'];
|
if (($this->getUserField($uid, 'access', 0) == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES) {
|
||||||
|
$ids[] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getUserField($uid, 'access', 0) == MULTIHUNTER) {
|
||||||
|
$ids[] = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
$q = 'SELECT Count(*) as numUnread FROM '.TB_PREFIX.'mdata WHERE target IN('.implode(', ', $ids).') AND viewed = 0';
|
||||||
|
return mysqli_fetch_array(mysqli_query($this->dblink, $q), MYSQLI_ASSOC)['numUnread'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
|
|||||||
Reference in New Issue
Block a user