Ejemplo n.º 1
0
 public function execute($parameters, $db)
 {
     $result = $db->query("select b.hash, a.killID from zz_killmails a left join (select hash, count(*) as count from zz_killmails where processed = 1 group by 1 having count(*) >= 2) as b on (a.hash = b.hash) where b.hash is not null and a.killID < 0", array(), 0);
     foreach ($result as $row) {
         $hash = $row["hash"];
         $mKillID = $row["killID"];
         $killID = $db->queryField("select killID from zz_killmails where hash = :hash and killID > 0 limit 1", "killID", array(":hash" => $hash), 0);
         Kills::cleanDupe($mKillID, $killID);
     }
     Log::log("Cleaned up " . sizeof($result) . " dupes");
 }
Ejemplo n.º 2
0
 public static function getTopIsk($parameters = array(), $allTime = false)
 {
     global $mdb;
     if (!isset($parameters['limit'])) {
         $parameters['limit'] = 5;
     }
     $parameters['orderBy'] = 'zkb.totalValue';
     $hashKey = 'getTopIsk:' . serialize($parameters);
     $result = RedisCache::get($hashKey);
     if ($result != null) {
         return $result;
     }
     $result = Kills::getKills($parameters);
     RedisCache::set($hashKey, $result, 300);
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Returns kills in json format according to the specified parameters.
  *
  * @static
  *
  * @param array $parameters
  *
  * @return array
  */
 public static function getKills($parameters = array())
 {
     global $debug;
     $ip = IP::get();
     $userAgent = @$_SERVER['HTTP_USER_AGENT'];
     if ($debug) {
         Log::log('API Fetch: ' . $_SERVER['REQUEST_URI'] . ' (' . $ip . ' / ' . $userAgent . ')');
     }
     if (isset($parameters['limit']) && $parameters['limit'] > 200) {
         $parameters['limit'] = 200;
     }
     if (isset($parameters['page'])) {
         $parameters['limit'] = 200;
     }
     if (!isset($parameters['limit'])) {
         $parameters['limit'] = 200;
     }
     $kills = Kills::getKills($parameters, true, false);
     return self::getJSON($kills, $parameters);
 }
Ejemplo n.º 4
0
        $kills = Kills::getKills(array('groupID' => array(547, 485), 'limit' => $limit, 'cacheTime' => 300, 'losses' => true, 'page' => $page));
        break;
    case 'freighters':
        $kills = Kills::getKills(array('groupID' => array(513, 902, 941), 'limit' => $limit, 'cacheTime' => 300, 'losses' => true, 'page' => $page));
        break;
    case 'supers':
        $kills = Kills::getKills(array('groupID' => array(30, 659), 'limit' => $limit, 'cacheTime' => 300, 'losses' => true, 'page' => $page));
        break;
    case 'dust':
        $kills = Kills::getKills(array('groupID' => array(351064, 351210), 'limit' => $limit, 'cacheTime' => 300, 'losses' => true, 'page' => $page));
        break;
    case 'dust_vehicles':
        $kills = Kills::getKills(array('groupID' => '351210', 'limit' => $limit, 'cacheTime' => 300, 'losses' => true, 'page' => $page));
        break;
    case 'lowsec':
        $kills = Kills::getKills(array('lowsec' => true, 'page' => $page));
        break;
    case 'highsec':
        $kills = Kills::getKills(array('highsec' => true, 'page' => $page));
        break;
    case 'nullsec':
        $kills = Kills::getKills(array('nullsec' => true, 'page' => $page));
        break;
    case 'w-space':
        $kills = Kills::getKills(array('w-space' => true, 'page' => $page));
        break;
    default:
        $kills = Kills::getKills(array('combined' => true, 'page' => $page));
        break;
}
$app->render('kills.html', array('kills' => $kills, 'page' => $page, 'killsType' => $type, 'pager' => true));
Ejemplo n.º 5
0
$cnt = 0;
$cnid = 0;
$stats = array();
$totalcount = ceil(count($detail['stats']) / 4);
if ($detail['stats'] != null) {
    foreach ($detail['stats'] as $q) {
        if ($cnt == $totalcount) {
            ++$cnid;
            $cnt = 0;
        }
        $stats[$cnid][] = $q;
        ++$cnt;
    }
}
if ($mixedKills) {
    $kills = Kills::mergeKillArrays($mixed, array(), $limit, $columnName, $id);
}
$prevID = null;
$nextID = null;
$warID = (int) $id;
$extra = array();
$extra['hasWars'] = false;
//Db::queryField("select count(distinct warID) count from zz_wars where aggressor = $warID or defender = $warID", "count");
$extra['wars'] = array();
if (false && $pageType == 'wars' && $extra['hasWars']) {
    $extra['wars'][] = War::getNamedWars('Active Wars - Aggressor', "select * from zz_wars where aggressor = {$warID} and timeFinished is null order by timeStarted desc");
    $extra['wars'][] = War::getNamedWars('Active Wars - Defending', "select * from zz_wars where defender = {$warID} and timeFinished is null order by timeStarted desc");
    $extra['wars'][] = War::getNamedWars('Closed Wars - Aggressor', "select * from zz_wars where aggressor = {$warID} and timeFinished is not null order by timeFinished desc");
    $extra['wars'][] = War::getNamedWars('Closed Wars - Defending', "select * from zz_wars where defender = {$warID} and timeFinished is not null order by timeFinished desc");
}
$filter = '';
Ejemplo n.º 6
0
<?php

require_once '../init.php';
$i = date('i');
if ($i % 15 != 0) {
    exit;
}
$p = array();
$numDays = 7;
$p['limit'] = 10;
$p['pastSeconds'] = $numDays * 86400;
$p['kills'] = true;
Storage::store('Kills5b+', json_encode(Kills::getKills(array('iskValue' => 5000000000), true, false)));
Storage::store('Kills10b+', json_encode(Kills::getKills(array('iskValue' => 10000000000), true, false)));
Storage::store('TopChars', json_encode(Info::doMakeCommon('Top Characters', 'characterID', getStats('characterID'))));
Storage::store('TopCorps', json_encode(Info::doMakeCommon('Top Corporations', 'corporationID', getStats('corporationID'))));
Storage::store('TopAllis', json_encode(Info::doMakeCommon('Top Alliances', 'allianceID', getStats('allianceID'))));
Storage::store('TopShips', json_encode(Info::doMakeCommon('Top Ships', 'shipTypeID', getStats('shipTypeID'))));
Storage::store('TopSystems', json_encode(Info::doMakeCommon('Top Systems', 'solarSystemID', getStats('solarSystemID'))));
Storage::store('TopIsk', json_encode(Stats::getTopIsk(array('pastSeconds' => $numDays * 86400, 'limit' => 5))));
// Cleanup old sessions
Db::execute('delete from zz_users_sessions where validTill < now()');
// Keep the account balance table clean
Db::execute('delete from zz_account_balance where balance = 0');
// Cleanup subdomain stuff
Db::execute('update zz_subdomains set adfreeUntil = null where adfreeUntil < now()');
Db::execute("update zz_subdomains set banner = null where banner = ''");
Db::execute("delete from zz_subdomains where adfreeUntil is null and banner is null and (alias is null or alias = '')");
// Expire change expirations
Db::execute('update zz_users set change_expiration = null, change_hash = null where change_expiration < date_sub(now(), interval 3 day)');
function getStats($column)
Ejemplo n.º 7
0
    $app->redirect($url, 302);
    die;
}
$systemInfo = $mdb->findDoc('information', ['cacheTime' => 3600, 'type' => 'solarSystemID', 'id' => $systemID]);
$systemName = $systemInfo['name'];
$regionInfo = $mdb->findDoc('information', ['cacheTime' => 3600, 'type' => 'regionID', 'id' => $systemInfo['regionID']]);
$regionName = $regionInfo['name'];
$unixTime = strtotime($relatedTime);
$time = date('Y-m-d H:i', $unixTime);
$exHours = 1;
if ((int) $exHours < 1 || (int) $exHours > 12) {
    $exHours = 1;
}
$key = md5("br:{$systemID}:{$relatedTime}:{$exHours}:" . json_encode($json_options) . (isset($battleID) ? ":{$battleID}" : ""));
$mc = RedisCache::get($key);
if ($mc == null) {
    $parameters = array('solarSystemID' => $systemID, 'relatedTime' => $relatedTime, 'exHours' => $exHours, 'nolimit' => true);
    $kills = Kills::getKills($parameters);
    $summary = Related::buildSummary($kills, $json_options);
    $mc = array('summary' => $summary, 'systemName' => $systemName, 'regionName' => $regionName, 'time' => $time, 'exHours' => $exHours, 'solarSystemID' => $systemID, 'relatedTime' => $relatedTime, 'options' => json_encode($json_options));
    if (isset($battleID) && $battleID > 0) {
        $teamA = $summary['teamA']['totals'];
        $teamB = $summary['teamB']['totals'];
        unset($teamA['groupIDs']);
        unset($teamB['groupIDs']);
        $mdb->set("battles", ['battleID' => $battleID], ['teamA' => $teamA]);
        $mdb->set("battles", ['battleID' => $battleID], ['teamB' => $teamB]);
    }
    RedisCache::set($key, $mc, 300);
}
$app->render('related.html', $mc);
Ejemplo n.º 8
0
$campaign = Db::queryRow('select * from zz_campaigns where uri = :uri', array(':uri' => $uri), 1);
if ($campaign == null) {
    $app->redirect('/', 302);
}
$title = 'Campaign: ' . $campaign['title'];
$subTitle = $campaign['subTitle'];
$p = json_decode($campaign['definition'], true);
$summary = Summary::getSummary('system', 'solarSystemID', $p, 30000142, $p, true);
$topPoints = array();
$topPods = array();
$top = array();
$top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTopPilots($p, true));
$top[] = Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTopCorps($p, true));
$top[] = Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTopAllis($p, true));
$top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTopShips($p, true));
$top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTopSystems($p, true));
$p['pastSeconds'] = $numDays * 86400;
$p['limit'] = 5;
$topIsk = Stats::getTopIsk($p, true);
$topIsk['title'] = 'Most Valuable Kills';
unset($p['pastSeconds']);
// get latest kills
$killsLimit = 50;
$p['limit'] = $killsLimit;
if (isset($page) && $page > 0 && $page < 100) {
    $p['page'] = $page;
} else {
    $page = 1;
}
$kills = Kills::getKills($p);
$app->render('campaign.html', array('topPods' => $topPods, 'topIsk' => $topIsk, 'topPoints' => $topPoints, 'topKillers' => $top, 'kills' => $kills, 'page' => 1, 'pageType' => 'kills', 'pager' => true, 'requesturi' => '/campaign/burnjita3/', 'page' => $page, 'detail' => $summary, 'pageTitle' => $title, 'subTitle' => $subTitle));
Ejemplo n.º 9
0
<?php

require_once '../init.php';
global $redis;
$key = "zkb:everyFiften";
if ($redis->get($key) === true) {
    exit;
}
$p = array();
$numDays = 7;
$p['limit'] = 10;
$p['pastSeconds'] = $numDays * 86400;
$p['kills'] = true;
$redis->setex('RC:Kills5b+', 3600, json_encode(Kills::getKills(array('iskValue' => 5000000000), true, false)));
$redis->setex('RC:Kills10b+', 3600, json_encode(Kills::getKills(array('iskValue' => 10000000000), true, false)));
$redis->setex('RC:TopIsk', 3600, json_encode(Stats::getTopIsk(array('pastSeconds' => $numDays * 86400, 'limit' => 5))));
function getStats($column)
{
    $result = Stats::getTop($column, ['isVictim' => false, 'pastSeconds' => 604800]);
    return $result;
}
$redis->keys('*');
// Helps purge expired ttl's
$redis->setex($key, 54000, true);
Ejemplo n.º 10
0
        $kills = Kills::getKills(array("groupID" => array(351064, 351210), "limit" => $limit, "cacheTime" => 300, "losses" => true, "page" => $page));
        break;
    case "dust_vehicles":
        $kills = Kills::getKills(array("groupID" => "351210", "limit" => $limit, "cacheTime" => 300, "losses" => true, "page" => $page));
        break;
        /*	case "lowsec":
        		$kills = Kills::getKills(array("lowsec" => true, "page" => $page));
        	break;
        	case "highsec":
        		$kills = Kills::getKills(array("highsec" => true, "page" => $page));
        	break;
        	case "nullsec":
        		$kills = Kills::getKills(array("nullsec" => true, "page" => $page));
        	break;*/
    /*	case "lowsec":
    		$kills = Kills::getKills(array("lowsec" => true, "page" => $page));
    	break;
    	case "highsec":
    		$kills = Kills::getKills(array("highsec" => true, "page" => $page));
    	break;
    	case "nullsec":
    		$kills = Kills::getKills(array("nullsec" => true, "page" => $page));
    	break;*/
    case "w-space":
        $kills = Kills::getKills(array("w-space" => true, "page" => $page));
        break;
    default:
        $kills = Kills::getKills(array("combined" => true, "page" => $page));
        break;
}
$app->render("kills.html", array("kills" => $kills, "page" => $page, "pageType" => $type, "pager" => true));
Ejemplo n.º 11
0
}
$extra["droppedisk"] = droppedIsk(md5($id), $killdata["items"]);
$extra["lostisk"] = $killdata["info"]["total_price"] - $extra["droppedisk"];
$extra["fittedisk"] = fittedIsk(md5($id), $killdata["items"]);
$extra["relatedtime"] = date("YmdH00", strtotime($killdata["info"]["killTime"]));
$extra["fittingwheel"] = eftarray(md5($id), $killdata["items"], $killdata["victim"]["characterID"]);
$extra["involvedships"] = involvedships($killdata["involved"]);
$extra["involvedshipscount"] = count($extra["involvedships"]);
$extra["totalprice"] = usdeurgbp($killdata["info"]["total_price"]);
$extra["destroyedprice"] = usdeurgbp($extra["lostisk"]);
$extra["droppedprice"] = usdeurgbp($extra["droppedisk"]);
$extra["fittedprice"] = usdeurgbp($extra["fittedisk"]);
$extra["efttext"] = Fitting::EFT($extra["fittingwheel"]);
$extra["dnatext"] = Fitting::DNA($killdata["items"], $killdata["info"]["shipTypeID"]);
$extra["edkrawmail"] = Kills::getRawMail($id);
$extra["zkbrawmail"] = Kills::getRawMail($id, array(), false);
$extra["reports"] = Db::queryField("SELECT count(*) as cnt FROM zz_tickets WHERE killID = :killid", "cnt", array(":killid" => $id), 0);
$extra["slotCounts"] = Info::getSlotCounts($killdata["victim"]["shipTypeID"]);
$extra["commentID"] = Info::commentID($id);
$extra["crest"] = Db::queryRow("select killID, hash from zz_crest_killmail where killID = :killID and processed = 1", array(":killID" => $id), 300);
$systemID = $killdata["info"]["solarSystemID"];
$data = Info::getWormholeSystemInfo($systemID);
$extra["wormhole"] = $data;
$url = "https://" . $_SERVER["SERVER_NAME"] . "/detail/{$id}/";
$app->render("detail.html", array("pageview" => $pageview, "killdata" => $killdata, "extra" => $extra, "message" => $message, "flags" => Info::$effectToSlot, "topDamage" => $topDamage, "finalBlow" => $finalBlow, "url" => $url));
function involvedships($array)
{
    $involved = array();
    foreach ($array as $inv) {
        if (isset($involved[$inv["shipTypeID"]]) && isset($inv["shipName"])) {
            $involved[$inv["shipTypeID"]] = array("shipName" => $inv["shipName"], "shipTypeID" => $inv["shipTypeID"], "count" => $involved[$inv["shipTypeID"]]["count"] + 1);
Ejemplo n.º 12
0
if (!$warFinished) {
    $p['pastSeconds'] = 7 * 86400;
}
$top = array();
$top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTop('characterID', $p));
$top[] = Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTop('corporationID', $p));
$top[] = Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTop('allianceID', $p));
$top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTop('shipTypeID', $p));
$top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTop('solarSystemID', $p));
$p['limit'] = 5;
$topIsk = array();
//Stats::getTopIsk($p);
unset($p['pastSeconds']);
unset($p['kills']);
// get latest kills
$killsLimit = 50;
$p['limit'] = $killsLimit;
$preKills = Kills::getKills($p);
$kills = array();
$agrID = $warData['aggressor']['id'];
$dfdID = $warData['defender']['id'];
foreach ($preKills as $kill) {
    $victim = $kill['victim'];
    if (@$victim['corporationID'] == $dfdID || @$victim['allianceID'] == $dfdID) {
        $kill['displayAsKill'] = true;
    } else {
        $kill['displayAsLoss'] = true;
    }
    $kills[] = $kill;
}
$app->render('index.html', array('war' => $warData, 'wars' => array($warData), 'topPods' => $topPods, 'topIsk' => $topIsk, 'topPoints' => $topPoints, 'topKillers' => $top, 'kills' => $kills, 'page' => $page, 'pageType' => 'war', 'pager' => false, 'pageTitle' => $pageTitle));
Ejemplo n.º 13
0
 /**
  * @param string $keyID string
  * @param $charID int
  * @param $killlog string
  * @return int
  */
 public static function processRawApi($keyID, $charID, $killlog)
 {
     $count = 0;
     $maxKillID = Db::queryField("select maxKillID from zz_api_characters where keyID = :keyID and characterID = :charID", "maxKillID", array(":keyID" => $keyID, ":charID" => $charID), 0);
     if ($maxKillID === null) {
         $maxKillID = 0;
     }
     $insertedMaxKillID = $maxKillID;
     foreach ($killlog->kills as $kill) {
         $killID = $kill->killID;
         //if ($killID < $maxKillID) continue;
         $insertedMaxKillID = max($insertedMaxKillID, $killID);
         $json = json_encode($kill->toArray());
         $hash = Util::getKillHash(null, $kill);
         try {
             $mKillID = Db::queryField("select killID from zz_killmails where killID < 0 and processed = 1 and hash = :hash", "killID", array(":hash" => $hash), 0);
         } catch (Exception $ex) {
             $mKillID = 0;
             //Log::log("Error: $keyID " . $ex->getMessage());
         }
         if ($mKillID) {
             Kills::cleanDupe($mKillID, $killID);
         }
         $added = Db::execute("insert ignore into zz_killmails (killID, hash, source, kill_json) values (:killID, :hash, :source, :json)", array(":killID" => $killID, ":hash" => $hash, ":source" => "keyID:{$keyID}", ":json" => $json));
         $count += $added;
     }
     if ($maxKillID != $insertedMaxKillID) {
         Db::execute("INSERT INTO zz_api_characters (keyID, characterID, maxKillID) VALUES (:keyID, :characterID, :maxKillID) ON DUPLICATE KEY UPDATE maxKillID = :maxKillID", array(":keyID" => $keyID, ":characterID" => $charID, ":maxKillID" => $insertedMaxKillID));
     }
     return $count;
 }
Ejemplo n.º 14
0
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
$topPoints = array();
$topIsk = json_decode(Storage::retrieve("TopIsk"), true);
$topPods = json_decode(Storage::retrieve("TopPods"), true);
$topPointList = json_decode(Storage::retrieve("TopPoints"), true);
if (is_array($topPointList)) {
    $topPoints = Kills::getKillsDetails($topPointList);
}
$p = array();
$p["limit"] = 5;
$p["pastSeconds"] = 3 * 86400;
$p["kills"] = true;
$top = array();
$top[] = json_decode(Storage::retrieve("Top3dayChars"), true);
$top[] = json_decode(Storage::retrieve("Top3dayCorps"), true);
$top[] = json_decode(Storage::retrieve("Top3dayAlli"), true);
// get latest kills
$killsLimit = 50;
$kills = Kills::getKills(array("limit" => $killsLimit));
$app->render("index.html", array("topPods" => $topPods, "topIsk" => $topIsk, "topPoints" => $topPoints, "topKillers" => $top, "kills" => $kills, "page" => 1, "pageType" => "kills", "pager" => true));
Ejemplo n.º 15
0
 /**
  * @param \Pheal\Core\Result $data
  * @param mixed $db
  * @return int
  */
 private static function processAPI($data, $db)
 {
     $count = 0;
     foreach ($data->kills as $kill) {
         if ($kill->killID > 0) {
             $killID = $kill->killID;
         } else {
             $killID = $kill->killInternalID * -1;
         }
         if ($killID == 0) {
             continue;
         }
         $killArray = $kill->toArray();
         // Remove all the unwanted crud that EDK sets
         unset($killArray["killInternalID"]);
         unset($killArray["hash"]);
         unset($killArray["trust"]);
         // If the killID is below zero, we'll just replace the killID in the array with the minus one..
         if ($killID < 0) {
             $killArray["killID"] = $killID;
         }
         $json = json_encode($killArray);
         $hash = Util::getKillHash(null, $kill);
         $source = "EDK Feed Fetch";
         $mKillID = $db->queryField("select killID from zz_killmails where killID < 0 and processed = 1 and hash = :hash", "killID", array(":hash" => $hash), 0);
         if ($mKillID) {
             Kills::cleanDupe($mKillID, $killID);
         }
         // If the killID is negative at this point, we need to create a raw mail, and use that to insert it into the zz_manual_mails table, so we can get a manual mail id
         if ($killID < 0) {
             $rawText = Kills::getRawMail(null, Info::addInfo($killArray));
             $db->execute("INSERT IGNORE INTO zz_manual_mails (hash, rawText) VALUES (:hash, :rawText)", array(":hash" => $hash, ":rawText" => $rawText));
             $killID = $db->queryField("SELECT mKillID FROM zz_manual_mails WHERE hash = :hash ORDER BY mKillID DESC LIMIT 1", array(":hash" => $hash), 0);
         }
         $added = $db->execute("insert ignore into zz_killmails (killID, hash, source, kill_json) values (:killID, :hash, :source, :json)", array(":killID" => $killID, ":hash" => $hash, ":source" => $source, ":json" => $json));
         $count += $added;
     }
     return $count;
 }
Ejemplo n.º 16
0
 private static function getStatsKillList($killIDs)
 {
     $totalPrice = 0;
     $totalPoints = 0;
     $groupIDs = array();
     $totalShips = 0;
     foreach ($killIDs as $killID) {
         $kill = Kills::getKillDetails($killID);
         $info = $kill['info'];
         $victim = $kill['victim'];
         $totalPrice += $info['zkb']['totalValue'];
         $totalPoints += $info['zkb']['points'];
         $groupID = $victim['groupID'];
         if (!isset($groupIDs[$groupID])) {
             $groupIDs[$groupID] = array();
             $groupIDs[$groupID]['count'] = 0;
             $groupIDs[$groupID]['isk'] = 0;
             $groupIDs[$groupID]['points'] = 0;
         }
         $groupIDs[$groupID]['groupID'] = $groupID;
         ++$groupIDs[$groupID]['count'];
         $groupIDs[$groupID]['isk'] += $info['zkb']['totalValue'];
         $groupIDs[$groupID]['points'] += $info['zkb']['points'];
         ++$totalShips;
     }
     Info::addInfo($groupIDs);
     return array('total_price' => $totalPrice, 'groupIDs' => $groupIDs, 'totalShips' => $totalShips, 'total_points' => $totalPoints);
 }
Ejemplo n.º 17
0
global $mdb;
$involved = array();
$message = '';
$id = (int) $id;
while ($mdb->count('queueInfo', ['killID' => $id])) {
    sleep(1);
}
$exists = $mdb->exists('killmails', ['killID' => $id]);
if (!$exists) {
    return $app->render('404.html', array('message' => "KillID {$id} does not exist."), 404);
}
$killKey = "CacheKill:{$id}:{$pageview}";
$details = RedisCache::get($killKey);
if ($details == null) {
    // Create the details on this kill
    $killdata = Kills::getKillDetails($id);
    // create the dropdown involved array
    $allinvolved = $killdata['involved'];
    $cnt = 0;
    while ($cnt < 10) {
        if (isset($allinvolved[$cnt])) {
            $involved[] = $allinvolved[$cnt];
            unset($allinvolved[$cnt]);
        }
        ++$cnt;
        continue;
    }
    $topDamage = $finalBlow = null;
    $first = null;
    if (sizeof($killdata['involved']) > 1) {
        foreach ($killdata['involved'] as $inv) {
Ejemplo n.º 18
0
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
//make sure the requester is not being a naughty boy
Util::scrapeCheck();
//set the headers to cache the request properly
$dna = array();
$parameters = Util::convertUriToParameters();
$page = 1;
if (isset($parameters["page"])) {
    $page = $parameters["page"];
}
$kills = Feed::getKills(array("limit" => 200, "cacheTime" => 3600, "page" => $page));
foreach ($kills as $kill) {
    $kill = json_decode($kill, true);
    $killdata = Kills::getKillDetails($kill["killID"]);
    $dna[][] = array("killtime" => $killdata["info"]["dttm"], "SolarSystemName" => $killdata["info"]["solarSystemName"], "solarSystemID" => $killdata["info"]["solarSystemID"], "regionID" => $killdata["info"]["regionID"], "regionName" => $killdata["info"]["regionName"], "victimCharacterID" => isset($killdata["victim"]["characterID"]) ? isset($killdata["victim"]["characterID"]) : null, "victimCharacterName" => isset($killdata["victim"]["characterName"]) ? isset($killdata["victim"]["characterName"]) : null, "victimCorporationID" => isset($killdata["victim"]["corporationID"]) ? isset($killdata["victim"]["corporationID"]) : null, "victimCorporationName" => isset($killdata["victim"]["corporationName"]) ? isset($killdata["victim"]["corporationName"]) : null, "victimAllianceID" => isset($killdata["victim"]["allianceID"]) ? isset($killdata["victim"]["allianceID"]) : null, "victimAllianceName" => isset($killdata["victim"]["allianceName"]) ? isset($killdata["victim"]["allianceName"]) : null, "victimFactionID" => isset($killdata["victim"]["factionID"]) ? isset($killdata["victim"]["factionID"]) : null, "victimFactionName" => isset($killdata["victim"]["factionName"]) ? isset($killdata["victim"]["factionName"]) : null, "dna" => Fitting::DNA($killdata["items"], $killdata["victim"]["shipTypeID"]));
}
$app->etag(md5(serialize($dna)));
$app->expires("+1 hour");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
$app->contentType("application/json; charset=utf-8");
echo json_encode($dna, JSON_NUMERIC_CHECK);
Ejemplo n.º 19
0
        }
    }
    $pageTitle = implode(',', $pageTitle);
    $pageType = 'subdomain';
} else {
    $topPoints = array();
    $topIsk = Stats::getTopIsk(array('cacheTime' => 15 * 60, 'pastSeconds' => 7 * 86400, 'limit' => 5));
    $topPods = array();
    $top = array();
    $top[] = json_decode(Storage::retrieve('TopChars', [], 900), true);
    $top[] = json_decode(Storage::retrieve('TopCorps', [], 900), true);
    $top[] = json_decode(Storage::retrieve('TopAllis', [], 900), true);
    $top[] = json_decode(Storage::retrieve('TopShips', [], 900), true);
    $top[] = json_decode(Storage::retrieve('TopSystems', [], 900), true);
    // get latest kills
    $kills = Kills::getKills(array('cacheTime' => 60, 'limit' => 50));
    // Collect active PVP stats
    $types = ['characterID', 'corporationID', 'allianceID', 'shipTypeID', 'solarSystemID', 'regionID'];
    $activePvP = [];
    foreach ($types as $type) {
        $result = Stats::getDistinctCount($type, []);
        if ($result <= 1) {
            continue;
        }
        $type = str_replace('ID', '', $type);
        if ($type == 'shipType') {
            $type = 'Ship';
        } elseif ($type == 'solarSystem') {
            $type = 'System';
        } else {
            $type = ucfirst($type);
Ejemplo n.º 20
0
<?php

//set the headers to cache the request properly
$dna = array();
$parameters = Util::convertUriToParameters();
$page = 1;
if (isset($parameters['page'])) {
    $page = $parameters['page'];
}
$kills = Feed::getKills(array('limit' => 200, 'cacheTime' => 3600, 'page' => $page));
foreach ($kills as $kill) {
    $kill = json_decode($kill, true);
    $killdata = Kills::getKillDetails($kill['killID']);
    $dna[][] = array('killtime' => $killdata['info']['dttm'], 'SolarSystemName' => $killdata['info']['solarSystemName'], 'solarSystemID' => $killdata['info']['solarSystemID'], 'regionID' => $killdata['info']['regionID'], 'regionName' => $killdata['info']['regionName'], 'victimCharacterID' => isset($killdata['victim']['characterID']) ? isset($killdata['victim']['characterID']) : null, 'victimCharacterName' => isset($killdata['victim']['characterName']) ? isset($killdata['victim']['characterName']) : null, 'victimCorporationID' => isset($killdata['victim']['corporationID']) ? isset($killdata['victim']['corporationID']) : null, 'victimCorporationName' => isset($killdata['victim']['corporationName']) ? isset($killdata['victim']['corporationName']) : null, 'victimAllianceID' => isset($killdata['victim']['allianceID']) ? isset($killdata['victim']['allianceID']) : null, 'victimAllianceName' => isset($killdata['victim']['allianceName']) ? isset($killdata['victim']['allianceName']) : null, 'victimFactionID' => isset($killdata['victim']['factionID']) ? isset($killdata['victim']['factionID']) : null, 'victimFactionName' => isset($killdata['victim']['factionName']) ? isset($killdata['victim']['factionName']) : null, 'dna' => Fitting::DNA($killdata['items'], $killdata['victim']['shipTypeID']));
}
$app->etag(md5(serialize($dna)));
$app->expires('+1 hour');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');
$app->contentType('application/json; charset=utf-8');
echo json_encode($dna, JSON_NUMERIC_CHECK);