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')); }
function generate() { global $smarty; $this->toplist->generate(); $i = 1; $rows = array(); while ($row = $this->toplist->getRow()) { $pilot = Pilot::getByID($row['plt_id']); $uri = edkURI::build(array('a', 'kill_detail', true), array('kll_id', $row['kll_id'], true)); if ($row['plt_externalid']) { $img = imageURL::getURL('Pilot', $row['plt_externalid'], 32); } else { $img = $pilot->getPortraitURL(32); } $ship = Ship::getByID($row['ship']); $shipUri = edkURI::build(array('a', 'invtype', true), array('id', $row['ship'], true)); if ((int) number_format($row["isk"], 0, "", "") > 1000000000) { $isk = number_format($row["isk"] / 1000000000, 2, ".", "") . " b"; } elseif ((int) number_format($row["isk"], 0, "", "") > 1000000) { $isk = number_format($row["isk"] / 1000000, 2, ".", "") . " M"; } else { $isk = number_format($row["isk"], 0, ".", ","); } $rows[] = array('rank' => $i, 'name' => $pilot->getName(), 'uri' => $uri, 'portrait' => $img, 'shipImage' => $ship->getImage(32), 'shipName' => $ship->getName(), 'shipId' => $row['ship'], 'shipURI' => $shipUri, 'isk' => $isk); $i++; } $smarty->assign('tl_name', 'Pilot'); $smarty->assign('tl_type', $this->entity_); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(getcwd() . '/mods/most_expensive_toplist/templates/toplisttable_expensive.tpl'); }
/** * Add a menu item to the corp detail page. * @param pCorpDetail $home */ public static function addMenu($home) { $args = array(); $args[] = array('a', 'corp_detail', true); $args[] = array('crp_id', $home->crp_id, true); $args[] = array('view', "known_members", true); $home->addMenuItem("link", "Known Members", edkURI::build($args)); }
function generate() { global $smarty; $this->toplist->generate(); while ($row = $this->toplist->getRow()) { $item = new Item($row['itm_id']); $rows[] = array('rank' => false, 'name' => $item->getName(), 'uri' => edkURI::build(array('a', 'invtype', true), array('id', $item->getID(), true)), 'icon' => $item->getIcon(32), 'count' => $row['cnt']); } $smarty->assign('tl_name', Language::get('weapon')); $smarty->assign('tl_type', Language::get('kills')); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(get_tpl('toplisttable')); }
function generate() { global $smarty; $this->toplist->generate(); while ($row = $this->toplist->getRow()) { $ship = Ship::getByID($row['shp_id']); $shipclass = $ship->getClass(); $shipclass->getName(); $rows[] = array('rank' => false, 'name' => $ship->getName(), 'subname' => $shipclass->getName(), 'uri' => edkURI::page('invtype', $ship->getID()), 'portrait' => $ship->getImage(32), 'count' => $row['cnt']); } $smarty->assign('tl_name', Language::get('ship')); $smarty->assign('tl_type', Language::get('kills')); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(get_tpl('toplisttable')); }
function display() { global $smarty; $alls = $corps = $pilots = false; if (config::get('cfg_allianceid')) { $alls = array(); foreach (config::get('cfg_allianceid') as $entity) { $alliance = new Alliance($entity); if ($alliance->getExternalID()) { $url = edkURI::page('alliance_detail', $alliance->getExternalID(), 'all_ext_id'); } else { $url = edkURI::page('alliance_detail', $alliance->getID(), 'all_id'); } $alls[] = array('id' => $alliance->getID(), 'extid' => $alliance->getExternalID(), 'name' => $alliance->getName(), 'portrait' => $alliance->getPortraitURL(128), 'url' => $url); } } if (config::get('cfg_corpid')) { $corps = array(); foreach (config::get('cfg_corpid') as $entity) { $corp = new Corporation($entity); if ($corp->getExternalID()) { $url = edkURI::page('corp_detail', $corp->getExternalID(), 'crp_ext_id'); } else { $url = edkURI::page('corp_detail', $corp->getID(), 'crp_id'); } $corps[] = array('id' => $corp->getID(), 'extid' => $corp->getExternalID(), 'name' => $corp->getName(), 'portrait' => $corp->getPortraitURL(128), 'url' => $url); } } if (config::get('cfg_pilotid')) { $pilots = array(); foreach (config::get('cfg_pilotid') as $entity) { $pilot = new Pilot($entity); if ($pilot->getExternalID()) { $url = edkURI::page('pilot_detail', $pilot->getExternalID(), 'plt_ext_id'); } else { $url = edkURI::page('pilot_detail', $pilot->getID(), 'plt_id'); } $pilots[] = array('id' => $pilot->getID(), 'extid' => $pilot->getExternalID(), 'name' => $pilot->getName(), 'portrait' => $pilot->getPortraitURL(128), 'url' => $url); } } $smarty->assignByRef('alliances', $alls); $smarty->assignByRef('corps', $corps); $smarty->assignByRef('pilots', $pilots); return $smarty->fetch(get_tpl('self')); }
/** * Generate the output html from the template file. */ function generate() { global $smarty; $rows = array(); $max = 0; for ($i = 1; $i <= $this->length_; $i++) { $row = $this->toplist_->getRow(); if ($row) { $rows[] = $row; } if ($row['cnt'] > $max) { $max = $row['cnt']; } } if (empty($rows)) { return; } $pilot = new Pilot($rows[0]['plt_id']); $smarty->assign('title', $this->title_); $smarty->assign('pilot_portrait', $pilot->getPortraitURL(64)); $smarty->assign('award_img', config::get('cfg_img') . "/awards/" . $this->award_ . ".png"); $smarty->assign('url', edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $rows[0]['plt_id'], true))); $smarty->assign('name', $pilot->getName()); $bar = new BarGraph($rows[0]['cnt'], $max); $smarty->assign('bar', $bar->generate()); $smarty->assign('cnt', $rows[0]['cnt']); for ($i = 2; $i < $this->length_ + 1; $i++) { if (!$rows[$i - 1]['plt_id']) { break; } else { if (!$rows[$i - 1]['plt_name']) { $pilot = new Pilot($rows[$i - 1]['plt_id']); $pilotname = $pilot->getName(); } else { $pilotname = $rows[$i - 1]['plt_name']; } } $bar = new BarGraph($rows[$i - 1]['cnt'], $max); $top[$i] = array('url' => edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $rows[$i - 1]['plt_id'], true)), 'name' => $pilotname, 'bar' => $bar->generate(), 'cnt' => $rows[$i - 1]['cnt']); } $smarty->assign('top', $top); $smarty->assign('comment', $this->comment_); return $smarty->fetch(get_tpl('award_box')); }
function generate() { $this->kill_list_->rewind(); while ($kill = $this->kill_list_->getKill()) { if ($kill->isClassified()) { continue; } /* date in format: Tue, 03 Jun 2003 09:39:21 GMT Hack added because the time is not parsed correctly by strtotime() */ $timestamp = $kill->getTimeStamp(); $timestring = explode(" ", $timestamp); $datestring = strftime("%a, %d %b %Y ", strtotime($timestamp)); $datestring .= $timestring[1]; $datestring .= strftime(" %Z", strtotime($timestamp)); $html .= "<item>\r\n <title>" . $kill->getVictimName() . " was killed</title>\r\n <description>\r\n <![CDATA[\r\n <p><b>Ship:</b> " . $kill->getVictimShipName() . "\r\n <br /><b>Victim:</b> " . $kill->getVictimName() . "\r\n <br /><b>Corp:</b> " . $kill->getVictimCorpName() . "\r\n <br /><b>Alliance:</b> " . $kill->getVictimAllianceName() . "\r\n <br /><b>System:</b> " . $kill->getSolarSystemName() . "\r\n <br /><b>Date:</b> " . $timestamp . "\r\n <br />\r\n <br /><b>Killed By:</b>\r\n <br /><b>Final Blow:</b> " . $kill->getFBPilotName() . "\r\n <br /><b>Corp:</b> " . $kill->getFBCorpName() . "\r\n <br /><b>Alliance:</b> " . $kill->getFBAllianceName() . "\r\n </p>\r\n ]]>\r\n </description>\r\n <guid>" . edkURI::page('kill_detail', $kill->getID(), 'kll_id') . "</guid>\r\n <pubDate>" . $datestring . "</pubDate>\r\n</item>\n"; } return $html; }
function content() { global $smarty; if (trim($_POST['usrpass'])) { if ($_POST['usrlogin'] == '' && $_POST['usrpass'] == ADMIN_PASSWORD && substr(ADMIN_PASSWORD, 0, 3) != '$1$' && substr(ADMIN_PASSWORD, 0, 3) != '$2$' && substr(ADMIN_PASSWORD, 0, 3) != '$2a$') { @chmod("kbconfig.php", 0660); if (!is_writeable("kbconfig.php")) { $smarty->assign('error', 'Admin password is unencrypted and ' . 'kbconfig.php is not writeable. Either encrypt the admin ' . 'password or set kbconfig.php writeable.'); } else { $kbconfig = file_get_contents('kbconfig.php'); $newpwd = preg_replace('/(\\$|\\\\)/', '\\\\$1', crypt(ADMIN_PASSWORD)); $kbconfig = preg_replace('/define\\s*\\(\\s*[\'"]ADMIN_PASSWORD[\'"]' . '[^)]*\\)/', "define('ADMIN_PASSWORD', '" . $newpwd . "')", $kbconfig); file_put_contents("kbconfig.php", trim($kbconfig)); chmod("kbconfig.php", 0440); session::create(true); session_write_close(); header('Location: ' . htmlspecialchars_decode(edkURI::page('admin') . '&akey=' . session::makeKey())); //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')); }
function generate() { global $smarty; $this->toplist->generate(); $i = 1; $rows = array(); while ($row = $this->toplist->getRow()) { $pilot = Pilot::getByID($row['plt_id']); if ($row['plt_externalid']) { $uri = edkURI::build(array('a', 'pilot_detail', true), array('plt_ext_id', $row['plt_externalid'], true)); $img = imageURL::getURL('Pilot', $row['plt_externalid'], 32); } else { $uri = edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $row['plt_id'], true)); $img = $pilot->getPortraitURL(32); } $rows[] = array('rank' => $i, 'name' => $pilot->getName(), 'uri' => $uri, 'portrait' => $img, 'count' => $row['cnt']); $i++; } $smarty->assign('tl_name', 'Pilot'); $smarty->assign('tl_type', $this->entity_); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(get_tpl('toplisttable')); }
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')); }
<?php /** * @package EDK */ /* * Export killmails, uses the searchroutine to find them. * Currently only supports users, * but will be made to support corps and alliances */ require_once 'admin_menu.php'; $page = new Page('Administration - Export searcher'); $page->setAdmin(); $html .= '<form id="search" method="post" action="' . edkURI::page("admin_kill_export_search") . '">'; $html .= "<table class=kb-subtable><tr>"; $html .= "<td>Type:</td><td>Text: (3 letters minimum)</td>"; $html .= "</tr><tr>"; $html .= "<td><input id=searchphrase name=searchphrase type=text size=30/></td>"; $html .= "<td><input type=submit name=submit value=Search></td>"; $html .= "</tr></table>"; $html .= "</form>"; if ($_POST['searchphrase'] != "" && strlen($_POST['searchphrase']) >= 3) { $sql = "select plt.plt_id, plt.plt_name, crp.crp_name\r\n from kb3_pilots plt, kb3_corps crp\r\n where lower( plt.plt_name ) like lower( '%" . slashfix($_POST['searchphrase']) . "%' )\r\n and plt.plt_crp_id = crp.crp_id\r\n order by plt.plt_name"; $header = "<td>Pilot</td><td>Corporation</td>"; $qry = DBFactory::getDBQuery(); if (!$qry->execute($sql)) { die($qry->getErrorMsg()); } $html .= "<div class=block-header>Search results</div>"; if ($qry->recordCount() > 0) { $html .= "<table class=kb-table width=450 cellspacing=1>";
return $html = $tkbox->generate(); } // add filter toggling script $jsDir = config::get("cfg_kbhost") . '/mods/' . basename(dirname(__FILE__)) . '/js/'; $page->addHeader("<script type=\"text/javascript\" src=\"" . $jsDir . "toggleFilter.js\"></script>"); switch ($_GET['view']) { case '': echo "<!-- MOD VERSION -->\n"; $battlelist = new BattleList(); $page->setTitle('Fleet Battles'); $table = new BattleListTable($battlelist); // pagination only available for cached battles and non-filtered results if (config::get('fleet_battles_mod_cache') && !isset($_POST["filter"])) { $table->setPageSplit(config::get('killcount') * 2); $pagesplitter = new PageSplitter($table->getCount(), config::get('killcount') * 2); $pagesplit = $pagesplitter->generate(); $html .= $pagesplit . $table->generate() . $pagesplit . $table->getStatsHtml(); } else { $html .= $table->generate() . $table->getStatsHtml(); } break; } $menubox = new box('Menu'); $menubox->setIcon('menu-item.gif'); $menubox->addOption('link', 'Fleet Battles', edkURI::page('battles')); $page->addContext($menubox->generate()); if (config::get('fleet_battles_mod_cache')) { $page->addContext(toplists($table->getFilterArgumentsWhereSql())); } $page->setContent($html); $page->generate();
</tr> <tr> <td valign="top">Constellations:</td> <td>'; foreach ($constellation as $const) { $html .= $const . '<br>'; } $html .= '</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="top">Systems: </td> <td>'; foreach ($systems as $sys) { $systemLink = edkURI::build(array(array('region_id', $regionID, true), array('sys', intval($sys['id']), false))); $html .= '<a href="' . $systemLink . '">' . $sys['name'] . '</a> ( <span style="color:' . $sec_color[$sys['sec'] * 10] . '"> ' . $sys['sec'] . '</span> )<br>'; } $html .= '</td> </tr> </table></td> </tr> <tr> <td colspan="2"> </td> </tr> </table>'; } $page->setContent($html); $page->generate();
/** * Set up the menu. * * Additional options that have been set are added to the menu. */ function menuSetup() { if ($this->month == 12) { $nmonth = 1; $nyear = $this->year + 1; } else { $nmonth = $this->month + 1; $nyear = $this->year; } if ($this->month == 1) { $pmonth = 12; $pyear = $this->year - 1; } else { $pmonth = $this->month - 1; $pyear = $this->year; } $this->addMenuItem("caption", "Navigation"); $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))); } }
/** * * @global array $destroyed * @global <type> $pilots * @global array $pods * @param Kill $kill * @param <type> $side * @return <type> */ function handle_destroyed($kill, $side, &$destroyed, &$pilots, $sideAssignmentMap = array(), $completeInformation = FALSE) { // ------------------------------------------------------------------------- // FIX BATTLE REPORT a little by Evoke. Salvoxia // BEGIN // ------------------------------------------------------------------------- // we don't want losses of our own corp/ally as losses on the enemy's side if ($side == 'e') { if (config::get('cfg_corpid')) { $corpId = config::get('cfg_corpid'); $corpId = $corpId[0]; if ($kill->getVictimCorpID() == $corpId) { return; } } elseif (config::get('cfg_allianceid')) { $allianceId = config::get('cfg_allianceid'); $allianceId = $allianceId[0]; if ($kill->getVictimAllianceID() == $allianceId) { return; } } } // ------------------------------------------------------------------------- // FIX BATTLE REPORT a little by Evoke. Salvoxia // END // ------------------------------------------------------------------------- if ($completeInformation && !is_null($destroyed) && is_array($destroyed)) { $destroyed[$kill->getID()] = $kill->getVictimID(); } if (config::get('fleet_battles_mod_sideassign')) { // determine whether the pilot is member of an alliance if ($kill->getVictimAllianceName() == "None") { $entityType = "corp"; $entityId = $kill->getVictimCorpID(); } else { $entityType = "alliance"; $entityId = $kill->getVictimAllianceID(); } if (isset($sideAssignmentMap[$entityType][$entityId])) { $pilotSide = $sideAssignmentMap[$entityType][$entityId]; } else { $pilotSide = $side; } } else { $pilotSide = $side; } $ship = Ship::lookup($kill->getVictimShipName()); $shipc = $ship->getClass(); $ts = strtotime($kill->getTimeStamp()); // mark the pilot as podded if ($shipc->getID() == 18 || $shipc->getID() == 2) { // increase the timestamp of a podkill by 1 so its after the shipkill $ts++; } // search for ships with the same id if (isset($pilots[$pilotSide][$kill->getVictimId()]) && is_array($pilots[$pilotSide][$kill->getVictimId()])) { foreach ($pilots[$pilotSide][$kill->getVictimId()] as $id => $_ship) { if ($ship->getID() == $_ship['sid']) { $pilots[$pilotSide][$kill->getVictimId()][$id]['destroyed'] = true; if (!isset($pilots[$pilotSide][$kill->getVictimId()][$id]['kll_id'])) { $pilots[$pilotSide][$kill->getVictimId()][$id]['kll_id'] = $kill->getID(); $pilots[$pilotSide][$kill->getVictimId()][$id]['kll_url'] = edkURI::page('kill_detail', $kill->getID(), "kll_id"); } //$pilots[$side][$kill->getVictimId()][0]["times"] +=1; return; } } } if ($completeInformation) { $pilots[$pilotSide][$kill->getVictimId()][] = array('name' => $kill->getVictimName(), 'plt_url' => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), 'kll_id' => $kill->getID(), 'kll_url' => edkURI::page('kill_detail', $kill->getID(), "kll_id"), 'spic' => imageURL::getURL('Ship', $ship->getID(), 32), 'scl' => $shipc->getPoints(), 'destroyed' => true, 'corp' => $kill->getVictimCorpName(), 'alliance' => $kill->getVictimAllianceName(), 'aid' => $kill->getVictimAllianceID(), 'alliance_url' => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), 'ship' => $kill->getVictimShipname(), 'shipClass' => $shipc->getName(), 'shipClassObject' => $shipc, 'sid' => $ship->getID(), 'cid' => $kill->getVictimCorpID(), 'crp_url' => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), 'ts' => $ts, 'times' => 0, 'color' => getColorClassByClass($shipc)); } else { $pilots[$pilotSide][$kill->getVictimId()] = 1; } }
/** * Check if database is at latest update * * @return string HTML link to update or show that no update is needed. */ public static function dbCheck() { if (!class_exists('DOMDocument')) { return "The required PHP DOMDocument libraries are not installed."; } update::checkStatus(); if (update::$dbVersion > Config::get('upd_dbVersion')) { return "<div>Database updates are available, <a href='" . edkURI::page('admin_upgrade') . "'>here</a></div><br/>"; } return "<div>No updates available</div>"; }
<?php /** * @package EDK */ // admin menu now loads all admin pages with options require_once 'common/admin/admin_menu.php'; $page = new Page(); $page->setAdmin(); if ($_POST) { options::handlePost(); } $page->setContent(options::genOptionsPage()); $page->addContext(options::genAdminMenu()); if (!edkURI::getArg('field', 1) || !edkURI::getArg('sub', 1) || edkURI::getArg('field', 1) == 'Advanced' && edkURI::getArg('sub', 2) == 'Configuration') { $page->setTitle('Administration - Board Configuration (Current version: ' . KB_VERSION . ' ' . KB_RELEASE . ')'); } $page->generate();
/** * Return a URL for the details page of this Pilot. * * @return string The URL for this Pilot's details page. */ function getDetailsURL() { if ($this->getExternalID()) { return edkURI::page('pilot_detail', $this->externalid, 'plt_ext_id'); } else { return edkURI::page('pilot_detail', $this->id, 'plt_id'); } }
$html .= "x"; } $html .= "</td>"; $html .= '<td align=center><a href="' . edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'edit', false), array('sop', "del_{$type}", false), array('id', $contracttarget->getID(), false))) . '">delete</a></td></tr>'; } if ($c < 30) { $html .= '<form id=add_target name=add_target method=post action="' . edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'edit', false))) . '">'; $html .= "<tr><td></td></tr>"; $html .= "<tr><td><input type=text id=add_name name=add_name size=30 maxlength=30></td><td align=center><input type=radio name=add_type id=add_type value=0 checked></td><td align=center><input type=radio name=add_type id=add_type value=1></td><td align=center><input type=radio name=add_type id=add_type value=2></td><td align=center><input type=radio name=add_type id=add_type value=3></td><td align=center><input type=submit id=submit name=submit value=Add></td></tr>"; } $html .= "</table>"; $html .= "</form>"; } } // add if (edkURI::getArg('op') == "add") { if ($_POST['detail_submit']) { $contract = new Contract(); $contract->add($_POST['ctr_name'], $_POST['ctr_started'], $_POST['ctr_ended'], $_POST['ctr_comment']); header("Location: " . htmlspecialchars_decode(edkuri::build(array(array('ctr_id', $contract->getID(), false), array('op', 'edit', false))))); } $page->setTitle("Administration - Add Campaign"); $html .= "<div class=block-header2>Details</div>"; $html .= '<form id=detail_edit name=detail_edit method=post action="' . edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'add', false))) . '">'; $html .= "<table class=kb-table width=98%>"; $html .= "<tr><td width=80><b>Name:</b></td><td><input type=text name=ctr_name id=ctr_name size=40 maxlength=40></td></tr>"; $html .= "<tr><td width=80><b>Start date:</b></td><td><input type=text name=ctr_started id=ctr_started size=10 maxlength=10 value=\"" . kbdate("Y-m-d") . "\"> (yyyy-mm-dd)</td></tr>"; $html .= "<tr><td width-80><b>End date:</b></td><td><input type=text name=ctr_ended id=ctr_ended size=10 maxlength=10> (yyyy-mm-dd or blank)</td></tr>"; $html .= "<tr><td><b>Comment:</b></td><td><input type='text' name='ctr_comment' size='100'/></td></tr>"; $html .= "<tr><td></td></tr>"; $html .= "<tr><td></td><td><input type=submit name=detail_submit value=\"Save\"></td></tr>";
<?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; }
if (!$row['last']) { return false; } else { return time() - (int) $row['last']; } } $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();
function getTableStats() { // Don't use caching to save memory. These queries are once only. $qry = new DBQuery(true); $this->metric_total = $this->contractlist_->getCount(); for ($i = 0; $i < $this->contractlist_->getCount(); $i++) { $contract = $this->contractlist_->getBattle($i); if (!($contract->getKillISK() + $contract->getLossISK() > config::get('fleet_battles_mod_minisk') * 1000000)) { $this->metric_total = $this->metric_total - 1; continue 1; } // generate all necessary objects within the contract $contract->execQuery(); for ($j = 0; $j < 2; $j++) { if ($j == 0) { $list =& $contract->llist_; } else { $list =& $contract->klist_; } $isk = $list->getISK(); if ($j == 0) { $ldata = array('losses' => $list->getCount(), 'lossisk' => $isk / 1000); $this->lss_isk_all_time += $isk; } else { $kdata = array('kills' => $list->getCount(), 'killisk' => $isk / 1000); $this->kll_isk_all_time += $isk; } } if ($kdata['killisk']) { $efficiency = round($kdata['killisk'] / ($kdata['killisk'] + $ldata['lossisk']) * 100, 2); } else { $efficiency = 0; } $bar = new BarGraph($efficiency, 100); if (!config::get('fleet_battles_mod_cache')) { $this->inv_all_time += $contract->getInvolved(); $this->kll_all_time += $contract->getKills(); $this->lss_all_time += $contract->getLosses(); } $battle = array_merge(array('name' => $contract->getName(), 'startdate' => $contract->getStartDate(), 'enddate' => $contract->getEndDate(), 'bar' => $bar->generate(), 'endtime' => date('H:i:s', strtotime($contract->getEndDate())), 'efficiency' => $efficiency, 'involved' => $contract->getInvolved(), 'kll_id' => $contract->getKillID(), 'id' => $contract->getID(), 'numberOfOwnersInvolved' => $contract->getNumberOfOwnersInvolved(), 'ownerPilotIds' => $contract->getOwnersInvolved()), $kdata, $ldata); if (config::get('fleet_battles_mod_cache')) { $this->cacheBattle($battle); } else { $tbldata[] = $battle; } } if (config::get('fleet_battles_mod_cache')) { $cacheq = DBFactory::getDBQuery(); $whereSql = ""; if ($this->isFiltered) { $filterTerms = $this->getFilterArgumentsWhereSql(); // build filter-string if (!empty($filterTerms)) { $whereSql = "WHERE " . implode(" AND ", $filterTerms); } } $sql = "SELECT * \n FROM kb3_battles_cache bc\n INNER JOIN kb3_systems sys ON sys.sys_name = bc.system\n INNER JOIN kb3_constellations con ON con.con_id = sys.sys_con_id\n INNER JOIN kb3_regions reg ON reg.reg_id = con.con_reg_id\n {$whereSql} \n ORDER BY end DESC"; $cacheq->execute($sql); while ($cb = $cacheq->getRow()) { $args = array(); $args[] = array('a', 'kill_related', true); $tbldata[] = array('name' => $cb['system'], 'kll_id' => $cb['kll_id'], 'id' => $cb['battle_id'], 'enddate' => $cb['end'], 'startdate' => $cb['start'], 'endtime' => date('H:i:s', strtotime($cb['end'])), 'kills' => $cb['kills'], 'losses' => $cb['losses'], 'efficiency' => $cb['efficiency'], 'involved' => $cb['involved'], 'killisk' => $cb['killisk'], 'lossisk' => $cb['lossisk'], 'bar' => $cb['bar'], 'numberOfOwnersInvolved' => $cb['ownersInvolved'], 'battle_url' => edkURI::build($args, array('kll_id', $cb['kll_id'], true), array('battle', true, true))); } } return $tbldata; }
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; }
if ($num >= $_SESSION['kill_import']['num']) { $html .= "{$i}/" . $_SESSION['kill_import']['count'] . " - {$num} files read, {$p} new, {$posted} old, {$inv} invalid<br>\n"; $_SESSION['kill_import']['numcount'] = $i; break; } } } } else { $html .= 'Killmail folder does not exist. Press reset to check settings.<br/>'; } if ($_SESSION['kill_import']['count'] - $_SESSION['kill_import']['numcount'] > 0) { $html .= '<meta http-equiv="refresh" content="5; URL=' . edkURI::page("admin_kill_import") . '" />'; $html .= 'Automatic refresh in 5s<br/>'; $html .= '<a href="' . edkURI::page("admin_kill_import") . '">Read next ' . $_SESSION['kill_import']['num'] . '</a> <a href="' . KB_HOST . '/?a=admin_kill_import&submit=Reset&akey=' . session::makeKey() . '">Reset</a>'; $_SESSION['kill_import']['read'] += $read; $_SESSION['kill_import']['p_all'] += $p_all; $_SESSION['kill_import']['posted_all'] += $posted_all; $_SESSION['kill_import']['invalid'] += $invalid; } else { $html .= 'Import complete, ' . $_SESSION['kill_import']['read'] . ' files read, ' . $_SESSION['kill_import']['p_all'] . ' kills added, ' . $_SESSION['kill_import']['posted_all'] . ' already posted, ' . $_SESSION['kill_import']['invalid'] . ' malformed<br>'; $html .= '<hr/>The following files contained malformed mails:<br/>'; foreach ($_SESSION['kill_import']['malformed'] as $mal_file) { $html .= $mal_file . '<br/>'; } $html .= '<a href="' . edkURI::page("admin_kill_import") . '">Ok</a>'; unset($_SESSION['kill_import']); } } $page->addContext($menubox->generate()); $page->setContent($html); $page->generate();
try { $count = $fetch->fetch_values(); $html .= "Fetched and updated <b>" . $count . "</b> items!<br /><br />"; } catch (Exception $e) { $html .= "Error in fetch: " . $e->getMessage(); $html .= "<br />This was probably caused by an incorrect filename"; } $html .= "</center>"; } else { // Get from config $url = config::get('fetchurl'); $timestamp = config::get('lastfetch'); $time = date('r', $timestamp); if ($url == null) { $url = "http://eve.no-ip.de/prices/30d/prices-all.xml"; } $html .= 'Last update: ' . $time . '<br /><br />'; $html .= '<form method="post" action="' . edkURI::page("admin_value_fetch") . '">'; $html .= '<table width="100%" border="1">'; $html .= '<tr><td>Filename</td><td colspan="2"><input type="text" name="turl" id="turl" value="' . $url . '" size="110" /></td></tr>'; $html .= '<tr><td colspan="3" align="center"><i>Leave above field empty to reset to default.</i></td></tr>'; if (time() - $timestamp < 86400) { $html .= '<tr><td colspan="3" align="center"><b>YOU HAVE UPDATED LESS THAN 24 HOURS AGO!</b></td></tr>'; } $html .= '<tr><td colspan="3"><button value="submit" type="submit" name="submit">Fetch</button></td></tr>'; $html .= '</table></form>'; $html .= '<br /><a href="' . edkURI::page('admin_value_editor') . '">Manually update values</a>'; } $page->setContent($html); $page->addContext($menubox->generate()); $page->generate();
/** * Return the URL for the alliance's details page. * * @return string URL for the details page. */ function getDetailsURL() { if ($this->getExternalID()) { return edkURI::page('alliance_detail', $this->externalid, 'all_ext_id'); } else { return edkURI::page('alliance_detail', $this->id, 'all_id'); } }
} else { if ($flags & KB_APIKEY_LEGACY) { $html .= "Requires Updated Key"; } if ($flags & KB_APIKEY_BADAUTH) { $html .= "Bad Authentication"; } if ($flags & KB_APIKEY_EXPIRED) { $html .= "Expired Key"; } if ($flags & KB_APIKEY_BADCORP) { $html .= "Bad Corporation Key"; } } $html .= "</td>"; $html .= '<td><a href="' . edkURI::build(array('delete', $row['key_id'], false)) . '">Del</a></td>'; $html .= "</tr>"; $cycle = !$cycle; } $html .= "</table>"; $html .= "<div class='block-header2'>Add a new API Key</div>"; $html .= "<i> Your API key ID and verification Code can be obtained <a href=\"http://support.eveonline.com/api/Key/CreatePredefined/256\">here</a></i><br /><br />"; $html .= "<table style='width: 100%' class='kb-subtable'>"; $html .= "<thead><tr><td>Name</td><td>ID</td><td>Verification Code</td><td></td></tr></thead>"; $html .= "<tbody><tr>"; $html .= "<td><input type='text' name='keyname' id='keyname' size='20' /></td>"; $html .= "<td><input type='text' name='keyid' id='keyid' size='10' maxlength='64' /></td>"; $html .= "<td><input type='text' name='keycode' id='keycode' size='64' maxlength='64' /></td><td colspan='3'><input id='add' name='add' type='submit' value='Add' /></td></tr>"; $html .= "<tr><td colspan='6'> </td></tr></tbody></table>"; $html .= "<div class='block-header2'>Options</div><table>"; $html .= "<tr><td style='padding: 10px 0' colspan='2'>(" . $deld . " files with a total size of " . number_format($dsize, "0", ".", ",") . " bytes)</td></tr>";
require_once 'common/admin/admin_menu.php'; $page = new Page('Administration - Mods'); $page->setAdmin(); if (isset($_POST['set_mods']) && $_POST['set_mods']) { foreach ($_POST as $key => $val) { if (substr($key, 0, 4) == "mod_" && $val == "on") { if (substr($key, 4, strlen($key) - 4) != 'item_values') { $activemods .= substr($key, 4, strlen($key) - 4) . ","; } } } $activemods = substr($activemods, 0, strlen($activemods) - 1); config::set("mods_active", $activemods); } $activemods = explode(",", config::get("mods_active")); $rows = array(); if ($handle = opendir('mods')) { $modlist = array(); while ($file = readdir($handle)) { if (is_dir("mods/{$file}") && $file != ".." & $file != "." & $file != ".svn") { $rows[$file] = array('name' => $file, 'url' => edkURI::page("settings_{$file}"), 'checked' => in_array($file, $activemods), 'settings' => file_exists("mods/{$file}/settings.php")); } } ksort($rows); closedir($handle); } $smarty->assign('rows', $rows); $smarty->assign('url', edkURI::page("admin_mods")); $page->setContent($smarty->fetch(get_tpl('admin_mods'))); $page->addContext($menubox->generate()); $page->generate();
/** * Set up the menu. * * Prepare all the base menu options. */ function menuSetup() { $this->addMenuItem("caption", "Overview"); $this->addMenuItem("link", "Target overview", edkURI::build(array('ctr_id', $this->ctr_id, true))); $this->addMenuItem("caption", "Kills & losses"); $this->addMenuItem("link", "Recent activity", edkURI::build(array(array('ctr_id', $this->ctr_id, true), array('view', 'recent_activity', true)))); $this->addMenuItem("link", "All kills", edkURI::build(array(array('ctr_id', $this->ctr_id, true), array('view', 'kills', true)))); $this->addMenuItem("link", "All losses", edkURI::build(array(array('ctr_id', $this->ctr_id, true), array('view', 'losses', true)))); return ""; }