예제 #1
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page();
     $this->plt_id = (int) edkURI::getArg('plt_id');
     if (!$this->plt_id) {
         $this->plt_external_id = (int) edkURI::getArg('plt_ext_id');
         if (!$this->plt_external_id) {
             $id = (int) edkURI::getArg('id', 1);
             // Arbitrary number bigger than we expect to reach locally
             if ($id > 1000000) {
                 $this->plt_external_id = $id;
             } else {
                 $this->plt_id = $id;
             }
         }
     }
     $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2));
     if ($this->view) {
         $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
     }
     if (!$this->plt_id) {
         if ($this->plt_external_id) {
             $this->pilot = new Pilot(0, $this->plt_external_id);
             $this->plt_id = $this->pilot->getID();
         } else {
             $html = 'That pilot doesn\'t exist.';
             $this->page->generate($html);
             exit;
         }
     } else {
         $this->pilot = Cacheable::factory('Pilot', $this->plt_id);
         $this->plt_external_id = $this->pilot->getExternalID();
     }
     $this->page->setTitle('Pilot details - ' . $this->pilot->getName());
     if (!$this->pilot->exists()) {
         $html = 'That pilot doesn\'t exist.';
         $this->page->setContent($html);
         $this->page->generate();
         exit;
     }
     if ($this->plt_external_id) {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::page('pilot_detail', $this->plt_external_id, 'plt_ext_id') . "' />");
     } else {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::page('pilot_detail', $this->plt_id, 'plt_id') . "' />");
     }
     $this->corp = $this->pilot->getCorp();
     $this->alliance = $this->corp->getAlliance();
 }
예제 #2
0
 function generate()
 {
     global $smarty;
     $this->toplist->generate();
     $i = 1;
     while ($row = $this->toplist->getRow()) {
         /* @var $corp Corporation */
         $corp = Cacheable::factory('Corporation', $row['crp_id']);
         if ($corp->getExternalID()) {
             $uri = KB_HOST . "/?a=corp_detail&amp;crp_ext_id=" . $corp->getExternalID();
         } else {
             $uri = KB_HOST . "/?a=corp_detail&amp;crp_id=" . $row['crp_id'];
         }
         $rows[] = array('rank' => $i, 'name' => $corp->getName(), 'uri' => $uri, 'portrait' => imageURL::getURL('Corporation', $corp->getExternalID(false), 32), 'count' => $row['cnt']);
         $i++;
     }
     $smarty->assign('tl_name', 'Corporation');
     $smarty->assign('tl_type', $this->entity_);
     $smarty->assignByRef('tl_rows', $rows);
     return $smarty->fetch(get_tpl('toplisttable'));
 }
예제 #3
0
 /**
  * Return a new object by ID. Will fetch from cache if enabled.
  *
  * @param mixed $id ID to fetch
  * @return Alliance
  */
 static function getByID($id)
 {
     return Cacheable::factory(get_class(), $id);
 }
예제 #4
0
function handle_involved($kill, $side, &$pilots, $sideAssignmentMap = array(), $completeInformation = FALSE)
{
    // -------------------------------------------------------------------------
    // FIX BATTLE REPORT a little by Evoke. Salvoxia
    // BEGIN
    // -------------------------------------------------------------------------
    // we dont want our corp/alliance to show up on the enemy's side
    if ($side == 'e') {
        if (config::get('cfg_corpid')) {
            $corpId = config::get('cfg_corpid');
            $corpId = $corpId[0];
            $excludeWhere = "AND ind_crp_id != {$corpId}";
        } elseif (config::get('cfg_allianceid')) {
            $allianceId = config::get('cfg_allianceid');
            $allianceId = $allianceId[0];
            $excludeWhere = "AND ind_all_id != {$allianceId}";
        } else {
            $excludeWhere = "";
        }
    }
    // we need to get all involved pilots, killlists dont supply them
    $qry = DBFactory::getDBQuery();
    $sql = "select ind_plt_id AS ind_plt_id, ind_crp_id, ind_all_id, ind_sec_status, ind_shp_id, ind_wep_id, ind_dmgdone,\n            typeName, plt_name, crp_name, all_name, scl_points, scl_id, scl_class\n            from kb3_inv_detail\n            left join kb3_invtypes on ind_wep_id=typeID\n            left join kb3_pilots on ind_plt_id=plt_id\n            left join kb3_corps on ind_crp_id=crp_id\n            left join kb3_alliances on ind_all_id=all_id\n            left join kb3_ships on ind_shp_id=shp_id\n            left join kb3_ship_classes on shp_class=scl_id\n            where ind_kll_id = " . $kill->getID() . " {$excludeWhere}\n            order by ind_order";
    $qry->execute($sql);
    while ($row = $qry->getRow()) {
        if (config::get('fleet_battles_mod_sideassign')) {
            // determine whether the pilot is member of an alliance
            if ($row["all_name"] == "None") {
                $entityType = "corp";
                $entityId = $row["ind_crp_id"];
            } else {
                $entityType = "alliance";
                $entityId = $row["ind_all_id"];
            }
            if (isset($sideAssignmentMap[$entityType][$entityId])) {
                $pilotSide = $sideAssignmentMap[$entityType][$entityId];
            } else {
                $pilotSide = $side;
            }
        } else {
            $pilotSide = $side;
        }
        // check for manual side assignment for pilot
        $ship = Cacheable::factory('Ship', $row['ind_shp_id']);
        $shipc = Cacheable::factory('ShipClass', $row['scl_id']);
        // check for npc names (copied from pilot class)
        $pos = strpos($row['plt_name'], "#");
        if ($pos !== false) {
            $name = explode("#", $row['plt_name']);
            $item = Item::getByID($name[2]);
            $row['plt_name'] = $item->getName();
        }
        // dont set pods as ships for pilots we already have
        if (isset($pilots[$pilotSide][$row['ind_plt_id']])) {
            if ($row['scl_id'] == 18 || $row['scl_id'] == 2) {
                continue;
            }
        }
        // search for ships with the same id
        if (isset($pilots[$pilotSide][$row['ind_plt_id']]) && is_array($pilots[$pilotSide][$row['ind_plt_id']])) {
            foreach ($pilots[$pilotSide][$row['ind_plt_id']] as $id => $_ship) {
                if ($row['ind_shp_id'] == $_ship['sid']) {
                    // we already got that pilot in this ship, continue
                    $pilots[$pilotSide][$row['ind_plt_id']][0]["times"] += 1;
                    // add up his damage done
                    $pilots[$pilotSide][$row['ind_plt_id']][0]["damage"] += $row['ind_dmgdone'];
                    continue 2;
                }
            }
        }
        if ($completeInformation) {
            $pilots[$pilotSide][$row['ind_plt_id']][] = array('name' => $row['plt_name'], 'plt_url' => edkURI::page("pilot_detail", $row["ind_plt_id"], "plt_id"), 'sid' => $row['ind_shp_id'], 'spic' => imageURL::getURL('Ship', $ship->getID(), 32), 'aid' => $row['ind_all_id'], 'ts' => strtotime($kill->getTimeStamp()), 'corp' => $row['crp_name'], 'alliance' => $row['all_name'], 'alliance_url' => edkURI::page("alliance_detail", $row['ind_all_id'], "all_id"), 'scl' => $row['scl_points'], 'ship' => $ship->getName(), 'shipClass' => $row['scl_class'], 'shipClassObject' => $shipc, 'weapon' => $row['itm_name'], 'cid' => $row['ind_crp_id'], 'crp_url' => edkURI::page("corp_detail", $row['ind_crp_id'], "crp_id"), 'times' => 1, 'damage' => $row['ind_dmgdone'], 'color' => getColorClassByClass($shipc));
        } else {
            $pilots[$pilotSide][$row['ind_plt_id']] = 1;
        }
    }
}
예제 #5
0
파일: sig.php 프로젝트: biow0lf/evedev-kb
$plt_id = (int) edkURI::getArg('i');
if ($plt_id) {
    $pilot = Cacheable::factory('Pilot', $plt_id);
} 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()) {
예제 #6
0
 /**
  * @param SimpleXMLElement $inv
  * @param Kill $kill
  * @param string $time YYYY-mm-dd hh:ss
  * @return boolean false on error
  */
 private function processInvolved($inv, &$kill, $time)
 {
     if (!(int) $inv['shipTypeID'] && !(int) $inv['weaponTypeID'] && !(int) $inv['characterID'] && !(string) $inv['characterName']) {
         $this->parsemsg[] = "Involved party blank.";
         return false;
     }
     $npc = false;
     $ship = Ship::getByID((int) $inv['shipTypeID']);
     $weapon = Cacheable::factory('Item', (int) $inv['weaponTypeID']);
     $alliance = new Alliance();
     if ((int) $inv['allianceID']) {
         $alliance = Alliance::add(strval($inv['allianceName']), (int) $inv['allianceID']);
     } else {
         if ((int) $inv['factionID']) {
             $alliance = Alliance::add(strval($inv['factionName']), (int) $inv['factionID']);
         } else {
             $alliance = Alliance::add("None");
         }
     }
     // get alliance from corp if ship is any kind of tower
     $shipClassID = $ship->getClass()->getID();
     if ($shipClassID == 35 || $shipClassID == 36 || $shipClassID == 37) {
         $corpByName = Corporation::lookup(strval($inv['corporationName']));
         if ($corpByName) {
             $alliance = $corpByName->getAlliance();
         }
     }
     $corp = Corporation::add(strval($inv['corporationName']), $alliance, $time, (int) $inv['corporationID']);
     $charid = (int) $inv['characterID'];
     $charname = (string) $inv['characterName'];
     // Allow for blank names for consistency with CCP API.
     if (preg_match("/(Mobile (Large|Medium|Small) Warp Disruptor I?I?|\\w+ Control Tower( \\w+)?)/", $charname)) {
         $charname = $inv['corporationName'] . ' - ' . $charname;
         $charid = 0;
     } else {
         if ($charname == "" && preg_match("/(Mobile \\w+ Warp|\\w+ Control Tower( \\w+)?)/", $weapon->getName())) {
             $charname = $inv['corporationName'] . ' - ' . $weapon->getName();
             $charid = 0;
         } else {
             if ($charname == "" && !$charid) {
                 // NPC ship
                 $ship = Ship::lookup("Unknown");
                 $weapon = Item::getByID((int) $inv['shipTypeID']);
                 $charname = $weapon->getName();
                 $npc = true;
                 $charid = $weapon->getID();
             } else {
                 if ($charname == "" && $charid) {
                     // Bugged kill
                     $this->parsemsg[] = "Involved party has blank pilot name.";
                     return false;
                 }
             }
         }
     }
     $pilot = Pilot::add((string) $charname, $corp, $time, $charid);
     $iparty = new InvolvedParty($pilot->getID(), $corp->getID(), $alliance->getID(), (double) $inv['securityStatus'], $ship->getID(), $weapon->getID(), (int) $inv['damageDone']);
     $kill->addInvolvedParty($iparty);
     if ((int) $inv['finalBlow'] == 1) {
         $kill->setFBPilotID($pilot->getID());
     }
     $this->npcOnly = $this->npcOnly && $npc;
     return true;
 }
예제 #7
0
popup| <?php 
/**
 * @package EDK
 */
$kll_id = (int) edkURI::getArg('kll_id', 1);
$kill = Cacheable::factory('Kill', $kll_id);
$html = $kill->getRawMail();
event::call("killmail_popup", $html);
$smarty->assign('rawMail', $html);
echo $smarty->fetch(get_tpl("kill_mail"));
예제 #8
0
            $url = edkURI::page('alliance_detail', $alls[0], 'all_id');
        }
        header("Location: " . htmlspecialchars_decode($url));
        die;
    } elseif (config::get('cfg_corpid')) {
        $corps = config::get('cfg_corpid');
        /* @var $corp Corporation */
        $corp = Cacheable::factory('Corporation', $corps[0]);
        if ($corp->getExternalID()) {
            $url = edkURI::page('corp_detail', $corp->getExternalID(), 'crp_ext_id');
        } else {
            $url = edkURI::page('corp_detail', $corps[0], 'crp_id');
        }
        header("Location: " . htmlspecialchars_decode($url));
        die;
    } elseif (config::get('cfg_pilotid')) {
        $pilots = config::get('cfg_pilotid');
        /* @var $pilot Pilot */
        $pilot = Cacheable::factory('Pilot', $pilots[0]);
        if ($pilot->getExternalID()) {
            $url = edkURI::page('pilot_detail', $pilot->getExternalID(), 'plt_ext_id');
        } else {
            $url = edkURI::page('pilot_detail', $pilots[0], 'plt_id');
        }
        header("Location: " . htmlspecialchars_decode($url));
        die;
    } else {
        header("Location: " . htmlspecialchars_decode(edkURI::page('about')));
        die;
    }
}
예제 #9
0
 /**
  * Get a cached object by ID
  * @param integer $id
  * @return Cacheable Returns an object of the called class type for the
  * given $id
  */
 public static function getByID($id)
 {
     return Cacheable::factory(get_called_class(), (int) $id);
 }
예제 #10
0
 /**
  * @deprecated
  * @return Item
  */
 function getWeapon()
 {
     return Cacheable::factory('Item', $this->weaponid);
 }
예제 #11
0
 /**
  * Return HTML to describe the victim's fitting
  *
  * @global Smarty $smarty
  * @return string HTML to describe the victim's fitting
  */
 function fitting()
 {
     global $smarty;
     if (is_array($this->fitting_array[27])) {
         foreach ($this->fitting_array[27] as $array_rowh) {
             $sort_by_nameh["groupID"][] = $array_rowh["groupID"];
         }
         array_multisort($sort_by_nameh["groupID"], SORT_ASC, $this->fitting_array[27]);
     }
     if (is_array($this->fitting_array[19])) {
         foreach ($this->fitting_array[19] as $array_rowm) {
             $sort_by_namem["groupID"][] = $array_rowm["groupID"];
         }
         array_multisort($sort_by_namem["groupID"], SORT_ASC, $this->fitting_array[19]);
     }
     if (is_array($this->fitting_array[11])) {
         foreach ($this->fitting_array[11] as $array_rowl) {
             $sort_by_namel["groupID"][] = $array_rowl["Name"];
         }
         array_multisort($sort_by_namel["groupID"], SORT_ASC, $this->fitting_array[11]);
     }
     if (is_array($this->fitting_array[92])) {
         foreach ($this->fitting_array[92] as $array_rowr) {
             $sort_by_namer["Name"][] = $array_rowr["Name"];
         }
         array_multisort($sort_by_namer["Name"], SORT_ASC, $this->fitting_array[92]);
     }
     if (is_array($this->fitting_array[125])) {
         foreach ($this->fitting_array[125] as $array_rowr) {
             $sort_by_namer["groupID"][] = $array_rowr["groupID"];
         }
         array_multisort($sort_by_namer["groupID"], SORT_ASC, $this->fitting_array[125]);
     }
     //Fitting - KE, sort the fitted items into name order, so that several of the same item apear next to each other. -end
     $length = count($this->ammo_array[27]);
     $temp = array();
     if (is_array($this->fitting_array[27])) {
         $hiammo = array();
         foreach ($this->fitting_array[27] as $highfit) {
             $group = $highfit["groupID"];
             $size = $highfit["chargeSize"];
             if ($group == 483 || $group == 53 || $group == 55 || $group == 74 || $group >= 506 && $group <= 511 || $group == 481 || $group == 899 || $group == 771 || $group == 589 || $group == 524) {
                 $found = 0;
                 if ($group == 511) {
                     $group = 509;
                 }
                 // Assault Missile Lauchers uses same ammo as Standard Missile Lauchers
                 if (is_array($this->ammo_array[27])) {
                     $i = 0;
                     while (!$found && $i < $length) {
                         $temp = array_shift($this->ammo_array[27]);
                         if ($temp["usedgroupID"] == $group && $temp["size"] == $size) {
                             $hiammo[] = array('type' => $temp["Icon"]);
                             $found = 1;
                         }
                         $this->ammo_array[27][] = $temp;
                         $i++;
                     }
                 }
                 if (!$found) {
                     $hiammo[] = array('type' => "<img src='" . IMG_URL . "/items/24_24/icon09_13.png' alt='' />");
                 }
             } else {
                 $hiammo[] = array('type' => $smarty->fetch(get_tpl('blank')));
             }
         }
     }
     $length = count($this->ammo_array[19]);
     if (is_array($this->fitting_array[19])) {
         $midammo = array();
         foreach ($this->fitting_array[19] as $midfit) {
             $group = $midfit["groupID"];
             if ($group == 76 || $group == 208 || $group == 212 || $group == 291 || $group == 213 || $group == 209 || $group == 290) {
                 $found = 0;
                 if (is_array($this->ammo_array[19])) {
                     $i = 0;
                     while (!$found && $i < $length) {
                         $temp = array_shift($this->ammo_array[19]);
                         if ($temp["usedgroupID"] == $group) {
                             $midammo[] = array('type' => $temp["Icon"]);
                             $found = 1;
                         }
                         $this->ammo_array[19][] = $temp;
                         $i++;
                     }
                 }
                 if (!$found) {
                     $midammo[] = array('type' => "<img src='" . IMG_URL . "/items/24_24/icon09_13.png' alt='' />");
                 }
             } else {
                 $midammo[] = array('type' => $smarty->fetch(get_tpl('blank')));
             }
         }
     }
     $smarty->assignByRef('fitting_high', $this->fitting_array[27]);
     $smarty->assignByRef('fitting_med', $this->fitting_array[19]);
     $smarty->assignByRef('fitting_low', $this->fitting_array[11]);
     $smarty->assignByRef('fitting_rig', $this->fitting_array[92]);
     $smarty->assignByRef('fitting_sub', $this->fitting_array[125]);
     $smarty->assignByRef('fitting_ammo_high', $hiammo);
     $smarty->assignByRef('fitting_ammo_mid', $midammo);
     $smarty->assign('showammo', config::get('fp_showammo'));
     $smarty->assign('victimShipBigImage', $this->kill->getVictimShip()->getImage(256));
     if ($this->kill->getExternalID() != 0) {
         $this->verification = true;
         $smarty->assign('verify_id', $this->kill->getExternalID());
     } else {
         $this->verification = false;
     }
     $smarty->assign('verify_yesno', $this->verification);
     //get the actual slot count for each vessel - for the fitting panel
     $dogma = Cacheable::factory('dogma', $this->kill->getVictimShipExternalID());
     $lowcount = (int) $dogma->attrib['lowSlots']['value'];
     $medcount = (int) $dogma->attrib['medSlots']['value'];
     $hicount = (int) $dogma->attrib['hiSlots']['value'];
     $rigcount = (int) $dogma->attrib['rigSlots']['value'];
     $subcount = count($this->fitting_array[125]);
     //This code counts the slots granted by subsystem modules for the fitting panel
     if ($subcount > 0) {
         foreach ($this->fitting_array[125] as $subfit) {
             $lookupRef = $subfit["itemID"];
             $sql = 'SELECT `attributeID`, `value` FROM `kb3_dgmtypeattributes` WHERE ' . '`attributeID` IN (1374, 1375, 1376) AND `typeID` = ' . $lookupRef . ';';
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 switch ($row["attributeID"]) {
                     case '1374':
                         $hicount += $row["value"];
                         break;
                     case '1375':
                         $medcount += $row["value"];
                         break;
                     case '1376':
                         $lowcount += $row["value"];
                         break;
                 }
             }
         }
     }
     $smarty->assign('hic', $hicount);
     $smarty->assign('medc', $medcount);
     $smarty->assign('lowc', $lowcount);
     $smarty->assign('rigc', $rigcount);
     $smarty->assign('subc', $subcount);
     return $smarty->fetch(get_tpl('kill_detail_fitting'));
 }
예제 #12
0
 /**
  * gets all the dropped loot int $dest_array
  * @param KillList $killList
  * @param array $droppedLoot
  * @return string 
  */
 protected static function getDroppedLoot($killList, &$droppedLoot)
 {
     $killList->rewind();
     $totalValue = 0;
     $qry = DBFactory::getDBQuery();
     while ($kill = $killList->getKill()) {
         $query = "SELECT kb3_items_dropped.itd_itm_id AS 'ID', kb3_invtypes.typeName AS 'Name', SUM( kb3_items_dropped.itd_quantity ) AS 'Quantity', AVG( kb3_item_price.price ) AS Price\n                FROM kb3_items_dropped, kb3_invtypes, kb3_item_price\n                WHERE \n                (\n                    (\n                        kb3_items_dropped.itd_itm_id = kb3_invtypes.typeID\n                    )\n                    AND \n                    (\n                        kb3_items_dropped.itd_itm_id = kb3_item_price.typeID\n                    )\n                    AND \n                    (\n                        kb3_items_dropped.itd_kll_id = " . $kill->getID() . ")\n                )\n                GROUP BY kb3_items_dropped.itd_itm_id";
         $qry->execute($query);
         while ($row = $qry->getRow()) {
             if (isset($droppedLoot[$row['Name']]['Quantity']) && is_numeric($droppedLoot[$row['Name']]['Quantity'])) {
                 $droppedLoot[$row['Name']]['Quantity'] += $row['Quantity'];
             } else {
                 $droppedLoot[$row['Name']]['Quantity'] = $row['Quantity'];
             }
             if (config::get('item_values')) {
                 $droppedLoot[$row['Name']]['TValue'] = self::formatIskValue($row['Price'] * $droppedLoot[$row['Name']]['Quantity']);
                 $droppedLoot[$row['Name']]['Value'] = self::formatIskValue($row['Price']);
                 $droppedLoot[$row['Name']]['RawValue'] = $row['Price'];
                 if (!isset($droppedLoot[$row['Name']]['Icon'])) {
                     $item = Cacheable::factory('Item', $row['ID']);
                     $droppedLoot[$row['Name']]['Icon'] = $item->getIcon(24, false);
                 }
                 $totalValue += $row['Quantity'] * $row['Price'];
             }
         }
     }
     return self::formatIskValue($totalValue);
 }
예제 #13
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  */
 function start()
 {
     $this->page = new Page();
     $this->all_id = (int) edkURI::getArg('all_id');
     $this->all_external_id = (int) edkURI::getArg('all_ext_id');
     if (!$this->all_id && !$this->all_external_id) {
         $this->all_id = (int) edkURI::getArg('id', 1);
         // And now a bit of magic to test if this is an external ID
         if ($this->all_id > 500000 && $this->all_id < 500021 || $this->all_id > 1000000) {
             $this->all_external_id = $this->all_id;
             $this->all_id = 0;
         }
     }
     $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2));
     // Search engines should only index the main view.
     if ($this->view) {
         $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
     }
     if (!$this->all_id && !$this->all_external_id) {
         $html = 'No valid alliance id specified.';
         $this->page->setContent($html);
         $this->page->generate();
         exit;
     }
     if (!$this->all_id && $this->all_external_id) {
         $this->alliance = new Alliance($this->all_external_id, true);
         $this->all_id = $this->alliance->getID();
         if (!$this->all_id) {
             echo 'No valid alliance id specified.';
             exit;
         }
     } else {
         $this->alliance = Cacheable::factory('Alliance', $this->all_id);
         $this->all_external_id = $this->alliance->getExternalID();
     }
     $this->page->addHeader("<link rel='canonical' href='" . $this->alliance->getDetailsURL() . "' />");
     if ($this->view) {
         $this->year = (int) edkURI::getArg('y', 3);
         $this->month = (int) edkURI::getArg('m', 4);
     } else {
         $this->year = (int) edkURI::getArg('y', 2);
         $this->month = (int) edkURI::getArg('m', 3);
     }
     if (!$this->month) {
         $this->month = kbdate('m');
     }
     if (!$this->year) {
         $this->year = kbdate('Y');
     }
     if ($this->month == 12) {
         $this->nmonth = 1;
         $this->nyear = $this->year + 1;
     } else {
         $this->nmonth = $this->month + 1;
         $this->nyear = $this->year;
     }
     if ($this->month == 1) {
         $this->pmonth = 12;
         $this->pyear = $this->year - 1;
     } else {
         $this->pmonth = $this->month - 1;
         $this->pyear = $this->year;
     }
     $this->monthname = kbdate("F", strtotime("2000-" . $this->month . "-2"));
     global $smarty;
     $smarty->assign('monthname', $this->monthname);
     $smarty->assign('year', $this->year);
     $smarty->assign('pmonth', $this->pmonth);
     $smarty->assign('pyear', $this->pyear);
     $smarty->assign('nmonth', $this->nmonth);
     $smarty->assign('nyear', $this->nyear);
     if ($this->alliance->isFaction()) {
         $this->page->setTitle(Language::get('page_faction_det') . ' - ' . $this->alliance->getName());
     } else {
         $this->page->setTitle(Language::get('page_all_det') . ' - ' . $this->alliance->getName());
     }
     $smarty->assign('all_name', $this->alliance->getName());
     $smarty->assign('all_id', $this->alliance->getID());
 }
예제 #14
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;
 }
예제 #15
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page('Corporation details');
     $this->scl_id = (int) edkURI::getArg('scl_id');
     $this->crp_id = (int) edkURI::getArg('crp_id');
     if (!$this->crp_id) {
         $this->crp_external_id = (int) edkURI::getArg('crp_ext_id');
         if (!$this->crp_external_id) {
             $id = (int) edkURI::getArg('id', 1);
             // True for NPC corps too, but NPC alliances recorded as corps
             // fail here. Use Jedi mind tricks?
             if ($id > 1000000) {
                 $this->crp_external_id = $id;
             } else {
                 $this->crp_id = $id;
             }
         }
     }
     $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2));
     if ($this->view) {
         $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
     }
     if (!$this->crp_id) {
         if ($this->crp_external_id) {
             $this->corp = new Corporation($this->crp_external_id, true);
             $this->crp_id = $this->corp->getID();
         } else {
             $html = 'That corporation does not exist.';
             $this->page->setContent($html);
             $this->page->generate();
             exit;
         }
     } else {
         $this->corp = Cacheable::factory('Corporation', $this->crp_id);
         $this->crp_external_id = $this->corp->getExternalID();
     }
     if ($this->crp_external_id) {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_ext_id', $this->crp_external_id, true)) . "' />");
     } else {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_id', $this->crp_id, true)) . "' />");
     }
     $this->alliance = $this->corp->getAlliance();
     if ($this->view) {
         $this->year = (int) edkURI::getArg('y', 3);
         $this->month = (int) edkURI::getArg('m', 4);
     } else {
         $this->year = (int) edkURI::getArg('y', 2);
         $this->month = (int) edkURI::getArg('m', 3);
     }
     if (!$this->month) {
         $this->month = kbdate('m');
     }
     if (!$this->year) {
         $this->year = kbdate('Y');
     }
     if ($this->month == 12) {
         $this->nmonth = 1;
         $this->nyear = $this->year + 1;
     } else {
         $this->nmonth = $this->month + 1;
         $this->nyear = $this->year;
     }
     if ($this->month == 1) {
         $this->pmonth = 12;
         $this->pyear = $this->year - 1;
     } else {
         $this->pmonth = $this->month - 1;
         $this->pyear = $this->year;
     }
     $this->monthname = kbdate("F", strtotime("2000-" . $this->month . "-2"));
 }