本文整理汇总了PHP中Dog::hasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::hasPermission方法的具体用法?PHP Dog::hasPermission怎么用?PHP Dog::hasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::hasPermission方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasPermission
public function hasPermission($serv, $chan, $user)
{
return Dog::hasPermission($serv, $chan, $user, $this->priv, $this->scope);
}
示例2: array
}
} else {
if (NULL !== ($t = $serv->getTriggers())) {
$plugin->rply('serv', array($t));
} else {
$plugin->rply('serv_by_bot', array(Dog_Init::getTriggers()));
}
}
} elseif ($argc === 1) {
if ($chan !== false) {
if ($argv[0] === 'default') {
$chan->saveVar('chan_triggers', NULL);
$plugin->rply('chan_to_default');
} else {
$chan->saveVar('chan_triggers', $argv[0]);
$plugin->rply('chan_to', array($argv[0]));
}
} else {
if (!Dog::hasPermission($serv, false, $user, 'i')) {
Dog::noPermission('i');
} elseif ($argv[0] === 'default') {
$serv->saveVar('serv_triggers', NULL);
$plugin->rply('serv_to_default');
} else {
$serv->saveVar('serv_triggers', $argv[0]);
$plugin->rply('serv_to', array($argv[0]));
}
}
} else {
$plugin->showHelp();
}
示例3: hasPermissionFor
public function hasPermissionFor($trigger, Dog_Server $serv, $chan, $user)
{
$privabc = $this->getPrivABC($trigger);
return Dog::hasPermission($serv, $chan, $user, $privabc[0], $privabc[1]);
}
示例4: on_autojoin_Ac
public function on_autojoin_Ac()
{
$user = Dog::getUser();
$server = Dog::getServer();
$argv = $this->argv();
$argc = count($argv);
# Invoked in channel.
switch ($argc) {
# .autojoin
case 0:
return $this->showStatus($channel);
# .autojoin on|#channel
# .autojoin on|#channel
case 1:
if (Dog_Var::isValid('b', $argv[0])) {
return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[0]));
} elseif (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) {
return Dog::rply('err_channel');
} else {
return $this->showStatus($channel);
}
# .autojoin #wechall on
# .autojoin #wechall on
case 2:
if (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) {
return Dog::rply('err_channel');
}
if (!Dog::hasPermission($server, $channel, $user, 'A')) {
return Dog::noPermission('s');
}
return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[1]));
}
$this->showHelp('autojoin');
}
示例5: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD% <target> <message here...>. Send an action to the target. Admins can utilize this across networks. Staff can PRIVMS other users. Voice can only do this to channels.'), 'de' => array('help' => 'Nutze: %CMD% <Ziel> <Nachricht hier...>. Sendet eine Aktion an das Ziel. Admins nutzen dies Netzwerkweit. Staff kann andere Nutzer anschreiben. Voice nur in einen Kanal.'));
$user = Dog::getUser();
$serv = Dog::getServer();
$plugin = Dog::getPlugin();
$message = $plugin->argv();
if (count($message) < 2) {
return $plugin->showHelp();
}
$arg = array_shift($message);
$message = implode(' ', $message);
# Admin
if (Dog::hasPermission($serv, false, $user, 'a')) {
if (false !== ($channel = Dog::getChannelByArg($arg))) {
return $channel->sendAction($message);
} elseif (false !== ($tuser = Dog::getUserByArg($arg))) {
return $tuser->sendAction($message);
}
} elseif (DOG::hasPermission($serv, false, $user, 's')) {
if (false !== ($channel = $serv->getChannelByName($arg))) {
return $channel->sendAction($message);
} elseif (false !== ($tuser = $serv->getUserByName($arg))) {
return $tuser->sendAction($message);
}
} else {
if (false !== ($channel = $serv->getChannelByName($arg))) {
return $channel->sendAction($message);
}
}
# Errors
示例6: elseif
if (!Dog::hasPermission($serv, false, $user, 'a')) {
Dog::noPermission('a');
} elseif (false !== ($plug = Dog_Plugin::getPlug($name))) {
Dog_Conf_Plug_Serv::setDisabled($plug->getName(), $sid, '1');
$plugin->rply('plg_on_serv', array($name, $serv->displayName()));
} elseif (false !== ($mod = Dog_Module::getByName($name))) {
Dog_Conf_Mod_Serv::setModuleDisabled($mod->getName(), $sid, '1');
$plugin->rply('mod_on_serv', array($mod->displayName(), $serv->displayName()));
} elseif (false !== ($mod = Dog_Module::getByTrigger($name))) {
Dog_Conf_Mod_Serv::setTriggerDisabled($mod->getName(), $sid, $name, '1');
$plugin->rply('trg_on_serv', array($name, $mod->displayName(), $serv->displayName()));
} else {
Dog::rply('err_command');
}
} else {
$cid = $chan->getID();
if (!Dog::hasPermission($serv, $chan, $user, 's')) {
return Dog::noPermission('s');
} elseif (false !== ($plug = Dog_Plugin::getPlug($name))) {
Dog_Conf_Plug_Chan::setDisabled($plug->getName(), $cid, '1');
$plugin->rply('plg_on_chan', array($name, $chan->displayLongName()));
} elseif (false !== ($mod = Dog_Module::getByName($name))) {
Dog_Conf_Mod_Chan::setModuleDisabled($mod->getName(), $cid, '1');
$plugin->rply('mod_on_chan', array($mod->displayName(), $chan->displayLongName()));
} elseif (false !== ($mod = Dog_Module::getByTrigger($name))) {
Dog_Conf_Mod_Chan::setTriggerDisabled($mod->getName(), $cid, $name, '1');
$plugin->rply('trg_on_chan', array($name, $mod->displayName(), $chan->displayLongName()));
} else {
Dog::rply('err_command');
}
}