Ejemplo n.º 1
0
 /**
  * Check if plugin is enabled for server and optional channel.
  * @param Dog_Server $server
  * @param DOG_Channel $channel
  * @return boolean
  */
 public function isEnabled(Dog_Server $server, $channel)
 {
     $plg = $this->name;
     if (Dog_Conf_Plug::isDisabled($plg) || Dog_Conf_Plug_Serv::isDisabled($plg, $server->getID()) || $channel !== false && Dog_Conf_Plug_Chan::isDisabled($plg, $channel->getID(), $this->defdis)) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 public function setConf($key, $val = '1')
 {
     return Dog_Conf_Plug_Serv::setConf('servers', $this->getID(), $key, $val);
 }
Ejemplo n.º 3
0
 public function setValue($value)
 {
     $key = $this->name;
     $sid = Dog::getServer()->getID();
     $uid = Dog::getUser()->getID();
     $c = Dog::getChannel();
     if ($this->module !== NULL) {
         $mod = $this->module;
         switch ($this->scope) {
             case 'g':
                 return Dog_Conf_Mod::setConf($mod, $key, $value);
             case 's':
                 return Dog_Conf_Mod_Serv::setConf($mod, $sid, $key, $value);
             case 'c':
                 if ($c !== false) {
                     return Dog_Conf_Mod_Chan::setConf($mod, $c->getID(), $key, $value);
                 }
                 return false;
             case 'u':
                 return Dog_Conf_Mod_User::setConf($mod, $uid, $key, $value);
         }
     } elseif ($this->plugin !== NULL) {
         $plg = $this->plugin;
         switch ($this->scope) {
             case 'g':
                 return Dog_Conf_Plug::setConf($plg, $key, $value);
             case 's':
                 return Dog_Conf_Plug_Serv::setConf($plg, $sid, $key, $value);
             case 'c':
                 if ($c !== false) {
                     Dog_Conf_Plug_Chan::setConf($plg, $c->getID(), $key, $value);
                 }
                 return false;
             case 'u':
                 return Dog_Conf_Plug_User::setConf($plg, $uid, $key, $value);
         }
     }
     return false;
 }
Ejemplo n.º 4
0
$chan = Dog::getChannel();
$user = Dog::getUser();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc !== 1) {
    return $plugin->showHelp();
}
$name = strtolower($argv[0]);
# Block important core plugins from beeing disabled.
if (in_array($name, $coreplugs, true)) {
    $plugin->rply('core_plugin', array($name));
} elseif ($chan === false) {
    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))) {