function generate() { global $smarty; if (!$this->split_ || $this->max_ / $this->split_ <= 1) { return; } $endpage = ceil($this->max_ / $this->split_); $args = edkURI::parseURI(); if ($page = edkURI::getArg('page')) { if (edkURI::getArg('page')) { foreach ($args as $key => $value) { if ($value[0] == 'page') { unset($args[$key]); break; } } } } else { $page = 1; } $url = edkURI::build($args); if (strpos($url, '?') === false) { $url .= "?"; } else { $url .= "&"; } $smarty->assign('splitter_endpage', $endpage); $smarty->assign('splitter_page', $page); $smarty->assign('splitter_url', $url); return $smarty->fetch(get_tpl('pagesplitter')); }
<?php /** * @package EDK */ require_once 'common/xajax/xajax_core/xajax.inc.php'; $xajax = new xajax(); event::register('page_assembleheader', 'edk_xajax::insertHTML'); // if mods depend on xajax they can register to xajax_initialised // it gets called after all mods have been initialized //event::register('smarty_displayindex', 'edk_xajax::lateProcess'); //event::register('page_assembleheader', 'edk_xajax::lateProcess'); event::register('mods_initialised', 'edk_xajax::lateProcess'); //event::register('page_initialisation', 'edk_xajax::lateProcess'); $uri = html_entity_decode(edkURI::build(edkURI::parseURI())); if (strpos($uri, "?") === false) { $uri .= "?xajax=1"; } else { $uri .= "&xajax=1"; } $xajax->configure('requestURI', $uri); /** * @package EDK */ class edk_xajax { public static function xajax() { global $xajax_enable; $xajax_enable = true; }
function generate() { if ($this->klist) { $entry = array(); // build array $sql = "select scl_id, scl_class\n from kb3_ship_classes\n where scl_class not in ( 'Drone', 'Unknown' )\n order by scl_class"; $qry = DBFactory::getDBQuery(); $qry->execute($sql) or die($qry->getErrorMsg()); while ($row = $qry->getRow()) { if (!$row['scl_id']) { continue; } $entry[$row['scl_class']]['id'] = $row['scl_id']; $entry[$row['scl_class']]['kills'] = 0; $entry[$row['scl_class']]['kills_isk'] = 0; } while ($kill = $this->klist->getKill()) { $classname = $kill->getVictimShipClassName(); $entry[$classname]['kills']++; $entry[$classname]['kills_isk'] += $kill->getISKLoss(); $this->tkcount++; $this->tkisk += $kill->getISKLoss(); } } else { $this->getkills(); $entry =& $this->entry; } // Don't count noobships. $num = count($entry) - 1; $summary = array(); $count = 0; $args = edkURI::parseURI(); if (edkURI::getArg('scl_id')) { foreach ($args as $key => $value) { if ($value[0] == 'scl_id') { unset($args[$key]); break; } } } $qrystring = edkURI::build($args); $clearfilter = $qrystring; if (strpos($qrystring, '?') === false) { $qrystring .= "?"; } else { $qrystring .= "&"; } foreach ($entry as $k => $v) { if ($v['id'] == 3) { continue; } $v['break'] = 0; if ($_GET['scl_id'] && $_GET['scl_id'] == $v['id']) { $v['hl'] = 1; } else { $v['hl'] = 0; } $v['qry'] = $qrystring; $v['kisk'] = round($v['kills_isk'] / 1000000, 2); $v['name'] = $k; $summary[] = $v; $this->tkcount += $kcount; $this->tkisk += $kisk; $this->tkpoints += $kpoints; $count++; } global $smarty; $smarty->assign('summary', $summary); $smarty->assign('count', $num); $smarty->assign('verbose', $this->verbose); $smarty->assign('filter', $this->filter); if (config::get('summarytable_summary')) { $smarty->assign('summarysummary', 1); $smarty->assign('efficiency', 0); $smarty->assign('kiskB', round($this->tkisk / 1000000000, 2)); $smarty->assign('kiskM', round($this->tkisk / 1000000, 2)); $smarty->assign('kcount', $this->tkcount); if (config::get('summarytable_collapsed')) { $smarty->assign('summarycollapsed', 1); } } if (edkURI::getArg('scl_id')) { $smarty->assign('clearfilter', $clearfilter); } $html .= $smarty->fetch(get_tpl('summarytable')); return $html; }
/** * Start constructing the page. * * Prepare all the shared variables such as dates and check alliance ID. */ function start() { $this->kll_id = (int) edkURI::getArg('kll_id'); $this->kll_external_id = 0; if (!$this->kll_id) { $this->kll_external_id = (int) edkURI::getArg('kll_ext_id'); if (!$this->kll_external_id) { // internal and external ids easily overlap so we can't guess which $this->kll_id = (int) edkURI::getArg('id', 1); } } $this->nolimit = edkURI::getArg('nolimit', 2); $this->menuOptions = array(); $this->page = new Page('Kill details'); if (!$this->kll_id && !$this->kll_external_id) { $html = "No kill id specified."; $this->page->setContent($html); $this->page->generate($html); exit; } if ($this->kll_id) { $this->kill = Cacheable::factory('Kill', $this->kll_id); } else { $this->kill = new Kill($this->kll_external_id, true); $this->kll_id = $this->kill->getID(); } if (!$this->kill->exists()) { $html = "That kill doesn't exist."; $this->page->setContent($html); $this->page->generate($html); exit; } if ($this->kll_external_id) { $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('kll_ext_id', $this->kll_external_id, true)) . "' />"); } else { $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('kll_id', $this->kll_id, true)) . "' />"); } $this->finalblow = false; $this->commenthtml = ''; // Check for posted comments. // If a comment is being posted then we won't exit this block. if (isset($_POST['comment']) && config::get('comments')) { $comments = new Comments($this->kll_id); $pw = false; if (!config::get('comments_pw') || $this->page->isAdmin()) { $pw = true; } if ($pw || crypt($_POST['password'], config::get("comment_password")) == config::get("comment_password")) { if ($_POST['comment'] == '') { $this->commenthtml = 'Error: The silent type, hey? Good for' . ' you, bad for a comment.'; } else { $comment = $_POST['comment']; $name = $_POST['name']; if ($name == null) { $name = 'Anonymous'; } $comments->addComment($name, $comment); //Redirect to avoid refresh reposting comments. header('Location: ' . $_SERVER['REQUEST_URI'], TRUE, 303); die; } } else { // Password is wrong $this->commenthtml = 'Error: Wrong Password'; } } global $smarty; if (!file_exists('img/panel/' . config::get('fp_theme') . '.png')) { config::set('fp_theme', 'tyrannis'); } $smarty->assign('panel_colour', config::get('fp_theme')); $smarty->assign('showiskd', config::get('kd_showiskd')); $smarty->assign('formURL', edkURI::build(edkURI::parseURI())); // Check admin update options. if ($this->page->isAdmin()) { $smarty->assign('admin', true); $this->updatePrices(); } $this->involvedSetup(); $this->fittingSetup(); }
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; }