1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Take care of global suspensions as well

This commit is contained in:
Tim Düsterhus 2012-05-19 21:27:49 +02:00
parent e8607eaf56
commit 874b5009a2

View File

@ -49,11 +49,17 @@ public function canEnter() {
$suspensions = ChatSuspension::getSuspensionsForUser(); $suspensions = ChatSuspension::getSuspensionsForUser();
$canEnter = $ph->getPermission($this, 'user.canEnter'); $canEnter = $ph->getPermission($this, 'user.canEnter');
if (isset($suspensions[$this->roomID][ChatSuspension::TYPE_BAN])) { if ($canEnter && isset($suspensions[$this->roomID][ChatSuspension::TYPE_BAN])) {
if ($suspensions[$this->roomID][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) { if ($suspensions[$this->roomID][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) {
$canEnter = false; $canEnter = false;
} }
} }
if ($canEnter && isset($suspensions[null][ChatSuspension::TYPE_BAN])) {
if ($suspensions[null][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) {
$canEnter = false;
}
}
return $canEnter || $ph->getPermission($this, 'mod.canAlwaysEnter'); return $canEnter || $ph->getPermission($this, 'mod.canAlwaysEnter');
} }
@ -67,11 +73,16 @@ public function canWrite() {
$suspensions = ChatSuspension::getSuspensionsForUser(); $suspensions = ChatSuspension::getSuspensionsForUser();
$canWrite = $ph->getPermission($this, 'user.canWrite'); $canWrite = $ph->getPermission($this, 'user.canWrite');
if (isset($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE])) { if ($canWrite && isset($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE])) {
if ($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) { if ($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) {
$canWrite = false; $canWrite = false;
} }
} }
if ($canWrite && isset($suspensions[null][ChatSuspension::TYPE_MUTE])) {
if ($suspensions[null][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) {
$canWrite = false;
}
}
return $canWrite || $ph->getPermission($this, 'mod.canAlwaysWrite'); return $canWrite || $ph->getPermission($this, 'mod.canAlwaysWrite');
} }