Пример #1
0
 /**
  *  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'));
 }
Пример #2
0
 /**
  *  Show the overall statistics for this alliance.
  *
  * @global Smarty $smarty
  * @return string
  */
 function stats()
 {
     global $smarty;
     if ($this->alliance->isFaction()) {
         $this->page->setTitle(Language::get('page_faction_det') . ' - ' . $this->alliance->getName() . " [" . $this->alliance->getshortName() . "]");
     } else {
         $this->page->setTitle(Language::get('page_all_det') . ' - ' . $this->alliance->getName() . " [" . $this->alliance->getshortName() . "]");
     }
     $sql = "select crp_id from kb3_corps WHERE crp_all_id=" . $this->alliance->getID();
     $qry = DBFactory::getDBQuery();
     $qry->execute($sql);
     while ($row = $qry->getRow()) {
         $this->allianceCorps[] = Corporation::getByID((int) $row['crp_id']);
     }
     if (!isset($this->kill_summary)) {
         $this->kill_summary = new KillSummaryTable();
         $this->kill_summary->addInvolvedAlliance($this->alliance);
         $this->kill_summary->generate();
     }
     $execcrp = Corporation::lookupByExternalID($this->alliance->GetExecutorID());
     if ($execcrp !== false) {
         $smarty->assign('ExecutorName', $execcrp->getName());
     } else {
         $smarty->assign('ExecutorName', '');
     }
     $smarty->registerObject('Alliance', $this->alliance);
     $smarty->assign('memberCorpCount', count($this->allianceCorps));
     if ($this->kill_summary->getTotalKillISK()) {
         $efficiency = round($this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()) * 100, 2);
     } else {
         $efficiency = 0;
     }
     // The summary table is also used by the stats. Whichever is called
     // first generates the table.
     $smarty->assign('all_img', $this->alliance->getPortraitURL(128));
     $smarty->assign('totalkills', $this->kill_summary->getTotalKills());
     $smarty->assign('totallosses', $this->kill_summary->getTotalLosses());
     $smarty->assign('totalkisk', round($this->kill_summary->getTotalKillISK() / 1000000000, 2));
     $smarty->assign('totallisk', round($this->kill_summary->getTotalLossISK() / 1000000000, 2));
     if ($this->kill_summary->getTotalKillISK()) {
         $smarty->assign('efficiency', round($this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()) * 100, 2));
     } else {
         $smarty->assign('efficiency', '0');
     }
     return $smarty->fetch(get_tpl('alliance_detail_stats'));
 }
Пример #3
0
 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'));
 }
Пример #4
0
/**
 * 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;
}
Пример #5
0
     foreach ($permissions as $typ => $id_array) {
         foreach ($id_array as $id) {
             $conf[] = $typ . $id;
         }
     }
     config::set('post_permission', implode(',', $conf));
 }
 asort($permissions['a']);
 asort($permissions['c']);
 asort($permissions['p']);
 $permt = array();
 foreach ($permissions as $typ => $ids) {
     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);
         }
Пример #6
0
 $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();
             $typeURL = edkURI::page('system_detail', $ctrTypeID, 'sys_id');
             break;
     }
     if ($typeURL) {
         $html .= '<tr class=kb-table-row-odd><td class=kb-table-cell><b><a href="' . $typeURL . '">' . $name . '</b></td><td class=kb-table-cell align=center>';
Пример #7
0
 /**
  * Remove selected alliances then return an array of alliances remaining.
  */
 public static function removeAlliance()
 {
     if (isset($_POST['option_rem_allianceid']) && $_POST['option_rem_allianceid']) {
         $arr = config::get('cfg_allianceid');
         $key = array_search(intval($_POST['option_rem_allianceid']), $arr);
         if ($key !== false) {
             unset($arr[$key]);
         }
         sort($arr);
         config::set('cfg_allianceid', $arr);
         unset($_POST['option_rem_allianceid']);
     }
     $options = array();
     foreach (config::get('cfg_allianceid') as $val) {
         $all = new Alliance($val);
         $options[$all->getName()] = array('value' => $val, 'descr' => $all->getName(), 'state' => 0);
     }
     ksort($options);
     array_unshift($options, array('value' => '0', 'descr' => '-', 'state' => 1));
     return $options;
 }
 function generate()
 {
     global $smarty;
     $prevdate = "";
     $this->kill_list_->rewind();
     $smarty->assign('daybreak', $this->daybreak_);
     $smarty->assign('comments_count', config::get('comments_count'));
     // evil hardcode-hack, don't do this at home kids ! ;)
     if (config::get('style_name') == 'revelations') {
         $smarty->assign('comment_white', '_white');
     }
     $c = 0;
     $kdpage = array('a', 'kill_detail', true);
     $krpage = array('a', 'kill_related', true);
     $kills = array();
     while ($kill = $this->kill_list_->getKill()) {
         if ($this->limit_ && $c >= $this->limit_) {
             break;
         } else {
             $c++;
         }
         $curdate = substr($kill->getTimeStamp(), 0, 10);
         if ($curdate != $prevdate) {
             if (count($kills) && $this->daybreak_) {
                 $kl[] = array('kills' => $kills, 'date' => strtotime($prevdate));
                 $kills = array();
             }
             $prevdate = $curdate;
         }
         $kll = array();
         $kll['id'] = $kill->getID();
         $kll['victimshipimage'] = $kill->getVictimShipImage(32);
         $kll['victimshipname'] = $kill->getVictimShipName();
         $kll['victimshipclass'] = $kill->getVictimShipClassName();
         $kll['victim'] = $kill->getVictimName();
         $kll['victimiskloss'] = $kill->getISKLoss();
         if ($kll['victimiskloss'] > 1000000000) {
             $kll['victimiskloss'] = sprintf("%.01fb", $kll['victimiskloss'] / 1000000000);
         } elseif ($kll['victimiskloss'] > 1000000) {
             $kll['victimiskloss'] = sprintf("%.01fm", $kll['victimiskloss'] / 1000000);
         } elseif ($kll['victimiskloss'] > 1000) {
             $kll['victimiskloss'] = sprintf("%.0fk", $kll['victimiskloss'] / 1000);
         }
         $kll['victimcorp'] = $kill->getVictimCorpName();
         $kll['victimalliancename'] = $kill->getVictimAllianceName();
         $kll['fb'] = $kill->getFBPilotName();
         $kll['fbcorp'] = $kill->getFBCorpName();
         if ($kill->isClassified() && !Session::isAdmin()) {
             if (config::get('killlist_regionnames')) {
                 $kll['region'] = Language::get("classified");
             }
             $kll['systemsecurity'] = "-";
             $kll['system'] = Language::get("classified");
         } else {
             if (config::get('killlist_regionnames')) {
                 $kll['region'] = $kill->getSystem()->getRegionName();
             }
             $kll['systemsecurity'] = $kill->getSolarSystemSecurity();
             $kll['system'] = $kill->getSolarSystemName();
         }
         $kll['victimid'] = $kill->getVictimID();
         $kll['victimcorpid'] = $kill->getVictimCorpID();
         $kll['victimallianceid'] = $kill->getVictimAllianceID();
         $kll['victimshipid'] = $kill->getVictimShipExternalID();
         $kll['fbid'] = $kill->getFBPilotID();
         $kll['fbcorpid'] = $kill->getFBCorpID();
         $kll['inv'] = 0;
         if (config::get('killlist_involved')) {
             $kll['inv'] = $kill->getInvolvedPartyCount();
         }
         $kll['timestamp'] = $kill->getTimeStamp();
         if (config::get('killlist_alogo')) {
             // Need to return yet another value from killlists.
             $all = new Alliance($kill->getVictimAllianceID());
             if (strcasecmp($all->getName(), "None") != 0) {
                 $kll['allianceexists'] = true;
                 $kll['victimallianceicon'] = $all->getPortraitURL(32);
             } else {
                 $kll['allianceexists'] = true;
                 $crp = new Corporation($kill->getVictimCorpID());
                 $kll['victimallianceicon'] = $crp->getPortraitURL(32);
             }
         }
         if (isset($kill->_tag)) {
             $kll['tag'] = $kill->_tag;
         }
         $kll['fbplext'] = $kill->getFBPilotExternalID();
         $kll['plext'] = $kill->getFBPilotExternalID();
         if (config::get('comments_count')) {
             $kll['commentcount'] = $kill->countComment();
         }
         $kll['loss'] = false;
         $kll['kill'] = false;
         if ($this->combined_) {
             if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) {
                 $kll['loss'] = true;
             } else {
                 if (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) {
                     $kll['loss'] = true;
                 } else {
                     if (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
                         $kll['loss'] = true;
                     }
                 }
             }
             $kll['kill'] = !$kll['loss'];
         }
         $kll['urldetail'] = edkURI::build($kdpage, array('kll_id', $kll['id'], true));
         if (!$kill->isClassified()) {
             $kll['urlrelated'] = edkURI::build($krpage, array('kll_id', $kll['id'], true));
         }
         $kll['victimextid'] = $kill->getVictimExternalID();
         $kll['urlvictim'] = edkURI::page('pilot_detail', $kll['victimextid'] ? $kll['victimextid'] : $kll['victimid'], $kll['victimextid'] ? 'plt_ext_id' : 'plt_id');
         $kll['urlfb'] = edkURI::page('pilot_detail', $kll['fbplext'] ? $kll['fbplext'] : $kll['fbid'], $kll['fbplext'] ? 'plt_ext_id' : 'plt_id');
         if ($kll['allianceexists']) {
             $kll['urlvictimall'] = edkURI::page('alliance_detail', $kll['victimallianceid'], 'all_id');
         }
         $kll['urlvictimcorp'] = edkURI::page('corp_detail', $kll['victimcorpid'], 'crp_id');
         $kll['urlfbcorp'] = edkURI::page('corp_detail', $kll['fbcorpid'], 'crp_id');
         event::call('killlist_table_kill', $kll);
         $kills[] = $kll;
     }
     event::call('killlist_table_kills', $kills);
     if (count($kills)) {
         $kl[] = array('kills' => $kills, 'date' => strtotime($prevdate));
     }
     $smarty->assignByRef('killlist', $kl);
     $smarty->assign('killlist_iskloss', config::get('killlist_iskloss'));
     return $smarty->fetch(getcwd() . "/mods/highlight_capitals/templates/killlisttable.tpl");
 }
Пример #9
0
 /**
  * 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;
 }
Пример #10
0
if (!$settingsPage && !file_exists('common/' . $page . '.php') && !$modOverrides) {
    $page = 'home';
}
$smarty->assign('theme_name', $themename);
$smarty->assign('theme_url', THEME_URL);
$smarty->assign('img_url', IMG_URL);
$smarty->assign('img_host', IMG_HOST);
$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());
    }
Пример #11
0
 /**
  * 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;
 }
Пример #12
0
 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;
 }