diff --git a/file/lib/action/LeaveAction.class.php b/file/lib/action/LeaveAction.class.php index 778f1e3..cedb813 100644 --- a/file/lib/action/LeaveAction.class.php +++ b/file/lib/action/LeaveAction.class.php @@ -43,23 +43,6 @@ class LeaveAction extends \wcf\action\AbstractAction { */ public $userData = array(); - /** - * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() - */ - public $request = null; - - /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() - */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); - - parent::__run(); - } - /** * @see \wcf\action\IAction::execute() */ diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 5929d3d..719169e 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -162,30 +162,14 @@ public function readParameters() { $this->request = $this; switch ($this->action) { - case 'Message': - $this->request = new ChatMessagePage(); - $this->request->__run(); - exit; case 'Log': $this->request = new LogPage(); $this->request->__run(); exit; - case 'RefreshRoomList': - $this->request = new RoomListPage(); - $this->request->__run(); - exit; case 'Send': $this->request = new \chat\form\ChatForm(); $this->request->__run(); exit; - case 'Leave': - $this->request = new \chat\action\LeaveAction(); - $this->request->__run(); - exit; - case 'Copyright': - $this->request = new CopyrightPage(); - $this->request->__run(); - exit; } if (isset($_REQUEST['id'])) $this->roomID = (int) $_REQUEST['id']; diff --git a/file/lib/page/CopyrightPage.class.php b/file/lib/page/CopyrightPage.class.php index 904379d..7600081 100644 --- a/file/lib/page/CopyrightPage.class.php +++ b/file/lib/page/CopyrightPage.class.php @@ -13,6 +13,11 @@ * @subpackage page */ class CopyrightPage extends \wcf\page\AbstractPage { + /** + * @see wcf\page\AbstractPage::$loginRequired + */ + public $loginRequired = true; + /** * @see \wcf\page\AbstractPage::$neededModules */ @@ -25,61 +30,26 @@ class CopyrightPage extends \wcf\page\AbstractPage { /** * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() + * @see \wcf\system\request\Request::getRequestObject() */ public $request = null; + /** + * @see \wcf\page\AbstractPage::$templateName + */ public $templateName = '__copyright'; /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() + * @see \wcf\page\IPage::assignVariables() */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); + public function assignVariables() { + parent::assignVariables(); - parent::__run(); - } - - /** - * @see \wcf\page\IPage::readParameters() - */ - public function readParameters() { - // ### - // ## ## - // # # - // # ##### # - // # # # # - // # # * * # # - // # # # # - // # # # # - // # ### # - // # # - // ####### - // # # # # - // # # # # - // # # # # - - if (isset($_GET['sheep'])) $this->useTemplate = false; - } - - /** - * @see \wcf\page\IPage::show() - */ - public function show() { - // guests are not supported - if (!WCF::getUser()->userID) { - throw new \wcf\system\exception\PermissionDeniedException(); - } - - parent::show(); - if ($this->useTemplate) exit; - @header('Content-type: image/png'); - \wcf\util\HeaderUtil::sendNoCacheHeaders(); $images = explode("\n\n", file_get_contents(__FILE__, null, null, __COMPILER_HALT_OFFSET__+2)); - echo base64_decode($images[array_rand($images)]); - exit; + + WCF::getTPL()->assign(array( + 'background' => str_replace("\n", '', $images[array_rand($images)]) + )); } } // @codingStandardsIgnoreStart diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/NewMessagesPage.class.php similarity index 90% rename from file/lib/page/ChatMessagePage.class.php rename to file/lib/page/NewMessagesPage.class.php index 49ebcd6..34f7db7 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/NewMessagesPage.class.php @@ -13,7 +13,7 @@ * @package be.bastelstu.chat * @subpackage page */ -class ChatMessagePage extends \wcf\page\AbstractPage { +class NewMessagesPage extends \wcf\page\AbstractPage { /** * @see wcf\page\AbstractPage::$loginRequired */ @@ -55,23 +55,6 @@ class ChatMessagePage extends \wcf\page\AbstractPage { */ public $useTemplate = false; - /** - * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() - */ - public $request = null; - - /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() - */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); - - parent::__run(); - } - /** * @see \wcf\page\Page::readData() */ diff --git a/file/lib/page/RoomListPage.class.php b/file/lib/page/RoomListPage.class.php index a5c5f12..12fbe24 100644 --- a/file/lib/page/RoomListPage.class.php +++ b/file/lib/page/RoomListPage.class.php @@ -6,7 +6,7 @@ use \wcf\system\WCF; /** - * Outputs roomlist + * Outputs roomlist. * * @author Tim Düsterhus * @copyright 2010-2013 Tim Düsterhus @@ -47,23 +47,6 @@ class RoomListPage extends \wcf\page\AbstractPage { */ public $useTemplate = false; - /** - * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() - */ - public $request = null; - - /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() - */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); - - parent::__run(); - } - /** * @see \wcf\page\IPage::readData() */ diff --git a/file/lib/system/event/listener/RouteHandlerListener.class.php b/file/lib/system/event/listener/RouteHandlerListener.class.php index d0f14d2..f9322bb 100644 --- a/file/lib/system/event/listener/RouteHandlerListener.class.php +++ b/file/lib/system/event/listener/RouteHandlerListener.class.php @@ -18,7 +18,7 @@ public function execute($eventObj, $className, $eventName) { $route = new \wcf\system\request\Route('chatAction'); $route->setSchema('/{controller}/{action}/{id}'); $route->setParameterOption('controller', null, 'Chat'); - $route->setParameterOption('action', null, '(Message|Log|Send|RefreshRoomList|Copyright|Leave)'); + $route->setParameterOption('action', null, '(Log|Send)'); $route->setParameterOption('id', null, '\d+', true); $eventObj->addRoute($route); } diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index 3409f3a..b3fe953 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -2,11 +2,10 @@ * Styles for Tims Chat * * @author Tim Düsterhus, Maximilian Mader - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike * @package be.bastelstu.wcf.chat */ - #tplChat { #content { #timsChatRoomContent { @@ -301,10 +300,10 @@ .textShadow(@wcfContentBackgroundColor); } - #timsChatCopyrightDialog { + #timsChatCopyrightDialog > div { background-position: right center; background-repeat: no-repeat; - min-height: 50%; + min-height: 150px; } .badgeBG(@backgroundColor) when (lightness(@backgroundColor) < 50%) { diff --git a/template/__copyright.tpl b/template/__copyright.tpl index 8c99c05..4210f19 100644 --- a/template/__copyright.tpl +++ b/template/__copyright.tpl @@ -1,47 +1,49 @@ {if $__chat->isActiveApplication()} {if $templateName != '__copyright'} {elseif $templateName == '__copyright'} -
-
{lang}chat.general.copyright.leader{/lang}
-
- -
-
-
-
{lang}chat.general.copyright.developer{/lang}
-
- -
-
-
-
{lang}chat.general.copyright.graphics{/lang}
-
- -
-
- {*
-
{lang}chat.general.copyright.translation{/lang}
-
+
+
+
{lang}chat.general.copyright.leader{/lang}
+
+ +
+
+
+
{lang}chat.general.copyright.developer{/lang}
+
+ +
+
+
+
{lang}chat.general.copyright.graphics{/lang}
+
+ +
+
+ {*
+
{lang}chat.general.copyright.translation{/lang}
+
-
-
*} -
-
{lang}chat.general.copyright.thanks{/lang}
-
- -
-
+
+
*} +
+
{lang}chat.general.copyright.thanks{/lang}
+
+ +
+
+ {/if} {/if} \ No newline at end of file diff --git a/template/chat.tpl b/template/chat.tpl index 0f4c40c..5af5af3 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -27,8 +27,8 @@ chat = new be.bastelstu.Chat({ reloadTime: {@CHAT_RELOADTIME}, - unloadURL: '{link controller="Chat" action="Leave"}{/link}', - messageURL: '{link controller="Chat" action="Message"}{/link}', + unloadURL: '{link application="chat" controller="Leave"}{/link}', + messageURL: '{link application="chat" controller="NewMessages"}{/link}', socketIOPath: '{@CHAT_SOCKET_IO_PATH|encodeJS}' }, (new WCF.Template('{ldelim}$title} - {'chat.general.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}')).compile(), (new WCF.Template('{@$messageTemplate|encodeJS}')).compile()); {event name='didInit'} @@ -44,7 +44,7 @@ $('#timsChatCopyright').click(function (event) { event.preventDefault(); if (!$.wcfIsset('timsChatCopyrightDialog')) $('
').appendTo('body'); - $('#timsChatCopyrightDialog').load('{link application='chat' controller='Chat' action='Copyright'}{/link}', function() { + $('#timsChatCopyrightDialog').load('{link application='chat' controller='Copyright'}{/link}', function() { WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}' }); }); }); @@ -60,10 +60,6 @@