diff --git a/acpMenu.xml b/acpMenu.xml
index 553f9e1..cc43cce 100644
--- a/acpMenu.xml
+++ b/acpMenu.xml
@@ -26,7 +26,7 @@
chat.acp.menu.link.chat
-
+ mod.chat.canViewAllSuspensions
1
diff --git a/acptemplate/chatSuspensionList.tpl b/acptemplate/chatSuspensionList.tpl
index 763e9a3..f221a30 100644
--- a/acptemplate/chatSuspensionList.tpl
+++ b/acptemplate/chatSuspensionList.tpl
@@ -118,7 +118,7 @@
{$suspension->time|plainTime} |
{$suspension->expires|plainTime}{if $suspension->expires > TIME_NOW} ({$suspension->expires|dateDiff}){/if}
- {if $suspension->revoker}{lang}chat.acp.suspension.revokedBy{/lang} {/if}
+ {if $suspension->revoker && $suspension->expires <= TIME_NOW}{lang}chat.acp.suspension.revokedBy{/lang} {/if}
|
{$suspension->issuerUsername} |
reason != $suspension->reason|truncate:30} class="jsTooltip" title="{$suspension->reason}"{/if}>{$suspension->reason|truncate:30} |
diff --git a/file/lib/acp/page/ChatSuspensionListPage.class.php b/file/lib/acp/page/ChatSuspensionListPage.class.php
index e5253a5..54f94f5 100644
--- a/file/lib/acp/page/ChatSuspensionListPage.class.php
+++ b/file/lib/acp/page/ChatSuspensionListPage.class.php
@@ -20,8 +20,7 @@ class ChatSuspensionListPage extends \wcf\page\SortablePage {
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
- // TODO: Permissions
- public $neededPermissions = array();
+ public $neededPermissions = array('mod.chat.canViewAllSuspensions');
/**
* @see \wcf\page\SortablePage::$defaultSortField
@@ -148,7 +147,7 @@ protected function initObjectList() {
LEFT JOIN wcf".WCF_N."_user user_table2
ON suspension.issuer = user_table2.userID
LEFT JOIN wcf".WCF_N."_user user_table3
- ON suspension.issuer = user_table3.userID";
+ ON suspension.issuer = user_table3.userID";
$conditionJoins = " LEFT JOIN chat".WCF_N."_room room_table
ON suspension.roomID = room_table.roomID";
$this->objectList->sqlConditionJoins .= $conditionJoins;
diff --git a/file/lib/data/suspension/Suspension.class.php b/file/lib/data/suspension/Suspension.class.php
index 0fc7a16..72ba521 100644
--- a/file/lib/data/suspension/Suspension.class.php
+++ b/file/lib/data/suspension/Suspension.class.php
@@ -22,8 +22,8 @@ class Suspension extends \chat\data\CHATDatabaseObject {
*/
protected static $databaseTableIndexName = 'suspensionID';
- const TYPE_MUTE = 1;
- const TYPE_BAN = 2;
+ const TYPE_MUTE = 'mute';
+ const TYPE_BAN = 'ban';
/**
* Returns whether the suspension still is valid.
@@ -34,6 +34,34 @@ public function isValid() {
return $this->expires > TIME_NOW;
}
+ /**
+ * Returns whether the given user may view this suspension.
+ *
+ * @param \wcf\data\user\User $user
+ * @return boolean
+ */
+ public function isVisible($user = null) {
+ if ($user === null) $user = WCF::getUser();
+
+ $ph = new \chat\system\permission\PermissionHandler($user);
+ if ($ph->getPermission($this->getRoom(), 'mod.canViewAllSuspensions')) return true;
+ if ($ph->getPermission($this->getRoom(), 'mod.canG'.$this->type)) return true;
+ if (!$this->room) return false;
+ if ($ph->getPermission($this->getRoom(), 'mod.can'.ucfirst($this->type))) return true;
+ return false;
+ }
+
+ /**
+ * Returns the room of this suspension.
+ *
+ * @return \chat\data\room\Room
+ */
+ public function getRoom() {
+ if (!$this->roomID) return new \chat\data\room\Room(null, array('roomID' => null));
+
+ return \chat\data\room\RoomCache::getInstance()->getRoom($this->roomID);
+ }
+
/**
* Returns all the suspensions for the specified user (current user if no user was specified).
*
diff --git a/file/lib/system/command/AbstractSuspensionCommand.class.php b/file/lib/system/command/AbstractSuspensionCommand.class.php
index 93f5da2..d55df8d 100644
--- a/file/lib/system/command/AbstractSuspensionCommand.class.php
+++ b/file/lib/system/command/AbstractSuspensionCommand.class.php
@@ -91,7 +91,7 @@ public function checkPermission() {
$this->room = $this->commandHandler->getRoom();
$ph = new \chat\system\permission\PermissionHandler();
- if (!$ph->getPermission($this->room, 'mod.can'.ucfirst(static::IDENTIFIER))) throw new \wcf\system\exception\PermissionDeniedException();
+ if (!$ph->getPermission($this->room, 'mod.can'.ucfirst((static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE))) throw new \wcf\system\exception\PermissionDeniedException();
}
/**
@@ -108,7 +108,7 @@ public function getMessage() {
return serialize(array(
'link' => $this->link,
'expires' => $this->expires,
- 'type' => static::IDENTIFIER,
+ 'type' => (static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE,
'reason' => $this->reason
));
}
diff --git a/file/lib/system/command/AbstractUnsuspensionCommand.class.php b/file/lib/system/command/AbstractUnsuspensionCommand.class.php
index ba59fcd..4c5fecf 100644
--- a/file/lib/system/command/AbstractUnsuspensionCommand.class.php
+++ b/file/lib/system/command/AbstractUnsuspensionCommand.class.php
@@ -60,7 +60,7 @@ public function checkPermission() {
$this->room = $this->commandHandler->getRoom();
$ph = new \chat\system\permission\PermissionHandler();
- if (!$ph->getPermission($this->room, 'mod.can'.ucfirst(static::IDENTIFIER))) throw new \wcf\system\exception\PermissionDeniedException();
+ if (!$ph->getPermission($this->room, 'mod.can'.ucfirst((static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE))) throw new \wcf\system\exception\PermissionDeniedException();
}
/**
@@ -76,7 +76,7 @@ public function getType() {
public function getMessage() {
return serialize(array(
'link' => $this->link,
- 'type' => 'un'.static::IDENTIFIER
+ 'type' => 'un'.(static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE,
));
}
}
diff --git a/file/lib/system/command/commands/BanCommand.class.php b/file/lib/system/command/commands/BanCommand.class.php
index c2d7ef3..c3fcf6a 100644
--- a/file/lib/system/command/commands/BanCommand.class.php
+++ b/file/lib/system/command/commands/BanCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class BanCommand extends \chat\system\command\AbstractSuspensionCommand {
- const IDENTIFIER = 'ban';
const IS_GLOBAL = false;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_BAN;
}
diff --git a/file/lib/system/command/commands/GbanCommand.class.php b/file/lib/system/command/commands/GbanCommand.class.php
index dcc92f5..106bf6b 100644
--- a/file/lib/system/command/commands/GbanCommand.class.php
+++ b/file/lib/system/command/commands/GbanCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class GbanCommand extends \chat\system\command\AbstractSuspensionCommand {
- const IDENTIFIER = 'gban';
const IS_GLOBAL = true;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_BAN;
}
diff --git a/file/lib/system/command/commands/GmuteCommand.class.php b/file/lib/system/command/commands/GmuteCommand.class.php
index 1f39976..c32ef0b 100644
--- a/file/lib/system/command/commands/GmuteCommand.class.php
+++ b/file/lib/system/command/commands/GmuteCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class GmuteCommand extends \chat\system\command\AbstractSuspensionCommand {
- const IDENTIFIER = 'gmute';
const IS_GLOBAL = true;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_MUTE;
}
diff --git a/file/lib/system/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php
index 23c40ba..b1f81eb 100644
--- a/file/lib/system/command/commands/InfoCommand.class.php
+++ b/file/lib/system/command/commands/InfoCommand.class.php
@@ -45,11 +45,11 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler)
}
// Suspensions
- // TODO: Permissions
$suspensions = \chat\data\suspension\Suspension::getSuspensionsForUser($this->user);
foreach ($suspensions as $roomSuspensions) {
foreach ($roomSuspensions as $typeSuspension) {
if (!$typeSuspension->isValid()) continue;
+ if (!$typeSuspension->isVisible()) continue;
$dateTime = DateUtil::getDateTimeByTimestamp($typeSuspension->expires);
$name = WCF::getLanguage()->getDynamicVariable('chat.general.information.suspension', array(
diff --git a/file/lib/system/command/commands/MuteCommand.class.php b/file/lib/system/command/commands/MuteCommand.class.php
index 25bbd75..519a58a 100644
--- a/file/lib/system/command/commands/MuteCommand.class.php
+++ b/file/lib/system/command/commands/MuteCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class MuteCommand extends \chat\system\command\AbstractSuspensionCommand {
- const IDENTIFIER = 'mute';
const IS_GLOBAL = false;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_MUTE;
}
diff --git a/file/lib/system/command/commands/UnbanCommand.class.php b/file/lib/system/command/commands/UnbanCommand.class.php
index 85905b2..82427f5 100644
--- a/file/lib/system/command/commands/UnbanCommand.class.php
+++ b/file/lib/system/command/commands/UnbanCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class UnbanCommand extends \chat\system\command\AbstractUnsuspensionCommand {
- const IDENTIFIER = 'ban';
const IS_GLOBAL = false;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_BAN;
}
diff --git a/file/lib/system/command/commands/UngbanCommand.class.php b/file/lib/system/command/commands/UngbanCommand.class.php
index db4a4a2..a742c01 100644
--- a/file/lib/system/command/commands/UngbanCommand.class.php
+++ b/file/lib/system/command/commands/UngbanCommand.class.php
@@ -10,8 +10,7 @@
* @package be.bastelstu.chat
* @subpackage system.chat.command.commands
*/
-class GunbanCommand extends \chat\system\command\AbstractUnsuspensionCommand {
- const IDENTIFIER = 'gban';
+class UngbanCommand extends \chat\system\command\AbstractUnsuspensionCommand {
const IS_GLOBAL = true;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_BAN;
}
diff --git a/file/lib/system/command/commands/UngmuteCommand.class.php b/file/lib/system/command/commands/UngmuteCommand.class.php
index c8c073d..4d912fe 100644
--- a/file/lib/system/command/commands/UngmuteCommand.class.php
+++ b/file/lib/system/command/commands/UngmuteCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class UngmuteCommand extends \chat\system\command\AbstractUnsuspensionCommand {
- const IDENTIFIER = 'gmute';
const IS_GLOBAL = true;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_MUTE;
}
diff --git a/file/lib/system/command/commands/UnmuteCommand.class.php b/file/lib/system/command/commands/UnmuteCommand.class.php
index e7818b2..021e6fa 100644
--- a/file/lib/system/command/commands/UnmuteCommand.class.php
+++ b/file/lib/system/command/commands/UnmuteCommand.class.php
@@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class UnmuteCommand extends \chat\system\command\AbstractUnsuspensionCommand {
- const IDENTIFIER = 'mute';
const IS_GLOBAL = false;
const SUSPENSION_TYPE = \chat\data\suspension\Suspension::TYPE_MUTE;
}
diff --git a/install.sql b/install.sql
index 563f8a3..4949484 100644
--- a/install.sql
+++ b/install.sql
@@ -46,7 +46,7 @@ CREATE TABLE chat1_suspension (
suspensionID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
userID INT(10) NOT NULL,
roomID INT(10) DEFAULT NULL,
- type TINYINT(3) NOT NULL,
+ type VARCHAR(15) NOT NULL,
expires INT(10) NOT NULL,
time INT(10) NOT NULL,
issuer INT(10) DEFAULT NULL,
diff --git a/language/de.xml b/language/de.xml
index d642c7a..594ed1c 100644
--- a/language/de.xml
+++ b/language/de.xml
@@ -144,8 +144,8 @@
-
-
+
+
diff --git a/package.xml b/package.xml
index 1fb22be..a334d00 100644
--- a/package.xml
+++ b/package.xml
@@ -5,7 +5,7 @@
1
- 3.0.0 Alpha 66
+ 3.0.0 Alpha 80
2011-11-26
]]>
diff --git a/userGroupOption.xml b/userGroupOption.xml
index 5c7150b..1a845fb 100644
--- a/userGroupOption.xml
+++ b/userGroupOption.xml
@@ -56,6 +56,12 @@
0
1
+