Example #1
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'));
 }
Example #2
0
 /**
  * @return integer
  */
 function getPilotID()
 {
     return $this->pilot_->getID();
 }
Example #3
0
} else {
    $plt_ext_id = (int) edkURI::getArg('ext');
    if ($plt_ext_id) {
        $pilot = new Pilot(0, $plt_id);
        $plt_id = $pilot->getID();
    } else {
        $plt_id = edkURI::getArg('id');
        if (!$plt_id) {
            errorPic('No pilot id specified.');
            $pilot = new Pilot();
        } else {
            if ($plt_id < 1000000) {
                $pilot = Cacheable::factory('Pilot', $plt_id);
            } else {
                $pilot = new Pilot(0, $plt_id);
                $plt_id = $pilot->getID();
            }
        }
    }
}
if (!$plt_ext_id) {
    $plt_ext_id = $pilot->getExternalID();
}
// If we still don't have an external ID then just use the internal for names.
if (!$plt_ext_id) {
    $plt_ext_id = $plt_id;
}
if (!$pilot->exists()) {
    errorPic('That pilot doesnt exist.');
}
$corp = $pilot->getCorp();
Example #4
0
<?php

/**
 * @package EDK
 */
$page = new Page('Signature Listing');
$signatures = array();
$dir = opendir(dirname(__FILE__) . '/signatures');
while ($line = readdir($dir)) {
    if (file_exists(dirname(__FILE__) . '/signatures/' . $line . '/' . $line . '.php')) {
        $signatures[] = $line;
    }
}
$smarty->assign('signatures', $signatures);
$smarty->assign('kb_host', KB_HOST);
if (intval($_GET['ext'])) {
    $pilot = new Pilot(0, $_GET['ext']);
    $smarty->assign('pilot', intval($pilot->getID()));
} else {
    $smarty->assign('pilot', intval($_GET['i']));
}
$page->setContent($smarty->fetch('file:' . dirname(__FILE__) . '/sig_list.tpl'));
$page->generate();
Example #5
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;
 }