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')); }
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 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')); }
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();
<?php /** * @package EDK */ $session = new Session(); $session->destroy(); header('Location: ' . html_entity_decode(edkURI::page("login")));
<?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>";
$typeURL = edkURI::page('corp_detail', $ctrTypeID, 'crp_id'); break; case "alliance": $alliance = new Alliance($ctrTypeID); $name = $alliance->getName(); $typeURL = edkURI::page('alliance_detail', $ctrTypeID, 'all_id'); break; case "region": $region = new Region($ctrTypeID); $name = $region->getName(); $typeURL = edkURI::page('detail_view', $ctrTypeID, 'region_id'); break; case "system": $system = new SolarSystem($ctrTypeID); $name = $system->getName(); $typeURL = edkURI::page('system_detail', $ctrTypeID, 'sys_id'); break; } if ($typeURL) { $html .= '<tr class=kb-table-row-odd><td class=kb-table-cell><b><a href="' . $typeURL . '">' . $name . '</b></td><td class=kb-table-cell align=center>'; } else { $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>" . $name . "</b></td><td class=kb-table-cell align=center>"; } if ($type == "corp") { $html .= "x"; } $html .= "</td><td class=kb-table-cell align=center>"; if ($type == "alliance") { $html .= "x"; } $html .= "</td><td class=kb-table-cell align=center>";
/** * 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'); } }
/** * 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>"; }
function Import($name, $id, $key, $flags) { $output = ""; // Skip bad keys if ($flags & KB_APIKEY_BADAUTH || $flags & KB_APIKEY_EXPIRED || $flags & KB_APIKEY_BADCORP) { return; // skip bad keys } // also skip legacy keys now if ($flags & KB_APIKEY_LEGACY) { return; } // reduces strain on DB if (function_exists("set_time_limit") && !ini_get('safe_mode')) { set_time_limit(0); } $lastdatakillid = 1; $currentdatakillid = 0; $logsource = "New XML"; // Load new XML $output = "<i>Downloading latest XML file for {$name}</i><br><br>"; $accts = new API_Account(); $characters = $accts->fetch($id, $key); $posted = array(); $skipped = array(); foreach ($characters as $char) { $output .= "Processing " . $char['characterName'] . "<br><br>"; $currentkill = 0; $lastkill = -1; while ($lastkill != $currentkill) { $lastkill = $currentkill; $args = array("characterID" => $char['characterID']); if ($lastkill) { $args["beforeKillID"] = $lastkill; } if ($flags & KB_APIKEY_CORP) { $killLog = $this->CallAPI("corp", "KillLog", $args, $id, $key); } else { if ($flags & KB_APIKEY_CHAR) { $killLog = $this->CallAPI("char", "KillLog", $args, $id, $key); } else { $output .= "<div class='block-header2'>Key does not have access to KillLog</div>"; break; } } if ($this->getError() === null) { // Get oldest kill $currentkill = 0; $sxe = simplexml_load_string($this->pheal->xml); foreach ($sxe->result->rowset->row as $row) { if ($currentkill < (int) $row['killID']) { $currentkill = (int) $row['killID']; } } } if ($this->getError() !== null) { if ($this->getError() == 120 && $this->pheal->xml) { // Check if we just need to skip back a few kills // i.e. first page of kills is already fetched. $pos = strpos($this->pheal->xml, "Expected beforeKillID ["); if ($pos) { $pos += 23; $pos2 = strpos($this->pheal->xml, "]", $pos); $currentkill = (int) substr($this->pheal->xml, $pos, $pos2 - $pos); } } else { if (!$posted && !$skipped) { // Something went wrong and no kills were found. $qry = DBFactory::getDBQuery(); $logtype = "Cron Job"; $qry->execute("insert into kb3_apilog\tvalues( '" . KB_SITE . "', '" . addslashes($name) . "'," . "0, " . "0, " . "0, " . "0, " . "0, '" . "Error','" . "Cron Job','" . $this->getError() . "', " . "UTC_TIMESTAMP() )"); $output .= "<div class='block-header2'>" . $this->getMessage() . "</div>"; break; } else { // We found kills! $qry = DBFactory::getDBQuery(); $logtype = "Cron Job"; $qry->execute("insert into kb3_apilog values( '" . KB_SITE . "', '" . addslashes($name) . "'," . count($posted) . "," . "0 ," . count($skipped) . "," . "0 ," . (count($posted) + count($skipped)) . ",'" . "New XML','" . "Cron Job','" . ($this->getError() == 119 ? 0 : $this->getError()) . "', " . "UTC_TIMESTAMP() )"); break; } } } $feedfetch = new IDFeed(); $feedfetch->setXML($this->pheal->xml); $feedfetch->setLogName("API"); $feedfetch->read(); $posted = array_merge($posted, $feedfetch->getPosted()); $skipped = array_merge($skipped, $feedfetch->getSkipped()); $output .= "<div class='block-header2'>" . count($posted) . " kill" . (count($posted) == 1 ? "" : "s") . " posted, " . count($skipped) . " skipped from feed: " . $id . ".<br></div>"; if (count($posted)) { $output .= "<div class='block-header2'>Posted</div>\n"; foreach ($posted as $killid) { $output .= "<div><a href='" . edkURI::page('kill_detail', $killid[2], 'kll_id') . "'>Kill " . $killid[0] . "</a></div>"; } } } } return $output; }
/** * If this is not an admin session redirect to the login page. */ public function setAdmin() { if (!Session::isAdmin()) { $page = edkURI::getArg("a"); $link = html_entity_decode(edkURI::page("login", $page, "page")); header("Location: {$link}"); echo '<a href="' . $link . '">Login</a>'; exit; } }
$search = slashfix($_POST['search']); $qry = DBFactory::getDBQuery(); $qry->execute('select usr_login from kb3_user where usr_login like ' . "'%" . $search . "%'"); while ($row = $qry->getRow()) { $hitlist[] = $row['usr_login']; } $smarty->assignByRef('role', $_POST['role']); $smarty->assignByRef('user', $hitlist); $smarty->assign('url', edkURI::page("admin_roles")); $page->addContext($menubox->generate()); $page->setContent($smarty->fetch(get_tpl('admin_roles_assign'))); $page->generate(); } elseif ($_POST['action'] == 'assign') { $qry = DBFactory::getDBQuery(); $tmp = role::_get($_POST['role']); var_dump($tmp); #$qry->execute('select usr_login from kb3_user where usr_login like '."'%".$search."%'"); } elseif ($_POST['action'] == 'create') { $page->addContext($menubox->generate()); $page->setContent('to be done'); $page->generate(); } else { $hardcoded =& role::get(true); $softcoded =& role::get(); $smarty->assignByRef('hroles', $hardcoded); $smarty->assignByRef('sroles', $softcoded); $smarty->assign('url', edkURI::page("admin_roles")); $page->addContext($menubox->generate()); $page->setContent($smarty->fetch(get_tpl('admin_roles'))); $page->generate(); }
$error = false; if (config::get('user_regpass')) { if ($_POST['regpass'] != config::get('user_regpass')) { $smarty->assign('error', 'Registration password does not match.'); $error = true; } } if (!$_POST['usrlogin']) { $smarty->assign('error', 'You missed to specify a login.'); $error = true; } if (!$_POST['usrpass']) { $smarty->assign('error', 'You missed to specify a password.'); $error = true; } if (strlen($_POST['usrpass']) < 3) { $smarty->assign('error', 'Your password needs to have at least 4 chars.'); $error = true; } if (!$error) { $pilot = null; $id = null; user::register(slashfix($_POST['usrlogin']), slashfix($_POST['usrpass']), $pilot, $id); $page->setContent('Account registered.'); $page->generate(); return; } } $smarty->assign('actionURL', edkURI::page('register')); $page->setContent($smarty->fetch(get_tpl('user_register'))); $page->generate();
/** * Start constructing the page. * Prepare all the shared variables such as dates and check alliance ID. * */ function start() { $this->page = new Page(); $this->plt_id = (int) edkURI::getArg('plt_id'); if (!$this->plt_id) { $this->plt_external_id = (int) edkURI::getArg('plt_ext_id'); if (!$this->plt_external_id) { $id = (int) edkURI::getArg('id', 1); // Arbitrary number bigger than we expect to reach locally if ($id > 1000000) { $this->plt_external_id = $id; } else { $this->plt_id = $id; } } } $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2)); if ($this->view) { $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />'); } if (!$this->plt_id) { if ($this->plt_external_id) { $this->pilot = new Pilot(0, $this->plt_external_id); $this->plt_id = $this->pilot->getID(); } else { $html = 'That pilot doesn\'t exist.'; $this->page->generate($html); exit; } } else { $this->pilot = Cacheable::factory('Pilot', $this->plt_id); $this->plt_external_id = $this->pilot->getExternalID(); } $this->page->setTitle('Pilot details - ' . $this->pilot->getName()); if (!$this->pilot->exists()) { $html = 'That pilot doesn\'t exist.'; $this->page->setContent($html); $this->page->generate(); exit; } if ($this->plt_external_id) { $this->page->addHeader("<link rel='canonical' href='" . edkURI::page('pilot_detail', $this->plt_external_id, 'plt_ext_id') . "' />"); } else { $this->page->addHeader("<link rel='canonical' href='" . edkURI::page('pilot_detail', $this->plt_id, 'plt_id') . "' />"); } $this->corp = $this->pilot->getCorp(); $this->alliance = $this->corp->getAlliance(); }
/** * Set up the menu. * * Prepare all the base menu options. */ function menuSetup() { $this->addMenuItem('link', 'Active campaigns', edkURI::page('campaigns')); $this->addMenuItem('link', 'Past campaigns', edkURI::build(array('view', 'past', false))); return ""; }
/** * Search function for the search.php page. * * @param string $searchphrase * @param string $type * @param integer $limit * @return xajaxResponse */ function doAjaxSearch($searchphrase = '', $type = 'pilot', $limit = 10) { $qry = new DBPreparedQuery(); switch ($type) { case "pilot": $sql = "select plt.plt_name as name1, crp.crp_name as name2, plt.plt_id as id\n\t\t\t\t from kb3_pilots plt, kb3_corps crp\n\t\t\t\t where plt.plt_name like ?\n\t\t\t\t and plt.plt_crp_id = crp.crp_id\n\t\t\t\t order by plt.plt_name LIMIT {$limit}"; break; case "corp": $sql = "select crp.crp_name as name1, ali.all_name as name2, crp.crp_id as id\n\t\t\t\t from kb3_corps crp, kb3_alliances ali\n\t\t\t\t where crp.crp_name like ?\n\t\t\t\t and crp.crp_all_id = ali.all_id\n\t\t\t\t order by crp.crp_name LIMIT {$limit}"; break; case "alliance": $sql = "select ali.all_name as name1, '' as name2, ali.all_id as id\n\t\t\t\t from kb3_alliances ali\n\t\t\t\t where ali.all_name like ?\n\t\t\t\t order by ali.all_name LIMIT {$limit}"; break; case "system": $sql = "select sys.sys_name as name1, reg.reg_name as name2, sys.sys_id as id\n\t\t\t\t from kb3_systems sys, kb3_constellations con, kb3_regions reg\n\t\t\t\t where sys.sys_name like ?\n\t\t\t\t\tand con.con_id = sys.sys_con_id and reg.reg_id = con.con_reg_id\n\t\t\t\t order by sys.sys_name LIMIT {$limit}"; break; case "item": $sql = "select typeName as name1, '' as name2, typeID as id\n\t\t\t\tfrom kb3_invtypes where typeName like ? LIMIT {$limit}"; break; default: $objResponse = new xajaxResponse(); $objResponse->assign('searchresults', "innerHTML", 'Invalid type'); return $objResponse; } $name1 = 'No result'; $name2 = ''; $id = 0; $qry->prepare($sql); $searchphrase2 = $searchphrase . '%'; $qry->bind_param('s', $searchphrase2); $qry->bind_result($name1, $name2, $id); $result = ''; if (!$qry->execute()) { $result = $qry->getErrorMsg(); } else { if (!$qry->recordCount()) { $result = "No results"; } else { $result = "<table class='kb-table' width='450'><tr class='kb-table-header'>"; switch ($type) { case "pilot": $result .= "<td>Pilot</td><td>Corporation</td></tr>"; break; case "corp": $result .= "<td>Corporation</td><td>Alliance</td></tr>"; break; case "alliance": $result .= "<td>Alliance</td><td></td></tr>"; break; case "system": $result .= "<td>System</td><td>Region</td></tr>"; break; case "item": $result .= "<td>Item</td><td></td></tr>"; break; } while ($qry->fetch()) { $result .= "<tr class='kb-table-row-even'><td><a href='"; switch ($type) { case "pilot": $result .= edkURI::page('pilot_detail', $id, 'plt_id') . "'>"; break; case "corp": $result .= edkURI::page('corp_detail', $id, 'crp_id') . "'>"; break; case "alliance": $result .= edkURI::page('alliance_detail', $id, 'all_id') . "'>"; break; case "system": $result .= edkURI::page('system_detail', $id, 'sys_id') . "'>"; break; case "item": $result .= edkURI::page('invtype', $id) . "'>"; break; } $result .= $name1 . "</a></td><td>" . $name2 . "</td></tr>"; } $result .= "</table>"; } } $objResponse = new xajaxResponse(); $objResponse->assign('searchresults', "innerHTML", $result); return $objResponse; }
function post() { global $page; if (config::get("post_password") == '' || crypt($_POST['password'], config::get("post_password")) == config::get("post_password") || $page->isAdmin()) { $parser = new Parser($_POST['killmail']); // Filtering if (config::get('filter_apply')) { $filterdate = config::get('filter_date'); $year = substr($_POST['killmail'], 0, 4); $month = substr($_POST['killmail'], 5, 2); $day = substr($_POST['killmail'], 8, 2); $killstamp = mktime(0, 0, 0, $month, $day, $year); if ($killstamp < $filterdate) { $killid = -3; } else { $killid = $parser->parse(true, null, false); } } else { $killid = $parser->parse(true, null, false); } if ($killid <= 0) { if ($killid == 0) { $html = "Killmail is malformed.<br/>"; if ($errors = $parser->getError()) { foreach ($errors as $error) { $html .= 'Error: ' . $error[0]; if ($error[1]) { $html .= ' The text leading to this error was: "' . $error[1] . '"'; } $html .= '<br/>'; } } } elseif ($killid == -1) { $url = edkURI::page('kill_detail', $parser->getDupeID(), 'kll_id'); $html = "That killmail has already been posted <a href=\"" . edkURI::page('kill_detail', $parser->getDupeID(), 'kll_id') . "\">here</a>."; } elseif ($killid == -2) { $html = "You are not authorized to post this killmail."; } elseif ($killid == -3) { $filterdate = kbdate("j F Y", config::get("filter_date")); $html = "You are not allowed to post killmails older than" . " {$filterdate}."; } elseif ($killid == -4) { $html = "That mail has been deleted. Kill id was " . $parser->getDupeID(); if ($page->isAdmin()) { $html .= '<br /> <form id="postform" name="postform" class="f_killmail" method="post" action="' . edkURI::page('post') . '"> <input type="hidden" name="killmail" id="killmail" value = "' . htmlentities($_POST['killmail']) . '"/> <input type="hidden" name="kll_id" id="kill_id" value = "' . $parser->getDupeID() . '"/> <input type="hidden" name="undelete" id="undelete" value = "1"/> <input id="submit" name="submit" type="submit" value="Undelete" /> </form>'; } } } else { if (config::get('post_mailto') != "") { $mailer = new PHPMailer(); $kill = new Kill($killid); if (!($server = config::get('post_mailserver'))) { $server = 'localhost'; } $mailer->From = "mailer@" . config::get('post_mailhost'); $mailer->FromName = config::get('post_mailhost'); $mailer->Subject = "Killmail #" . $killid; $mailer->Host = $server; $mailer->Port = 25; $mailer->Helo = $server; $mailer->Mailer = "smtp"; $mailer->AddReplyTo("no_reply@" . config::get('post_mailhost'), "No-Reply"); $mailer->Sender = "mailer@" . config::get('post_mailhost'); $mailer->Body = $_POST['killmail']; $mailer->AddAddress(config::get('post_mailhost')); $mailer->Send(); } logger::logKill($killid); header("Location: " . htmlspecialchars_decode(edkURI::page('kill_detail', $killid, 'kll_id'))); exit; } } else { $html = "Invalid password."; } return $html; }
} $kills = array(); while ($kill = $klist->getKill()) { $kills[$kill->getID()] = $kill->getTimestamp(); } while ($kill = $llist->getKill()) { $kills[$kill->getID()] = $kill->getTimestamp(); } asort($kills); $cnt = 0; foreach ($kills as $id => $timestamp) { $kill = new Kill($id); $cnt++; $file = $_SESSION['admin_kill_export']['dir'] . $cnt . $_SESSION['admin_kill_export']['ext']; $fp = fopen($file, 'w'); fwrite($fp, $kill->getRawMail()); fclose($fp); } $html .= $cnt . ' mails exported<br/>'; $html .= '<a href="' . edkURI::page("admin_kill_export") . '">Ok</a>'; unset($_SESSION['admin_kill_export']); } else { // nothing to export, retry unset($_SESSION['admin_kill_export']['do']); $_SESSION['admin_kill_export']['select'] = 1; header('Location: ' . edkURI::page("admin_kill_export")); } } $page->addContext($menubox->generate()); $page->setContent($html); $page->generate();
$html .= "<td>" . $numverified . "</td>"; $html .= "<td>" . $row['log_totalmails'] . "</td>"; $html .= "<td>" . $datasource . "</td>"; $html .= "<td>" . $row['log_type'] . "</td>"; $html .= "<td>" . $row['log_errorcode'] . "</td>"; $html .= "<td>" . $row['log_timestamp'] . "</td>"; $html .= "</tr>"; } $html .= "</table>"; $html .= "<br />"; $html .= "<table><tr><td width='60'><input type=\"submit\" name=\"back\" value=\"Back\" /></td><td><input type='submit' name='clearlog' value='Clear Log' /></td></tr></table>"; $html .= "</form>"; } else { // API Settings $html .= "<div class='block-header2'>API Key Details (must be CEO/Director to retrieve corp mails)</div>"; $html .= '<form id="options" name="options" method="post" action="' . edkURI::page("admin_api") . '">'; // show current server time $html .= "Servers current time: <span style='color:00FF00'>" . date("M d Y H:i") . "</span><br /><br />"; function cmp($a, $b) { if ($a == $b) { return 0; } return $a < $b ? -1 : 1; } $order = array(); for ($i = 1; $i <= $keycount; $i++) { $corpName = config::get("API_Name_{$i}"); $order[$i] = $corpName; } uasort($order, "cmp");
function newSearch() { global $smarty; $smarty->assign('actionURL', edkURI::page('search')); return $smarty->fetch(get_tpl('search_new')); }
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();
function start() { $this->page = new Page(); $this->page->addHeader("<link rel='canonical' href='" . edkURI::page() . "' />"); $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 1)); $period = edkURI::getArg('period'); $day = $week = $month = $year = 0; // First argument is either the view or the year if (is_numeric($this->view) || !$this->view || $this->view == 'day' || $this->view == 'week' || $this->view == 'month') { $this->view = ''; $datestart = 1; } else { $datestart = 2; } $year = edkURI::getArg('y', $datestart); if ((int) $year && !$period) { $year = (int) $year; $this->dateSet = true; if (config::get('show_monthly')) { $month = (int) edkURI::getArg('m', $datestart + 1); } else { $week = (int) edkURI::getArg('w', $datestart + 1); } } else { if ($year || $period) { if (!$period) { $period = $year; } $datestart++; switch ($period) { case "month": $year = (int) edkURI::getArg('y', $datestart); if ((int) $year) { $month = (int) edkURI::getArg('m', $datestart + 1); $this->dateSet = true; } break; case "week": $year = (int) edkURI::getArg('y', $datestart); if ((int) $year) { $week = (int) edkURI::getArg('w', $datestart + 1); $this->dateSet = true; } break; case "day": $year = (int) edkURI::getArg('y', $datestart); if ((int) $year) { $month = (int) edkURI::getArg('m', $datestart + 1); if ((int) $month) { $day = (int) edkURI::getArg('d', $datestart + 2); $this->dateSet = true; } } break; } } } $this->setTime($week, $year, $month, $day); if (edkURI::getArg('scl_id') === false || edkURI::getArg('y', 1) === false) { $this->page->addHeader('<meta name="robots" content="index, follow" />'); } $this->scl_id = (int) edkURI::getArg('scl_id'); $this->showcombined = config::get('show_comb_home') && (count(config::get('cfg_allianceid')) || count(config::get('cfg_corpid')) || count(config::get('cfg_pilotid'))); if ($this->view == 'kills') { $this->page->setTitle('Kills - ' . $this->getCurrentPeriod()); } else { if ($this->view == 'losses') { $this->page->setTitle('Losses - ' . $this->getCurrentPeriod()); } else { $this->page->setTitle($this->getCurrentPeriod()); } } }
/** * * @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; } }
} else { // update $id = intval($key); $uri = $val["url"]; $active = isset($val["active"]) ? 1 : 0; $lastkill = intval($val["lastkill"]); if ($feeds[$id]['active'] != $active) { // flags have changed $feed_flags = 0; if ($active) { $feed_flags |= FEED_ACTIVE; } $qry->execute("UPDATE kb3_feeds SET feed_flags={$feed_flags} WHERE feed_kbsite = '" . KB_SITE . "' AND feed_id = {$id}"); $feeds[$id]['active'] = (bool) ($feed_flags & FEED_ACTIVE); } if ($feeds[$id]['lastkill'] != $lastkill || $feeds[$id]['uri'] != $uri) { $qry->execute("UPDATE kb3_feeds SET feed_lastkill={$lastkill}, feed_url='" . $qry->escape($uri) . "' WHERE feed_kbsite = '" . KB_SITE . "' AND feed_id = {$id}"); $feeds[$id]['lastkill'] = $lastkill; $feeds[$id]['uri'] = $uri; } } } } // Add an empty feed to the list, or create with one empty feed. $feeds[] = array('id' => 'new', 'updated' => '', 'active' => '', 'uri' => "", 'lastkill' => 0); $smarty->assignByRef('rows', $feeds); $smarty->assign('results', $html); $smarty->assign('url', edkURI::page("admin_idfeedsyndication")); $page->addContext($menubox->generate()); $page->setContent($smarty->fetch(get_tpl('admin_idfeed'))); $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'); } }
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();
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();
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"); }