diff --git a/file/lib/system/chat/command/commands/Info.class.php b/file/lib/system/chat/command/commands/Info.class.php index 236da42..3bcfd48 100644 --- a/file/lib/system/chat/command/commands/Info.class.php +++ b/file/lib/system/chat/command/commands/Info.class.php @@ -1,5 +1,6 @@ getParameters(), ',')); + $user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ',')); if (!$user->userID) throw new \wcf\system\chat\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); $room = new \wcf\data\chat\room\ChatRoom(ChatUtil::readUserData('roomID', $user)); $color = ChatUtil::readUserData('color', $user); @@ -33,10 +34,30 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand if ($room->roomID && $room->canEnter()) { $this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle(); } + $session = $this->fetchSession($user); + if ($session) { + // TODO: Check permission + $this->lines['IP_ADDRESS'] = $session->ipAddress; + } $this->didInit(); } + public function fetchSession(User $user) { + $sql = "SELECT + * + FROM + wcf".WCF_N."_session + WHERE + userID = ?"; + $stmt = WCF::getDB()->prepareStatement($sql); + $stmt->execute(array($user->userID)); + $row = $stmt->fetchArray(); + if (!$row) return false; + + return new \wcf\data\session\Session(null, $row); + } + /** * @see \wcf\system\chat\command\ICommand::getType() */