diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index c51e190..06577d5 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -1,7 +1,8 @@ assign(array( + 'chatVersion' => $this->chatVersion, 'room' => $this->room, 'roomID' => $this->roomID, 'rooms' => $this->rooms, @@ -34,6 +37,20 @@ public function assignVariables() { )); } + public function readChatVersion() { + CacheHandler::getInstance()->addResource( + 'packages', + WCF_DIR.'cache/cache.packages.php', + 'wcf\system\cache\builder\PackageCacheBuilder' + ); + $packages = CacheHandler::getInstance()->get('packages'); + foreach ($packages as $package) { + if ($package->package != 'timwolla.wcf.chat') continue; + $this->chatVersion = $package->packageVersion; + break; + } + } + /** * @see \wcf\page\IPage::readData() */ @@ -69,8 +86,8 @@ public function readData() { 'color2' => 0x00FF00 )); - $smilies = \wcf\data\smiley\SmileyCache::getInstance()->getSmilies(); - $this->smilies = $smilies[null]; + $this->readDefaultSmileys(); + $this->readChatVersion(); } /** @@ -82,6 +99,11 @@ public function readParameters() { if (isset($_GET['id'])) $this->roomID = (int) $_GET['id']; } + public function readDefaultSmileys() { + $smilies = \wcf\data\smiley\SmileyCache::getInstance()->getSmilies(); + $this->smilies = $smilies[null]; + } + /** * @see \wcf\page\IPage::show() */ diff --git a/template/chatJavascriptInclude.tpl b/template/chatJavascriptInclude.tpl index 9a793e9..70a3857 100644 --- a/template/chatJavascriptInclude.tpl +++ b/template/chatJavascriptInclude.tpl @@ -1 +1 @@ -{if $templateName == 'chat'}{/if} \ No newline at end of file +{if $templateName == 'chat'}{/if} \ No newline at end of file