/** * Check if a version of this template exists in this theme or for the igb. * If client is igb check if theme has an igb version. If not check in default * theme for one. If client is not igb check if the theme has the template. * If not then again return the default template. * * @param string $name containing the name of the template. */ function get_tpl($name) { global $themename; event::call('get_tpl', $name); // If a specific tempate file is already asked for then simply return it. if (substr($name, -3) == 'tpl') { return $name; } if ($themename == 'default') { if (IS_IGB && file_exists('./themes/default/templates/igb_' . $name . '.tpl')) { return 'igb_' . $name . '.tpl'; } return $name . '.tpl'; } else { if (IS_IGB) { if (is_file('./themes/' . $themename . '/templates/igb_' . $name . '.tpl')) { return 'igb_' . $name . '.tpl'; } else { if (is_file('./themes/default/templates/igb_' . $name . '.tpl')) { return '../../default/templates/igb_' . $name . '.tpl'; } } } if (is_file('./themes/' . $themename . '/templates/' . $name . '.tpl')) { return $name . '.tpl'; } else { if (is_file('./themes/default/templates/' . $name . '.tpl')) { return '../../default/templates/' . $name . '.tpl'; } } } return $name . '.tpl'; }
public static function lateProcess() { // let all mods know we're here so they can register their functions event::call('xajax_initialised', $this); // Also register this for old mods registered to the ajax mod. event::call('mod_xajax_initialised', $this); // now process all xajax calls global $xajax; $xajax->processRequest(); }
/** * Assemble the page and return the HTML. * * @return string */ function assemble() { event::call('pageAssembly_assemble', $this); $output = ''; foreach ($this->assemblyQueue as $id => $object) { usort($object['addBefore'], array(&$this, 'prioSortHelper')); foreach ($object['addBefore'] as $callback) { $output .= $this->call($callback['callback']); } $text = $this->call($object['callback']); foreach ($object['filter'] as $callback) { $text = $this->callFilter($callback['callback'], $text); } $output .= $text; foreach ($object['addBehind'] as $callback) { $output .= $this->call($callback['callback']); } } return $output; }
$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')); } } if (count(config::get('cfg_allianceid')) + count(config::get('cfg_corpid')) + count(config::get('cfg_pilotid')) > 1) { $selfDetail = new pSelf(); event::call("self_assembling", $selfDetail); $html = $selfDetail->assemble(); $selfDetail->page->setContent($html); $selfDetail->page->generate(); } else { if (config::get('cfg_allianceid')) { $alls = config::get('cfg_allianceid'); /* @var $alliance Alliance */ $alliance = Cacheable::factory('Alliance', $alls[0]); if ($alliance->getExternalID()) { $url = edkURI::page('alliance_detail', $alliance->getExternalID(), 'all_ext_id'); } else { $url = edkURI::page('alliance_detail', $alls[0], 'all_id'); } header("Location: " . htmlspecialchars_decode($url)); die;
$this->addMenuItem("link", "Lost ships", edkURI::build($args, array('view', 'losses_class', true))); $this->addMenuItem("caption", "Global statistics"); $this->addMenuItem("link", "Ships & weapons", edkURI::build($args, array('view', 'ships_weapons', true))); $this->addMenuItem("link", "Most violent systems", edkURI::build($args, array('view', 'violent_systems', true))); } /** * Return the set month. * @return integer */ function getMonth() { return $this->month; } /** * Return the set year. * @return integer */ function getYear() { return $this->year; } } $allianceDetail = new pAllianceDetail(); event::call("allianceDetail_assembling", $allianceDetail); $html = $allianceDetail->assemble(); $allianceDetail->page->setContent($html); $allianceDetail->context(); event::call("allianceDetail_context_assembling", $allianceDetail); $context = $allianceDetail->assemble(); $allianceDetail->page->addContext($context); $allianceDetail->page->generate();
$this->addMenuItem("link", "Previous month ", edkURI::build(array('y', $pyear, true), array('m', $pmonth, true))); if (!($this->month == kbdate("m") - 1 && $this->year == kbdate("Y"))) { $this->addMenuItem("link", "Next month", edkURI::build(array('y', $nyear, true), array('m', $nmonth, true))); } } /** * Return the set month. * @return integer */ function getMonth() { return $this->month; } /** * Return the set year. * @return integer */ function getYear() { return $this->year; } } $award = new pAwards(); event::call("award_assembling", $award); $html = $award->assemble(); $award->page->setContent($html); $award->context(); event::call("award_context_assembling", $award); $context = $award->assemble(); $award->page->addContext($context); $award->page->generate();
$this->page = new Page('Item Database'); } function details() { global $smarty; if (!$this->groupID) { $this->page->setTitle('Error'); return 'This ID is not a valid group ID.'; } $sql = 'SELECT * FROM kb3_item_types d' . ' WHERE d.itt_id = ' . $this->groupID; $qry = DBFactory::getDBQuery(); $qry->execute($sql); $row = $qry->getRow(); $this->page->setTitle('Item Database - ' . $row['itt_name'] . ' Index'); $sql = 'SELECT * FROM kb3_invtypes d' . ' WHERE d.groupID = ' . $this->groupID . ' ORDER BY d.typeName ASC'; $qry = DBFactory::getDBQuery(); $qry->execute($sql); $rows = array(); while ($row = $qry->getRow()) { $rows[] = array('typeID' => $row['typeID'], 'typeName' => $row['typeName']); } $smarty->assign('rows', $rows); $smarty->assign('actionURL', edkURI::page('invtype')); return $smarty->fetch(get_tpl('groupdb')); } } $invtype = new pInvtype(); event::call("invtype_assembling", $invtype); $html = $invtype->assemble(); $invtype->page->setContent($html); $invtype->page->generate();
/** * * @param string $login * @param string $site */ public static function delete($login, $site = KB_SITE) { $qry = DBFactory::getDBQuery(true); $name = $qry->escape($login); $site = $qry->escape($site); $qry->execute("SELECT usr_id FROM kb3_user WHERE usr_login = '******' AND usr_site = '{$site}'"); $row = $qry->getRow(); $usr_id = $row['usr_id']; $qry->execute("DELETE FROM kb3_user WHERE usr_id = {$usr_id}"); $qry->execute("DELETE FROM kb3_user_extra WHERE use_usr_id = {$usr_id}"); $qry->execute("DELETE FROM kb3_user_roles WHERE uro_usr_id = {$usr_id}"); $qry->execute("DELETE FROM kb3_user_titles WHERE ust_usr_id = {$usr_id}"); event::call("user_deleted", $login); }
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"));
{ if ($day && $month && $year) { $this->setDay($day, $month, $year); $this->week = 0; } else { if ($week && $year) { $this->setWeek($week, $year); $this->month = 0; } elseif ($month && $year) { $this->setMonth($month, $year); $this->week = 0; } else { if (config::get('show_monthly')) { $this->setMonth(kbdate('m'), kbdate('Y')); } else { $this->setWeek(kbdate('W'), kbdate('o')); } } } } } $pageAssembly = new pHome(); event::call("home_assembling", $pageAssembly); $html = $pageAssembly->assemble(); $pageAssembly->page->setContent($html); $pageAssembly->context(); //This resets the queue and queues context items. event::call("home_context_assembling", $pageAssembly); $contextHTML = $pageAssembly->assemble(); $pageAssembly->page->addContext($contextHTML); $pageAssembly->page->generate();
if (file_exists('mods/' . $mod . '/' . $page . '.php')) { $modconflicts[] = $mod; $modOverrides = true; $modOverride = $mod; } } if (count($modconflicts) > 1) { echo "<html><head></head><body>There are multiple active mods " . "for this page. Only one may be active at a time. All others " . "must be deactivated in the admin panel.<br>"; foreach ($modconflicts as $modname) { echo $modname . " <br> "; } echo "</body>"; die; } $none = ''; event::call('mods_initialised', $none); 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);
global $smarty, $themeInfo; if (!isset($themeInfo)) { global $themename; $themeInfo['name'] = $themename; } $smarty->assignByRef("themeInfo", $themeInfo); return $smarty->fetch(get_tpl("about_theme")); } function mods() { global $smarty, $modInfo; $smarty->assignByRef("mods", $modInfo); return $smarty->fetch(get_tpl("about_mods")); } function top() { global $smarty; $smarty->assign('version', KB_VERSION . " " . KB_RELEASE); return $smarty->fetch(get_tpl('about')); } function bottom() { global $smarty; return $smarty->fetch(get_tpl('about_bottom')); } } $about = new pAbout(); event::call("about_assembling", $about); $html = $about->assemble(); $about->page->setContent($html); $about->page->generate();
$this->addMenuItem("caption", "View"); if ($this->adjacent) { $this->addMenuItem("link", "Remove adjacent", edkURI::build(array('kll_id', $this->kll_id, true))); } else { $this->addMenuItem("link", "Include adjacent", edkURI::build(array('kll_id', $this->kll_id, true), array('adjacent', true, true))); } $this->addMenuItem("link", "Back to Killmail", edkURI::build(array('a', 'kill_detail', true), array('kll_id', $this->kll_id, true))); } public function menu() { $menubox = new Box("Menu"); $menubox->setIcon("menu-item.gif"); foreach ($this->menuOptions as $options) { if (isset($options[2])) { $menubox->addOption($options[0], $options[1], $options[2]); } else { $menubox->addOption($options[0], $options[1]); } } return $menubox->generate(); } } $killRelated = new pKillRelated(); event::call("killRelated_assembling", $killRelated); $html = $killRelated->assemble(); $killRelated->page->setContent($html); $killRelated->context(); event::call("killRelated_context_assembling", $killRelated); $context = $killRelated->assemble(); $killRelated->page->addContext($context); $killRelated->page->generate();
if (preg_match("/^API/", $source)) { $type = "API"; $source = $this->kill->getExternalID(); } else { if (preg_match("/^http/", $source)) { $type = "URL"; } else { if (preg_match("/^ID:http/", $source)) { $type = "URL"; $source = substr($source, 3); } else { $type = "unknown"; } } } } $smarty->assign("source", htmlentities($source)); $smarty->assign("type", $type); $smarty->assign("postedDate", $posteddate); return $smarty->fetch(get_tpl("sourcedFrom")); } } $killDetail = new pKillDetail(); event::call("killDetail_assembling", $killDetail); $html = $killDetail->assemble(); $killDetail->page->setContent($html); $killDetail->context(); event::call("killDetail_context_assembling", $killDetail); $context = $killDetail->assemble(); $killDetail->page->addContext($context); $killDetail->page->generate();
<?php /** * @package EDK */ class pLocked extends pageAssembly { /** @var Page */ public $page = null; function __construct() { parent::__construct(); $this->queue("start"); $this->queue("content"); } function start() { $this->page = new Page("Locked"); } function content() { global $smarty; return $smarty->fetch(get_tpl("locked")); } } $locked = new pLocked(); event::call("locked_assembling", $locked); $html = $locked->assemble(); $locked->page->setContent($html); $locked->page->generate();
//session created but not in current page die; } } else { if ($_POST['usrlogin'] == '' && crypt($_POST['usrpass'], ADMIN_PASSWORD) == ADMIN_PASSWORD) { session::create(true); $page = preg_replace('/[^a-zA-Z0-9-_]/', '', edkURI::getArg("page", 1)); $page = $page ? $page : "admin"; header('Location: ' . htmlspecialchars_decode(edkURI::page('admin') . '&akey=' . session::makeKey())); //session created but not in current page session_write_close(); die; } else { $result = user::login($_POST['usrlogin'], $_POST['usrpass']); if ($result) { header('Location: ' . html_entity_decode(edkURI::page('home'))); die; } else { $smarty->assign('error', 'Login error, please check your username and password.'); } } } } return $smarty->fetch(get_tpl('user_login')); } } $login = new pLogin(); event::call("login_assembling", $about); $html = $login->assemble(); $login->page->setContent($html); $login->page->generate();
/** * Generate the output html. * * Output is constructed from the variables passed in through the * add methods and the index.tpl. */ public function generate() { global $smarty; $smarty->assign('kb_title', config::get('cfg_kbtitle') . ' ' . $this->title); if ($this->onload) { $smarty->assign('on_load', ' onload="' . implode('; ', $this->onload) . '"'); } // header event::call('page_assembleheader', $this); $smarty->assign('page_headerlines', join("\n", $this->headlines)); event::call('page_assemblebody', $this); $smarty->assign('page_bodylines', join("\n", $this->bodylines)); if (config::get('cfg_mainsite')) { $smarty->assign('banner_link', config::get('cfg_mainsite')); } $smarty->assign('banner', config::get('style_banner')); $smarty->assign('banner_x', config::get('style_banner_x')); $smarty->assign('banner_y', config::get('style_banner_y')); $nav = new Navigation(); $menu = $nav->generateMenu(); if (!count($menu->get())) { $w = 100; } else { $w = floor(100 / count($menu->get())); } $smarty->assign('menu_w', $w . '%'); $smarty->assign('menu_count', count($menu->get())); $smarty->assign('menu', $menu->get()); //check if banner is a swf $bannerExn = substr(config::get('style_banner'), -3); if (strtoupper($bannerExn) == 'SWF') { $smarty->assign('bannerswf', 'true'); } else { $smarty->assign('bannerswf', 'false'); } $smarty->assign('page_title', $this->title); $processingtime = number_format(microtime(true) - $this->timestart, 4); $qry = DBFactory::getDBQuery(); $smarty->assign('profile_sql_cached', $qry->queryCachedCount()); $smarty->assign('profile_sql', $qry->queryCount()); $smarty->assign('profile_time', $processingtime); $smarty->assign('sql_time', number_format($qry->getTotalTime(), 4)); if ($this->isAdmin() || config::get('cfg_profile') || intval(KB_PROFILE)) { $smarty->assign('profile', 1); } $smarty->assign('content_html', $this->contenthtml); if (config::get('user_showmenu')) { $this->contexthtml = array_merge(array(user::menu()), $this->contexthtml); } $smarty->assign('context_html', implode($this->contexthtml)); $smarty->assignByRef('context_divs', $this->contexthtml); event::call('smarty_displayindex', $smarty); $html = $smarty->fetch(get_tpl('index')); event::call('final_content', $html); // Reduce page size by about 10% //TODO: enable for prod //$html = preg_replace('/\s+\<\//', ' </', $html); //$html = preg_replace('/>\s+/', '> ', $html); echo $html; }
public function execQuery() { /* Killlist philosophy * * Killlists are constructed based on whether they set involved parties, * victims or combined. Combined lists look for a party as either * involved or victim. The combined list uses the union of involved * and victim, both limited if a limit is set. Other parts of a killlist * are then added on to this core. * * MySQL will sometimes try to construct the query with alliance, corp, * system or ship class first. Now that timestamp order is removed it * will add every kill to the result, sort and return the top few. To * avoid this the secondary tables use a left or straight join which forces * a particular evaluation order. Since the result is never null the * result is the same. * * Comments and involved count are added in an outer query. This returns * the counts in a single query * */ if (!$this->executed) { $datefilter = $this->getDateFilter(); $startdate = makeStartDate($this->weekno_, $this->yearno_, $this->monthno_, $this->startweekno_, $this->startDate_); $enddate = makeEndDate($this->weekno_, $this->yearno_, $this->monthno_, $this->endDate_); $this->sql_ = ''; $this->sqlinner_ = $this->makeKllQuery($startdate, $enddate); if (!count($this->groupby_) && ($this->comments_ || $this->involved_)) { $this->sqloutertop_ = 'SELECT list.* '; if ($this->comments_) { $this->sqloutertop_ .= ', count(distinct com.id) as comments'; } if ($this->involved_) { $this->sqloutertop_ .= ', count(distinct ind.ind_order) as inv'; } $this->sqloutertop_ .= ' FROM ('; } if (!count($this->groupby_)) { $this->sqltop_ = 'SELECT '; if (count($this->inv_all_) + count($this->inv_crp_) + count($this->inv_plt_) > 1) { $this->sqltop_ .= ' DISTINCT '; } $this->sqltop_ .= implode(', ', $this->expr); event::call('killlist_select_expr', $this->sqltop_); } else { $this->sqltop_ = "SELECT COUNT(1) as cnt, " . implode(",", $this->groupby_); } $this->sqltop_ .= " FROM " . $this->sqlinner_ . " "; // LEFT JOIN/STRAIGHT_JOIN is used to force processing after the main tables. $this->sqllong_ = "STRAIGHT_JOIN kb3_pilots plt\n\t\t\t\t\t\t\t\tON ( plt.plt_id = kll.kll_victim_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_corps crp\n\t\t\t\t\t\t\t\tON ( crp.crp_id = kll.kll_crp_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_alliances ali\n\t\t\t\t\t\t\t\tON ( ali.all_id = kll.kll_all_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_pilots fbplt\n\t\t\t\t\t\t\t\tON ( fbplt.plt_id = kll.kll_fb_plt_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_inv_detail fb\n\t\t\t\t\t\t\t\tON ( fb.ind_kll_id = kll.kll_id AND fb.ind_plt_id = kll.kll_fb_plt_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_corps fbcrp\n\t\t\t\t\t\t\t\tON ( fbcrp.crp_id = fb.ind_crp_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_alliances fbali\n\t\t\t\t\t\t\t\tON ( fbali.all_id = fb.ind_all_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_pilots tdplt\n\t\t\t\t\t\t\t\tON ( tdplt.plt_id = kll.kll_td_plt_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_inv_detail td\n\t\t\t\t\t\t\t\tON ( td.ind_kll_id = kll.kll_id AND td.ind_plt_id = kll.kll_td_plt_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_corps tdcrp\n\t\t\t\t\t\t\t\tON ( tdcrp.crp_id = td.ind_crp_id )\n\t\t\t\t\t\t\tSTRAIGHT_JOIN kb3_alliances tdali\n\t\t\t\t\t\t\t\tON ( tdali.all_id = td.ind_all_id )\n\t\t\t\t\t\t "; // System if (count($this->systems_) || count($this->regions_)) { $this->sql_ .= " INNER JOIN kb3_systems sys\n\t\t\t\t\tON ( sys.sys_id = kll.kll_system_id )"; } else { $this->sqllong_ .= " STRAIGHT_JOIN kb3_systems sys\n\t\t\t\t\tON ( sys.sys_id = kll.kll_system_id )"; } // regions if (count($this->regions_)) { $this->sql_ .= " INNER JOIN kb3_constellations con\n\t ON ( con.con_id = sys.sys_con_id and\n\t\t\t con.con_reg_id in ( " . implode($this->regions_, ",") . " ) )"; } if (count($this->exclude_scl_) || count($this->vic_scl_id_)) { $this->sql_ .= " STRAIGHT_JOIN kb3_ships shp\n\t\t\t\t\tON ( shp.shp_id = kll.kll_ship_id )\n\t\t\t\t\tSTRAIGHT_JOIN kb3_ship_classes scl\n\t\t\t\t\tON ( scl.scl_id = shp.shp_class )"; } else { $this->sqllong_ .= " STRAIGHT_JOIN kb3_ships shp\n\t\t\t\t\tON ( shp.shp_id = kll.kll_ship_id )\n\t\t\t\t\tSTRAIGHT_JOIN kb3_ship_classes scl\n\t\t\t\t\tON ( scl.scl_id = shp.shp_class )"; } if ($this->comb_plt_ || $this->comb_crp_ || $this->comb_all_) { // GROUP BY if ($this->groupby_) { $this->sql_ .= " GROUP BY " . implode(",", $this->groupby_); } // order/limit if ($this->ordered_) { if (!$this->orderby_) { $this->sql_ .= " order by kll.kll_timestamp desc"; } else { $this->sql_ .= " order by " . $this->orderby_; } } } elseif ($this->inv_plt_ || $this->inv_crp_ || $this->inv_all_) { if ($this->inv_plt_ || $this->inv_crp_ && $this->inv_all_) { $this->sql_ .= " INNER JOIN kb3_inv_detail ind ON (ind.ind_kll_id = kll.kll_id)\n\t\t\t\t\t\tWHERE "; $invP = array(); if ($this->inv_all_) { $invP[] = " ind.ind_all_id in (" . implode(',', $this->inv_all_) . " ) "; } if ($this->inv_crp_) { $invP[] = " ind.ind_crp_id in (" . implode(',', $this->inv_crp_) . " ) "; } if ($this->inv_plt_) { $invP[] = " ind.ind_plt_id in (" . implode(',', $this->inv_plt_) . " ) "; } $this->sql_ .= "( " . implode(' OR ', $invP) . " )"; if ($startdate) { $this->sql_ .= " AND ind.ind_timestamp >= '" . gmdate('Y-m-d H:i', $startdate) . "' "; } if ($enddate) { $this->sql_ .= " AND ind.ind_timestamp <= '" . gmdate('Y-m-d H:i', $enddate) . "' "; } } else { if ($this->inv_all_) { $this->sql_ .= " INNER JOIN kb3_inv_all ina ON (ina.ina_kll_id = kll.kll_id)\n\t\t\t\t\t\tWHERE ina.ina_all_id in (" . implode(',', $this->inv_all_) . " ) "; if ($startdate) { $this->sql_ .= " AND ina.ina_timestamp >= '" . gmdate('Y-m-d H:i', $startdate) . "' "; } if ($enddate) { $this->sql_ .= " AND ina.ina_timestamp <= '" . gmdate('Y-m-d H:i', $enddate) . "' "; } } else { if ($this->inv_crp_) { $this->sql_ .= " INNER JOIN kb3_inv_crp inc ON (inc.inc_kll_id = kll.kll_id)\n\t\t\t\t\t\tWHERE inc.inc_crp_id in (" . implode(',', $this->inv_crp_) . " ) "; if ($startdate) { $this->sql_ .= " AND inc.inc_timestamp >= '" . gmdate('Y-m-d H:i', $startdate) . "' "; } if ($enddate) { $this->sql_ .= " AND inc.inc_timestamp <= '" . gmdate('Y-m-d H:i', $enddate) . "' "; } } } } // victim filter if ($this->vic_plt_ || $this->vic_crp_ || $this->vic_all_) { $this->sql_ .= " AND ( "; if ($this->vic_plt_) { $this->sql_ .= " " . $sqlwhereop . " kll.kll_victim_id in ( " . implode(',', $this->vic_plt_) . " )"; $sqlwhereop = " OR "; } if ($this->vic_crp_) { $this->sql_ .= " " . $sqlwhereop . " kll.kll_crp_id in ( " . implode(',', $this->vic_crp_) . " )"; $sqlwhereop = " OR "; } if ($this->vic_all_) { $this->sql_ .= " " . $sqlwhereop . " kll.kll_all_id in ( " . implode(',', $this->vic_all_) . " )"; $sqlwhereop = " OR "; } $this->sql_ .= " ) "; } if ($this->apikill_) { $this->sql_ .= " AND kll.kll_external_id IS NOT NULL "; } // System filter if (count($this->systems_)) { $this->sql_ .= " AND kll.kll_system_id in ( " . implode($this->systems_, ",") . ")"; } // Get all kills after given kill id (used for feed syndication) if ($this->minkllid_) { $this->sql_ .= ' AND kll.kll_id >= ' . $this->minkllid_ . ' '; } // Get all kills before given kill id (used for feed syndication) if ($this->maxkllid_) { $this->sql_ .= ' AND kll.kll_id <= ' . $this->maxkllid_ . ' '; } // Get all kills after given kill id (used for feed syndication) if ($this->minextkllid_) { $this->sqlinner_ .= ' AND kll.kll_external_id >= ' . $this->minextkllid_ . ' '; } // Get all kills before given kill id (used for feed syndication) if ($this->maxextkllid_) { $this->sqlinner_ .= ' AND kll.kll_external_id <= ' . $this->maxextkllid_ . ' '; } // excluded ship filter if (count($this->exclude_scl_)) { $this->sql_ .= " AND shp.shp_class not in ( " . implode(",", $this->exclude_scl_) . " )"; } // included ship filter if (count($this->vic_scl_id_)) { $this->sql_ .= " AND shp.shp_class in ( " . implode(",", $this->vic_scl_id_) . " ) "; } event::call('killlist_where_kill', $this->sql_); if ($this->ordered_) { if (!$this->orderby_) { if ($this->inv_plt_ || $this->inv_crp_ && $this->inv_all_) { $this->sql_ .= " order by ind.ind"; } elseif ($this->inv_all_) { $this->sql_ .= " order by ina.ina"; } elseif ($this->inv_crp_) { $this->sql_ .= " order by inc.inc"; } else { $this->sql_ .= " order by ind.ind"; } $this->sql_ .= "_timestamp desc"; } else { $this->sql_ .= " order by " . $this->orderby_; } } } else { $sqlwhereop = " WHERE "; if ($startdate) { $this->sql_ .= $sqlwhereop . " kll.kll_timestamp >= '" . gmdate('Y-m-d H:i', $startdate) . "' "; $sqlwhereop = " AND "; } if ($enddate) { $this->sql_ .= " AND kll.kll_timestamp <= '" . gmdate('Y-m-d H:i', $enddate) . "' "; $sqlwhereop = " AND "; } // victim filter if ($this->vic_plt_ || $this->vic_crp_ || $this->vic_all_) { $this->sql_ .= $sqlwhereop . " ( "; $sqlwhereop = ''; if ($this->vic_plt_) { $this->sql_ .= " " . $sqlwhereop . " kll.kll_victim_id in ( " . implode(',', $this->vic_plt_) . " )"; $sqlwhereop = " OR "; } if ($this->vic_crp_) { $this->sql_ .= " " . $sqlwhereop . " kll.kll_crp_id in ( " . implode(',', $this->vic_crp_) . " )"; $sqlwhereop = " OR "; } if ($this->vic_all_) { $this->sql_ .= " " . $sqlwhereop . " kll.kll_all_id in ( " . implode(',', $this->vic_all_) . " )"; } $this->sql_ .= " ) "; $sqlwhereop = ' AND '; } if ($this->apikill_) { $this->sql_ .= $sqlwhereop . " kll.kll_external_id IS NOT NULL "; $sqlwhereop = ' AND '; } // System filter if (count($this->systems_)) { $this->sql_ .= $sqlwhereop . " kll.kll_system_id in ( " . implode($this->systems_, ",") . ")"; $sqlwhereop = ' AND '; } // Get all kills after given kill id (used for feed syndication) if ($this->minkllid_) { $this->sql_ .= $sqlwhereop . ' kll.kll_id >= ' . $this->minkllid_ . ' '; $sqlwhereop = ' AND '; } // Get all kills before given kill id (used for feed syndication) if ($this->maxkllid_) { $this->sql_ .= $sqlwhereop . ' kll.kll_id <= ' . $this->maxkllid_ . ' '; $sqlwhereop = ' AND '; } // Get all kills after given kill id (used for feed syndication) if ($this->minextkllid_) { $this->sql_ .= $sqlwhereop . ' kll.kll_external_id >= ' . $this->minextkllid_ . ' '; $sqlwhereop = ' AND '; } // Get all kills before given kill id (used for feed syndication) if ($this->maxextkllid_) { $this->sql_ .= $sqlwhereop . ' kll.kll_external_id <= ' . $this->maxextkllid_ . ' '; $sqlwhereop = ' AND '; } // excluded ship filter if (count($this->exclude_scl_)) { $this->sql_ .= $sqlwhereop . " shp.shp_class not in ( " . implode(",", $this->exclude_scl_) . " )"; $sqlwhereop = ' AND '; } // included ship filter if (count($this->vic_scl_id_)) { $this->sql_ .= $sqlwhereop . " shp.shp_class in ( " . implode(",", $this->vic_scl_id_) . " ) "; $sqlwhereop = ' AND '; } event::call('killlist_where_loss', $this->sql_); if ($this->ordered_) { if (!$this->orderby_) { $this->sql_ .= " order by kll.kll_timestamp desc"; } else { $this->sql_ .= " order by " . $this->orderby_; } } } // Enclose query in another to fetch comments and involved parties if (!count($this->groupby_) && ($this->comments_ || $this->involved_)) { $this->sqlouterbottom_ .= ") list"; if ($this->involved_) { $this->sqlouterbottom_ .= ' join kb3_inv_detail ind ON (ind.ind_kll_id = list.kll_id)'; } if ($this->comments_) { $this->sqlouterbottom_ .= ' left join kb3_comments com ON (list.kll_id = com.kll_id AND (com.site = "' . KB_SITE . '" OR com.site IS NULL))'; } $this->sqlouterbottom_ .= " group by list.kll_id"; // Outer query also needs to be ordered, if there's an order if ($this->ordered_) { if (!$this->orderby_) { $this->sqlouterbottom_ .= " order by kll_timestamp desc"; } else { $this->sqlouterbottom_ .= " order by " . $this->orderby_; } } } // If the killlist will be split then only return kills in the range needed. if ($this->limit_) { $this->sql_ .= " limit " . $this->limit_ . " OFFSET " . $this->offset_; } elseif ($this->plimit_) { $splitq = DBFactory::getDBQuery(); $ssql = 'SELECT COUNT(1) as cnt FROM ' . $this->sqlinner_ . $this->sql_; $splitq->execute($ssql); $splitr = $splitq->getRow(); $this->count_ = $splitr['cnt']; $this->sql_ .= " limit " . $this->plimit_ . " OFFSET " . $this->poffset_; } $this->sql_ = $this->sqloutertop_ . $this->sqltop_ . $this->sqllong_ . $this->sql_ . $this->sqlouterbottom_; $this->sql_ .= " /* kill list */"; // die($this->sql_); $this->qry_->execute($this->sql_); if (!$this->plimit_ || $this->limit_) { $this->count_ = $this->qry_->recordcount(); } $this->executed = true; } }
$this->addMenuItem("link", "Recent Activity", edkURI::build($args, array('view', 'recent', true))); return ""; } /** * Build the menu. * * Add all preset options to the menu. */ function menu() { $menubox = new box("Menu"); $menubox->setIcon("menu-item.gif"); foreach ($this->menuOptions as $options) { if (isset($options[2])) { $menubox->addOption($options[0], $options[1], $options[2]); } else { $menubox->addOption($options[0], $options[1]); } } return $menubox->generate(); } } $systemDetail = new pSystemDetail(); event::call("systemdetail_assembling", $systemDetail); $html = $systemDetail->assemble(); $systemDetail->page->setContent($html); $systemDetail->context(); event::call("systemdetail_context_assembling", $systemDetail); $context = $systemDetail->assemble(); $systemDetail->page->addContext($context); $systemDetail->page->generate();
} function points() { $html = ''; if (config::get('kill_points') && !empty($this->points)) { $scorebox = new Box("Kill points"); $scorebox->addOption("points", $this->points); $html .= $scorebox->generate(); } if (config::get('loss_points') && !empty($this->lpoints)) { $scorebox = new Box("Loss points"); $scorebox->addOption("points", $this->lpoints); $html .= $scorebox->generate(); } if (config::get('total_points') && !empty($this->lpoints)) { $scorebox = new Box("Total points"); $scorebox->addOption("points", $this->points - $this->lpoints); $html .= $scorebox->generate(); } return $html; } } $pilotDetail = new pPilotDetail(); event::call("pilotDetail_assembling", $pilotDetail); $html = $pilotDetail->assemble(); $pilotDetail->page->setContent($html); $pilotDetail->context(); event::call("pilotDetail_context_assembling", $pilotDetail); $context = $pilotDetail->assemble(); $pilotDetail->page->addContext($context); $pilotDetail->page->generate();
case 'item': $result['link'] = edkURI::page('invtype', $row['typeID']); $result['name'] = $row['typeName']; $result['type'] = ''; $results[] = $result; break; } if ($qry->recordCount() == 1) { // if there is only one entry we redirect the user header("Location: " . html_entity_decode($result['link'])); die; } } $smarty->assignByRef('results', $results); } } $smarty->assign('nonajax', true); return $smarty->fetch(get_tpl('search_result')); } function newSearch() { global $smarty; $smarty->assign('actionURL', edkURI::page('search')); return $smarty->fetch(get_tpl('search_new')); } } $searchDetail = new pSearch(); event::call("search_assembling", $searchDetail); $html = $searchDetail->assemble(); $searchDetail->page->setContent($html); $searchDetail->page->generate();
function remove($delcomments = true, $permanent = true) { if (!$this->id) { return; } $qry = DBFactory::getDBQuery(); $qry->autocommit(false); event::call('killmail_delete', $this); summaryCache::delKill($this); $qry->execute("delete from kb3_inv_detail where ind_kll_id = " . $this->id); $qry->execute("delete from kb3_inv_all where ina_kll_id = " . $this->id); $qry->execute("delete from kb3_inv_crp where inc_kll_id = " . $this->id); $qry->execute("delete from kb3_items_destroyed where itd_kll_id = " . $this->id); $qry->execute("delete from kb3_items_dropped where itd_kll_id = " . $this->id); // Don't remove comments when readding a kill if ($delcomments) { $qry->execute("delete from kb3_comments where kll_id = " . $this->id); if ($permanent) { //this uses the trust field for a different purpose: to prevent reposts of deleted kills $qry->execute("UPDATE kb3_mails SET kll_trust = -1, kll_modified_time = UTC_TIMESTAMP() WHERE kll_id = " . $this->id); } else { $qry->execute("DELETE FROM kb3_mails WHERE kll_id = " . $this->id); } } $qry->execute("delete from kb3_kills where kll_id = " . $this->id); $qry->autocommit(true); $this->valid = false; Cacheable::delCache($this); }
$this->addMenuItem("link", "All losses", edkURI::build(array(array('ctr_id', $this->ctr_id, true), array('view', 'losses', true)))); return ""; } /** * Build the menu. * * Add all preset options to the menu. */ function menu() { $menubox = new box("Menu"); $menubox->setIcon("menu-item.gif"); foreach ($this->menuOptions as $options) { if (isset($options[2])) { $menubox->addOption($options[0], $options[1], $options[2]); } else { $menubox->addOption($options[0], $options[1]); } } return $menubox->generate(); } } $contractDetail = new pContractDetail(); event::call("contractDetail_assembling", $contractDetail); $html = $contractDetail->assemble(); $contractDetail->page->setContent($html); $contractDetail->context(); event::call("contractDetail_context_assembling", $contractDetail); $context = $contractDetail->assemble(); $contractDetail->page->addContext($context); $contractDetail->page->generate();
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"); }
//! Add an item to the menu in standard box format. /* ! * Only links need all 3 attributes * \param type Types can be caption, img, link, points. * \param name The name to display. * \param url Only needed for URLs. */ function addMenuItem($type, $name, $url = '') { $this->menuOptions[] = array($type, $name, $url); } //! Add a type of view to the options. /* ! * \param view The name of the view to recognise. * \param callback The method to call when this view is used. */ function addView($view, $callback) { $this->viewList[$view] = $callback; } } $pageAssembly = new killcharts(); event::call("killcharts_assembling", $pageAssembly); $html = $pageAssembly->assemble(); $pageAssembly->page->setContent($html); $pageAssembly->context(); //This resets the queue and queues context items. event::call("killcharts_context_assembling", $pageAssembly); $contextHTML = $pageAssembly->assemble(); $pageAssembly->page->addContext($contextHTML); $pageAssembly->page->generate();
$menubox->addOption($options[0], $options[1]); } } return $menubox->generate(); } /** * Return the set month. * @return integer */ function getMonth() { return $this->month; } /** * Return the set year. * @return integer */ function getYear() { return $this->year; } } $campaignList = new pCampaignList(); event::call("campaignList_assembling", $campaignList); $html = $campaignList->assemble(); $campaignList->page->setContent($html); $campaignList->context(); event::call("campaignList_context_assembling", $campaignList); $context = $campaignList->assemble(); $campaignList->page->addContext($context); $campaignList->page->generate();
/** * Add a comment to a kill. * * The kill id is set when the Comments object is constructed. * @param string $name The name of the comment poster. * @param string $text The text of the comment to post. */ function addComment($name, $text) { $comment = $this->bbencode(trim($text)); $name = trim($name); $qryP = new DBPreparedQuery(); $sql = "INSERT INTO kb3_comments (`kll_id`,`site`, `comment`,`name`,`posttime`, `ip`)\n VALUES (?, ?, ?, ?, ?, ?)"; $qryP->prepare($sql); $site = KB_SITE; $date = kbdate('Y-m-d H:i:s'); $ip = logger::getip(); $params = array('isssss', &$this->id_, &$site, &$comment, &$name, &$date, &$ip); $qryP->bind_params($params); $qryP->execute(); $id = $qryP->getInsertID(); $this->comments_[] = array('time' => kbdate('Y-m-d H:i:s'), 'name' => $name, 'comment' => $comment, 'id' => $id); // create comment_added event event::call('comment_added', $this); }
} /** * Build context. * * @return none */ function context() { parent::__construct(); $this->queue('menu'); } /** * Render of admin menu. * * @return string html */ function menu() { include 'common/admin/admin_menu.php'; return $menubox->generate(); } } $pageAssembly = new pIncCCForm(); event::call('pIncCCForm_assembling', $pageAssembly); $html = $pageAssembly->assemble(); $pageAssembly->page->setContent($html); $pageAssembly->context(); event::call('pIncCCForm_context_assembling', $pageAssembly); $context = $pageAssembly->assemble(); $pageAssembly->page->addContext($context); $pageAssembly->page->generate();