* @package be.bastelstu.wcf.chat * @subpackage system.chat.command.commands */ class RestoreCommand extends \wcf\system\chat\command\AbstractRestrictedCommand { public $enableHTML = 1; public $user = null; public $link = ''; public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) { parent::__construct($commandHandler); $this->user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ',')); if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); // Username + link to profile $color = array(1 => ChatUtil::getRandomNumber(), 2 => ChatUtil::getRandomNumber() * 0xFFFF); ChatUtil::writeUserData(array('color' => $color), $this->user); $profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array( 'object' => $this->user )); $this->link = ''.ChatUtil::gradient($this->user->username, $color[1], $color[2]).''; $this->didInit(); } /** * @see \wcf\system\chat\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; } /** * @see \wcf\system\chat\command\ICommand::getMessage() */ public function getMessage() { return 'restored '.$this->link; } /** * @see \wcf\system\chat\command\ICommand::getReceiver() */ public function getReceiver() { return \wcf\system\WCF::getUser()->userID; } }