diff --git a/.travis.yml b/.travis.yml index f9a7c0b..9d091f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,9 @@ php: - 5.4 - 5.3 before_install: + - pear config-set auto_discover 1 - pear install pear/PHP_CodeSniffer + - pear install pear.phpunit.de/phpcpd - phpenv rehash before_script: - git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF @@ -15,3 +17,4 @@ before_script: script: - find file -type f -name '*.php' |xargs -I file php -l file - phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" file + - phpcpd --verbose --min-lines 10 file \ No newline at end of file diff --git a/acptemplate/chatSuspensionList.tpl b/acptemplate/chatSuspensionList.tpl index b736365..c632484 100644 --- a/acptemplate/chatSuspensionList.tpl +++ b/acptemplate/chatSuspensionList.tpl @@ -135,7 +135,7 @@ {foreach from=$objects item=$suspension} - + {event name='rowButtons'} {#$suspension->suspensionID} diff --git a/acptemplate/messageLog.tpl b/acptemplate/messageLog.tpl index dedbf9a..d31a383 100644 --- a/acptemplate/messageLog.tpl +++ b/acptemplate/messageLog.tpl @@ -40,7 +40,7 @@
- + {if $errorField == 'date'} {lang}chat.acp.log.date.error.{$errorType}{/lang} diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index b4444e0..8ad112a 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -75,7 +75,7 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures. init = (roomID, config, titleTemplate, messageTemplate, userTemplate) -> return false if initialized initialized = true - + v.config = config v.titleTemplate = titleTemplate v.messageTemplate = messageTemplate @@ -93,8 +93,7 @@ When **Tims Chat** becomes focused mark the chat as active and remove the number When **Tims Chat** loses the focus mark the chat as inactive. - $(window).blur -> - isActive = false + $(window).blur -> isActive = false Make the user leave the chat when **Tims Chat** is about to be unloaded. @@ -113,13 +112,11 @@ Make the user leave the chat when **Tims Chat** is about to be unloaded. Insert the appropriate smiley code into the input when a smiley is clicked. - $('#smilies').on 'click', 'img', -> - insertText " #{$(@).attr('alt')} " + $('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} " Handle private channel menu - $('#privateChannelsMenu').on 'click', '.privateChannel', -> - openPrivateChannel $(@).data 'privateChannelID' + $('#privateChannelsMenu').on 'click', '.privateChannel', -> openPrivateChannel $(@).data 'privateChannelID' Handle submitting the form. The message will be validated by some basic checks, passed to the `submit` eventlisteners and afterwards sent to the server by an AJAX request. @@ -132,8 +129,7 @@ and afterwards sent to the server by an AJAX request. return false if text.length is 0 - unless openChannel is 0 - text = "/whisper #{userList.allTime[openChannel].username}, #{text}" + text = "/whisper #{userList.allTime[openChannel].username}, #{text}" unless openChannel is 0 # Free the fish! do freeTheFish if text.toLowerCase() is '/free the fish' @@ -222,8 +218,7 @@ Reset autocompleter to default status, when the input is `click`ed, as the posit Refresh the room list when the associated button is `click`ed. - $('#timsChatRoomList button').click -> - do refreshRoomList + $('#timsChatRoomList button').click -> do refreshRoomList Clear the chat by removing every single message once the clear button is `clicked`. @@ -261,7 +256,7 @@ Toggle fullscreen mode. # Force dropdowns to reorientate $('.dropdownMenu').data 'orientationX', '' - if $('#timsChatFullscreen').data 'status' + if $(@).data 'status' $('html').addClass 'fullscreen' else $('html').removeClass 'fullscreen' @@ -315,18 +310,18 @@ Scroll down when autoscroll is being activated. Enable duplicate tab detection. - window.localStorage.setItem 'be.bastelstu.chat.session', chatSession - $(window).on 'storage', (event) -> - if event.originalEvent.key is 'be.bastelstu.chat.session' - if parseInt(event.originalEvent.newValue) isnt chatSession - showError WCF.Language.get 'chat.error.duplicateTab' + try + window.localStorage.setItem 'be.bastelstu.chat.session', chatSession + $(window).on 'storage', (event) -> + if event.originalEvent.key is 'be.bastelstu.chat.session' + showError WCF.Language.get 'chat.error.duplicateTab' unless parseInt(event.originalEvent.newValue) is chatSession Ask for permissions to use Desktop notifications when notifications are activated. if window.Notification? $('#timsChatNotify').click (event) -> return unless $(@).data 'status' - if window.Notification.permission isnt 'granted' + unless window.Notification.permission is 'granted' window.Notification.requestPermission (permission) -> window.Notification.permission ?= permission @@ -682,10 +677,10 @@ Shows an unrecoverable error with the given text. """).appendTo 'body' formSubmit = $("""
""").appendTo errorDialog + reloadButton = $("""""").appendTo formSubmit - reloadButton.on 'click', -> - do window.location.reload - + reloadButton.on 'click', -> do window.location.reload + $('#timsChatLoadingErrorDialog').wcfDialog closable: false title: WCF.Language.get 'wcf.global.error.title' @@ -743,6 +738,7 @@ Open private channel $('#timsChatMessageContainer0').after div $('.privateChannel').removeClass 'active' + if userID isnt 0 $('#timsChatTopic').removeClass 'hidden empty' $('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username} diff --git a/file/lib/data/suspension/SuspensionAction.class.php b/file/lib/data/suspension/SuspensionAction.class.php index b0bf7e6..3964a0d 100644 --- a/file/lib/data/suspension/SuspensionAction.class.php +++ b/file/lib/data/suspension/SuspensionAction.class.php @@ -17,6 +17,11 @@ class SuspensionAction extends \wcf\data\AbstractDatabaseObjectAction { */ protected $className = '\chat\data\suspension\SuspensionEditor'; + /** + * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP + */ + protected $requireACP = array('revoke'); + /** * Validates permissions and parameters */ @@ -30,6 +35,7 @@ public function validateRevoke() { * Revokes suspensions. */ public function revoke() { + // TODO: ignore revokes if suspension already is revoked if (!isset($this->parameters['revoker'])) { $this->parameters['revoker'] = null; } diff --git a/file/lib/system/command/AbstractSuspensionCommand.class.php b/file/lib/system/command/AbstractSuspensionCommand.class.php index 8d15e7c..1c2551f 100644 --- a/file/lib/system/command/AbstractSuspensionCommand.class.php +++ b/file/lib/system/command/AbstractSuspensionCommand.class.php @@ -60,7 +60,7 @@ public function executeAction() { if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, static::SUSPENSION_TYPE)) { if ($suspension->expires >= $this->expires) { - throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists')); + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('chat.suspension.exists')); } $action = new suspension\SuspensionAction(array($suspension), 'revoke', array( diff --git a/file/lib/system/command/AbstractUnsuspensionCommand.class.php b/file/lib/system/command/AbstractUnsuspensionCommand.class.php index 7fa1082..3f18bb3 100644 --- a/file/lib/system/command/AbstractUnsuspensionCommand.class.php +++ b/file/lib/system/command/AbstractUnsuspensionCommand.class.php @@ -48,7 +48,7 @@ public function executeAction() { $action->executeAction(); } else { - throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.notExists')); + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('chat.suspension.notExists')); } } diff --git a/file/lib/system/command/CommandHandler.class.php b/file/lib/system/command/CommandHandler.class.php index ed9e8b1..3c3dbe0 100644 --- a/file/lib/system/command/CommandHandler.class.php +++ b/file/lib/system/command/CommandHandler.class.php @@ -54,14 +54,19 @@ public function __construct($text, \chat\data\room\Room $room = null) { * @return array */ public static function getAliasMap() { - $result = array(); - foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) { - list($key, $val) = explode(':', $line, 2); + try { + $result = array(); + foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) { + list($key, $val) = explode(':', $line, 2); + + $result[$key] = $val; + } - $result[$key] = $val; + return $result; + } + catch (\wcf\system\exception\SystemException $e) { + throw new \wcf\system\exception\SystemException("Invalid alias specified: '".$line."'"); } - - return $result; } /** diff --git a/file/lib/system/command/commands/TemproomCommand.class.php b/file/lib/system/command/commands/TemproomCommand.class.php index 121e69e..1c1fd27 100644 --- a/file/lib/system/command/commands/TemproomCommand.class.php +++ b/file/lib/system/command/commands/TemproomCommand.class.php @@ -75,7 +75,7 @@ public function getType() { * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { - return $this->roomName; + return WCF::getLanguage()->getDynamicVariable('chat.message.temproom.success', array('roomName' => $this->roomName)); } /** diff --git a/file/style/be.bastelstu.chat.less b/file/style/be.bastelstu.chat.less index 9b55623..7504ec4 100644 --- a/file/style/be.bastelstu.chat.less +++ b/file/style/be.bastelstu.chat.less @@ -29,10 +29,6 @@ } #tplChat { - #main > div { - overflow: hidden; - } - #timsChatTopic { padding: @wcfGapTiny; .transition(height, .2s); @@ -45,10 +41,6 @@ border: 0px; padding: 0px; margin: 0px; - - ~ #timsChatMessageContainer { - margin-top: 0; - } } .jsTopicCloser { @@ -67,13 +59,13 @@ &.shown { opacity: 1; z-index: 130; - + ~ .timsChatMessageContainer { margin-left: 35px; border-top-left-radius: 0; } } - + > ul { text-align: right; @@ -84,7 +76,7 @@ } } } - + > li:last-child { > .userAvatar.framed { img, > canvas, > .icon { @@ -92,7 +84,7 @@ } } } - + > li { margin-bottom: -1px; background-color: @wcfContainerBackgroundColor; @@ -109,14 +101,6 @@ &.small { display: block; } - - &.framed { - > .icon { - background-color: @wcfContentBackgroundColor; - border: 1px solid @wcfContainerBorderColor; - padding: 1px; - } - } } &.active { @@ -189,7 +173,7 @@ } &:nth-child(even) { - > .innerMessageContainer.bubble .innerMessage, .innerMessageContainer.right.bubble .innerMessage { + > .innerMessageContainer.bubble .innerMessage { background-color: @wcfContainerAccentBackgroundColor; &:after { @@ -221,7 +205,6 @@ float: right; } - .username { font-weight: bold; } @@ -408,13 +391,14 @@ #timsChatRoomList { > div { > div { - margin-top: @wcfGapMedium; text-align: center; } } } #smilies { + margin-top: @wcfGapMedium; + li { .transition(opacity, .2s); } @@ -424,14 +408,6 @@ opacity: .5; } } - - margin-top: @wcfGapMedium; - } - - @media only screen and (max-width: 800px) { - .timsChatMessage .text li > time, #smilies { - display: none !important; - } } #timsChatOptions { @@ -440,17 +416,6 @@ } } - #toggleRooms .ajaxLoad { - position: absolute; - right: 10px; - top: 7px; - display: none; - } - - #timsChatCopyright { - .textShadow(@wcfContentBackgroundColor); - } - #timsChatCopyrightDialog > div { background-position: right center; background-repeat: no-repeat; @@ -465,6 +430,12 @@ animation-timing-function: linear; border-color: @wcfInputHoverBorderColor; } + + @media only screen and (max-width: 800px) { + .timsChatMessage .text li > time, #smilies { + display: none !important; + } + } } html.fullscreen { diff --git a/language/de.xml b/language/de.xml index 6ab1255..0bfda11 100644 --- a/language/de.xml +++ b/language/de.xml @@ -17,8 +17,10 @@ - - revokerUsername}]]> + + username}“ wirklich zurückziehen?]]> + + revokerUsername}“]]> @@ -86,12 +88,11 @@ - + - @@ -107,6 +108,7 @@ getCommand()}“ wurde nicht gefunden.]]> getUsername()}“ wurde nicht gefunden.]]> + @@ -188,11 +190,14 @@ Probieren Sie den Chat neu zu laden diff --git a/option.xml b/option.xml index 9fac9ad..8dbebeb 100644 --- a/option.xml +++ b/option.xml @@ -56,11 +56,6 @@ gunmute:ungmute -