roomID = intval($_GET['id']); $this->room = \chat\data\room\RoomCache::getInstance()->getRoom($this->roomID); if ($this->room === null) throw new IllegalLinkException(); if (!$this->room->canSee($user = null, $reason)) throw $reason; if (!$this->room->canJoin($user = null, $reason)) throw $reason; $this->canonicalURL = $this->room->getLink(); } /** * @inheritDoc */ public function checkPermissions() { parent::checkPermissions(); $package = \wcf\data\package\PackageCache::getInstance()->getPackageByIdentifier('be.bastelstu.chat'); if (stripos($package->packageVersion, 'Alpha') !== false) { $sql = "SELECT COUNT(*) FROM wcf".WCF_N."_user"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); $userCount = $statement->fetchSingleColumn(); if ((($userCount > 5 && !OFFLINE) || ($userCount > 30 && OFFLINE)) && sha1(WCF_UUID) !== '643a6b3af2a6ea3d393c4d8371e75d7d1b66e0d0') { throw new PermissionDeniedException("Do not use alpha versions of Tims Chat in production communities!"); } } } /** * @inheritDoc */ public function readData() { $sql = "SELECT 1"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); if ($statement->fetchSingleColumn() !== 1) { throw new NamedUserException('PHP must be configured to use the MySQLnd driver, instead of libmysqlclient.'); } parent::readData(); $pushHandler = \wcf\system\push\PushHandler::getInstance(); $pushHandler->joinChannel('be.bastelstu.chat'); $pushHandler->joinChannel('be.bastelstu.chat.room-'.$this->room->roomID); } /** * @inheritDoc */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign([ 'room' => $this->room , 'config' => $this->getConfig() ]); } }