/** * Show the overall statistics for this corporation. */ function stats() { global $smarty; // The summary table is also used by the stats. Whichever is called // first generates the table. $this->page->setTitle('Corporation details - ' . $this->corp->getName() . " [" . $this->corp->getShortName() . "]"); $smarty->registerObject('Corp', $this->corp); $smarty->assign('portrait_url', $this->corp->getPortraitURL(128)); if ($this->alliance->getName() == "None") { $smarty->assign('alliance_url', false); } else { if ($this->alliance->getExternalID()) { $smarty->assign('alliance_url', edkURI::build(array('a', 'alliance_detail', true), array('all_ext_id', $this->alliance->getExternalID(), true))); } else { $smarty->assign('alliance_url', edkURI::build(array('a', 'alliance_detail', true), array('all_id', $this->alliance->getID(), true))); } } $smarty->assign('alliance_name', $this->alliance->getName()); $smarty->assign('kill_count', $this->kill_summary->getTotalKills()); $smarty->assign('loss_count', $this->kill_summary->getTotalLosses()); $smarty->assign('damage_done', number_format($this->kill_summary->getTotalKillISK() / 1000000000, 2)); $smarty->assign('damage_received', number_format($this->kill_summary->getTotalLossISK() / 1000000000, 2)); if ($this->kill_summary->getTotalKillISK()) { $smarty->assign('efficiency', number_format(100 * $this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()), 2)); } else { $smarty->assign('efficiency', 0); } $smarty->assign('ceo_url', edkURI::build(array('a', 'pilot_detail', true), array('plt_ext_id', $this->corp->getCeoID(), true))); $pilot = new Pilot(0, $this->corp->getCeoID()); $smarty->assign('ceo_name', $pilot->getName()); return $smarty->fetch(get_tpl('corp_detail_stats')); }
function display() { global $smarty; $alls = $corps = $pilots = false; if (config::get('cfg_allianceid')) { $alls = array(); foreach (config::get('cfg_allianceid') as $entity) { $alliance = new Alliance($entity); if ($alliance->getExternalID()) { $url = edkURI::page('alliance_detail', $alliance->getExternalID(), 'all_ext_id'); } else { $url = edkURI::page('alliance_detail', $alliance->getID(), 'all_id'); } $alls[] = array('id' => $alliance->getID(), 'extid' => $alliance->getExternalID(), 'name' => $alliance->getName(), 'portrait' => $alliance->getPortraitURL(128), 'url' => $url); } } if (config::get('cfg_corpid')) { $corps = array(); foreach (config::get('cfg_corpid') as $entity) { $corp = new Corporation($entity); if ($corp->getExternalID()) { $url = edkURI::page('corp_detail', $corp->getExternalID(), 'crp_ext_id'); } else { $url = edkURI::page('corp_detail', $corp->getID(), 'crp_id'); } $corps[] = array('id' => $corp->getID(), 'extid' => $corp->getExternalID(), 'name' => $corp->getName(), 'portrait' => $corp->getPortraitURL(128), 'url' => $url); } } if (config::get('cfg_pilotid')) { $pilots = array(); foreach (config::get('cfg_pilotid') as $entity) { $pilot = new Pilot($entity); if ($pilot->getExternalID()) { $url = edkURI::page('pilot_detail', $pilot->getExternalID(), 'plt_ext_id'); } else { $url = edkURI::page('pilot_detail', $pilot->getID(), 'plt_id'); } $pilots[] = array('id' => $pilot->getID(), 'extid' => $pilot->getExternalID(), 'name' => $pilot->getName(), 'portrait' => $pilot->getPortraitURL(128), 'url' => $url); } } $smarty->assignByRef('alliances', $alls); $smarty->assignByRef('corps', $corps); $smarty->assignByRef('pilots', $pilots); return $smarty->fetch(get_tpl('self')); }
/** * Fetch the board owners. * @return array Array of id strings to add to URLS */ function getOwners() { $myids = array(); if (!defined('MASTER') || !MASTER) { foreach (config::get('cfg_pilotid') as $entity) { $pilot = new Pilot($entity); $myids[] = '&pilot=' . urlencode($pilot->getName()); } foreach (config::get('cfg_corpid') as $entity) { $corp = new Corporation($entity); $myids[] = '&corp=' . urlencode($corp->getName()); } foreach (config::get('cfg_allianceid') as $entity) { $alli = new Alliance($entity); $myids[] = '&alli=' . urlencode($alli->getName()); } } return $myids; }
foreach ($ids as $id) { if ($typ == 'a') { $alliance = new Alliance($id); $text = $alliance->getName(); $link = KB_HOST . '/?a=admin_postperm&del=' . $typ . $id . '&akey=' . session::makeKey(); $permt[$typ][] = array('text' => $text, 'link' => $link); } if ($typ == 'p') { $pilot = new Pilot($id); $text = $pilot->getName(); $link = KB_HOST . '/?a=admin_postperm&del=' . $typ . $id . '&akey=' . session::makeKey(); $permt[$typ][] = array('text' => $text, 'link' => $link); } if ($typ == 'c') { $corp = new Corporation($id); $text = $corp->getName(); $link = KB_HOST . '/?a=admin_postperm&del=' . $typ . $id . '&akey=' . session::makeKey(); $permt[$typ][] = array('text' => $text, 'link' => $link); } } } $perm = array(); if ($permt['a']) { $perm[] = array('name' => 'Alliances', 'list' => $permt['a']); } if ($permt['p']) { $perm[] = array('name' => 'Pilots', 'list' => $permt['p']); } if ($permt['c']) { $perm[] = array('name' => 'Corporations', 'list' => $permt['c']); }
$html .= "<tr><td></td><td><input type=submit name=detail_submit value=\"Save\"></td></tr>"; $html .= "</table>"; $html .= "</form>"; $html .= "<div class=block-header2>Targets</div>"; $html .= "<table class=kb-table cellspacing=1>"; $html .= "<tr class=kb-table-header><td class=kb-table-cell width=160>Target</td><td class=kb-table-cell width=80 align=center>Corporation</td><td class=kb-table-cell width=80 align=center>Alliance</td><td class=kb-table-cell width=80 align=center>Region</td><td class=kb-table-cell width=80 align=center>System</td><td class=kb-table-cell width=80 align=center>Action</td></tr>"; $c = 0; while ($contracttarget = $contract->getContractTarget()) { $c++; $type = $contracttarget->getType(); $typeURL = false; $ctrTypeID = $contracttarget->getID(); switch ($type) { case "corp": $corp = new Corporation($ctrTypeID); $name = $corp->getName(); $typeURL = edkURI::page('corp_detail', $ctrTypeID, 'crp_id'); break; case "alliance": $alliance = new Alliance($ctrTypeID); $name = $alliance->getName(); $typeURL = edkURI::page('alliance_detail', $ctrTypeID, 'all_id'); break; case "region": $region = new Region($ctrTypeID); $name = $region->getName(); $typeURL = edkURI::page('detail_view', $ctrTypeID, 'region_id'); break; case "system": $system = new SolarSystem($ctrTypeID); $name = $system->getName();
/** * Remove selected corps then return an array of corps remaining. */ public static function removeCorp() { if (isset($_POST['option_rem_corpid']) && $_POST['option_rem_corpid']) { $arr = config::get('cfg_corpid'); $key = array_search(intval($_POST['option_rem_corpid']), $arr); if ($key !== false) { unset($arr[$key]); } sort($arr); config::set('cfg_corpid', $arr); unset($_POST['option_rem_corpid']); } $options = array(); foreach (config::get('cfg_corpid') as $val) { $crp = new Corporation($val); $options[$crp->getName()] = array('value' => $val, 'descr' => $crp->getName(), 'state' => 0); } ksort($options); array_unshift($options, array('value' => '0', 'descr' => '-', 'state' => 1)); return $options; }
/** * Return the raw killmail for this kill. * * @return string */ function getRawMail() { if (!is_null($this->mail)) { return $this->mail; } if (config::get('km_cache_enabled') && file_exists(KB_PAGECACHEDIR . "/" . $this->getID() . ".txt")) { $this->mail = file_get_contents(KB_PAGECACHEDIR . "/" . $this->getID() . ".txt"); return $this->mail; } if (!$this->timestamp) { $this->execQuery(); } if (!$this->valid) { return "The specified kill ID is not valid."; } if ($this->isClassified()) { return 'Killmail not yet available, try again in ' . round($this->getClassifiedTime() / 3600, 2) . ' hrs.'; } static $locations; if (!isset($locations)) { $qry = DBFactory::getDBQuery(); $qry->execute("SELECT itl_id, itl_location FROM kb3_item_locations"); while ($row = $qry->getRow()) { $locations[$row['itl_id']] = $row['itl_location']; } } $ship = $this->getVictimShip(); $shipclass = $ship->getClass(); if (!$this->getVictimCorpName()) { $corp = new Corporation($this->victimcorpid); $this->victimcorpname = $corp->getName(); } if (!$this->getVictimAllianceName()) { $all = new Alliance($this->victimallianceid); $this->victimalliancename = $all->getName(); } if (!$this->getVictimName()) { trigger_error("Invalid mail, victim name blank", E_USER_ERROR); return ""; } else { if (!$this->getVictimCorpName()) { trigger_error("Invalid mail, victim corporation blank", E_USER_ERROR); return ""; } else { if (!$this->getVictimAllianceName() && !$this->getVictimFactionName()) { trigger_error("Invalid mail, victim alliance blank", E_USER_ERROR); return ""; } else { if (!$ship->getName()) { trigger_error("Invalid mail, ship blank", E_USER_ERROR); return ""; } else { if (!$this->getSystem()->getName()) { trigger_error("Invalid mail, system blank", E_USER_ERROR); return ""; } } } } } $mail = substr(str_replace('-', '.', $this->getTimeStamp()), 0, 16) . "\r\n\r\n"; // Starbase (so this is a POS mail) if (in_array($shipclass->getID(), array(35, 36, 37, 38))) { $mail .= "Corp: " . $this->getVictimCorpName() . "\r\n"; if ($this->getIsVictimFaction()) { $mail .= "Alliance: None\r\n"; } else { $mail .= "Alliance: " . $this->getVictimAllianceName() . "\r\n"; } $mail .= "Faction: " . $this->getVictimFactionName() . "\r\n"; //$ship = $this->getVictimShip(); $mail .= "Destroyed: " . $ship->getName() . "\r\n"; if ($this->getVictimName() == $this->getSystem()->getName()) { $mail .= "Moon: Unknown\r\n"; } else { $mail .= "Moon: " . $this->getVictimName() . "\r\n"; } $mail .= "System: " . $this->getSystem()->getName() . "\r\n"; $mail .= "Security: " . $this->getSystem()->getSecurity(true) . "\r\n"; $mail .= "Damage Taken: " . $this->dmgtaken . "\r\n\r\n"; $mail .= "Involved parties:\r\n\r\n"; } else { $mail .= "Victim: " . $this->getVictimName() . "\r\n"; $mail .= "Corp: " . $this->getVictimCorpName() . "\r\n"; if ($this->getIsVictimFaction()) { $mail .= "Alliance: None\r\n"; } else { $mail .= "Alliance: " . $this->getVictimAllianceName() . "\r\n"; } $mail .= "Faction: " . $this->getVictimFactionName() . "\r\n"; //$ship = $this->getVictimShip(); $mail .= "Destroyed: " . $ship->getName() . "\r\n"; $system = $this->getSystem(); $mail .= "System: " . $system->getName() . "\r\n"; $mail .= "Security: " . $system->getSecurity(true) . "\r\n"; $mail .= "Damage Taken: " . $this->dmgtaken . "\r\n\r\n"; $mail .= "Involved parties:\r\n\r\n"; } foreach ($this->involvedparties_ as $inv) { /* @var $inv InvolvedParty */ $pilot = new Pilot($inv->getPilotID()); $corp = new Corporation($inv->getCorpID()); $alliance = new Alliance($inv->getAllianceID()); $weapon = $inv->getWeapon(); $ship = $inv->getShip(); // Split these into multiple ifs so the error tells us where the // problem was. if (!$pilot->getName()) { trigger_error("Invalid mail, invalid involved pilot", E_USER_ERROR); var_dump($pilot); return ""; } else { if (!$corp->getName()) { trigger_error("Invalid mail, invalid involved corporation", E_USER_ERROR); return ""; } else { if (!$alliance->getName()) { trigger_error("Invalid mail, invalid involved alliance", E_USER_ERROR); return ""; } else { if (!$weapon->getName()) { trigger_error("Invalid mail, invalid involved weapon", E_USER_ERROR); return ""; } else { if (!$ship->getName()) { trigger_error("Invalid mail, invalid involved ship", E_USER_ERROR); return ""; } } } } } if ($pilot->getName() == $weapon->getName()) { $name = $pilot->getName() . " / " . $corp->getName(); } else { $name = $pilot->getName(); } $mail .= "Name: " . $name; if ($pilot->getID() == $this->getFBPilotID()) { $mail .= " (laid the final blow)"; } $mail .= "\r\n"; if ($pilot->getName() != $weapon->getName()) { $mail .= "Security: " . $inv->getSecStatus() . "\r\n"; $mail .= "Corp: " . $corp->getName() . "\r\n"; if ($alliance->isFaction()) { $mail .= "Alliance: None\r\n"; $mail .= "Faction: " . $alliance->getName() . "\r\n"; } else { $mail .= "Alliance: " . $alliance->getName() . "\r\n"; $mail .= "Faction: None\r\n"; } $mail .= "Ship: " . $ship->getName() . "\r\n"; $mail .= "Weapon: " . $weapon->getName() . "\r\n"; $mail .= "Damage Done: " . $inv->getDamageDone() . "\r\n"; } else { $mail .= "Damage Done: " . $inv->getDamageDone() . "\r\n"; } $mail .= "\r\n"; } if (count($this->destroyeditems_) > 0) { $mail .= "\r\nDestroyed items:\r\n\r\n"; foreach ($this->destroyeditems_ as $destroyed) { $item = $destroyed->getItem(); $mail .= $item->getName(); if ($destroyed->getQuantity() > 1) { $mail .= ", Qty: " . $destroyed->getQuantity(); } if ($destroyed->getLocationID() == 5) { $mail .= " (Cargo)"; } else { if ($destroyed->getLocationID() == 87) { $mail .= " (Drone Bay)"; } else { if ($destroyed->getLocationID() == 89) { $mail .= " (Implant)"; } else { if ($destroyed->getLocationID() == -1) { $mail .= " (Copy)"; } } } } $mail .= "\r\n"; } } if (count($this->droppeditems_) > 0) { $mail .= "\r\nDropped items:\r\n\r\n"; foreach ($this->droppeditems_ as $dropped) { $item = $dropped->getItem(); $mail .= $item->getName(); if ($dropped->getQuantity() > 1) { $mail .= ", Qty: " . $dropped->getQuantity(); } if ($dropped->getLocationID() == 5) { $mail .= " (Cargo)"; } else { if ($dropped->getLocationID() == 87) { $mail .= " (Drone Bay)"; } else { if ($dropped->getLocationID() == 89) { $mail .= " (Implant)"; } else { if ($dropped->getLocationID() == -1) { $mail .= " (Copy) (Cargo)"; } } } } $mail .= "\r\n"; } } if ($this->id && config::get('km_cache_enabled')) { file_put_contents(KB_MAILCACHEDIR . "/" . $this->getID() . ".txt", $mail); } $this->mail = $mail; return $mail; }
$smarty->assign('kb_host', KB_HOST); $smarty->assignByRef('config', $config); $smarty->assign('is_IGB', IS_IGB); // Set the name of the board owner. $owners = array(); if (config::get('cfg_allianceid')) { foreach (config::get('cfg_allianceid') as $owner) { $alliance = new Alliance($owner); $owners[] = htmlentities($alliance->getName()); } unset($alliance); } if (config::get('cfg_corpid')) { foreach (config::get('cfg_corpid') as $owner) { $corp = new Corporation($owner); $owners[] = htmlentities($corp->getName()); } unset($corp); } if (config::get('cfg_pilotid')) { foreach (config::get('cfg_corpid') as $owner) { $pilot = new Pilot($owner); $owners[] = htmlentities($pilot->getName()); } unset($pilot); } if (!$owners) { $smarty->assign('kb_owner', false); } else { $smarty->assign('kb_owner', implode(',', $owners)); }
$html = "That pilot doesn't exist."; $page->generate($html); exit; } if ($_POST['confirm']) { $sql = "UPDATE `kb3_pilots` SET `plt_crp_id` = '" . intval($_POST['crp_id']) . "' WHERE `plt_id` =" . intval($_POST['plt_id']); $qry = DBFactory::getDBQuery(); $qry->execute($sql); $html .= "Pilot Moved"; } if ($_REQUEST['crp']) { $corp = new Corporation(intval($_GET['crp'])); $html .= "<form id=change method=post action=><table class=kb-subtable>"; $html .= "<tr><td><input name=crp_id type=hidden value=" . htmlentities($_GET['crp']) . ">"; $html .= "<input name=plt_id type=hidden value=" . htmlentities($_GET['plt_id']) . ">"; $html .= "Confirm move<b> " . $pilot->getName() . "</b> to <b>" . $corp->getName() . "</b></td></tr>"; $html .= "<tr><td><input type=submit name=confirm value=\"Move\"></td></tr>"; $html .= "</table>"; } if ($_POST['search']) { $qry = DBFactory::getDBQuery(); $sql = "SELECT * FROM `kb3_corps` WHERE crp_name LIKE '%" . $qry->escape($_POST['search']) . "%'"; $qry->execute($sql); //$html .= $sql ; $html .= "<div class=block-header2>Results</div>"; $html .= "<table class=kb-subtable>"; while ($row = $qry->getRow()) { $html .= '<tr><td><a href="?a=admin_move_pilot&plt_id=' . intval($_GET['plt_id']) . '&crp=' . intval($row['crp_id']) . '&akey=' . session::makeKey() . '">'; $html .= $row['crp_name'] . "<br/>"; $html .= "</td><tr>"; }
/** * Return the raw killmail for this kill. * * @return string */ function getRawMail() { if (!is_null($this->mail)) { return $this->mail; } if (config::get('km_cache_enabled') && file_exists(KB_PAGECACHEDIR . "/" . $this->getID() . ".txt")) { $this->mail = file_get_contents(KB_PAGECACHEDIR . "/" . $this->getID() . ".txt"); return $this->mail; } if (!$this->timestamp) { $this->execQuery(); } if (!$this->valid) { return "The specified kill ID is not valid."; } if ($this->isClassified()) { return 'Killmail not yet available, try again in ' . round($this->getClassifiedTime() / 3600, 2) . ' hrs.'; } static $locations; if (!isset($locations)) { $qry = DBFactory::getDBQuery(); $qry->execute("SELECT itl_flagID, itl_flagText FROM kb3_item_locations"); while ($row = $qry->getRow()) { $locations[$row['itl_flagID']] = $row['itl_flagText']; } } $ship = $this->getVictimShip(); $shipclass = $ship->getClass(); if (!$this->getVictimCorpName()) { $corp = new Corporation($this->victimcorpid); $this->victimcorpname = $corp->getName(); } if (!$this->getVictimAllianceName()) { $all = new Alliance($this->victimallianceid); $this->victimalliancename = $all->getName(); } if (!$this->getVictimName()) { throw new KillException("Invalid mail, victim name blank"); } else { if (!$this->getVictimCorpName()) { throw new KillException("Invalid mail, victim corporation blank"); } else { if (!$this->getVictimAllianceName() && !$this->getVictimFactionName()) { throw new KillException("Invalid mail, victim alliance blank"); } else { if (!$ship->getName()) { throw new KillException("Invalid mail, ship blank"); } else { if (!$this->getSystem()->getName()) { throw new KillException("Invalid mail, system blank", ´); } } } } } $mail = substr(str_replace('-', '.', $this->getTimeStamp()), 0, 19) . "\r\n\r\n"; // Starbase (so this is a POS mail) if (in_array($shipclass->getID(), array(35, 36, 37, 38))) { $mail .= "Corp: " . $this->getVictimCorpName() . "\r\n"; if ($this->getIsVictimFaction()) { $mail .= "Alliance: None\r\n"; } else { $mail .= "Alliance: " . $this->getVictimAllianceName() . "\r\n"; } $mail .= "Faction: " . $this->getVictimFactionName() . "\r\n"; //$ship = $this->getVictimShip(); $mail .= "Destroyed: " . $ship->getName() . "\r\n"; if ($this->getVictimName() == $this->getSystem()->getName()) { $mail .= "Moon: Unknown\r\n"; } else { // is the victim's name a moon? $moonID = API_Helpers::getMoonID($this->getVictimName()); if ($moonID) { $mail .= "Moon: " . $this->getVictimName() . "\r\n"; } else { // try parsing the victim's name in case it's the format // <corporationName> - <moonName> $namePieces = explode(" - ", $this->getVictimName()); if (is_array($namePieces) && count($namePieces) > 2) { // remove first part, which is the corp name array_splice($namePieces, 0, 1); $mail .= "Moon: " . implode(" - ", $namePieces) . "\r\n"; } } } $mail .= "System: " . $this->getSystem()->getName() . "\r\n"; $mail .= "Security: " . $this->getSystem()->getSecurity(true) . "\r\n"; $mail .= "Damage Taken: " . $this->dmgtaken . "\r\n\r\n"; $mail .= "Involved parties:\r\n\r\n"; } else { $mail .= "Victim: " . $this->getVictimName() . "\r\n"; $mail .= "Corp: " . $this->getVictimCorpName() . "\r\n"; if ($this->getIsVictimFaction()) { $mail .= "Alliance: None\r\n"; } else { $mail .= "Alliance: " . $this->getVictimAllianceName() . "\r\n"; } $mail .= "Faction: " . $this->getVictimFactionName() . "\r\n"; //$ship = $this->getVictimShip(); $mail .= "Destroyed: " . $ship->getName() . "\r\n"; $system = $this->getSystem(); $mail .= "System: " . $system->getName() . "\r\n"; $mail .= "Security: " . $system->getSecurity(true) . "\r\n"; $mail .= "Damage Taken: " . $this->dmgtaken . "\r\n\r\n"; $mail .= "Involved parties:\r\n\r\n"; } foreach ($this->involvedparties_ as $inv) { /* @var $inv InvolvedParty */ $pilot = new Pilot($inv->getPilotID()); $corp = new Corporation($inv->getCorpID()); $alliance = new Alliance($inv->getAllianceID()); $weapon = $inv->getWeapon(); $ship = $inv->getShip(); if ($ship->getID() != "9999") { // Split these into multiple ifs so the error tells us where the // problem was. if (!$pilot->getName()) { throw new KillException("Invalid mail, invalid involved pilot (ID: " . $pilot->getID() . ")"); } else { if (!$corp->getName()) { throw new KillException("Invalid mail, invalid involved corporation (ID: " . $corp->getID() . ")"); } else { if (!$alliance->getName()) { throw new KillException("Invalid mail, invalid involved alliance (ID: " . $alliance->getID() . ")"); } else { if (!$weapon->getName()) { throw new KillException("Invalid mail, invalid involved weapon (ID: " . $weapon->getID() . ")"); } else { if (!$ship->getName()) { throw new KillException("Invalid mail, invalid involved ship (ID: " . $ship->getID() . ")"); } } } } } if ($pilot->getName() == $weapon->getName()) { $name = $pilot->getName() . " / " . $corp->getName(); } else { $name = $pilot->getName(); } $mail .= "Name: " . $name; if ($pilot->getID() == $this->getFBPilotID()) { $mail .= " (laid the final blow)"; } $mail .= "\r\n"; if ($pilot->getName() != $weapon->getName()) { $mail .= "Security: " . $inv->getSecStatus() . "\r\n"; $mail .= "Corp: " . $corp->getName() . "\r\n"; if ($alliance->isFaction()) { $mail .= "Alliance: None\r\n"; $mail .= "Faction: " . $alliance->getName() . "\r\n"; } else { $mail .= "Alliance: " . $alliance->getName() . "\r\n"; $mail .= "Faction: None\r\n"; } $mail .= "Ship: " . $ship->getName() . "\r\n"; $mail .= "Weapon: " . $weapon->getName() . "\r\n"; $mail .= "Damage Done: " . $inv->getDamageDone() . "\r\n"; } else { $mail .= "Damage Done: " . $inv->getDamageDone() . "\r\n"; } $mail .= "\r\n"; } } if (count($this->destroyeditems_) > 0) { $mail .= "\r\nDestroyed items:\r\n\r\n"; foreach ($this->destroyeditems_ as $destroyed) { $item = $destroyed->getItem(); $mail .= $item->getName(); if ($destroyed->getQuantity() > 1) { $mail .= ", Qty: " . $destroyed->getQuantity(); } if ($destroyed->getSingleton() == InventoryFlag::$SINGLETON_COPY) { $mail .= " (Copy)"; } $flagID = InventoryFlag::collapse($destroyed->getLocationID()); if ($destroyed->getLocationID() == InventoryFlag::$CARGO) { $mail .= " (Cargo)"; } else { if ($destroyed->getLocationID() == InventoryFlag::$DRONE_BAY) { $mail .= " (Drone Bay)"; } else { if ($destroyed->getLocationID() == InventoryFlag::$IMPLANT) { $mail .= " (Implant)"; } else { if ($destroyed->getLocationID() == InventoryFlag::$OTHER) { $mail .= " (Other)"; } } } } $mail .= "\r\n"; } } if (count($this->droppeditems_) > 0) { $mail .= "\r\nDropped items:\r\n\r\n"; foreach ($this->droppeditems_ as $dropped) { $item = $dropped->getItem(); $mail .= $item->getName(); if ($dropped->getQuantity() > 1) { $mail .= ", Qty: " . $dropped->getQuantity(); } if ($dropped->getSingleton() == InventoryFlag::$SINGLETON_COPY) { $mail .= " (Copy)"; } if ($dropped->getLocationID() == InventoryFlag::$CARGO) { $mail .= " (Cargo)"; } else { if ($dropped->getLocationID() == InventoryFlag::$DRONE_BAY) { $mail .= " (Drone Bay)"; } else { if ($dropped->getLocationID() == InventoryFlag::$IMPLANT) { $mail .= " (Implant)"; } else { if ($dropped->getLocationID() == InventoryFlag::$OTHER) { $mail .= " (Other)"; } } } } $mail .= "\r\n"; } } if ($this->id && config::get('km_cache_enabled')) { file_put_contents(KB_MAILCACHEDIR . "/" . $this->getID() . ".txt", $mail); } $this->mail = $mail; return $mail; }
function displayFitting($home) { global $smarty; //require_once("common/includes/class.dogma.php"); $kll_id = $home->kll_id; //echo "here"; //echo self::$oper; self::$shipStats = new shipstats(); $urlsettings = edkURI::parseURI(); self::$simpleurl = $urlsettings[0][2]; //echo "-> ".self::$simpleurl; $fitter = new fitting($kll_id); $theFit = $fitter->displayFitting(); if ($home->kll_id) { $km = Cacheable::factory('Kill', $home->kll_id); } else { $km = new Kill($home->kll_external_id, true); $km = $home->kill->getID(); } if (!$km->exists()) { $html = "That kill doesn't exist."; $home->page->setContent($html); $home->page->generate($html); exit; } //echo "-->".$km->getExternalID()."<br />"; if ($km->getExternalID() != 0) { //echo "Yes<br />"; self::$extid = $km->getExternalID(); } else { //echo "No<br />"; $qry = new DBQuery(); $qry->execute("SELECT kll_external_id FROM kb3_kills WHERE kll_id = '" . $home->kll_id . "';"); $row = $qry->getRow(); if ($row['kll_external_id'] != 0) { //echo "Yes ".$row['kll_external_id']."br />"; self::$extid = $row['kll_external_id']; } else { //echo "No<br />"; self::$extid = 0; } } fittingTools::source($kll_id, $km->getExternalID()); $corp = ""; $alli = ""; $char = ""; $ship = ""; $weap = ""; $topdamage = 0; $maxdamage = -1; foreach ($km->getInvolved() as $inv) { /*echo "<pre>"; print_r($inv); echo "</pre>";*/ if ($inv->getDamageDone() > $maxdamage) { if ($km->getFBPilotID() == $inv->getPilotID()) { $maxdamage = $inv->getDamageDone(); //$topdamage = $inv; $corp = $inv->getCorpID(); $alli = $inv->getAllianceID(); $char = $inv->getPilotID(); $ship = $inv->getShipID(); $weap = $inv->getWeaponID(); $fcorp = $inv->getCorpID(); $falli = $inv->getAllianceID(); $fchar = $inv->getPilotID(); $fship = $inv->getShipID(); $fweap = $inv->getWeaponID(); } else { $maxdamage = $inv->getDamageDone(); //$topdamage = $inv; $corp = $inv->getCorpID(); $alli = $inv->getAllianceID(); $char = $inv->getPilotID(); $ship = $inv->getShipID(); $weap = $inv->getWeaponID(); } } else { if ($km->getFBPilotID() == $inv->getPilotID()) { $fcorp = $inv->getCorpID(); $falli = $inv->getAllianceID(); $fchar = $inv->getPilotID(); $fship = $inv->getShipID(); $fweap = $inv->getWeaponID(); } } } $plt = new Pilot($char); $charIcon = $plt->getPortraitURL(64); $charName = $plt->getName(); $charURL = edkURI::page('pilot_detail', $char, 'plt_id'); $clt = new Corporation($corp, false); $corpIcon = $clt->getPortraitURL(32); $corpName = $clt->getName(); $corpURL = edkURI::page('corp_detail', $corp, 'crp_id'); $alt = new Alliance($alli, false); $alliIcon = $alt->getPortraitURL(32); $alliName = $alt->getName(); $alliURL = edkURI::page('alliance_detail', $corp, 'all_id'); $slt = new Ship($ship); $shipIcon = $slt->getImage(32); $shipName = $slt->getName(); $shipURL = edkURI::page('invtype', $ship, 'id'); $ilt = new Item($weap); $weapIcon = $ilt->getIcon(32); $weapURL = edkURI::page('invtype', $weap, 'id'); $smarty->assign('topgetCorpID', $corp); $smarty->assign('topgetAllianceID', $alli); $smarty->assign('topgetPilotID', $char); $smarty->assign('topgetShipID', $ship); $smarty->assign('topgetWeaponID', $weap); $smarty->assign('topgetCorpIcon', $corpIcon); $smarty->assign('topgetAllianceIcon', $alliIcon); $smarty->assign('topgetPilotIcon', $charIcon); $smarty->assign('topgetShipIcon', $shipIcon); $smarty->assign('topgetWeaponIcon', $weapIcon); $smarty->assign('topgetCorpName', $corpName); $smarty->assign('topgetAllianceName', $alliName); $smarty->assign('topgetPilotName', $charName); $smarty->assign('topgetShipName', $shipName); $smarty->assign('topgetCorpURL', $corpURL); $smarty->assign('topgetAllianceURL', $alliURL); $smarty->assign('topgetPilotURL', $charURL); $smarty->assign('topgetShipURL', $shipURL); $smarty->assign('topgetWeaponURL', $weapURL); $fplt = new Pilot($fchar); $fcharIcon = $fplt->getPortraitURL(64); $fcharName = $fplt->getName(); $fcharURL = edkURI::page('pilot_detail', $fchar, 'plt_id'); $fclt = new Corporation($fcorp, false); $fcorpIcon = $fclt->getPortraitURL(32); $fcorpName = $fclt->getName(); $fcorpURL = edkURI::page('corp_detail', $fcorp, 'crp_id'); $falt = new Alliance($falli, false); $falliIcon = $falt->getPortraitURL(32); $falliName = $falt->getName(); $falliURL = edkURI::page('alliance_detail', $fcorp, 'all_id'); $fslt = new Ship($fship); $fshipIcon = $fslt->getImage(32); $fshipName = $fslt->getName(); $fshipURL = edkURI::page('invtype', $fship, 'id'); $filt = new Item($fweap); $fweapIcon = $filt->getIcon(32); $fweapURL = edkURI::page('invtype', $fweap, 'id'); $smarty->assign('fingetCorpID', $fcorp); $smarty->assign('fingetAllianceID', $falli); $smarty->assign('fingetPilotID', $fchar); $smarty->assign('fingetShipID', $fship); $smarty->assign('fingetWeaponID', $fweap); $smarty->assign('fingetCorpIcon', $fcorpIcon); $smarty->assign('fingetAllianceIcon', $falliIcon); $smarty->assign('fingetPilotIcon', $fcharIcon); $smarty->assign('fingetShipIcon', $fshipIcon); $smarty->assign('fingetWeaponIcon', $fweapIcon); $smarty->assign('fingetCorpName', $fcorpName); $smarty->assign('fingetAllianceName', $falliName); $smarty->assign('fingetPilotName', $fcharName); $smarty->assign('fingetShipName', $fshipName); $smarty->assign('fingetCorpURL', $fcorpURL); $smarty->assign('fingetAllianceURL', $falliURL); $smarty->assign('fingetPilotURL', $fcharURL); $smarty->assign('fingetShipURL', $fshipURL); $smarty->assign('fingetWeaponURL', $fweapURL); //echo self::$extid."<br />"; //echo "-> ".edkURI::page('pilot_detail', $km->getVictimID(), 'plt_id'); $plt = new Pilot($km->getVictimID()); $victimPortrait = $plt->getPortraitURL(64); $victimURL = edkURI::page('pilot_detail', $km->getVictimID(), 'plt_id'); $victimExtID = $plt->getExternalID(); $victimCorpURL = edkURI::page('corp_detail', $km->getVictimCorpID(), 'crp_id'); $victimCorpName = $km->getVictimCorpName(); $victimAllianceURL = edkURI::page('alliance_detail', $km->getVictimAllianceID(), 'all_id'); $victimAllianceName = $km->getVictimAllianceName(); $victimDamageTaken = $km->getDamageTaken(); $getISKLoss = number_format($km->getISKLoss()); $smarty->assign('victimDamageTaken', $victimDamageTaken); $corp = new Corporation($km->getVictimCorpID(), false); //echo $corp->getPortraitURL(32); $alliance = new Alliance($km->getVictimAllianceID(), false); //echo $alliance->getPortraitURL(32); if ($km->isClassified()) { //Admin is able to see classified Systems if ($home->page->isAdmin()) { $system = $km->getSystem()->getName() . ' (Classified)'; $region = $km->getSystem()->getRegionName(); $systemURL = edkURI::page('system_detail', $km->getSystem()->getID(), 'sys_id'); $systemSecurity = $km->getSystem()->getSecurity(true); } else { $system = 'Classified'; $region = $km->getSystem()->getRegionName(); $systemURL = ""; $systemSecurity = '0.0'; } } else { $system = $km->getSystem()->getName(); $region = $km->getSystem()->getRegionName(); $systemURL = edkURI::page('system_detail', $km->getSystem()->getID(), 'sys_id'); $systemSecurity = $km->getSystem()->getSecurity(true); } // Ship detail $ship = $km->getVictimShip(); $shipclass = $ship->getClass(); $shipname = $ship->getName(); $victimShipClassName = $shipclass->getName(); $timeStamp = $km->getTimeStamp(); $victimShipID = edkURI::page('invtype', $ship->getExternalID(), 'id'); if ($home->page->isAdmin()) { $smarty->assign('ship', $ship); } self::$shipStats->setPilotName($km->getVictimName()); self::$shipStats->setPilotCorp($victimCorpName); self::$shipStats->setPilotAlliance($victimAllianceName); self::$shipStats->setPilotShip($shipname); self::$shipStats->setPilotLoc($system); self::$shipStats->setPilotLocReg($region); self::$shipStats->setPilotLocSec($systemSecurity); self::$shipStats->setPilotDate($timeStamp); self::$shipStats->setPilotDam($victimDamageTaken); self::$shipStats->setPilotCos($getISKLoss); self::$shipStats->setPilotShipClass($victimShipClassName); self::$shipStats->setCorpPort($corp->getPortraitURL(32)); self::$shipStats->setAlliPort($alliance->getPortraitURL(32)); self::$shipStats->setPilotPort($victimPortrait); self::$shipStats->setPilotNameURL($victimURL); self::$shipStats->setPilotCorpURL($victimCorpURL); self::$shipStats->setPilotAllianceURL($victimAllianceURL); self::$shipStats->setPilotShipURL($victimShipID); self::$shipStats->setPilotLocURL($systemURL); fittingTools::getShipStats($shipname); fittingTools::moduleInfo($theFit); /*fittingTools::getModuleStats();*/ fittingTools::returnShipSkills(); fittingTools::shipEffects(); fittingTools::setlevel5Skills(); fittingTools::getExtraStats(); fittingTools::getCPUandPowerValues(); $html = fittingTools::displayShipStats($shipname, 100, 100); return $html; }