mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
parent
46d86de030
commit
21104e4097
@ -66,7 +66,7 @@ public function validateSend() {
|
|||||||
$this->parameters['enableHTML'] = false;
|
$this->parameters['enableHTML'] = false;
|
||||||
|
|
||||||
// validate text
|
// validate text
|
||||||
if (\wcf\util\StringUtil::length($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong');
|
if (mb_strlen($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong');
|
||||||
|
|
||||||
// search for disallowed bbcodes
|
// search for disallowed bbcodes
|
||||||
$disallowedBBCodes = \wcf\system\bbcode\BBCodeParser::getInstance()->validateBBCodes($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
|
$disallowedBBCodes = \wcf\system\bbcode\BBCodeParser::getInstance()->validateBBCodes($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
|
||||||
|
@ -147,7 +147,7 @@ public function readCommands() {
|
|||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$command = $regex->replace(basename($file), '');
|
$command = $regex->replace(basename($file), '');
|
||||||
if ($command == 'Plain') continue;
|
if ($command == 'Plain') continue;
|
||||||
$this->commands[] = \wcf\util\StringUtil::toLowerCase($command);
|
$this->commands[] = mb_strtolower($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->commands = array_merge($this->commands, array_keys(\chat\system\command\CommandHandler::getAliasMap()));
|
$this->commands = array_merge($this->commands, array_keys(\chat\system\command\CommandHandler::getAliasMap()));
|
||||||
|
@ -97,7 +97,7 @@ public function getRoom() {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getParameters() {
|
public function getParameters() {
|
||||||
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
|
$parts = explode(' ', mb_substr($this->text, mb_strlen(static::COMMAND_CHAR)), 2);
|
||||||
|
|
||||||
if (!isset($parts[1])) return '';
|
if (!isset($parts[1])) return '';
|
||||||
return $parts[1];
|
return $parts[1];
|
||||||
@ -107,7 +107,7 @@ public function getParameters() {
|
|||||||
* Loads the command.
|
* Loads the command.
|
||||||
*/
|
*/
|
||||||
public function loadCommand() {
|
public function loadCommand() {
|
||||||
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
|
$parts = explode(' ', mb_substr($this->text, mb_strlen(static::COMMAND_CHAR)), 2);
|
||||||
|
|
||||||
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
|
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace chat\system\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the user as away.
|
* Marks the user as away.
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace chat\system\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\util\StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the color of the username
|
* Changes the color of the username
|
||||||
|
@ -14,7 +14,7 @@ class FreeCommand extends MeCommand {
|
|||||||
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) != 'the fish') {
|
if (mb_strtolower($this->commandHandler->getParameters()) != 'the fish') {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
use \wcf\data\user\User;
|
use \wcf\data\user\User;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\DateUtil;
|
use \wcf\util\DateUtil;
|
||||||
use \wcf\util\StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows information about the specified user.
|
* Shows information about the specified user.
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace chat\system\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\util\StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates an action. The message is shown without the colon.
|
* Indicates an action. The message is shown without the colon.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace chat\system\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a temporary room
|
* Creates a temporary room
|
||||||
|
@ -58,7 +58,7 @@ public static function getPackageID() {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function gradient($string, $start, $end) {
|
public static function gradient($string, $start, $end) {
|
||||||
if (($length = \wcf\util\StringUtil::length($string)) === 0) return '';
|
if (($length = mb_strlen($string)) === 0) return '';
|
||||||
|
|
||||||
if ($start === $end) {
|
if ($start === $end) {
|
||||||
return '<span style="color:rgb('.($start >> 16 & 255).','.($start >> 8 & 255).','.($start & 255).')">'.\wcf\util\StringUtil::encodeHTML($string).'</span>';
|
return '<span style="color:rgb('.($start >> 16 & 255).','.($start >> 8 & 255).','.($start & 255).')">'.\wcf\util\StringUtil::encodeHTML($string).'</span>';
|
||||||
@ -87,8 +87,8 @@ public static function gradient($string, $start, $end) {
|
|||||||
*/
|
*/
|
||||||
public static function str_split($string, $length = 1) {
|
public static function str_split($string, $length = 1) {
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i = 0, $max = \wcf\util\StringUtil::length($string); $i < $max; $i += $length) {
|
for ($i = 0, $max = mb_strlen($string); $i < $max; $i += $length) {
|
||||||
$result[] = \wcf\util\StringUtil::substring($string, $i, $length);
|
$result[] = mb_substr($string, $i, $length);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user