error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('display_errors', 1); ini_set('set_time_limit', 60); date_default_timezone_set("Europe/London"); // Close the session to ensure asynchronous behaviour in AJAX calls session_write_close(); require_once("dbconn.php"); require_once("../includes/settings.php"); require_once("../includes/funcs.php"); require_once("../classes/class_wormhole.php"); require_once("../classes/class_killboard.php"); db_open(); $action = trim($_REQUEST["func"]); // ======================================================================== if ($action == "no-trust") { // ======================================================================== // If the user does not want to trust this website we set a cookie on their computer // that expires in +30 days, and let them know that they won't be bothered again for that time. setcookie("WHSE_NO_TRUST",true,time()+60*60*24*30); printf('
So you don\'t want to trust us? Fine, it\'s your call.
'); printf('We\'ll leave you alone for 30 days to think about it. If in the meantime you decide you would like to trust us then simply add http://' . $_SERVER['SERVER_NAME'] . ' to your trusted sites, or click the padlock at the top of the screen.
'); printf('This window will automatically close in a few seconds.
'); printf('Now we\'re getting somewhere. A dialog should have appeared ' . 'on-screen asking you to confirm the trust settings for this website...
'); printf('
Just click on TRUST WEBSITE and you\'re done!
'); printf('Cmon! Do it! I\'m here c\'mon kill me! Do it now!
'); printf('It seems like you\'re not in the game.
'); printf('Trusting websites in Eve actually involves... being in Eve. I know it\'s a bit unorthodox but please try again when you\'re actually playing the game.
'); printf('If you\'re seeing this message in-game then something else went wrong, and I look like a bit of a fool. Try refreshing the page and if it happens again let me know.
'); printf('This window will automatically close in a few seconds.
'); printf('Unable to gather Dotlan data at this time - error returned was: %s', $n_LocusID, $n_LocusID, str_replace("_"," ",$n_LocusID), $e->getMessage()); exit(1); } file_put_contents($cacheFile, gzdeflate(serialize($pageHTML))); } if ($pageHTML) { $dom = new DOMDocument(); $dom->preserveWhiteSpace = false; libxml_use_internal_errors(true); $dom->loadHTML($pageHTML); // First, get the jumps in last hour/24 hours $dlData = array('JumpGraphSrc' => '', 'NPCKillsGraphSrc' => '', 'ShipKillsGraphSrc' => '', 'PodKillsGraphSrc' => '', 'Jumps_1hr' => -1, 'Jumps_24hr' => -1, 'ShipKills_1hr' => -1, 'ShipKills_24hr' => -1, 'NPCKills_1hr' => -1, 'NPCKills_24hr' => -1, 'PodKills_1hr' => -1, 'PodKills_24hr' => -1); $nodes = $dom->getElementsByTagName('td'); for ($i = 0; $i < $nodes->length; $i++) { $td = $nodes->item($i); if (stristr($td->nodeValue,"Jumps 1h/24h")) { // Node - Jumps 1h/24h $dlDataAry["Jumps_1hr"] = is_numeric($nodes->item($i+1)->nodeValue) ? (int)$nodes->item($i+1)->nodeValue : -1; $dlDataAry["Jumps_24hr"] = is_numeric($nodes->item($i+2)->nodeValue) ? (int)$nodes->item($i+2)->nodeValue : -1; } elseif (stristr($td->nodeValue,"Ship Kills")) { // Node - Ship Kills 1h/24h $dlDataAry["ShipKills_1hr"] = is_numeric($nodes->item($i+1)->nodeValue) ? (int)$nodes->item($i+1)->nodeValue : -1; $dlDataAry["ShipKills_24hr"] = is_numeric($nodes->item($i+2)->nodeValue) ? (int)$nodes->item($i+2)->nodeValue : -1; } elseif (stristr($td->nodeValue,"NPC Kills")) { // Node - NPC Kills 1h/24h $dlDataAry["NPCKills_1hr"] = is_numeric($nodes->item($i+1)->nodeValue) ? (int)$nodes->item($i+1)->nodeValue : -1; $dlDataAry["NPCKills_24hr"] = is_numeric($nodes->item($i+2)->nodeValue) ? (int)$nodes->item($i+2)->nodeValue : -1; } elseif (stristr($td->nodeValue,"Pod Kills")) { // Node - Pod Kills 1h/24h $dlDataAry["PodKills_1hr"] = is_numeric($nodes->item($i+1)->nodeValue) ? (int)$nodes->item($i+1)->nodeValue : -1; $dlDataAry["PodKills_24hr"] = is_numeric($nodes->item($i+2)->nodeValue) ? (int)$nodes->item($i+2)->nodeValue : -1; } } $nodes = $dom->getElementsByTagName('img'); foreach ($nodes as $img) { if (stristr($img->getAttribute('src'),"chart.googleapis.com")) { if (stristr($img->getAttribute('alt'),"Jumps")) { $dlGraphSrc = $img->getAttribute('src'); $dlGraphSrc = str_ireplace('D5DF3D','CC9966',$dlGraphSrc); $dlGraphSrc = str_ireplace('chs=230x160','chs='.EVEMAPS_GRAPH_WIDTH.'x'.EVEMAPS_GRAPH_HEIGHT,$dlGraphSrc); $dlGraphSrc .= "&chxs=1,c2c2c2,10|0,c2c2c2,10"; $dlDataAry["JumpGraphSrc"] = $dlGraphSrc; //printf('
', $n_LocusID, $n_LocusID, str_replace("_"," ",$n_LocusID)); if (!$aTempWH->isWHLocus()) { // only show jumps for non-wormholes - CCP removed jumps from WH systems printf('Jumps: %d / %d–', urlencode($dlDataAry["JumpGraphSrc"]), $dlDataAry["Jumps_1hr"], $dlDataAry["Jumps_24hr"]); } printf('NPC Kills: %d / %d–Ship Kills: %d / %d–Pod Kills: %d / %d—(last 1 / 24 hours)', urlencode($dlDataAry["NPCKillsGraphSrc"]), ($dlDataAry["NPCKills_1hr"] > 0) ? ' dlB dlAtv' : '', $dlDataAry["NPCKills_1hr"], $dlDataAry["NPCKills_24hr"], urlencode($dlDataAry["ShipKillsGraphSrc"]), ($dlDataAry["ShipKills_1hr"] > 0) ? ' dlB dlAtv' : '', $dlDataAry["ShipKills_1hr"], $dlDataAry["ShipKills_24hr"], urlencode($dlDataAry["PodKillsGraphSrc"]), ($dlDataAry["PodKills_1hr"] > 0) ? ' dlB' : '', $dlDataAry["PodKills_1hr"], $dlDataAry["PodKills_24hr"]); printf('
%s
", $staticInfoSQL); $rsStaticInfo = mysql_query_cache($staticInfoSQL,$whConn); if (!empty($rsStaticInfo)) { printf('| Lifetime: | %s hours |
| Max. stable mass: | %s kg (%s b) |
| Mass variance (±10%%): | %s kg |
| Max. jump mass: | %s kg |
| Signature size: | %s |
| Region: | %s |
| Constellation: | %s |
| Planet | Type | Moons |
| %s | %s | ', $aCelestial->Name(), $aCelestial->typeID(), $aCelestial->planetType(), $aCelestial->typeID()); $aMoons = $aTempWH->getCelestialChildren($aCelestial->itemID()); $moonCount = 0; foreach ($aMoons as $cCelestial) { $moonCount += ($cCelestial->isMoon()) ? 1 : 0; } printf('%d | ',$moonCount); printf('
| %d | %d |
%s is not a valid locus ID.
", $n_LocusID); } // ======================================================================== } elseif ($action == "intel_whanom") { // ======================================================================== $n_LocusID = strtoupper(trim(mysql_real_escape_string($_REQUEST["lid"]))); $aTempWH = new Wormhole($n_LocusID); if ($aTempWH->isValidLocus() && $aTempWH->hasAnomaly()) { // Technically we should check isWHLocus() here, but maybe CCP will make non-wormholes have anoms? $anomalySQL = sprintf("SELECT dgmTypeAttributes.*, dgmAttributeTypes.attributeName, dgmAttributeTypes.displayName " . "FROM ".EVEDB_NAME.".dgmTypeAttributes INNER JOIN ".EVEDB_NAME.".dgmAttributeTypes USING(attributeID) " . "WHERE typeID = '%s'", $aTempWH->getAnomalyTypeID()); //print($anomalySQL); $rsAnomaly = mysql_query_cache($anomalySQL,$whConn); if (!empty($rsAnomaly)) { printf('| Effect | Strength |
| %s | %s |
Most recent kill recorded on %s–%s (%s)%s lost a %s to %s (%s)%s in a %s%s.
', urldecode($lastKill->url), date("d M Y H:i", strtotime($lastKill->timestamp)), $lastKill->victimExternalID, $lastKill->victimName, $aKillboard->getEVEIDFromName($lastKill->victimCorpName, GET_CORPORATION_ID), $lastKill->victimCorpName, (strlen($lastKill->victimAllianceName) > 0 && $aKillboard->getEVEIDFromName($lastKill->victimAllianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($lastKill->victimAllianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($lastKill->victimAllianceName, GET_ALLIANCE_ID), $lastKill->victimAllianceName) : "", $lastKill->victimShipName, $aKillboard->getEVEIDFromName($lastKill->FBPilotName, GET_CHARACTER_ID), $lastKill->FBPilotName, $aKillboard->getEVEIDFromName($lastKill->FBCorpName, GET_CORPORATION_ID), $lastKill->FBCorpName, (strlen($lastKill->FBAllianceName) > 0 && $aKillboard->getEVEIDFromName($lastKill->FBAllianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($lastKill->FBAllianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($lastKill->FBAllianceName, GET_ALLIANCE_ID), $lastKill->FBAllianceName) : "", $aKillboard->getDBNameFromEVEID($lastKill->getFinalBlower()->shipTypeID), sizeof($lastKill->involved) > 1 ? sprintf(' and %d associate%s', $lastKill->internalID, sizeof($lastKill->involved)-1, sizeof($lastKill->involved)-1 > 1 ? "s" : "") : "" ); } else { // No kills found in the database (this should only occur when the killboard is empty) printf("No kills recorded in this system in the past %d months.
", EVEKILL_ANALYSIS_MAX_MONTH_HISTORY); } } else { // Killboard was invalid, probably a problem querying evekill printf('Unable to query Eve-Kill data at this time - please try again later.
'); } printf("DEBUG TABLE:
| CORP | ALLIANCE | KILLS | LOSSES | BATTLES | SCORE | timeEarliestKill | timeLatestKill | timeEarliestLoss | timeLatestLoss | involvedCount |
| %s | %s | %d | %d | %d | %0.2f (a: %0.1f%%) (t: %0.1f%%) (h: %0.1f%%) (as: %0.1f%%) (p: %f%%) | %s | %s | %s | %s | %d |
%sMost active are %s, with %d losses over %d battles. ', ICON_ACTIVITY_IMAGE, $topCorp->corporationID, $topCorp->corporationName, $topCorp->lossCount, sizeof($topCorp->battle)); } else { printf('
%sMost active are %s, with %d kills and %d losses, involving an average of %d ship%s. ', ICON_ACTIVITY_IMAGE, $topCorp->corporationID, $topCorp->corporationName, $topCorp->killCount, $topCorp->lossCount, floor($topCorp->involvedCount/$topCorp->killCount), floor($topCorp->involvedCount/$topCorp->killCount) > 1 ? "s" : ""); } // Get the top corp in alliance ship types $topCorpShips = $topCorp->shipTypes; if (is_array($topCorpShips)) { arsort($topCorpShips, SORT_NUMERIC); // $bigKillShips contains a list of ship typeIDs together with the number of // times they were used. In order to get the total count of ship CLASSES we // have to build a convoluted SQL query using UNIONs in order to add a column // containing the counts-per-ship, and then aggregating them into a // total-per-class, which is what we display. $bigShipJoinSQL = "LEFT JOIN ("; foreach($topCorpShips as $sName => $sUses) { $bigShipJoinSQL .= sprintf("SELECT %d AS typeID, %d AS useCnt%s", $sName, $sUses, ($sName != end(array_keys($topCorpShips)) ? " UNION " : "")); } $bigShipJoinSQL .= ") sK USING(typeID)"; $shipClassSQL = sprintf("SELECT ig.groupName, SUM(sK.useCnt) AS timesUsed FROM ".EVEDB_NAME.".invTypes it LEFT JOIN ".EVEDB_NAME.".invGroups ig USING(groupID) %s WHERE (it.typeID IN (%s) AND NOT it.typeID = 0) AND ig.anchorable = 0 GROUP BY ig.groupName ORDER BY timesUsed DESC", $bigShipJoinSQL, implode(",",array_keys($topCorpShips))); $rsShipClass = mysql_query_cache($shipClassSQL); if (is_array($rsShipClass)) { if (!empty($rsShipClass)) { $classCnt = 1; $classCount = count($rsShipClass); //$bigKillShipID = key($topCorpShips); printf('Their favourite ship class%s %s %s (%0.1f%% of total)', ($classCount > 1 && EVEKILL_MAX_SHIP_CLASSES_TO_SHOW > 1 ? "es" : ""), ($classCount > 1 && EVEKILL_MAX_SHIP_CLASSES_TO_SHOW > 1 ? "include" : "is"), $rsShipClass[0]["groupName"], (($rsShipClass[0]["timesUsed"]/$classCount)*100)); if ($classCount > 1 && EVEKILL_MAX_SHIP_CLASSES_TO_SHOW > 1) { $clAry = array(); for ($s = 1; $s < count($rsShipClass) && ($classCnt++ < EVEKILL_MAX_SHIP_CLASSES_TO_SHOW); $s++) { $clAry[] = sprintf('%s (%0.1f%%)', $rsShipClass[$s]["groupName"], (($rsShipClass[$s]["timesUsed"]/$classCount)*100)); } printf(", %s. ", (isset($clAry) ? implode(", ",$clAry) : "")); } else { printf(". "); } } } } printf("
"); } // ============================================================================== } else { // ============================================================================== // Occupied by one or more corps that are distinct from a single alliance printf("%s%s are most active in system during the %s timezone (EVE%s) with %0.2f%% of all activity. ', ICON_TIMEZONE_IMAGE, ($allianceOccupied || sizeof($aryResident) > 1) ? "Collectively they" : "They", $topTZ["name"], sprintf("%s%d", ($topTZ["shift"] >= 0 ? "+" : ""), $topTZ["shift"]), $topTZ["r-perc"]); foreach($tzArray as $aTimezone) { if ($aTimezone == $topTZ) continue; $addTZ[] = sprintf('%s - %0.2f%%', $aTimezone["name"], $aTimezone["r-perc"]); } printf("(%s).
", implode(", ",$addTZ)); } // Work out whether the top corp has used capital ships in this system $capKills = $aKillboard->getActivityInvolvingCaps(); if (sizeof($capKills) > 0) { // Itemise capital ships, and link to eve-kill $capStr = array(); $killDB = array(); $lastKillID = 0; $cpCnt = 0; $capUseCount = 0; foreach($capKills as $aCap) { if (!in_array(sprintf("%s%s", $aKillboard->getShipNameForTypeID($aCap["typeID"]), (!$aCap["isShip"]) ? " (delegated)" : ""), $capStr)) { $capStr[] = sprintf('%s%s', $aKillboard->getShipNameForTypeID($aCap["typeID"]), (!$aCap["isShip"]) ? " (delegated)" : ""); } if (!strcasecmp($aCap["kill"]->url, $lastKillID) == 0) { if (++$cpCnt <= SHOW_MAX_CAPITAL_KILLMAILS) { $killDB[] = sprintf('%d', $aCap["kill"]->url, $cpCnt); } // We keep a running update of the current kill ID so as not to duplicate // capital sightings $lastKillID = $aCap["kill"]->url; } } printf('%sCapital ship%s (%s) %s been used in combat in this wormhole on %d occasion%s - %s%s
', ICON_CAPUSE_IMAGE, (sizeof($capStr) > 1) ? "s" : "", implode(', ',$capStr), (sizeof($capStr) > 1) ? "have" : "has", $cpCnt, ($cpCnt > 1) ? "s" : "", (($cpCnt > SHOW_MAX_CAPITAL_KILLMAILS) ? sprintf('last %d: ', SHOW_MAX_CAPITAL_KILLMAILS) : ''), implode(', ',$killDB)); } } else { // We have no residents, assume unoccupied dprintf('residency: std dev for system: %f (threshold: %f)', $aKillboard->corp[0]->residency["stddev"], SCORE_RES_STDDEV_TOO_LOW_THRESHOLD); printf('%sSystem may be unoccupied or contested–%d seperate corporations have had %d isolated battles over a period of %d days.
', ICON_VACATED_IMAGE, sizeof($aKillboard->corp), $aKillboard->res_metrics["battleCount"], ((strtotime($aKillboard->res_metrics["newestKill"]->timestamp) - strtotime($aKillboard->res_metrics["oldestKill"]->timestamp)) / 60 / 60 / 24)); } $evicteeDB = array(); // Show instances where a corp recovered from a POS loss foreach ($aKillboard->corp as $eCorp) { if ($eCorp->isNPCCorporation()) continue; // Max evicters to show, changes depending on how many POSes have been lost $evicterMaxCnt = (sizeof($eCorp->residency["evicted"]["losses"] > 1) ? EVEKILL_MAX_EVICTERS_FOR_MULTIPOS_LOSS : EVEKILL_MAX_EVICTERS_TO_REPORT); if (!is_null($eCorp->residency["evicted"]) && ($eCorp->residency["evicted"]["ppl_score"] >= SCORE_RES_STILL_RES_THRESHOLD_SCORE || strtotime("+".EVEKILL_RECENT_EVICTION_IN_DAYS." days", strtotime($eCorp->getNewestEvictionPOSKill()->timestamp)) - time() >= 0)) { $aryKillers = array(); $killDB = array(); $pkCnt = 0; // Corp suffered a POS loss, but they recovered foreach($eCorp->residency["evicted"]["losses"] as $aPOSKill) { $aryKillers = array_merge($aryKillers, $aKillboard->getInvolvedCorpsOnKill($aPOSKill)); } // Remove duplicate corps from combined evicter array //$aryKillers = $aKillboard->filterUniqueCorps($aryKillers); $aryKillers = $aKillboard->beautifyCorps($aryKillers); $aryKillAry = array(); if (sizeof($aryKillers) > 0) { foreach($aryKillers as $allianceID => $allyData) { $evtCnt = 0; if ($allianceID !== NO_ALLIANCE_ALLIANCE_ID) { if (sizeof($allyData["corps"]) == 1) { // Only one corp recorded in the alliance, so just show them normally $corpData = current($allyData["corps"]); $aryKillAry[] = sprintf('%s%s', $corpData["corporationID"], $corpData["corporationName"], sprintf(' [%s]', $allyData["allianceID"], $allyData["allianceName"])); } else { $corpKillAry = array(); foreach($allyData["corps"] as $corporationID => $corpData) { if (++$evtCnt > EVEKILL_MAX_EVICTERS_TO_REPORT) continue; $corpKillAry[] = sprintf('%s', $corpData["corporationID"], $corpData["corporationName"]); } $aryKillAry[] = sprintf('%s%s%s (%s%s)', substr_compare($allyData["allianceName"], "the", 0, 3, true) === 0 ? "" : "the ", $allyData["allianceID"], $allyData["allianceName"], substr_compare($allyData["allianceName"], "alliance", strlen($allyData["allianceName"])-8, 8, true) === 0 ? "" : " alliance", ($evtCnt <= EVEKILL_MAX_EVICTERS_TO_REPORT) ? fimplode(", ", $corpKillAry) : implode(", ", $corpKillAry), ($evtCnt > EVEKILL_MAX_EVICTERS_TO_REPORT) ? sprintf(" and %d other%s", ($evtCnt - EVEKILL_MAX_EVICTERS_TO_REPORT), ($evtCnt - EVEKILL_MAX_EVICTERS_TO_REPORT > 1 ? "s" : "")) : ""); } } else { // Individual unallied corps $corpKillAry = array(); foreach($allyData["corps"] as $corporationID => $corpData) { $aryKillAry[] = sprintf('%s', $corpData["corporationID"], $corpData["corporationName"]); } } } /*$aryKillAry = array(); if (sizeof($aryKillers) > 0) { $evtCnt = 0; foreach($aryKillers as $aKiller) { if (++$evtCnt <= $evicterMaxCnt && !in_array($aKiller->corporationName, $aryKillAry) && $eCorp !== $aKiller) { $aryKillAry[] = sprintf('%s%s', $aKiller->corporationID, $aKiller->corporationName, (strlen($aKiller->allianceName) > 0 && ($aKillboard->getEVEIDFromName($aKiller->allianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($aKiller->allianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID)) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($aKiller->allianceName, GET_ALLIANCE_ID), $aKiller->allianceName) : ""); } } */ $oldPOSKillDT = new DateTime($eCorp->getOldestEvictionPOSKill()->timestamp); $newPOSKillDT = new DateTime($eCorp->getNewestEvictionPOSKill()->timestamp); if ($eCorp->residency["evicted"]["ppl_score"] >= SCORE_RES_STILL_RES_THRESHOLD_SCORE) { // EVICTION RECOVERY printf('%s%s %s — to %s%s - but they appear to have recovered.
', ICON_COMBAT_IMAGE, $eCorp->corporationName, (sizeof($eCorp->residency["evicted"]["losses"]) == 1) ? sprintf('lost a POS on %s', $eCorp->getOldestEvictionPOSKill()->url, date("d M Y H:i", strtotime($eCorp->getOldestEvictionPOSKill()->timestamp))) : sprintf('lost %d POS between %s and %s', sizeof($eCorp->residency["evicted"]["losses"]), date(($oldPOSKillDT->diff($newPOSKillDT)->days === 0 ? "d M Y H:i" : "d M Y"), strtotime($eCorp->getOldestEvictionPOSKill()->timestamp)), date(($oldPOSKillDT->diff($newPOSKillDT)->days === 0 ? "d M Y H:i" : "d M Y"), strtotime($eCorp->getNewestEvictionPOSKill()->timestamp))), ($evtCnt <= $evicterMaxCnt) ? fimplode(', ',$aryKillAry) : implode(', ',$aryKillAry), ($evtCnt > $evicterMaxCnt) ? sprintf(" and %d other%s ", ($evtCnt - $evicterMaxCnt), ($evtCnt - $evicterMaxCnt > 1 ? "s" : "")) : ""); } elseif (strtotime("+".EVEKILL_RECENT_EVICTION_IN_DAYS." days", strtotime($eCorp->getNewestEvictionPOSKill()->timestamp)) - time() >= 0) { // RECENT EVICTION printf('%sRECENT EVICTION ACTIVITY — %s%s %s — to %s%s.
', ICON_EVICTING_IMAGE, $eCorp->corporationID, $eCorp->corporationName, (strlen($eCorp->allianceName) > 0 && ($aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID)) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID), $eCorp->allianceName) : "", (sizeof($eCorp->residency["evicted"]["losses"]) == 1) ? sprintf('have lost a POS on %s', $eCorp->getOldestEvictionPOSKill()->url, date("d M Y H:i", strtotime($eCorp->getOldestEvictionPOSKill()->timestamp))) : sprintf('have lost %d POS between %s and %s', sizeof($eCorp->residency["evicted"]["losses"]), date(($oldPOSKillDT->diff($newPOSKillDT)->days === 0 ? "d M Y H:i" : "d M Y"), strtotime($eCorp->getOldestEvictionPOSKill()->timestamp)), date(($oldPOSKillDT->diff($newPOSKillDT)->days === 0 ? "d M Y H:i" : "d M Y"), strtotime($eCorp->getNewestEvictionPOSKill()->timestamp))), ($evtCnt <= $evicterMaxCnt) ? fimplode(', ',$aryKillAry) : implode(', ',$aryKillAry), ($evtCnt > $evicterMaxCnt) ? sprintf(" and %d other%s", ($evtCnt - $evicterMaxCnt), ($evtCnt - $evicterMaxCnt > 1 ? "s" : "")) : ""); } } } elseif ($eCorp->isEvicted()) ($evicteeDB[] = $eCorp); } if (sizeof($evicteeDB) > 0) { foreach($evicteeDB as $eCorp) { // Max evicters to show, changes depending on how many POSes have been lost $evicterMaxCnt = (sizeof($eCorp->residency["evicted"]["losses"] > 1) ? EVEKILL_MAX_EVICTERS_FOR_MULTIPOS_LOSS : EVEKILL_MAX_EVICTERS_TO_REPORT); $aryKillers = array(); $killDB = array(); $pkCnt = 0; // Corp suffered a POS loss, but they recovered foreach($eCorp->residency["evicted"]["losses"] as $aPOSKill) { $aryKillers = array_merge($aryKillers, $aKillboard->getInvolvedCorpsOnKill($aPOSKill)); } // Remove duplicate corps from combined evicter array //$aryKillers = $aKillboard->filterUniqueCorps($aryKillers); $aryKillers = $aKillboard->beautifyCorps($aryKillers); $aryKillAry = array(); if (sizeof($aryKillers) > 0) { foreach($aryKillers as $allianceID => $allyData) { $evtCnt = 0; if ($allianceID !== NO_ALLIANCE_ALLIANCE_ID) { if (sizeof($allyData["corps"]) == 1) { // Only one corp recorded in the alliance, so just show them normally $corpData = current($allyData["corps"]); $aryKillAry[] = sprintf('%s%s', $corpData["corporationID"], $corpData["corporationName"], sprintf(' [%s]', $allyData["allianceID"], $allyData["allianceName"])); } else { $corpKillAry = array(); foreach($allyData["corps"] as $corporationID => $corpData) { if (++$evtCnt > EVEKILL_MAX_EVICTERS_TO_REPORT) continue; $corpKillAry[] = sprintf('%s', $corpData["corporationID"], $corpData["corporationName"]); } $aryKillAry[] = sprintf('%s%s%s (%s%s)', substr_compare($allyData["allianceName"], "the", 0, 3, true) === 0 ? "" : "the ", $allyData["allianceID"], $allyData["allianceName"], substr_compare($allyData["allianceName"], "alliance", strlen($allyData["allianceName"])-8, 8, true) === 0 ? "" : " alliance", ($evtCnt <= EVEKILL_MAX_EVICTERS_TO_REPORT) ? fimplode(", ", $corpKillAry) : implode(", ", $corpKillAry), ($evtCnt > EVEKILL_MAX_EVICTERS_TO_REPORT) ? sprintf(" and %d other%s", ($evtCnt - EVEKILL_MAX_EVICTERS_TO_REPORT), ($evtCnt - EVEKILL_MAX_EVICTERS_TO_REPORT > 1 ? "s" : "")) : ""); } } else { // Individual unallied corps $corpKillAry = array(); foreach($allyData["corps"] as $corporationID => $corpData) { $aryKillAry[] = sprintf('%s', $corpData["corporationID"], $corpData["corporationName"]); } } } $aryEvictee[] = sprintf('%s%s%s', $eCorp->corporationID, $eCorp->corporationName, (strlen($eCorp->allianceName) > 0 && ($aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID)) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID), $eCorp->allianceName) : "", (sizeof($evicteeDB) == 1) ? sprintf(' – %s on %s, by %s%s', sprintf('evicted', $eCorp->getNewestEvictionPOSKill()->url), date("d M Y H:i", strtotime($eCorp->getNewestEvictionPOSKill()->timestamp)), ($evtCnt <= $evicterMaxCnt) ? fimplode(', ',$aryKillAry) : implode(', ',$aryKillAry), ($evtCnt > $evicterMaxCnt) ? sprintf(" and %d other%s ", ($evtCnt - $evicterMaxCnt), ($evtCnt - $evicterMaxCnt > 1 ? "s" : "")) : "") : sprintf(' – %s on %s', sprintf('evicted', $eCorp->getNewestEvictionPOSKill()->url), date("d M Y H:i", strtotime($eCorp->getNewestEvictionPOSKill()->timestamp)))); } /* $aryKillAry = array(); if (sizeof($aryKillers) > 0) { $evtCnt = 0; foreach($aryKillers as $aKiller) { if (++$evtCnt <= $evicterMaxCnt && !in_array($aKiller->corporationName, $aryKillAry) && $eCorp !== $aKiller) { $aryKillAry[] = sprintf('%s%s', $aKiller->corporationID, $aKiller->corporationName, (strlen($aKiller->allianceName) > 0 && ($aKillboard->getEVEIDFromName($aKiller->allianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($aKiller->allianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID)) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($aKiller->allianceName, GET_ALLIANCE_ID), $aKiller->allianceName) : ""); } } $aryEvictee[] = sprintf('%s%s%s', $eCorp->corporationID, $eCorp->corporationName, (strlen($eCorp->allianceName) > 0 && ($aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID) != 0 && $aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID) != NO_ALLIANCE_ALLIANCE_ID)) ? sprintf(' [%s]', $aKillboard->getEVEIDFromName($eCorp->allianceName, GET_ALLIANCE_ID), $eCorp->allianceName) : "", (sizeof($evicteeDB) == 1) ? sprintf(' (%s on %s, by %s%s)', sprintf('evicted', $eCorp->getNewestEvictionPOSKill()->url), date("d M Y H:i", strtotime($eCorp->getNewestEvictionPOSKill()->timestamp)), ($evtCnt <= $evicterMaxCnt) ? fimplode(', ',$aryKillAry) : implode(', ',$aryKillAry), ($evtCnt > $evicterMaxCnt) ? sprintf(" and %d other%s ", ($evtCnt - $evicterMaxCnt), ($evtCnt - $evicterMaxCnt > 1 ? "s" : "")) : "") : sprintf(' (%s on %s)', sprintf('evicted', $eCorp->getNewestEvictionPOSKill()->url), date("d M Y H:i", strtotime($eCorp->getNewestEvictionPOSKill()->timestamp)))); } */ } if (sizeof($aryEvictee) > 0) { printf('%sPrevious residents include: %s
', ICON_EVICTED_IMAGE, fimplode(", ",$aryEvictee)); } } } else { // Not a wormhole locus, just show the most active corp // Re-order corp table by kills descending usort($aKillboard->corp, 'kcmp'); $topCorp = current($aKillboard->corp); if (is_object($topCorp)) { printf('Most active are %s, with %d kills and %d losses, involving an average of %d ships. ', $topCorp->corporationID, $topCorp->corporationName, $topCorp->killCount, $topCorp->lossCount, floor($topCorp->involvedCount/$topCorp->killCount)); // Get the top corp in alliance ship types $topCorpShips = $topCorp->shipTypes; if (is_array($topCorpShips)) { arsort($topCorpShips, SORT_NUMERIC); // $bigKillShips contains a list of ship typeIDs together with the number of // times they were used. In order to get the total count of ship CLASSES we // have to build a convoluted SQL query using UNIONs in order to add a column // containing the counts-per-ship, and then aggregating them into a // total-per-class, which is what we display. $bigShipJoinSQL = "LEFT JOIN ("; foreach($topCorpShips as $sName => $sKills) { $bigShipJoinSQL .= sprintf("SELECT %d AS typeID, %d AS useCnt%s", $sName, $sKills, ($sName != end(array_keys($topCorpShips)) ? " UNION " : "")); } $bigShipJoinSQL .= ") sK USING(typeID)"; $shipClassSQL = sprintf("SELECT ig.groupName, SUM(sK.useCnt) AS timesUsed FROM ".EVEDB_NAME.".invTypes it LEFT JOIN ".EVEDB_NAME.".invGroups ig USING(groupID) %s WHERE (it.typeID IN (%s) AND NOT it.typeID = 0) AND ig.anchorable = 0 GROUP BY ig.groupName ORDER BY timesUsed DESC", $bigShipJoinSQL, implode(",",array_keys($topCorpShips))); $rsShipClass = mysql_query_cache($shipClassSQL); if (is_array($rsShipClass)) { if (!empty($rsShipClass)) { $classCnt = 1; $classCount = count($rsShipClass); //$bigKillShipID = key($topCorpShips); printf('Their favourite ship class%s %s %s (%0.1f%% of total)', ($classCount > 1 && EVEKILL_MAX_SHIP_CLASSES_TO_SHOW > 1 ? "es" : ""), ($classCount > 1 && EVEKILL_MAX_SHIP_CLASSES_TO_SHOW > 1 ? "include" : "is"), $rsShipClass[0]["groupName"], (($rsShipClass[0]["timesUsed"]/$classCount)*100)); if ($classCount > 1 && EVEKILL_MAX_SHIP_CLASSES_TO_SHOW > 1) { $clAry = array(); for ($s = 1; $s < count($rsShipClass) && ($classCnt++ < EVEKILL_MAX_SHIP_CLASSES_TO_SHOW); $s++) { $clAry[] = sprintf('%s (%0.1f%%)', $rsShipClass[$s]["groupName"], (($rsShipClass[$s]["timesUsed"]/$classCount)*100)); } printf(", %s. ", (isset($clAry) ? implode(", ",$clAry) : "")); } else { printf(". "); } } } } } else { // No top corp, so not enough data to do anything! printf("
No kills recorded in this system in the past %d months. No intel analysis is possible.
", EVEKILL_ANALYSIS_MAX_MONTH_HISTORY); } } } else { // Killboard was invalid, probably a problem querying evekill printf('Unable to query Eve-Kill data at this time - please try again later.
'); } dprintf("intel_evekill_analysis - Finished."); printf("

