本文整理汇总了PHP中Services::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::getLanguage方法的具体用法?PHP Services::getLanguage怎么用?PHP Services::getLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services::getLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
if (!$this->bot->isRegistered($target)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.notRegistered'));
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < 500) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
$sql = "SELECT\n\t\t\t\tunregistercode\n\t\t\tFROM\n\t\t\t\tchanserv_channels\n\t\t\tWHERE\n\t\t\t\tchannel = '" . escapeString($target) . "'";
$row = Services::getDB()->getFirstRow($sql);
$code = $row['unregistercode'];
if (isset($messageEx[1])) {
if ($code != trim($messageEx[1])) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.codeWrong', $target));
}
// TODO: Validate unregistercode
$this->bot->unregister($target);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $target));
} else {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.code', $code));
}
}
示例2: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, $this->originalName)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 2) {
// check target access
if ($access < $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($messageEx[1])->accountname)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
} else {
Services::getConnection()->getProtocol()->sendKick($this->bot->getUuid(), $target, $messageEx[1], $user->getNick());
}
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
unset($messageEx[0]);
$username = $messageEx[1];
unset($messageEx[1]);
// check target access
// todo: abort when target has no account
if ($access < $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($username)->accountname)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
} else {
Services::getConnection()->getProtocol()->sendKick($this->bot->getUuid(), $target, $username, $user->getNick() . ': ' . implode(' ', $messageEx));
}
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
}
}
示例3: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) >= 2) {
// get channel name
$channel = $messageEx[1];
// avoid empty strings
if (empty($channel)) {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
// add the #
if ($channel[0] != '#') {
$channel = '#' . $channel;
}
unset($messageEx[0]);
unset($messageEx[1]);
$message = implode(' ', $messageEx);
$this->bot->part($channel, $message);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $channel));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例4: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, $this->originalName)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 1) {
$sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\tchanserv_channel_accessLevel\n\t\t\t\tWHERE\n\t\t\t\t\tchannel = '" . escapeString($target) . "'\n\t\t\t\tORDER BY \n\t\t\t\t\taccessLevel DESC";
$result = Services::getDB()->sendQuery($sql);
while ($row = Services::getDB()->fetchArray($result)) {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.' . $row['function']) . ': ' . $row['accessLevel']);
}
} else {
if (count($messageEx) == 3) {
if ($access < $messageEx[2]) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.tooHigh'));
}
if (!$this->bot->getNeededAccess($target, $messageEx[1])) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.unknown'));
}
$sql = "UPDATE\n\t\t\t\t\t\tchanserv_channel_accessLevel\n\t\t\t\t\tSET\n\t\t\t\t\t\taccessLevel = " . $messageEx[2] . "\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tfunction = '" . escapeString($messageEx[1]) . "'";
Services::getDB()->sendQuery($sql);
} else {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
}
示例5: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) == 2) {
$email = $messageEx[1];
if (!$this->bot->isAuthed($user->getUuid())) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.notAuthed'));
}
$this->bot->email(Services::getUserManager()->getUser($user->getUuid())->accountname, $email);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例6: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
// BIND <bot> <module> <command> <appearInHelp>
if (count($messageEx) >= 3) {
$botAddress = Services::getModuleManager()->lookupModule($messageEx[1]);
$moduleAddress = Services::getModuleManager()->lookupModule($messageEx[2]);
$commandName = $messageEx[3];
$appearInHelp = (bool) (isset($messageEx[4]) ? $messageEx[4] : true);
Services::getModuleManager()->bindCommand($botAddress, $moduleAddress, $commandName, $appearInHelp);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例7: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) == 2 and !empty($messageEx[1])) {
// get module name
$moduleName = $messageEx[1];
try {
// try to load module
Services::getModuleManager()->loadModule(SDIR . 'lib/modules/' . ucfirst($moduleName) . '.class.php');
} catch (Exception $ex) {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.cannotLoad', $ex->getMessage()));
}
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例8: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) == 3) {
$oldPassword = $messageEx[1];
$newPassword = $messageEx[2];
if (!$this->bot->isAuthed($user->getUuid())) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.notAuthed'));
}
if (!$this->bot->checkCredentials($accountname, $oldPassword)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.auth.invalidCredentials'));
}
$this->bot->pass(Services::getUserManager()->getUser($user->getUuid())->accountname, $newPassword);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例9: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, 'access')) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 3) {
if ($messageEx[2] >= $access) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.tooHigh'));
} else {
if ($messageEx[2] > 500) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.tooHigh'));
}
}
if ($access <= $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($messageEx[1])->accountname)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
$authServ = Services::getModuleManager()->lookupModule('AuthServ');
$userID = call_user_func(array($authServ, 'getUserID'), $messageEx[1]);
if (!$userID) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.invalidUser'));
}
if ($messageEx[0] < 1) {
$sql = "DELETE FROM chanserv_channels_to_users WHERE channel = '" . escapeString($target) . "' AND userID = " . $userID;
} else {
$sql = "INSERT INTO chanserv_channels_to_users (channel, userID, accessLevel)\n\t\t\t\t\tVALUES ('" . escapeString($target) . "', " . $userID . ", " . intval($messageEx[2]) . ")\n\t\t\t\t\tON DUPLICATE KEY UPDATE accessLevel = VALUES(accessLevel)";
}
Services::getDB()->sendQuery($sql);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例10: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, $this->originalName)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 1) {
$this->bot->setStandardModes($target);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
unset($messageEx[0]);
$modeString = implode(' ', $messageEx);
Services::getConnection()->getProtocol()->sendMode($this->bot->getUuid(), $target, str_replace(array('q', 'r', 'a', 'v', 'o', 'b', 'h', 'A', 'O', 'e', 'P'), '', $modeString));
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
}
}
示例11: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, 'access')) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 1) {
$sql = "SELECT\n\t\t\t\t\tc.*,\n\t\t\t\t\ta.accountname\n\t\t\t\tFROM\n\t\t\t\t\tchanserv_channels_to_users c\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\tauthserv_users a\n\t\t\t\t\t\tON c.userID = a.userID\n\t\t\t\tWHERE\n\t\t\t\t\tchannel = '" . escapeString($target) . "'\n\t\t\t\tORDER BY \n\t\t\t\t\tc.accessLevel DESC";
$result = Services::getDB()->sendQuery($sql);
while ($row = Services::getDB()->fetchArray($result)) {
$this->bot->sendMessage($user->getUuid(), $row['accountname'] . ': ' . $row['accessLevel']);
}
} else {
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例12: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) == 3) {
$accountname = $messageEx[1];
$password = $messageEx[2];
if ($this->bot->isAuthed($user->getUuid())) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.alreadyAuthed'));
}
if (!$this->bot->checkCredentials($accountname, $password)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.invalidCredentials'));
}
$users = $this->bot->getUsers($accountname);
foreach ($users as $uuid) {
$this->bot->sendMessage($uuid, Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.login'));
}
$this->bot->setAccount($user->getUuid(), $accountname);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $accountname));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例13: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) == 2) {
$password = $messageEx[1];
if (!$this->bot->isAuthed($user->getUuid())) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.notAuthed'));
}
$accountname = Services::getUserManager()->getUser($user->getUuid())->accountname;
if (!$this->bot->checkCredentials($accountname, $password)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.auth.invalidCredentials'));
}
$userID = $this->bot->getUserID($accountname);
$this->bot->delete($accountname);
// TODO: Kill user to log him out
$sql = "DELETE FROM chanserv_channels_to_users WHERE userID = " . $userID;
Services::getDB()->sendQuery($sql);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例14: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if (count($messageEx) == 4) {
$accountname = $messageEx[1];
$password = $messageEx[2];
$email = $messageEx[3];
if ($this->bot->isAuthed($user->getUuid())) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.alreadyAuthed'));
}
if ($this->bot->accountExists($accountname)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.accountExists'));
}
if ($this->bot->emailExists($email)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.emailExists'));
}
$this->bot->create($accountname, $password, $email);
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $accountname));
} else {
// send syntax hint
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint'));
}
}
示例15: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
if ($this->bot->isRegistered($target)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.alreadyRegistered'));
}
$users = Services::getChannelManager()->getChannel($target)->getUserList();
foreach ($users as $channelUser) {
if ($channelUser['user']->getUuid() == $user->getUuid()) {
if (stripos($channelUser['mode'], 'o')) {
$this->bot->register($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
Services::getConnection()->getProtocol()->sendMode($this->bot->getUuid(), $target, '+q ' . $user->getNick());
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $target));
}
}
}
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.noOp'));
}