} $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);
/** * @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; }