function details() { global $smarty; $item = new dogma($this->typeID); if (!$item->isValid()) { $this->page->setTitle('Error'); return 'This ID is not a valid dogma ID.'; } $this->page->setTitle('Item details - ' . $item->get('typeName')); $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />'); $smarty->assignByRef('item', $item); if ($item->get('itt_cat') == 6) { //we have a ship, so get it from the db $ship = Ship::getByID($item->get('typeID')); $smarty->assign('shipImage', $ship->getImage(64)); $smarty->assign('armour', array('armorHP', 'armorEmDamageResonance', 'armorExplosiveDamageResonance', 'armorKineticDamageResonance', 'armorThermalDamageResonance')); $smarty->assign('shield', array('shieldCapacity', 'shieldRechargeRate', 'shieldEmDamageResonance', 'shieldExplosiveDamageResonance', 'shieldKineticDamageResonance', 'shieldThermalDamageResonance')); $smarty->assign('propulsion', array('maxVelocity', 'agility', 'droneCapacity', 'capacitorCapacity', 'rechargeRate')); $smarty->assign('fitting', array('hiSlots', 'medSlots', 'lowSlots', 'rigSlots', 'upgradeCapacity', 'droneBandwidth', 'launcherSlotsLeft', 'turretSlotsLeft', 'powerOutput', 'cpuOutput')); $smarty->assign('targetting', array('maxTargetRange', 'scanResolution', 'maxLockedTargets', 'scanRadarStrength', 'scanLadarStrength', 'scanMagnetometricStrength', 'scanGravimetricStrength', 'signatureRadius')); $smarty->assign('miscellaneous', array('techLevel', 'propulsionFusionStrength', 'propulsionIonStrength', 'propulsionMagpulseStrength', 'propulsionPlasmaStrength')); $html = $smarty->fetch(get_tpl('invtype_ship')); } else { $i = new Item($this->typeID); $smarty->assign('itemImage', $i->getIcon(64, false)); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); $html = $smarty->fetch(get_tpl('invtype_item')); } return $html; }
/** * Retrieve formatted html comments for a kill. * * The kill id is set when the Comments object is constructed. * * @global Smarty $smarty * @param boolean $commentsOnly * @return string */ function getHtml($commentsOnly = false) { global $smarty; if (empty($this->comments_)) { $this->getComments(); } $smarty->assignByRef('comments', $this->comments_); $smarty->assign('norep', time() % 3700); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); if ($commentsOnly) { return $smarty->fetch(get_tpl('comments_comments')); } else { return $smarty->fetch(get_tpl('block_comments')); } }
public function generateMenu() { $this->execQuery(); $menu = new Menu(); while ($row = $this->getRow()) { $url = $row['url']; if ($row['intern'] == 1 && session::isAdmin()) { if (strpos($url, "?") === false) { $url .= "?"; } else { $url .= "&"; } $url .= "akey=" . session::makeKey(); } // Note that changing the standard naming will also remove any translations. $menu->add($url, Language::get($row['descr'])); } return $menu; }
$KB_HOME = preg_replace('/[\\/\\\\]cron[\\/\\\\]cron_idfeed\\.php$/', '', __FILE__); } else { die("Set \$KB_HOME to the killboard root in cron/cron_fleet_battles_update.php."); } // If the above doesn't work - place your working directory path to killboard root below - comment out the above two lines and uncomment the two below // Edit the path below with your webspace directory to the killboard root folder - also check your php folder is correct as defined by the first line of this file //$KB_HOME = "/home/yoursite/public_html/kb"; chdir($KB_HOME); require_once 'kbconfig.php'; require_once 'common/includes/globals.php'; require_once 'common/includes/db.php'; require_once 'common/includes/class.edkerror.php'; require_once 'mods/fleet_battles_mod/init.php'; require_once 'mods/fleet_battles_mod/include/class.battles.php'; $smarty = new Smarty(); if (!session::isAdmin()) { // Disable checking of timestamps for templates to improve performance. $smarty->compile_check = false; } $themename = config::get('theme_name'); if (!file_exists("themes/" . $themename . "/" . $stylename . ".css")) { $stylename = 'default'; } $smarty->template_dir = "./themes/{$themename}/templates"; if (!is_dir(KB_CACHEDIR . '/templates_c/' . $themename)) { mkdir(KB_CACHEDIR . '/templates_c/' . $themename); } $smarty->compile_dir = KB_CACHEDIR . '/templates_c/' . $themename; $smarty->cache_dir = KB_CACHEDIR . '/data'; $smarty->assign('theme_url', THEME_URL); if ($stylename != 'default' || $themename != 'default') {
/** * Build the killlists that are needed for the options selected. */ function killList() { if (isset($this->viewList[$this->view])) { return call_user_func_array($this->viewList[$this->view], array(&$this)); } $scl_id = (int) edkURI::getArg('scl_id'); global $smarty; $html = ''; $smarty->assign('view', $this->view); switch ($this->view) { case "": $targets = array(); $curtarget = array(); while ($target =& $this->contract->getContractTarget()) { $kl =& $target->getKillList(); $ll =& $target->getLossList(); $summary = new KillSummaryTable($kl, $ll); $summary->setVerbose(true); $summary->setView('combined'); $curtargets['type'] = $target->getType(); $curtargets['id'] = $target->getID(); $curtargets['name'] = $target->getName(); $curtargets['summary'] = $summary->generate(); if ($summary->getTotalKillISK()) { $curtargets['efficiency'] = round($summary->getTotalKillISK() / ($summary->getTotalKillISK() + $summary->getTotalLossISK()) * 100, 2); } else { $curtargets['efficiency'] = 0; } $curtargets['total_kills'] = $summary->getTotalKills(); $curtargets['total_losses'] = $summary->getTotalLosses(); $curtargets['total_kill_isk'] = round($summary->getTotalKillISK() / 1000000000, 2); $curtargets['total_loss_isk'] = round($summary->getTotalLossISK() / 1000000000, 2); $bar = new BarGraph($curtargets['efficiency'], 100, 120); $curtargets['bar'] = $bar->generate(); $targets[] = $curtargets; } $smarty->assignByRef('targets', $targets); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); $html .= $smarty->fetch(get_tpl('cc_detail_lists')); break; case "recent_activity": $this->contract = new Contract($this->ctr_id); $klist = $this->contract->getKillList(); $klist->setOrdered(true); if ($scl_id) { $klist->addVictimShipClass($scl_id); } else { $klist->setPodsNoobShips(config::get('podnoobs')); } $table = new KillListTable($klist); $table->setLimit(10); $smarty->assign('killtable', $table->generate()); $llist = $this->contract->getLossList(); $llist->setOrdered(true); if ($scl_id) { $llist->addVictimShipClass($scl_id); } else { $llist->setPodsNoobShips(config::get('podnoobs')); } $table = new KillListTable($llist); $table->setLimit(10); $smarty->assign('losstable', $table->generate()); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); $html .= $smarty->fetch(get_tpl('cc_detail_lists')); break; case "kills": $this->contract = new Contract($this->ctr_id); $list = $this->contract->getKillList(); $list->setOrdered(true); if ($scl_id) { $list->addVictimShipClass($scl_id); } else { $list->setPodsNoobShips(config::get('podnoobs')); } $list->setPageSplit(config::get('killcount')); $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount')); $table = new KillListTable($list); $smarty->assign('killtable', $table->generate()); $smarty->assign('splitter', $pagesplitter->generate()); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); $html .= $smarty->fetch(get_tpl('cc_detail_lists')); break; case "losses": $this->contract = new Contract($this->ctr_id); $llist = $this->contract->getLossList(); $llist->setOrdered(true); if ($scl_id) { $llist->addVictimShipClass($scl_id); } else { $llist->setPodsNoobShips(config::get('podnoobs')); } $llist->setPageSplit(config::get('killcount')); $pagesplitter = new PageSplitter($llist->getCount(), config::get('killcount')); $table = new KillListTable($llist); $smarty->assign('losstable', $table->generate()); $smarty->assign('splitter', $pagesplitter->generate()); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); $html .= $smarty->fetch(get_tpl('cc_detail_lists')); break; } return $html; }
function removeOld($hours, $dir, $recurse = false) { if (!session::isAdmin()) { return false; } if (strpos($dir, '.') !== false) { return false; } //$dir = KB_CACHEDIR.'/'.$dir; if (!is_dir($dir)) { return false; } if (substr($dir, -1) != '/') { $dir = $dir . '/'; } $seconds = $hours * 60 * 60; $files = scandir($dir); foreach ($files as $num => $fname) { $del = 0; if (file_exists("{$dir}{$fname}") && !is_dir("{$dir}{$fname}") && substr($fname, 0, 1) != "." && time() - filemtime("{$dir}{$fname}") > $seconds) { $mod_time = filemtime("{$dir}{$fname}"); if (unlink("{$dir}{$fname}")) { $del = $del + 1; } } if ($recurse && file_exists("{$dir}{$fname}") && is_dir("{$dir}{$fname}") && substr($fname, 0, 1) != "." && $fname !== "..") { $del = $del + admin_acache::remove_old($hours, $dir . $fname . "/"); } } return $del; }
/** * Create a board URI from the given arguments. * * This takes an ordered array of parameter arrays. Each parameter array * contains name, value (or true if no value), true/false depending on * whether it was in the pathinfo or querystring. If a page is not specified * then the current page will be assumed. * * e.g. * 0=>(a, kill_detail, true), 1=>(id, 45, true), 2=>(unlimited,true, true) * * If path URIs are enabled this returns: * kburl/index/kill_detail/45/unlimited/ * * If path URIs are disabled this returns: * kburl/?a=kill_detail&id=45&unlimited * * Passing in no arguments would return: * kburl/index/home/ * or kburl/?a=home * * @param array $parameters * @return string valid URI to an EDK page. */ private static function make($parameters) { if (is_null(self::$kb_host)) { if (defined('KB_HOST')) { self::$kb_host = KB_HOST . "/"; if (self::$pathinfo) { self::$kb_host .= "index.php/"; } } else { if (class_exists('Config', true)) { self::$kb_host = Config::get('cfg_kbhost') . "/"; if (self::$pathinfo) { self::$kb_host .= "index.php/"; } } else { self::$kb_host = $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; if (self::$pathinfo) { self::$kb_host .= "/"; } } } } // Let's be nice and accept a single argument to not be nested. if (!is_array($parameters[0])) { $parameters = array($parameters); } if (session::isAdmin()) { $parameters[] = array("akey", session::makeKey(), false); } $url = self::$kb_host; $patharr = array(); $qryarr = array(); foreach ($parameters as $param) { if ($param[2] && self::$pathinfo) { if ($param[1] === true) { $patharr[] = $param[0]; } else { $patharr[] = $param[1]; } } else { if ($param[1] === true) { $qryarr[] = $param[0]; } else { $qryarr[] = $param[0] . '=' . $param[1]; } } } if (self::$pathinfo) { // If no page is specified then use the current page if (!$parameters || $parameters[0][0] != 'a') { $url .= self::getArg('a', 0) . '/'; } if ($patharr) { $url .= join('/', $patharr) . '/'; } if ($qryarr) { $url .= '?'; } } else { // If no page is specified then use the current page if (!$qryarr) { $url .= '?a=' . self::getArg('a', 0); } else { if ($parameters[0][0] != 'a') { $url .= '?a=' . self::getArg('a', 0) . "&"; } else { $url .= '?'; } } } $url .= join('&', $qryarr); return $url; }
/** * Show the overall statistics for this alliance. */ function stats() { $this->summary->generate(); if ($this->pilot->getExternalID()) { $apiInfo = new API_CharacterInfo(); $apiInfo->setID($this->pilot->getExternalID()); $result .= $apiInfo->fetchXML(); // Update the name if it has changed. if ($result == "") { $data = $apiInfo->getData(); $this->alliance = Alliance::add($data['alliance'], $data['allianceID']); $this->corp = Corporation::add($data['corporation'], $this->alliance, $apiInfo->getCurrentTime(), $data['corporationID']); $this->pilot = Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']); } } global $smarty; $smarty->assign('portrait_URL', $this->pilot->getPortraitURL(128)); $smarty->assign('corp_id', $this->corp->getID()); $smarty->assign('corp_name', $this->corp->getName()); $smarty->assign('all_name', $this->alliance->getName()); $smarty->assign('all_id', $this->alliance->getID()); $smarty->assign('klist_count', $this->summary->getTotalKills()); $smarty->assign('klist_real_count', $this->summary->getTotalRealKills()); //$this->klist->getRealCount()); $smarty->assign('llist_count', $this->summary->getTotalLosses()); $smarty->assign('klist_isk_B', round($this->summary->getTotalKillISK() / 1000000000, 2)); $smarty->assign('llist_isk_B', round($this->summary->getTotalLossISK() / 1000000000, 2)); //Pilot Efficiency Mod Begin (K Austin) if ($this->summary->getTotalKills() == 0) { $pilot_survival = 100; $pilot_efficiency = 0; } else { if ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) { $pilot_survival = round($this->summary->getTotalLosses() / ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) * 100, 2); } else { $pilot_survival = 0; } if ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) { $pilot_efficiency = round($this->summary->getTotalKillISK() / ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) * 100, 2); } else { $pilot_efficiency = 0; } } $smarty->assign('pilot_survival', $pilot_survival); $smarty->assign('pilot_efficiency', $pilot_efficiency); $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false); $this->lpoints = $this->summary->getTotalLossPoints(); $this->points = $this->summary->getTotalKillPoints(); return $smarty->fetch(get_tpl('pilot_detail_stats')); }