private function updateChars() { if (empty($this->chars)) { return $this->chars; } foreach ($this->chars as $char) { // check if chars eveid exists in kb $sql = 'select plts.plt_id, plts.plt_externalid from kb3_pilots plts where plts.plt_name = "' . $char['Name'] . '"'; $qry = DBFactory::getDBQuery(); $qry->execute($sql); if ($qry->recordCount() != 0) { // pilot is in kb db, check he has his char id $row = $qry->getRow(); $pilot_id = $row['plt_id']; $pilot_external_id = $row['plt_externalid']; if ($pilot_external_id == 0 && $pilot_id != 0) { // update DB with ID $qry->execute("UPDATE kb3_pilots SET plt_externalid = " . intval($char['charID']) . "\n WHERE plt_id = " . $pilot_id); } } else { // pilot is not in DB // Set Corp $pilotscorp = Corporation::lookup($char['corpName']); // Check Corp was set, if not, add the Corp if (!$pilotscorp->getID()) { $ialliance = Alliance::add('None'); $pilotscorp = Corporation::add($char['corpName'], $ialliance, gmdate("Y-m-d H:i:s")); } Pilot::add($char['Name'], $pilotscorp, gmdate("Y-m-d H:i:s"), intval($char['charID'])); } } return; }
/** * Show the overall statistics for this corporation. */ function stats() { global $smarty; // The summary table is also used by the stats. Whichever is called // first generates the table. $this->page->setTitle('Corporation details - ' . $this->corp->getName() . " [" . $this->corp->getShortName() . "]"); $smarty->registerObject('Corp', $this->corp); $smarty->assign('portrait_url', $this->corp->getPortraitURL(128)); if ($this->alliance->getName() == "None") { $smarty->assign('alliance_url', false); } else { if ($this->alliance->getExternalID()) { $smarty->assign('alliance_url', edkURI::build(array('a', 'alliance_detail', true), array('all_ext_id', $this->alliance->getExternalID(), true))); } else { $smarty->assign('alliance_url', edkURI::build(array('a', 'alliance_detail', true), array('all_id', $this->alliance->getID(), true))); } } $smarty->assign('alliance_name', $this->alliance->getName()); $smarty->assign('kill_count', $this->kill_summary->getTotalKills()); $smarty->assign('loss_count', $this->kill_summary->getTotalLosses()); $smarty->assign('damage_done', number_format($this->kill_summary->getTotalKillISK() / 1000000000, 2)); $smarty->assign('damage_received', number_format($this->kill_summary->getTotalLossISK() / 1000000000, 2)); if ($this->kill_summary->getTotalKillISK()) { $smarty->assign('efficiency', number_format(100 * $this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()), 2)); } else { $smarty->assign('efficiency', 0); } $smarty->assign('ceo_url', edkURI::build(array('a', 'pilot_detail', true), array('plt_ext_id', $this->corp->getCeoID(), true))); $pilot = new Pilot(0, $this->corp->getCeoID()); $smarty->assign('ceo_name', $pilot->getName()); return $smarty->fetch(get_tpl('corp_detail_stats')); }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permission if (!WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->alliance = Alliance::getByUserID($this->userID, true); $this->user = new LWUser($this->userID); if ($this->userID == WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } if ($this->user->ally_id != $this->allianceID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } if (!$this->alliance->getRank(true, 6)) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->alliance->deleteUser($this->userID); $this->executed(); header('Location: index.php?page=AllianceMembersList'); exit; }
/** * @see Page::readData() */ public function readData() { parent::readData(); if (!empty($this->allianceID)) { $this->alliance = new Alliance($this->allianceID); } else { $this->alliance = Alliance::getByUserID(WCF::getUser()->userID); } // no such alliance if ($this->alliance === null || $this->alliance->id <= 0) { require_once WCF_DIR . 'lib/system/exception/NamedUserException.class.php'; //$_SERVER['HTTP_ACCEPT'] = str_replace('platzhalter', 'application/xhtml+xml', $_SERVER['HTTP_ACCEPT']); // user has no alliance if (empty($this->allianceID)) { // waiting for a answer to the application if (WCF::getUser()->ally_request) { $alliance = new Alliance(WCF::getUser()->ally_request); throw new NamedUserException(WCF::getLanguage()->get('wot.alliance.waitingForApplicationAnswer', array('allianceID' => $alliance->allianceID, 'allianceTag' => $alliance->ally_tag, 'userID' => WCF::getUser()->userID))); } throw new NamedUserException(WCF::getLanguage()->get('wot.alliance.notMember')); } // requested alliance does not exist throw new NamedUserException(WCF::getLanguage()->get('wot.alliance.notExisting')); } // applications if ($this->alliance->getRank(true, 3)) { $sql = "SELECT COUNT(*) AS count\n\t\t\t\t\tFROM ugml_users\n\t\t\t\t\tWHERE ally_request = " . $this->alliance->allianceID; $result = WCF::getDB()->getFirstRow($sql); $this->applicationsCount = $result['count']; } }
/** * @see Action::readParameters() */ public function readParameters() { parent::readParameters(); if (isset($_REQUEST['allianceID'])) { $this->allianceID = intval($_REQUEST['allianceID']); } else { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } if (isset($_REQUEST['userID'])) { $this->userID = intval($_REQUEST['userID']); } else { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } if ($this->allianceID != WCF::getUser()->ally_id) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } if ($this->userID != WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } $this->alliance = Alliance::getByUserID(WCF::getUser()->userID, true); }
public function __construct($id = NULL, $name = NULL, $alliance_id = NULL, $race = NULL) { $this->id = $id; $this->name = $name; $this->alliance = Alliance::dbGet($alliance_id); $this->race = $race; $this->artefacts = Artefact::dbGet($this->{$id}); }
/** * @see Page::readData() */ public function readData() { // alliance $this->alliance = Alliance::getByUserID(WCF::getUser()->userID, true); $this->interrelations = $this->alliance->getInterrelation(); $this->interrelations[$this->alliance->allianceID] = $this->alliance; parent::readData(); }
public static function dbGet($id = NULL) { $dbh = new DBL(); $strSQL = "SELECT * FROM alliance WHERE alliance.alliance_id=" . $id; $result = $dbh->query($strSQL); while ($record = $result->fetch_array()) { $newAlliance = new Alliance(); $newAlliance->setName($record["alliance_name"]); $newAlliance->setCode($record["alliance_code"]); $newAlliance->setDescription($record["alliance_description"]); $buffer[] = $newAlliance; } $result->free(); if (isset($id)) { return $buffer[0]; } return $buffer; }
/** * Fetch the board owners. * @return array Array of id strings to add to URLS */ function getOwners() { $myids = array(); if (!defined('MASTER') || !MASTER) { foreach (config::get('cfg_pilotid') as $entity) { $pilot = new Pilot($entity); $myids[] = '&pilot=' . urlencode($pilot->getName()); } foreach (config::get('cfg_corpid') as $entity) { $corp = new Corporation($entity); $myids[] = '&corp=' . urlencode($corp->getName()); } foreach (config::get('cfg_allianceid') as $entity) { $alli = new Alliance($entity); $myids[] = '&alli=' . urlencode($alli->getName()); } } return $myids; }
/** * @see Page::readData() */ public function readData() { // alliance $this->alliance = Alliance::getByUserID(WCF::getUser()->userID, true); // user if (empty($this->userID)) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } $this->user = new LWUser($this->userID); parent::readData(); }
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')); }
/** * Show the overall statistics for this alliance. * * @global Smarty $smarty * @return string */ function stats() { global $smarty; if ($this->alliance->isFaction()) { $this->page->setTitle(Language::get('page_faction_det') . ' - ' . $this->alliance->getName() . " [" . $this->alliance->getshortName() . "]"); } else { $this->page->setTitle(Language::get('page_all_det') . ' - ' . $this->alliance->getName() . " [" . $this->alliance->getshortName() . "]"); } $sql = "select crp_id from kb3_corps WHERE crp_all_id=" . $this->alliance->getID(); $qry = DBFactory::getDBQuery(); $qry->execute($sql); while ($row = $qry->getRow()) { $this->allianceCorps[] = Corporation::getByID((int) $row['crp_id']); } if (!isset($this->kill_summary)) { $this->kill_summary = new KillSummaryTable(); $this->kill_summary->addInvolvedAlliance($this->alliance); $this->kill_summary->generate(); } $execcrp = Corporation::lookupByExternalID($this->alliance->GetExecutorID()); if ($execcrp !== false) { $smarty->assign('ExecutorName', $execcrp->getName()); } else { $smarty->assign('ExecutorName', ''); } $smarty->registerObject('Alliance', $this->alliance); $smarty->assign('memberCorpCount', count($this->allianceCorps)); if ($this->kill_summary->getTotalKillISK()) { $efficiency = round($this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()) * 100, 2); } else { $efficiency = 0; } // The summary table is also used by the stats. Whichever is called // first generates the table. $smarty->assign('all_img', $this->alliance->getPortraitURL(128)); $smarty->assign('totalkills', $this->kill_summary->getTotalKills()); $smarty->assign('totallosses', $this->kill_summary->getTotalLosses()); $smarty->assign('totalkisk', round($this->kill_summary->getTotalKillISK() / 1000000000, 2)); $smarty->assign('totallisk', round($this->kill_summary->getTotalLossISK() / 1000000000, 2)); if ($this->kill_summary->getTotalKillISK()) { $smarty->assign('efficiency', round($this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()) * 100, 2)); } else { $smarty->assign('efficiency', '0'); } return $smarty->fetch(get_tpl('alliance_detail_stats')); }
public static function GetAlliancesOtherThanMineWithFleets($myAllianceId) { if (!is_int($myAllianceId)) { throw new Exception("myAllianceId was not an int."); } $conn = DataManager::GetInstance()->GetConnection(); $stmt = $conn->prepare('SELECT id, name FROM alliance WHERE id in (SELECT allianceId FROM fleet WHERE added > ?) AND id != ?'); $stmt->bind_param('si', DataManager::GetInstance()->FormatTimestampForSql(LastDowntimeMidpoint()), $myAllianceId); $stmt->execute(); $stmt->bind_result($id, $name); $alliances = array(); while ($stmt->fetch()) { $a = new Alliance(); Alliance::fill($a, $id, $name); $alliances[] = $a; } $stmt->close(); return $alliances; }
/** * @see Mission::check() */ public static function check(FleetQueue $fleetQueue) { $alliance = Alliance::getByUserID($fleetQueue->getTargetPlanet()->id_owner); $foreignPlanet = $fleetQueue->getTargetPlanet()->id_owner != WCF::getUser()->userID; $isBuddy = WCF::getUser()->hasBuddy($fleetQueue->getTargetPlanet()->id_owner); $isInAlliance = $alliance !== null && LWCore::getAlliance() !== null && $alliance->allianceID == LWCore::getAlliance()->allianceID; if ($fleetQueue->pageNo == 2) { WCF::getTPL()->assign('availableTimes', self::$availableTimes); } if ($fleetQueue->pageNo == 3) { $selectedTime = intval(@$_REQUEST['standByTime']); if (!in_array($selectedTime, self::$availableTimes)) { return false; } } if ($foreignPlanet && ($isBuddy || $isInAlliance)) { return true; } return false; }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permission if (!WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->alliance = Alliance::getByUserID($this->userID, true); $this->user = new LWUser($this->userID); // can not edit users of other alliances if ($this->user->ally_id != $this->allianceID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } // not allowed if (!$this->alliance->getRank(true, 6)) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } // change leader if ($this->rankID == -1) { if (WCF::getUser()->userID != $this->alliance->ally_owner) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } $this->alliance->changeLeader($this->userID); } else { if ($this->alliance->getRank($this->rankID - 1) === null && $this->rankID != 0) { require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php'; throw new IllegalLinkException(); } $sql = "UPDATE ugml_users\n\t\t\t\t\tSET ally_rank_id = " . $this->rankID . "\n\t\t\t\t\tWHERE id = " . $this->userID; WCF::getDB()->sendQuery($sql); $sql = "DELETE FROM wcf" . WCF_N . "_session\n\t\t\t\t\tWHERE userID = " . $this->userID; WCF::getDB()->sendQuery($sql); } $this->executed(); header('Location: index.php?page=AllianceMembersList'); exit; }
/** * Fetch the pilot name from CCP using the stored external ID. * * Corporation will be set to Unknown. */ private function fetchPilot() { if (!$this->externalid) { return false; } $apiInfo = new API_CharacterInfo(); $apiInfo->setID($this->externalid); $result .= $apiInfo->fetchXML(); if ($result == "") { $data = $apiInfo->getData(); $this->alliance = Alliance::add($data['alliance'], $data['allianceID']); $this->corp = Corporation::add($data['corporation'], $this->alliance, $apiInfo->getCurrentTime(), $data['corporationID']); $this->name = $data['characterName']; Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']); } else { return false; } }
/** * Fetch the alliance name from CCP using the stored external ID. */ private function fetchAlliance() { if (!$this->getExternalID()) { return false; } $myID = new API_IDtoName(); $myID->setIDs($this->externalid); $myID->fetchXML(); if ($myID != "") { return false; } $myNames = $myID->getIDData(); // Use ::add to make sure names are updated in the db and clashes are fixed. $alliance = Alliance::add($myNames[0]['name'], (int) $myNames[0]['characterID']); $this->name = $alliance->name; }
/** * @return integer */ function getAllianceID() { return $this->alliance_->getID(); }
/** * Check if the victim is in a Faction. * * @return boolean */ function getIsVictimFaction() { $alliance = new Alliance($this->getVictimAllianceID()); return $alliance->isFaction(); }
/** * @see Page::readParameters */ public function readParameters() { parent::readParameters(); $this->alliance = Alliance::getByUserID(WCF::getUser()->userID); }
$t->alliance = new Alliance(); try { if ($filtered['alliance-submit']) { $name = $filtered['alliance-name' ]; $password = md5($filtered['alliance-password']); $tag = $filtered['alliance-tag' ]; $url = $filtered['alliance-url' ]; $server = $filtered['alliance-ircserver' ]; $channel = $filtered['alliance-ircchannel' ]; $status = $filtered['alliance-status' ]; $status = max(min($status, 1), 0); $message = htmlentities($filtered['alliance-message'], ENT_QUOTES, 'UTF-8'); $news = htmlentities($filtered['alliance-news' ], ENT_QUOTES, 'UTF-8'); if ($alliances = Alliance::queryNameTag($name, $tag)) { // They might be trying to resurrect an alliance, check for dead alliances foreach ($alliances as $a) { if ($name == $a->name and $a->isDead($user)) { // Okay, try to resurrect if ($password == $a->password) { // Okay, they have the name and password right // Check if the leaders are null if ($a->hasNullLeaders()) { // Make the user the leader $t->alliance = $a; $a->status = 0; $a->addLeader($user); $a->save(); header('Location: alliance-home.php');
/** * Handle submitted settings. * * @return */ public function postIndex() { if (Input::has('api_key_id')) { $api_key_id = Setting::where('key', 'api_key_id')->firstOrFail(); $api_key_id->value = Input::get('api_key_id'); $api_key_id->save(); } if (Input::has('api_key_verification_code')) { $api_key_verification_code = Setting::where('key', 'api_key_verification_code')->firstOrFail(); $api_key_verification_code->value = Input::get('api_key_verification_code'); $api_key_verification_code->save(); } if (Input::has('api_key_character_id')) { $api_key_character_id = Setting::where('key', 'api_key_character_id')->firstOrFail(); $api_key_character_id->value = Input::get('api_key_character_id'); $api_key_character_id->save(); } if (Input::has('home_region_id')) { $home_region_id = Setting::where('key', 'home_region_id')->firstOrFail(); $home_region_id->value = Input::get('home_region_id'); $home_region_id->save(); } if (Input::has('systems')) { // Clean up the input in case the JS screwed up somewhere. $input = preg_replace('/^,|,$/', '', Input::get('systems')); $systems = Setting::where('key', 'systems')->firstOrFail(); $systems->value = $input; $systems->save(); } if (Input::has('alliances')) { // Clean up the input in case the JS screwed up somewhere. $input = preg_replace('/^,|,$/', '', Input::get('alliances')); $alliances = Setting::where('key', 'alliances')->firstOrFail(); $alliances->value = $input; $alliances->save(); // We also need to populate the alliances table with these new alliances. $response = API::eveOnline('eve/AllianceList', 'version=1'); foreach ($response->body->result->rowset->row as $row) { if (strpos($input, (string) $row['allianceID']) !== FALSE) { $alliance = Alliance::find($row['allianceID']); if (!isset($alliance->id)) { $alliance = new Alliance(); $alliance->id = $row['allianceID']; $alliance->allianceName = $row['name']; $alliance->save(); } } } } if (Input::has('shipping_cost')) { $shipping_cost = Setting::where('key', 'shipping_cost')->firstOrFail(); $shipping_cost->value = Input::get('shipping_cost'); $shipping_cost->save(); } // Process default filters. DB::table('filters')->update(array('is_default' => 0)); $filters = Filter::all(); foreach ($filters as $filter) { if (Input::has($filter->categoryName)) { $category = Filter::find($filter->categoryID); $category->is_default = 1; $category->save(); } } return Redirect::to('settings'); }
public static function GenerateRow($pods = false, $header = true) { global $smarty; $klist = new KillList(); $klist->setOrdered(true); $klist->setOrderBy("kll_isk_loss DESC"); if ($pods == false) { $klist->setPodsNoobShips(false); } else { $klist->addVictimShipClass(2); } $klist->setLimit(self::NUM_DISPLAYED); if (isset($_GET["w"])) { self::$week = intval($_GET["w"]); } if (isset($_GET["m"])) { self::$month = intval($_GET["m"]); } if (isset($_GET["y"])) { self::$year = intval($_GET["y"]); } self::setTime(self::$week, self::$year, self::$month); $view = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['view']); if (config::get('show_monthly')) { $start = makeStartDate(0, self::$year, self::$month); $end = makeEndDate(0, self::$year, self::$month); $klist->setStartDate(gmdate('Y-m-d H:i', $start)); $klist->setEndDate(gmdate('Y-m-d H:i', $end)); $smarty->assign("displaylist", date('F', mktime(0, 0, 0, self::$month, 1, self::$year)) . ", " . self::$year); } else { $klist->setWeek(self::$week); $klist->setYear(self::$year); $plist->setWeek(self::$week); $plist->setYear(self::$year); $smarty->assign("displaylist", "Week " . self::$week . ", " . self::$year); } if (config::get("exp_incloss")) { $smarty->assign("displaytype", "Kills and Losses"); involved::load($klist, "combined"); } else { $smarty->assign("displaytype", "Kills"); involved::load($klist, "kill"); } $kills = array(); while ($kill = $klist->getKill()) { $kll = array(); $plt = new Pilot($kill->getVictimID()); if ($kill->isClassified() && !Session::isAdmin()) { $kll['systemsecurity'] = "-"; $kll['system'] = Language::get("classified"); } else { $kll['systemsecurity'] = $kill->getSolarSystemSecurity(); $kll['system'] = $kill->getSolarSystemName(); } $kll["id"] = $kill->getID(); $kll["victim"] = $kill->getVictimName(); $kll["victimid"] = $kill->getVictimID(); $kll["victimship"] = $kill->getVictimShipName(); $kll["victimshipid"] = $kill->getVictimShipExternalID(); $kll["victimshipclass"] = $kill->getVictimShipClassName(); $kll["victimcorp"] = $kill->getVictimCorpName(); $kll["victimcorpid"] = $kill->getVictimCorpID(); $alliance = Alliance::getByID($kill->getVictimAllianceID()); if ($pods == false) { $kll["victimimageurl"] = $kill->getVictimShipImage(128); } else { $kll["victimimageurl"] = $plt->getPortraitURL(128); } $kll["victimallimage"] = $alliance->getPortraitURL(32); $kll["victimallname"] = $alliance->getName(); if ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000000) { $kll["isklost"] = number_format($kill->getISKLoss() / 1000000000, 2, ".", "") . " Billion"; } elseif ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000) { $kll["isklost"] = number_format($kill->getISKLoss() / 1000000, 2, ".", "") . " Million"; } else { $kll["isklost"] = number_format($kill->getISKLoss(), 0, ".", ","); } if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) { $kll["class"] = "kl-loss"; $kll["classlink"] = '<font color="#AA0000">•</font>'; } elseif (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) { $kll["class"] = "kl-loss"; $kll["classlink"] = '<font color=\\"#AA0000\\">•</font>'; } elseif (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) { $kll["class"] = "kl-loss"; $kll["classlink"] = '<font color="#AA0000">•</font>'; } else { $kll["class"] = "kl-kill"; $kll["classlink"] = '<font color="#00AA00">•</font>'; } $kills[] = $kll; } if ($header == true) { $smarty->assign("header", true); } else { $smarty->assign("header", false); } $smarty->assign("killlist", $kills); $smarty->assign("width", 100 / self::NUM_DISPLAYED); return $smarty->fetch(get_tpl('most_expensive_summary')); }
Copyright (C) 2009-2010 Richard Eames This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ***/ require_once('scripts/vsys.php'); require_once('scripts/Template.php'); require_once('scripts/Alliance.php'); new Privacy(PRIVACY_USER); $t = new Template('alliance-list', intval($cgi['t'])); $t->alliances = Alliance::getAll(); $t->pageTitle = 'Alliance List'; $t->display(); ?>
/** * * @param KillList $killList * @return string KillList as XML */ public static function killListToXML($killList) { global $idfeedversion; $qry = DBFactory::getDBQuery(); $date = gmdate('Y-m-d H:i:s'); $xml = "<?xml version='1.0' encoding='UTF-8'?>\n\t\t<eveapi version='2' edkapi='" . $idfeedversion . "'>\n\t\t</eveapi>"; $sxe = new SimpleXMLElement($xml); // Let's start making the xml. $sxe->addChild('currentTime', $date); $result = $sxe->addChild('result'); $kills = $result->addChild('rowset'); $kills->addAttribute('name', 'kills'); $kills->addAttribute('key', 'killID'); $kills->addAttribute('columns', 'killID,solarSystemID,killTime,moonID,hash,trust'); $count = 0; $timing = ''; while ($kill = $killList->getKill()) { if (config::get('km_cache_enabled') && CacheHandler::exists($kill->getID() . ".xml", 'mails')) { $cachedRow = new SimpleXMLElement(CacheHandler::get($kill->getID() . ".xml", 'mails')); IDFeed::addXMLElement($kills, $cachedRow); continue; } $count++; if ($kill->isClassified()) { continue; } //$kill = Kill::getByID($kill->getID()); $row = $kills->addChild('row'); $row->addAttribute('killID', intval($kill->getExternalID())); $row->addAttribute('killInternalID', intval($kill->getID())); $row->addAttribute('solarSystemID', $kill->getSystem()->getExternalID()); $row->addAttribute('killTime', $kill->getTimeStamp()); $row->addAttribute('moonID', '0'); $row->addAttribute('hash', bin2hex(IDFeed::getHash($kill, true))); $row->addAttribute('trust', 3); $victim = Pilot::getByID($kill->getVictimID()); $victimCorp = Corporation::getByID($kill->getVictimCorpID()); $victimAlliance = Alliance::getByID($kill->getVictimAllianceID()); $victimrow = $row->addChild('victim'); if ($victim->getName() == $kill->getVictimShipName()) { $victimrow->addAttribute('characterID', "0"); $victimrow->addAttribute('characterName', ""); } else { $victimrow->addAttribute('characterID', $victim->getExternalID()); $victimrow->addAttribute('characterName', $victim->getName()); } $victimrow->addAttribute('corporationID', $victimCorp->getExternalID()); $victimrow->addAttribute('corporationName', $victimCorp->getName()); if ($victimAlliance->isFaction()) { $victimrow->addAttribute('allianceID', 0); $victimrow->addAttribute('allianceName', ''); $victimrow->addAttribute('factionID', $victimAlliance->getFactionID()); $victimrow->addAttribute('factionName', $victimAlliance->getName()); } else { $victimrow->addAttribute('allianceID', $victimAlliance->getExternalID()); $victimrow->addAttribute('allianceName', $victimAlliance->getName()); $victimrow->addAttribute('factionID', 0); $victimrow->addAttribute('factionName', ''); } $victimrow->addAttribute('damageTaken', $kill->getDamageTaken()); $victimrow->addAttribute('shipTypeID', $kill->getVictimShipExternalID()); $involved = $row->addChild('rowset'); $involved->addAttribute('name', 'attackers'); $involved->addAttribute('columns', 'characterID,characterName,corporationID,corporationName,allianceID,allianceName,factionID,factionName,securityStatus,damageDone,finalBlow,weaponTypeID,shipTypeID'); $sql = "SELECT ind_sec_status, ind_all_id, ind_crp_id,\n\t\t\t\tind_shp_id, ind_wep_id, ind_order, ind_dmgdone, plt_id, plt_name,\n\t\t\t\tplt_externalid, crp_name, crp_external_id,\n\t\t\t\twtype.typeName AS wep_name FROM kb3_inv_detail\n\t\t\t\tJOIN kb3_pilots ON (plt_id = ind_plt_id)\n\t\t\t\tJOIN kb3_corps ON (crp_id = ind_crp_id)\n\t\t\t\tJOIN kb3_invtypes wtype ON (ind_wep_id = wtype.typeID)\n\t\t\t\tWHERE ind_kll_id = " . $kill->getID() . " ORDER BY ind_order ASC"; $qry->execute($sql); while ($inv = $qry->getRow()) { $invrow = $involved->addChild('row'); if (strpos($inv['plt_name'], '- ') !== false) { $inv['plt_name'] = substr($inv['plt_name'], strpos($inv['plt_name'], '- ') + 2); } else { if (strpos($inv['plt_name'], '#') !== false) { $name = explode("#", $inv['plt_name']); $inv['plt_name'] = $name[3]; } } if ($inv['plt_name'] == $inv['wep_name']) { $invrow->addAttribute('characterID', 0); $invrow->addAttribute('characterName', ""); $invrow->addAttribute('weaponTypeID', 0); $invrow->addAttribute('shipTypeID', $inv['ind_wep_id']); } else { $invrow->addAttribute('characterID', $inv['plt_externalid']); $invrow->addAttribute('characterName', $inv['plt_name']); $invrow->addAttribute('weaponTypeID', $inv['ind_wep_id']); $invrow->addAttribute('shipTypeID', $inv['ind_shp_id']); } $invrow->addAttribute('corporationID', $inv['crp_external_id']); $invrow->addAttribute('corporationName', $inv['crp_name']); $invAlliance = Alliance::getByID($inv['ind_all_id']); if ($invAlliance->isFaction()) { $invrow->addAttribute('allianceID', 0); $invrow->addAttribute('allianceName', ''); $invrow->addAttribute('factionID', $invAlliance->getFactionID()); $invrow->addAttribute('factionName', $invAlliance->getName()); } else { if (strcasecmp($invAlliance->getName(), "None") == 0) { $invrow->addAttribute('allianceID', 0); $invrow->addAttribute('allianceName', ""); } else { $invrow->addAttribute('allianceID', $invAlliance->getExternalID()); $invrow->addAttribute('allianceName', $invAlliance->getName()); } $invrow->addAttribute('factionID', 0); $invrow->addAttribute('factionName', ''); } $invrow->addAttribute('securityStatus', number_format($inv['ind_sec_status'], 1)); $invrow->addAttribute('damageDone', $inv['ind_dmgdone']); if ($inv['plt_id'] == $kill->getFBPilotID()) { $final = 1; } else { $final = 0; } $invrow->addAttribute('finalBlow', $final); } $sql = "SELECT * FROM kb3_items_destroyed WHERE itd_kll_id = " . $kill->getID(); $qry->execute($sql); $qry2 = DBFactory::getDBQuery(); $sql = "SELECT * FROM kb3_items_dropped WHERE itd_kll_id = " . $kill->getID(); $qry2->execute($sql); if ($qry->recordCount() || $qry2->recordCount()) { $items = $row->addChild('rowset'); $items->addAttribute('name', 'items'); $items->addAttribute('columns', 'typeID,flag,qtyDropped,qtyDestroyed, singleton'); while ($iRow = $qry->getRow()) { $itemRow = $items->addChild('row'); $itemRow->addAttribute('typeID', $iRow['itd_itm_id']); $itemRow->addAttribute('flag', $iRow['itd_itl_id']); if ($iRow['itd_itl_id'] == -1) { $itemRow->addAttribute('singleton', 2); } else { $itemRow->addAttribute('singleton', 0); } $itemRow->addAttribute('qtyDropped', 0); $itemRow->addAttribute('qtyDestroyed', $iRow['itd_quantity']); } while ($iRow = $qry2->getRow()) { $itemRow = $items->addChild('row'); $itemRow->addAttribute('typeID', $iRow['itd_itm_id']); $itemRow->addAttribute('flag', $iRow['itd_itl_id']); if ($iRow['itd_itl_id'] == -1) { $itemRow->addAttribute('singleton', 2); } else { $itemRow->addAttribute('singleton', 0); } $itemRow->addAttribute('qtyDropped', $iRow['itd_quantity']); $itemRow->addAttribute('qtyDestroyed', 0); } } if (config::get('km_cache_enabled')) { CacheHandler::put($kill->getID() . ".xml", $row->asXML(), 'mails'); } $timing .= $kill->getID() . ": " . (microtime(true) - $starttime) . "<br />"; } $sxe->addChild('cachedUntil', $date); return $sxe->asXML(); }
public function focusDynamic($params = array()) { extract($params); if (isset($user_id) && $user_id) { // $obj = Dynamic::model()->with('focus')->findAll('user_id=:user_id and is_focus=:focus', array(':user_id' => $user_id, ':focus' => '1')); $obj = Dynamic::model()->getFocusDynamic($user_id); if ($obj) { //获取用户信息 $focus_users = $this->getFocus($user_id); $dynamic = array(); foreach ($obj as $key => $val) { $user_info = $focus_users[$val->focus->focus_id]; if ($user_info) { $image = explode(',', $val->dy_images); $images = array(); if ($image) { foreach ($image as $k => $v) { $images[] = Yii::app()->params['qiniu']['host'] . $v; } } $dynamic[$key] = array('id' => $val->dy_id, 'content' => $val->dy_content, 'images' => $images, 'num' => $val->dy_agree, 'time' => $val->gmt_created); $dynamic[$key]['logo'] = Yii::app()->params['qiniu']['host'] . $user_info['image']; $dynamic[$key]['nickname'] = $user_info['user_name']; $dynamic[$key]['url'] = 'www.baidu.com'; } } if ($dynamic) { $ret = $this->notice('OK', 0, '成功', $dynamic); } else { $ret = $this->notice('OK', 0, '暂无数据', []); } } else { $ret = $this->notice('OK', 0, '暂无数据', []); } } else { //$ret = $this->notice('ERR', 301, '缺少参数', []); $obj = Dynamic::model()->findAll(array('order' => 'gmt_created desc', 'limit' => '100')); $dynamic = array(); if ($obj) { //user $users = User::model()->loadUsers(); $alliances = Alliance::model()->loadAlliances(); $stores = Store::model()->loadStores(); foreach ($obj as $key => $val) { if (!$val->dy_type) { $user = $users[$val->dy_user]; if ($user) { $dynamic[$key]['logo'] = Yii::app()->params['qiniu']['host'] . $user['image']; $dynamic[$key]['nickname'] = $user['name']; } else { continue; } } else { if ($val->dy_type == 1) { $alliance = $alliances[$val->dy_user]; if ($alliance) { $dynamic[$key]['logo'] = Yii::app()->params['qiniu']['host'] . $alliance['image']; $dynamic[$key]['nickname'] = $alliance['name']; } else { continue; } } else { if ($val->dy_type == 2) { $store = $stores[$val->dy_user]; if ($store) { $dynamic[$key]['logo'] = Yii::app()->params['qiniu']['host'] . $store['image']; $dynamic[$key]['nickname'] = $store['name']; } else { continue; } } } } $image = explode(',', $val->dy_images); $images = array(); if ($image) { foreach ($image as $k => $v) { $images[] = Yii::app()->params['qiniu']['host'] . $v; } } $dynamic[$key] = array('id' => $val->dy_id, 'content' => $val->dy_content, 'images' => $images, 'num' => $val->dy_agree, 'time' => $val->gmt_created); $dynamic[$key]['url'] = 'www.baidu.com'; } if ($dynamic) { $ret = $this->notice('OK', 0, '成功', $dynamic); } else { $ret = $this->notice('OK', 0, '暂无数据', []); } } else { $ret = $this->notice('OK', 0, '暂无数据', []); } } return $ret; }
$html .= "<table class=kb-table cellspacing=1>"; $html .= "<tr class=kb-table-header><td class=kb-table-cell width=160>Target</td><td class=kb-table-cell width=80 align=center>Corporation</td><td class=kb-table-cell width=80 align=center>Alliance</td><td class=kb-table-cell width=80 align=center>Region</td><td class=kb-table-cell width=80 align=center>System</td><td class=kb-table-cell width=80 align=center>Action</td></tr>"; $c = 0; while ($contracttarget = $contract->getContractTarget()) { $c++; $type = $contracttarget->getType(); $typeURL = false; $ctrTypeID = $contracttarget->getID(); switch ($type) { case "corp": $corp = new Corporation($ctrTypeID); $name = $corp->getName(); $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) {
<?php require_once 'app_code/EveBrowserFactory.php'; require_once 'app_code/Utilities.php'; require_once 'app_code/Fleet.php'; require_once 'app_code/Alliance.php'; require_once 'app_code/DataManager.php'; $brow = EveBowserFactory::Get(); if (!($brow->IsIGB() && $brow->IsTrusted())) { RedirectResponse('links.php'); } if (isset($_POST['fleetLink']) && isset($_POST['name'])) { $matches; if (preg_match('/gang:(?<id>\\d+)/', GetPost('fleetLink'), $matches)) { $a = Alliance::EnsureAlliance($brow->AllianceId(), $brow->AllianceName()); $f = new Fleet(); $f->Id = $matches['id']; $f->AllianceId = $a->Id; $f->Name = GetPost('name'); $f->Added = time(); if ($f->Validate()) { $f->Save(); // this seems like a good place to delete old fleets Fleet::DeleteOldFleets(); DataManager::GetInstance()->CloseConnection(); RedirectResponse('links.php'); } } } ?>
$conf = array(); foreach ($permissions as $typ => $id_array) { foreach ($id_array as $id) { $conf[] = $typ . $id; } } config::set('post_permission', implode(',', $conf)); } asort($permissions['a']); asort($permissions['c']); asort($permissions['p']); $permt = array(); foreach ($permissions as $typ => $ids) { foreach ($ids as $id) { if ($typ == 'a') { $alliance = new Alliance($id); $text = $alliance->getName(); $link = KB_HOST . '/?a=admin_postperm&del=' . $typ . $id . '&akey=' . session::makeKey(); $permt[$typ][] = array('text' => $text, 'link' => $link); } if ($typ == 'p') { $pilot = new Pilot($id); $text = $pilot->getName(); $link = KB_HOST . '/?a=admin_postperm&del=' . $typ . $id . '&akey=' . session::makeKey(); $permt[$typ][] = array('text' => $text, 'link' => $link); } if ($typ == 'c') { $corp = new Corporation($id); $text = $corp->getName(); $link = KB_HOST . '/?a=admin_postperm&del=' . $typ . $id . '&akey=' . session::makeKey(); $permt[$typ][] = array('text' => $text, 'link' => $link);
public static function nameToId($type, $set, $value) { if ($type == 'nametoid') { $api = new API_NametoID(); $api->setNames($value); } else { if ($type == 'idtoname') { $api = new API_IDtoName(); $api->setIDs($value); } } $api->fetchXML(); if ($type == 'nametoid') { $char_info = $api->getNameData(); } else { if ($type == 'idtoname') { $char_info = $api->getIDData(); } } if (isset($char_info[0]['characterID']) && strlen($char_info[0]['characterID']) > 0) { $timestamp = gmdate('%Y.%m.%d %H:%i:%s', time()); if ($set == 'p') { $all = Alliance::add('Unknown'); $crp = Corporation::add('Unknown', $all, $timestamp, 0, false); $plt = Pilot::add($char_info[0]['name'], $crp, $timestamp, $char_info[0]['characterID'], false); $_POST['option_cfg_pilotid'] = $value = $plt->getID(); $pilots = config::get('cfg_pilotid'); $pilots[] = intval($value); config::set('cfg_pilotid', $pilots); $html = '<input type="text" id="option_cfg_pilotid"' . ' name="option_cfg_pilotid" value="" size="40"' . ' maxlength="64" />'; } else { if ($set == 'c') { $all = Alliance::add('Unknown'); $crp = new Corporation(); $crp->add($char_info[0]['name'], $all, $timestamp, $char_info[0]['characterID'], false); $_POST['option_cfg_corpid'] = $value = $crp->getID(); $corps = config::get('cfg_corpid'); $corps[] = intval($value); config::set('cfg_pilotid', $corps); $html = '<input type="text" id="option_cfg_corpid"' . ' name="option_cfg_corpid" value="" size="40"' . ' maxlength="64" />'; } else { if ($set == 'a') { $all = Alliance::add('Unknown'); $_POST['option_cfg_allianceid'] = $value = $all->getID(); $alliances = config::get('option_cfg_allianceid'); $alliances[] = intval($value); config::set('option_cfg_allianceid', $alliances); $html = '<input type="text" id="option_cfg_allianceid"' . ' name="option_cfg_allianceid" value="" size="40"' . ' maxlength="64" />'; } } } return $html; } else { return $html; } }