public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     $commands = array();
     $dir = __DIR__;
     if ($handle = opendir($dir)) {
         while (false !== ($entry = readdir($handle))) {
             if ($entry != "." && $entry != "..") {
                 $s1 = explode("irc_", $entry);
                 $s2 = explode(".php", $s1[1]);
                 if (sizeof($s2) == 2) {
                     require_once "{$dir}/{$entry}";
                     $command = $s2[0];
                     $className = "irc_{$command}";
                     $class = new $className();
                     if (is_a($class, "ircCommand")) {
                         $accessLevel = $class->getRequiredAccessLevel();
                         if ($nickAccessLevel >= $accessLevel && !$class->isHidden()) {
                             $commands[] = $command;
                         }
                     }
                 }
             }
         }
         closedir($handle);
     }
     sort($commands);
     irc_out("|g|your available commands:|n| " . implode(", ", $commands));
 }
 public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     $keyIDs = array();
     $entity = implode(" ", $parameters);
     if (sizeof($parameters) == 1 && (int) $parameters[0]) {
         $keyIDs[] = (int) $parameters[0];
     } else {
         // Perform a search
         $chars = array();
         $corps = array();
         $charResult = Db::query("select characterID from zz_characters where name = :s", array(":s" => $entity));
         foreach ($charResult as $char) {
             $chars[] = $char["characterID"];
         }
         foreach ($chars as $charID) {
             $corpID = Db::queryField("select corporationID from zz_participants where characterID = :c order by killID desc limit 1", "corporationID", array(":c" => $charID));
             if ($corpID !== null && $corpID > 0) {
                 $corps[] = $corpID;
             }
         }
         if (sizeof($chars)) {
             $keys = Db::query("select distinct keyID from zz_api_characters where isDirector = 'F' and characterID in (" . implode(",", $chars) . ")");
             foreach ($keys as $key) {
                 $keyIDs[] = $key["keyID"];
             }
         } else {
             $corpID = Db::queryField("select corporationID from zz_corporations where name = :s order by memberCount desc", "corporationID", array(":s" => $entity));
             if ($corpID !== null && $corpID > 0) {
                 $corps[] = $corpID;
             }
         }
         if (sizeof($corps)) {
             $keys = Db::query("select distinct keyID from zz_api_characters where isDirector = 'T' and corporationID in (" . implode(",", $corps) . ")");
             foreach ($keys as $key) {
                 $keyIDs[] = $key["keyID"];
             }
         }
     }
     if (sizeof($keyIDs) == 0) {
         irc_out("|r|Unable to locate any keys associated with {$entity} |n|");
     } else {
         $keyIDs = array_unique($keyIDs);
         sort($keyIDs);
         $key = sizeof($keyIDs) == 1 ? "keyID" : "keyIDs";
         $keys = implode(", ", $keyIDs);
         Db::execute("update zz_api set errorCode = 0, errorCount = 0, lastValidation = 0 where keyID in ({$keys})");
         if (sizeof($keyIDs)) {
             irc_out("Revalidating {$key}: {$keys}");
         }
     }
 }
Example #3
0
 public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     if (sizeof($parameters) == 0 || $parameters[0] == "") {
         irc_error("Usage: |g|.z help <command>|n| To see the list of commands: |g|.z commands|n|");
     }
     $command = $parameters[0];
     $base = __DIR__;
     $fileName = "{$base}/irc_{$command}.php";
     if (!file_exists($fileName)) {
         irc_error("|r|Unknown command: {$command} |n|");
     }
     require_once $fileName;
     $className = "irc_{$command}";
     $class = new $className();
     if (!is_a($class, "ircCommand")) {
         irc_error("|r|Module {$command} does not implement interface ircCommand!|n|");
     }
     $dscr = $class->getDescription();
     irc_out("{$command}: {$dscr}");
 }
 public function execute($nick, $uhost, $channel, $command, $parameters, $nickAccessLevel)
 {
     if (Util::isMaintenanceMode()) {
         irc_error("|r|Cannot reprice while in maintenance mode");
     }
     @($killID = (int) $parameters[0]);
     if ($killID == 0) {
         irc_error("|r|Please provide a valid killID.");
     }
     $count = Db::queryField("select count(*) count from zz_participants where killID = :killID", "count", array(":killID" => $killID));
     if ($count == 0) {
         irc_error("|r|KillID {$killID} does not exist!");
     }
     Stats::calcStats($killID, false);
     Db::execute("update zz_killmails set processed = 0 where killID = :killID", array(":killID" => $killID));
     do {
         sleep(1);
         $processed = Db::queryField("select processed from zz_killmails where killID = :killID", "processed", array(":killID" => $killID), 0);
     } while ($processed == 0);
     $kill = Db::queryRow("select * from zz_participants where isVictim = 1 and killID = :killID", array(":killID" => $killID), 0);
     $total = $kill["total_price"];
     $points = $kill["points"];
     irc_out("|g|{$killID}|n| repriced to|g| " . number_format($total, 2) . "|n| ISK and |g|" . number_format($points, 0) . "|n| points");
 }
Example #5
0
function irc_error($text)
{
    $text = Log::addIRCColors($text);
    irc_out($text);
    die;
}