mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Remove proxying of pages, remove deliver copyright background in own request
This commit is contained in:
parent
71936e14d6
commit
98943f9309
@ -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()
|
||||
*/
|
||||
|
@ -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'];
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
*/
|
@ -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()
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||
* @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%) {
|
||||
|
@ -1,47 +1,49 @@
|
||||
{if $__chat->isActiveApplication()}
|
||||
{if $templateName != '__copyright'}<address id="timsChatCopyright" class="copyright marginTop">{lang}chat.general.copyright{/lang}</address>
|
||||
{elseif $templateName == '__copyright'}
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.leader{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.developer{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
||||
<li><a href="https://github.com/max-m">Maximilian Mader</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.graphics{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://www.cls-design.com/">Tom</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
{*<dl>
|
||||
<dt>{lang}chat.general.copyright.translation{/lang}</dt>
|
||||
<dd>
|
||||
<div style="background-image: url('data:image/png;base64,{$background}');">
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.leader{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.developer{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
||||
<li><a href="https://github.com/max-m">Maximilian Mader</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.graphics{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://www.cls-design.com/">Tom</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
{*<dl>
|
||||
<dt>{lang}chat.general.copyright.translation{/lang}</dt>
|
||||
<dd>
|
||||
|
||||
</dd>
|
||||
</dl>*}
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.thanks{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://www.wbbaddons.de/user/2020-noone/">-noone-</a></li>
|
||||
<li>Gabi</li>
|
||||
<li><a href="https://github.com/Leon-">Stefan Hahn</a></li>
|
||||
<li><a href="http://www.wbbaddons.de">Martin Schwendowius</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>*}
|
||||
<dl>
|
||||
<dt>{lang}chat.general.copyright.thanks{/lang}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="http://www.wbbaddons.de/user/2020-noone/">-noone-</a></li>
|
||||
<li>Gabi</li>
|
||||
<li><a href="https://github.com/Leon-">Stefan Hahn</a></li>
|
||||
<li><a href="http://www.wbbaddons.de">Martin Schwendowius</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
@ -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')) $('<fieldset id="timsChatCopyrightDialog"></fieldset>').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 @@
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#timsChatCopyrightDialog {
|
||||
background-image: url("{link application='chat' controller='Chat' action='Copyright' sheep=1}{/link}");
|
||||
}
|
||||
|
||||
{assign var='type' value='\chat\data\message\Message::TYPE_'}
|
||||
.timsChatMessage{$type|concat:'JOIN'|constant}, .timsChatMessage{$type|concat:'LEAVE'|constant},
|
||||
.timsChatMessage{$type|concat:'INFORMATION'|constant}, .timsChatMessage{$type|concat:'ERROR'|constant} {
|
||||
|
@ -2,7 +2,7 @@
|
||||
<nav class="timsChatSidebarTabs">
|
||||
<ul>
|
||||
<li id="toggleUsers" class="active"><a title="{lang}chat.general.users{/lang}">{lang}chat.general.users{/lang} <span class="badge">0</span></a></li>
|
||||
<li id="toggleRooms"><a title="{lang}chat.general.rooms{/lang}" data-refresh-url="{link application='chat' controller="Chat" action="RefreshRoomList"}{/link}">{lang}chat.general.rooms{/lang} <span class="badge">{#$rooms|count}</span><span class="ajaxLoad icon icon32 icon-spinner"></span></a></li>
|
||||
<li id="toggleRooms"><a title="{lang}chat.general.rooms{/lang}" data-refresh-url="{link application='chat' controller='RoomList'}{/link}">{lang}chat.general.rooms{/lang} <span class="badge">{#$rooms|count}</span><span class="ajaxLoad icon icon32 icon-spinner"></span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user