From cdb8ad0c2d2c2f568191465692b56ab0286e73f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 18 May 2013 22:05:03 +0200 Subject: [PATCH] Clean up :) --- file/lib/data/suspension/Suspension.class.php | 9 ++++++++- file/lib/system/command/commands/InfoCommand.class.php | 7 ++++--- file/lib/system/command/commands/MuteCommand.class.php | 6 +++--- language/de.xml | 6 +++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/file/lib/data/suspension/Suspension.class.php b/file/lib/data/suspension/Suspension.class.php index ccf65d5..5724644 100644 --- a/file/lib/data/suspension/Suspension.class.php +++ b/file/lib/data/suspension/Suspension.class.php @@ -25,6 +25,12 @@ class Suspension extends \chat\data\CHATDatabaseObject { const TYPE_MUTE = 1; const TYPE_BAN = 2; + /** + * Returns all the suspensions for the specified user (current user if no user was specified). + * + * @param \wcf\data\user\User $user + * @return array + */ public static function getSuspensionsForUser(\wcf\data\user\User $user = null) { if ($user === null) $user = WCF::getUser(); $suspensions = \chat\util\ChatUtil::readUserData('suspensions', $user); @@ -53,6 +59,7 @@ public static function getSuspensionsForUser(\wcf\data\user\User $user = null) { /** * Returns the appropriate suspension for user, room and type. + * Returns false if no suspension was found. * * @param \wcf\data\user\User $user * @param \chat\data\room\Room $room @@ -78,7 +85,7 @@ public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user, $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($parameter); $row = $statement->fetchArray(); - if(!$row) $row = array(); + if (!$row) return false; return new self(null, $row); } diff --git a/file/lib/system/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php index 637d5bf..4bf7c38 100644 --- a/file/lib/system/command/commands/InfoCommand.class.php +++ b/file/lib/system/command/commands/InfoCommand.class.php @@ -23,8 +23,9 @@ class InfoCommand extends \chat\system\command\AbstractCommand { public function __construct(\chat\system\command\CommandHandler $commandHandler) { parent::__construct($commandHandler); - $this->user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ',')); - if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); + $username = rtrim($commandHandler->getParameters(), ','); + $this->user = User::getUserByUsername($username); + if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException($username); // Username + link to profile $profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array( @@ -40,7 +41,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) // Room $room = new \chat\data\room\Room(ChatUtil::readUserData('roomID', $this->user)); if ($room->roomID && $room->canEnter()) { - $this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle(); + $this->lines[WCF::getLanguage()->get('chat.general.room')] = $room->getTitle(); } // Suspensions diff --git a/file/lib/system/command/commands/MuteCommand.class.php b/file/lib/system/command/commands/MuteCommand.class.php index d2dfbbc..18ca85e 100644 --- a/file/lib/system/command/commands/MuteCommand.class.php +++ b/file/lib/system/command/commands/MuteCommand.class.php @@ -1,9 +1,9 @@ get('wcf.chat.suspension.exists')); } - $editor = new suspension\SuspensionEditor($suspension); - $editor->delete(); + $action = new suspension\SuspensionAction(array($suspension), 'delete'); + $action->executeAction(); } $this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array( diff --git a/language/de.xml b/language/de.xml index 4583958..772a625 100644 --- a/language/de.xml +++ b/language/de.xml @@ -4,7 +4,6 @@ - @@ -64,8 +63,8 @@ - - + + Tims Chat{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}, entwickelt in Tims Bastelstube]]> @@ -113,6 +112,7 @@ +