Esempio n. 1
0
 /**
  *  Show the list of campaigns.
  */
 function listCampaigns()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $pageNum = (int) edkURI::getArg('page');
     switch ($this->view) {
         case '':
             $activelist = new ContractList();
             $activelist->setActive('yes');
             $this->page->setTitle('Active campaigns');
             $table = new ContractListTable($activelist);
             $table->paginate(10, $pageNum);
             return $table->generate();
             break;
         case 'past':
             $pastlist = new ContractList();
             $pastlist->setActive('no');
             $this->page->setTitle('Past campaigns');
             $table = new ContractListTable($pastlist);
             $table->paginate(10, $pageNum);
             return $table->generate();
             break;
     }
     return $html;
 }
Esempio n. 2
0
 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 .= "&amp;";
     }
     $smarty->assign('splitter_endpage', $endpage);
     $smarty->assign('splitter_page', $page);
     $smarty->assign('splitter_url', $url);
     return $smarty->fetch(get_tpl('pagesplitter'));
 }
Esempio n. 3
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page('Related kills & losses');
     $this->page->addHeader('<meta name="robots" content="index, nofollow" />');
     $this->kll_id = (int) edkURI::getArg('kll_id', 1);
     if (!$this->kll_id) {
         $this->kll_external_id = (int) edkURI::getArg('kll_ext_id');
         if (!$this->kll_external_id) {
             // internal and external ids easily overlap so we can't guess which
             $this->kll_id = (int) edkURI::getArg(null, 1);
             $this->kill = Kill::getByID($this->kll_id);
         } else {
             $this->kill = new Kill($this->kll_external_id, true);
             $this->kll_id = $this->kill->getID();
         }
     } else {
         $this->kill = Kill::getByID($this->kll_id);
     }
     $this->adjacent = edkURI::getArg('adjacent');
     $this->scl_id = (int) edkURI::getArg('scl_id');
     $this->menuOptions = array();
     if (!$this->kll_id || !$this->kill->exists()) {
         echo 'No valid kill id specified';
         exit;
     }
     if ($this->kill->isClassified()) {
         Header("Location: " . htmlspecialchars_decode(edkURI::page('kill_detail', $this->kll_id, 'kll_id')));
         die;
     }
     //		$this->getInvolved();
     //		$this->buildStats();
 }
Esempio n. 4
0
 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'));
 }
Esempio n. 5
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables.
  *
  */
 function start()
 {
     $this->page = new Page(Language::get('page_awards'));
     $this->page->addHeader('<meta name="robots" content="index, follow" />');
     $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('a', 'awards', true)) . "' />");
     $this->year = (int) edkURI::getArg('y', 1);
     $this->month = (int) edkURI::getArg('m', 2);
     if (!$this->month) {
         $this->month = kbdate('m') - 1;
     }
     if (!$this->year) {
         $this->year = kbdate('Y');
     }
     if ($this->month == 0) {
         $this->month = 12;
         $this->year = $this->year - 1;
     }
     if (!edkURI::getArg('y', 1)) {
         $this->view = edkURI::getArg('view', 1);
     } else {
         $this->view = edkURI::getArg('view', 3);
     }
     $this->listList = $this->listSetup();
 }
Esempio n. 6
0
 function start()
 {
     $this->typeID = edkURI::getArg('id', 1);
     $this->page = new Page('Item Details');
 }
Esempio n. 7
0
 function start()
 {
     $this->groupID = (int) edkURI::getArg('id', 1);
     $this->page = new Page('Item Database');
 }
Esempio n. 8
0
require_once "class.rss.php";
$scl_id = (int) edkURI::getArg('scl_id', 2);
header('Content-Type: text/xml');
$html .= "<" . "?xml version=\"1.0\"?" . ">\r\n<rss version=\"2.0\">\r\n<channel>\r\n<title>" . config::get('cfg_kbtitle') . "</title>";
if (edkURI::getArg('losses', 1)) {
    $html .= "<description>20 Most Recent Kills</description>";
} else {
    $html .= "<description>20 Most Recent Losses</description>";
}
$html .= "<link>" . KB_HOST . "</link>\r\n<copyright>" . config::get('cfg_kbtitle') . "</copyright>\n";
$klist = new KillList();
$klist->setOrdered(true);
if (edkURI::getArg('all') || edkURI::getArg('', 1) == 'all') {
    involved::load($klist, 'combined');
} else {
    if (edkURI::getArg('losses') || edkURI::getArg('', 1) == 'losses') {
        involved::load($klist, 'loss');
    } else {
        involved::load($klist, 'kill');
    }
}
if ($scl_id) {
    $klist->addVictimShipClass($scl_id);
} else {
    $klist->setPodsNoobShips(false);
}
$klist->setLimit(20);
$table = new RSSTable($klist);
$html .= $table->generate();
$html .= "</channel>\r\n</rss>";
echo $html;
Esempio n. 9
0
<?php

/**
 * @package EDK
 */
$page = new Page();
$page->setAdmin();
$kll_id = (int) edkURI::getArg('kll_id', 1);
$page->setTitle('Administration - Deletion of Kill ID "' . $kll_id . '"');
if (isset($_GET['confirm'])) {
    $kill = Kill::getByID($kll_id);
    $kill->remove(true, false);
    $html .= "Kill ID \"" . $kll_id . "\" deleted!";
    $html .= "<br><br><a href=\"javascript:window.close();\">[close]</a>";
} else {
    if (isset($_GET['permanent'])) {
        $kill = Kill::getByID($kll_id);
        $kill->remove(true, true);
        $html .= "Kill ID \"" . $kll_id . "\" deleted!";
        $html .= "<br><br><a href=\"javascript:window.close();\">[close]</a>";
    } else {
        $cargs = array();
        $cargs[] = array("a", "admin_kill_delete", true);
        $cargs[] = array("kll_id", $kll_id, true);
        $pargs = $cargs;
        $cargs[] = array("confirm", "yes", false);
        $pargs[] = array("permanent", "yes", false);
        $html .= "Delete Kill ID \"" . $kll_id . "\": ";
        $html .= "<button onClick=\"window.location.href='" . edkURI::build($cargs) . "'\">Yes</button><br />";
        $html .= "Delete and prevent reposting: ";
        $html .= "<button onClick=\"window.location.href='" . edkURI::build($pargs) . "'\">Yes</button><br />";
Esempio n. 10
0
 /**
  *  Build the killlists that are needed for the options selected.
  *
  * @global Smarty $smarty
  * @return string
  */
 function killList()
 {
     global $smarty;
     if ($this->view == '') {
         $smarty->assign('view', Language::get('recent'));
     } else {
         $smarty->assign('view', $this->view);
     }
     $args = array(array('a', 'alliance_detail', true), array('all_id', $this->all_id, true));
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     switch ($this->view) {
         default:
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addInvolvedAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $ktab = new KillListTable($list);
             $ktab->setLimit(10);
             $smarty->assign('kills', $ktab->generate());
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addVictimAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $ltab = new KillListTable($list);
             $ltab->setLimit(10);
             $smarty->assign('losses', $ltab->generate());
             return $smarty->fetch(get_tpl('detail_kl_default'));
             break;
         case "kills":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addInvolvedAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('kills', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             return $smarty->fetch(get_tpl('detail_kl_kills'));
             break;
         case "losses":
             $list = new KillList();
             $list->setOrdered(true);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->addVictimAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('losses', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             return $smarty->fetch(get_tpl('detail_kl_losses'));
             break;
         case "corp_kills":
             $smarty->assign('title', Language::get('topkillers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'corp_kills', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'corp_kills', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_CorpKills();
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Corp($list, Language::get('kills'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_CorpKills();
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Corp($list, Language::get('kills'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "corp_kills_class":
             $smarty->assign('title', Language::get('topdestroyedships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             $newrow = true;
             $ships = array();
             foreach ($shipclass as $shp) {
                 $list = new TopList_CorpKills();
                 $list->addInvolvedAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Corp($list, Language::get('kills'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "kills_class":
             $smarty->assign('title', Language::get('topdestroyedships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             foreach ($shipclass as $shp) {
                 $list = new TopList_Kills();
                 $list->addInvolvedAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Pilot($list, Language::get('kills'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "corp_losses_class":
             $smarty->assign('title', Language::get('toplostships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             foreach ($shipclass as $shp) {
                 $list = new TopList_CorpLosses();
                 $list->addVictimAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Corp($list, Language::get('losses'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "losses_class":
             $smarty->assign('title', Language::get('toplostships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             foreach ($shipclass as $shp) {
                 $list = new TopList_Losses();
                 $list->addVictimAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Pilot($list, Language::get('losses'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "corp_losses":
             $smarty->assign('title', Language::get('toplosers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'corp_losses', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'corp_losses', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_CorpLosses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Corp($list, Language::get('losses'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_CorpLosses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Corp($list, Language::get('losses'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_kills":
             $smarty->assign('title', Language::get('topkillers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_kills', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_kills', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, Language::get('kills'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, Language::get('kills'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_scores":
             $smarty->assign('title', Language::get('topscorers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_scores', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_scores', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_Score();
             $list->addInvolvedAlliance($this->alliance);
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, Language::get('top_points'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Score();
             $list->addInvolvedAlliance($this->alliance);
             $table = new TopTable_Pilot($list, Language::get('top_points'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_losses":
             $smarty->assign('title', Language::get('toplosers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_losses', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_losses', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_Losses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, Language::get('losses'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Losses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, Language::get('losses'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "ships_weapons":
             $view = "ships_weapons";
             $shiplist = new TopList_Ship();
             $shiplist->addInvolvedAlliance($this->alliance);
             $shiplisttable = new TopTable_Ship($shiplist);
             $smarty->assign('ships', $shiplisttable->generate());
             $weaponlist = new TopList_Weapon();
             $weaponlist->addInvolvedAlliance($this->alliance);
             $weaponlisttable = new TopTable_Weapon($weaponlist);
             $smarty->assign('title', Language::get('ships_weapons'));
             $smarty->assign('weapons', $weaponlisttable->generate());
             return $smarty->fetch(get_tpl('detail_kl_ships_weapons'));
             break;
         case 'violent_systems':
             $smarty->assign('title', Language::get('topmostviolentsys'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'violent_systems', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'violent_systems', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $startdate = gmdate('Y-m-d H:i', makeStartDate(0, $this->year, $this->month));
             $enddate = gmdate('Y-m-d H:i', makeEndDate(0, $this->year, $this->month));
             $sql = "select sys.sys_name, sys.sys_sec, sys.sys_id, count(kll.kll_id) as kills\n\t\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_all ina\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand ina.ina_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand ina.ina_all_id = " . $this->all_id;
             $sql .= "   and kll.kll_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand kll.kll_timestamp < '{$enddate}'\n\t\t\t\t\t\t\tand ina.ina_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand ina.ina_timestamp < '{$enddate}'\n\t\t\t\t\t\t\tgroup by sys.sys_id\n\t\t\t\t\t\t\torder by kills desc, sys.sys_name asc\n\t\t\t\t\t\t\tlimit 25";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             $odd = false;
             $counter = 1;
             $syslist = array();
             while ($row = $qry->getRow()) {
                 if (!$odd) {
                     $odd = true;
                     $rowclass = 'kb-table-row-odd';
                 } else {
                     $odd = false;
                     $rowclass = 'kb-table-row-even';
                 }
                 $syslist[] = array("counter" => $counter, "url" => "?a=system_detail&amp;sys_id=" . $row['sys_id'], "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => (int) $row['kills']);
                 $counter++;
             }
             $smarty->assignByRef('syslist', $syslist);
             $smarty->assign('monthly_stats', $smarty->fetch(get_tpl(violent_systems)));
             $sql = "select sys.sys_name, sys.sys_id, sys.sys_sec, count(kll.kll_id) as kills\n\t\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_all ina\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand ina.ina_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand ina.ina_all_id = " . $this->all_id;
             $sql .= " group by sys.sys_id\n\t\t\t\t\t\t\torder by kills desc, sys.sys_name asc\n\t\t\t\t\t\t\tlimit 25";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             $odd = false;
             $counter = 1;
             $syslist = array();
             while ($row = $qry->getRow()) {
                 if (!$odd) {
                     $odd = true;
                     $rowclass = 'kb-table-row-odd';
                 } else {
                     $odd = false;
                     $rowclass = 'kb-table-row-even';
                 }
                 $syslist[] = array("counter" => $counter, "url" => "?a=system_detail&amp;sys_id=" . $row['sys_id'], "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => (int) $row['kills']);
                 $counter++;
             }
             $smarty->assignByRef('syslist', $syslist);
             $smarty->assign('total_stats', $smarty->fetch(get_tpl(violent_systems)));
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case 'corp_list':
             return $this->corpList();
             break;
         case 'history':
             $allsum = new allianceSummary($this->alliance);
             $smarty->assign('title', Language::get('history'));
             $smarty->assign('summary', $allsum->getMonthlySummary());
             return $smarty->fetch(get_tpl('detail_history'));
             break;
     }
     return '';
 }
Esempio n. 11
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     global $smarty;
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     $klist = new KillList();
     $klist->setOrdered(true);
     if ($this->view == 'losses') {
         involved::load($klist, 'loss');
     } else {
         involved::load($klist, 'kill');
     }
     $klist->addSystem($this->system);
     if (config::get('kill_classified')) {
         $klist->setEndDate(gmdate('Y-m-d H:i', strtotime('now - ' . config::get('kill_classified') . ' hours')));
     }
     if ($scl_id) {
         $klist->addVictimShipClass(intval($scl_id));
     } else {
         $klist->setPodsNoobShips(config::get('podnoobs'));
     }
     if ($this->view == 'recent' || !$this->view) {
         $klist->setLimit(20);
         $smarty->assign('klheader', config::get('killcount') . ' most recent kills');
     } else {
         if ($this->view == 'losses') {
             $smarty->assign('klheader', 'All losses');
         } else {
             $smarty->assign('klheader', 'All kills');
         }
     }
     $klist->setPageSplit(config::get('killcount'));
     $pagesplitter = new PageSplitter($klist->getCount(), config::get('killcount'));
     $table = new KillListTable($klist);
     $smarty->assign('klsplit', $pagesplitter->generate());
     $smarty->assign('kltable', $table->generate());
     $html = $smarty->fetch(get_tpl('system_detail'));
     return $html;
 }
Esempio n. 12
0
 /**
  * Generate an options page based on the contentions of the URL request.
  * 
  * @global Smarty $smarty
  * @global Page $page
  *
  * @return string html for an options page.
  */
 public static function genOptionsPage()
 {
     $field = urldecode(edkURI::getArg('field', 1));
     $sub = urldecode(edkURI::getArg('sub', 2));
     if (!$field || !$sub) {
         $field = "Advanced";
         $sub = "Configuration";
     }
     global $smarty, $page;
     if (is_object($page)) {
         $page->setTitle('Administration - ' . $sub);
     }
     // create the option field
     $smarty->assign('field', urlencode($field));
     $smarty->assign('sub', urlencode($sub));
     $smarty->assign('actionURL', edkURI::build(array(array('a', 'admin', true), array('field', urlencode($field), true), array('sub', urlencode($sub), true))));
     $html = $smarty->fetch(get_tpl('admin_options_field_head'));
     // create all option sets
     foreach (self::$data[$field][$sub] as $set => $options) {
         $smarty->assign('set', $set);
         $html .= $smarty->fetch(get_tpl('admin_options_set_head'));
         // create all options in the set
         foreach ($options as $option) {
             $html .= options::assembleElement($option);
         }
         $html .= $smarty->fetch(get_tpl('admin_options_set_foot'));
     }
     $html .= $smarty->fetch(get_tpl('admin_options_field_foot'));
     return $html;
 }
Esempio n. 13
0
    public function buildStats()
    {
        // this is a fast query to get the system and timestamp
        $rqry = DBFactory::getDBQuery();
        if ($this->adjacent) {
            $rsql = 'SELECT kll_timestamp, sjp_to as sys_id from kb3_kills
				join kb3_systems a ON (a.sys_id = kll_system_id)
				join kb3_system_jumps on (sjp_from = a.sys_id)
				where kll_id = ' . $this->kll_id . ' UNION
				SELECT kll_timestamp, kll_system_id as sys_id from kb3_kills
				where kll_id = ' . $this->kll_id;
        } else {
            $rsql = 'SELECT kll_timestamp, kll_system_id as sys_id from kb3_kills
				where kll_id = ' . $this->kll_id;
        }
        $rqry->execute($rsql);
        while ($rrow = $rqry->getRow()) {
            $this->systems[] = $rrow['sys_id'];
            $basetime = $rrow['kll_timestamp'];
        }
        // now we get all kills in that system for +-4 hours
        $query = 'SELECT kll.kll_timestamp AS ts FROM kb3_kills kll WHERE kll.kll_system_id IN (' . implode(',', $this->systems) . ') AND kll.kll_timestamp <= "' . date('Y-m-d H:i:s', strtotime($basetime) + config::get('fleet_battles_mod_maxtime') * 60 * 60) . '"' . ' AND kll.kll_timestamp >= "' . date('Y-m-d H:i:s', strtotime($basetime) - config::get('fleet_battles_mod_maxtime') * 60 * 60) . '"' . ' ORDER BY kll.kll_timestamp ASC';
        $qry = DBFactory::getDBQuery();
        $qry->execute($query);
        $ts = array();
        $timestampsRaw = array();
        while ($row = $qry->getRow()) {
            $time = strtotime($row['ts']);
            $ts[intval(date('H', $time))][] = $row['ts'];
            $timestampsRaw[] = $row["ts"];
        }
        // only for non-battles
        if (!$this->displayingBattle) {
            // this tricky thing looks for gaps of more than 1 hour and creates an intersection
            $baseh = date('H', strtotime($basetime));
            $maxc = count($ts);
            $times = array();
            for ($i = 0; $i < $maxc; $i++) {
                $h = ($baseh + $i) % 24;
                if (!isset($ts[$h])) {
                    break;
                }
                foreach ($ts[$h] as $timestamp) {
                    $times[] = $timestamp;
                }
            }
            for ($i = 0; $i < $maxc; $i++) {
                $h = ($baseh - $i) % 24;
                if ($h < 0) {
                    $h += 24;
                }
                if (!isset($ts[$h])) {
                    break;
                }
                foreach ($ts[$h] as $timestamp) {
                    $times[] = $timestamp;
                }
            }
            unset($ts);
            asort($times);
            // we got 2 resulting timestamps
            $this->firstts = array_shift($times);
            $this->lastts = array_pop($times);
        } else {
            // take the first and last timestamp from our original query
            $this->firstts = array_shift($timestampsRaw);
            $this->lastts = array_pop($timestampsRaw);
        }
        // get parameters for overriding start and end times
        // dirty hook for the enlightened circle ;)
        $overrideStartTime = str_replace('%20', ' ', edkURI::getArg('starttime'));
        $overrideEndTime = str_replace('%20', ' ', edkURI::getArg('endtime'));
        if ($overrideStartTime && strtotime($overrideStartTime)) {
            $this->firstts = $overrideStartTime;
        }
        if ($overrideEndTime && strtotime($overrideEndTime)) {
            $this->lastts = $overrideEndTime;
        }
        // unfiltered kill list (no ship class filter applied)
        $this->kslist = new KillList();
        $this->kslist->setOrdered(true);
        foreach ($this->systems as $system) {
            $this->kslist->addSystem($system);
        }
        $this->kslist->setStartDate($this->firstts);
        $this->kslist->setEndDate($this->lastts);
        involved::load($this->kslist, 'kill');
        // unfiltered loss list (no ship class filter applied)
        $this->lslist = new KillList();
        $this->lslist->setOrdered(true);
        foreach ($this->systems as $system) {
            $this->lslist->addSystem($system);
        }
        $this->lslist->setStartDate($this->firstts);
        $this->lslist->setEndDate($this->lastts);
        involved::load($this->lslist, 'loss');
        // filtered kill list (shipclass filter applied)
        $this->klist = new KillList();
        $this->klist->setOrdered(true);
        $this->klist->setCountComments(true);
        $this->klist->setCountInvolved(true);
        foreach ($this->systems as $system) {
            $this->klist->addSystem($system);
        }
        $this->klist->setStartDate($this->firstts);
        $this->klist->setEndDate($this->lastts);
        involved::load($this->klist, 'kill');
        // filtered loss list (ship class filter applied)
        $this->llist = new KillList();
        $this->llist->setOrdered(true);
        $this->llist->setCountComments(true);
        $this->llist->setCountInvolved(true);
        foreach ($this->systems as $system) {
            $this->llist->addSystem($system);
        }
        $this->llist->setStartDate($this->firstts);
        $this->llist->setEndDate($this->lastts);
        involved::load($this->llist, 'loss');
        // apply ship class filters
        if ($this->scl_id) {
            $this->klist->addVictimShipClass($this->scl_id);
            $this->llist->addVictimShipClass($this->scl_id);
        }
        // if manual side assignment is enabled
        if (config::get("fleet_battles_mod_sideassign")) {
            // get possible side assignments
            $sideAssignments = getSideAssignments($this->systems[0], $this->firstts, $this->lastts);
            $sideAssignmentMap = array();
            // apply
            foreach ($sideAssignments as $sideAssignment) {
                $this->isFixed = TRUE;
                $sideAssignmentMap[$sideAssignment["entity_type"]][$sideAssignment["entity_id"]] = $sideAssignment["side"];
                // entity is an alliance
                if ($sideAssignment["entity_type"] == "alliance") {
                    // alliance is an enemy
                    if ($sideAssignment["side"] == "e") {
                        $this->kslist->addVictimAlliance($sideAssignment["entity_id"]);
                        $this->lslist->addInvolvedAlliance($sideAssignment["entity_id"]);
                        $this->klist->addVictimAlliance($sideAssignment["entity_id"]);
                        $this->llist->addInvolvedAlliance($sideAssignment["entity_id"]);
                    } else {
                        $this->kslist->addInvolvedAlliance($sideAssignment["entity_id"]);
                        $this->lslist->addVictimAlliance($sideAssignment["entity_id"]);
                        // also add as involved alliance for blue-on-blue kills
                        $this->lslist->addInvolvedAlliance($sideAssignment["entity_id"]);
                        $this->klist->addInvolvedAlliance($sideAssignment["entity_id"]);
                        $this->llist->addVictimAlliance($sideAssignment["entity_id"]);
                        // also add as involved alliance for blue-on-blue kills
                        $this->llist->addInvolvedAlliance($sideAssignment["entity_id"]);
                    }
                } else {
                    // alliance is an enemy
                    if ($sideAssignment["side"] == "e") {
                        $this->kslist->addVictimCorp($sideAssignment["entity_id"]);
                        $this->lslist->addInvolvedCorp($sideAssignment["entity_id"]);
                        $this->klist->addVictimCorp($sideAssignment["entity_id"]);
                        $this->llist->addInvolvedCorp($sideAssignment["entity_id"]);
                    } else {
                        $this->kslist->addInvolvedCorp($sideAssignment["entity_id"]);
                        $this->lslist->addVictimCorp($sideAssignment["entity_id"]);
                        // also add as involved alliance for blue-on-blue kills
                        $this->lslist->addInvolvedCorp($sideAssignment["entity_id"]);
                        $this->klist->addInvolvedCorp($sideAssignment["entity_id"]);
                        $this->llist->addVictimCorp($sideAssignment["entity_id"]);
                        // also add as involved alliance for blue-on-blue kills
                        $this->llist->addInvolvedCorp($sideAssignment["entity_id"]);
                    }
                }
            }
        }
        // we need a summary table first
        $this->summaryTable = new KillSummaryTable($this->kslist, $this->lslist);
        $this->summaryTable->generate();
        $this->destroyed = array();
        $this->lossValues = array();
        $this->killValues = array();
        $this->pilots = array('a' => array(), 'e' => array());
        $this->klist->rewind();
        $this->damageOverview = array('a' => array(), 'e' => array());
        $totalKillIsk = $this->summaryTable->getTotalKillISK();
        while ($kill = $this->klist->getKill()) {
            handle_involved($kill, 'a', $this->pilots, $sideAssignmentMap, TRUE);
            handle_destroyed($kill, 'e', $this->destroyed, $this->pilots, $sideAssignmentMap, TRUE);
            // gather data for battle timeline and loss value lists
            // for better performance we use this loop so we won't have to loop over the same data again
            // ---------------------------------------------------------------------------------------
            // gathering kill values
            // ---------------------------------------------------------------------------------------
            // we dont want our own people on the enemy's side!
            if (in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid')) || in_array($kill->getVictimCorpID(), config::get('cfg_corpid')) || in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
                continue;
            }
            $lossValueRaw = $kill->getISKLoss();
            $lossValue = self::formatIskValue($lossValueRaw);
            if ($totalKillIsk != 0) {
                $percentualLossValue = number_format($lossValueRaw / $totalKillIsk * 100, 2);
            } else {
                $percentualLossValue = 0.0;
            }
            if ($lossValueRaw > 0) {
                $this->killValues[] = array("victimName" => $kill->getVictimName(), "victimID" => $kill->getVictimID(), "victimUrl" => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), "victimShipName" => $kill->getVictimShipName(), "victimShipImage" => imageUrl::getURL("Ship", $kill->getVictimShipID(), 32), "victimShipClass" => $kill->getVictimShipClassName(), "victimCorpName" => $kill->getVictimCorpName(), "victimCorpID" => $kill->getVictimCorpID(), "victimCorpUrl" => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), "victimAllianceName" => $kill->getVictimAllianceName(), "victimAllianceID" => $kill->getVictimAllianceID(), "victimAllianceUrl" => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), "killId" => $kill->getID(), "killUrl" => edkURI::page("kill_detail", $kill->getID(), "kll_id"), "lossValueRaw" => $lossValueRaw, "lossValue" => $lossValue, "lossValuePercentage" => $percentualLossValue);
            }
            // ---------------------------------------------------------------------------------------
            // gathering timeline data
            // ---------------------------------------------------------------------------------------
            $killTimestamp = strtotime($kill->getTimeStamp());
            // increase killtimestamp for pods so they appear AFTER the ship kill in the timeline
            $shipClassId = $kill->getVictimShip()->getClass()->getID();
            if ($shipClassId == 18 || $shipClassId == 2) {
                $killTimestamp += 1;
            }
            $this->timeLine[] = array("timestamp" => $killTimestamp, "loss" => NULL, "kill" => array("victimName" => $kill->getVictimName(), "victimID" => $kill->getVictimID(), "victimUrl" => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), "victimShipName" => $kill->getVictimShipName(), "victimShipImage" => imageUrl::getURL("Ship", $kill->getVictimShipID(), 32), "victimShipClass" => $kill->getVictimShipClassName(), "victimCorpName" => $kill->getVictimCorpName(), "victimCorpID" => $kill->getVictimCorpID(), "victimCorpUrl" => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), "victimAllianceName" => $kill->getVictimAllianceName(), "victimAllianceID" => $kill->getVictimAllianceID(), "victimAllianceUrl" => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), "killId" => $kill->getID(), "killUrl" => edkURI::page("kill_detail", $kill->getID(), "kll_id")));
            // ---------------------------------------------------------------------------------------
            // gathering damage overview data
            // ---------------------------------------------------------------------------------------
            $this->damageOverview["a"][] = array("victimName" => $kill->getVictimName(), "victimID" => $kill->getVictimID(), "victimUrl" => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), "victimShipName" => $kill->getVictimShipName(), "victimShipImage" => imageUrl::getURL("Ship", $kill->getVictimShipID(), 32), "victimShipClass" => $kill->getVictimShipClassName(), "victimCorpName" => $kill->getVictimCorpName(), "victimCorpID" => $kill->getVictimCorpID(), "victimCorpUrl" => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), "victimAllianceName" => $kill->getVictimAllianceName(), "victimAllianceID" => $kill->getVictimAllianceID(), "victimAllianceUrl" => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), "killId" => $kill->getID(), "killUrl" => edkURI::page("kill_detail", $kill->getID(), "kll_id"), "lossValueRaw" => $lossValueRaw, "lossValue" => $lossValue, "lossValuePercentage" => $percentualLossValue);
        }
        $this->llist->rewind();
        $totalLossIsk = $this->summaryTable->getTotalLossISK();
        while ($kill = $this->llist->getKill()) {
            handle_involved($kill, 'e', $this->pilots, $sideAssignmentMap, TRUE);
            handle_destroyed($kill, 'a', $this->destroyed, $this->pilots, $sideAssignmentMap, TRUE);
            // gather data for battle timeline and loss value lists
            // for better performance we use this loop so we won't have to loop over the same data again
            // ---------------------------------------------------------------------------------------
            // gathering loss values
            // ---------------------------------------------------------------------------------------
            $lossValueRaw = $kill->getISKLoss();
            $lossValue = self::formatIskValue($lossValueRaw);
            if ($totalLossIsk != 0) {
                $percentualLossValue = number_format($lossValueRaw / $totalLossIsk * 100, 2);
            } else {
                $percentualLossValue = 0.0;
            }
            if ($lossValueRaw > 0) {
                $this->lossValues[] = array("victimName" => $kill->getVictimName(), "victimID" => $kill->getVictimID(), "victimUrl" => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), "victimShipName" => $kill->getVictimShipName(), "victimShipImage" => imageUrl::getURL("Ship", $kill->getVictimShipID(), 32), "victimShipClass" => $kill->getVictimShipClassName(), "victimCorpName" => $kill->getVictimCorpName(), "victimCorpID" => $kill->getVictimCorpID(), "victimCorpUrl" => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), "victimAllianceName" => $kill->getVictimAllianceName(), "victimAllianceID" => $kill->getVictimAllianceID(), "victimAllianceUrl" => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), "killId" => $kill->getID(), "killUrl" => edkURI::page("kill_detail", $kill->getID(), "kll_id"), "lossValueRaw" => $lossValueRaw, "lossValue" => $lossValue, "lossValuePercentage" => $percentualLossValue);
            }
            // ---------------------------------------------------------------------------------------
            // gathering timeline data
            // ---------------------------------------------------------------------------------------
            $killTimestamp = strtotime($kill->getTimeStamp());
            $shipClassId = $kill->getVictimShip()->getClass()->getID();
            $this->timeLine[] = array("timestamp" => strtotime($kill->getTimeStamp()), "loss" => array("victimName" => $kill->getVictimName(), "victimID" => $kill->getVictimID(), "victimUrl" => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), "victimShipName" => $kill->getVictimShipName(), "victimShipImage" => imageUrl::getURL("Ship", $kill->getVictimShipID(), 32), "victimShipClass" => $kill->getVictimShipClassName(), "victimCorpName" => $kill->getVictimCorpName(), "victimCorpID" => $kill->getVictimCorpID(), "victimCorpUrl" => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), "victimAllianceName" => $kill->getVictimAllianceName(), "victimAllianceID" => $kill->getVictimAllianceID(), "victimAllianceUrl" => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), "killId" => $kill->getID(), "killUrl" => edkURI::page("kill_detail", $kill->getID(), "kll_id")), "kill" => NULL);
        }
        //echo "<pre>"; var_dump($this->pilots); echo "</pre>";
        // sort pilot ships, order pods after ships
        foreach ($this->pilots as $side => $pilot) {
            foreach ($pilot as $id => $kll) {
                usort($this->pilots[$side][$id], array($this, 'cmp_ts_func'));
            }
        }
        // sort arrays, ships with high points first
        uasort($this->pilots['a'], array($this, 'cmp_func'));
        uasort($this->pilots['e'], array($this, 'cmp_func'));
        // now get the pods out and mark the ships the've flown as podded
        foreach ($this->pilots as $side => $pilot) {
            foreach ($pilot as $id => $kll) {
                $max = count($kll);
                for ($i = 0; $i < $max; $i++) {
                    // add up total damage for each side
                    if ($side == "a") {
                        if (isset($kll[$i]["damage"])) {
                            $this->damageTotalFriendly += $kll[$i]["damage"];
                        }
                    } else {
                        if (isset($kll[$i]["damage"])) {
                            $this->damageTotalHostile += $kll[$i]["damage"];
                        }
                    }
                    // this kill has a pod as ship
                    if ($kll[$i]['shipClass'] == 'Capsule') {
                        // this pilot made previous kills in another ship
                        if (isset($kll[$i - 1]['sid'])) {
                            // this kill is a pod loss
                            if (isset($kll[$i]['destroyed'])) {
                                $this->pilots[$side][$id][$i - 1]['podded'] = true;
                                $this->pilots[$side][$id][$i - 1]['podid'] = $kll[$i]['kll_id'];
                                $this->pilots[$side][$id][$i - 1]['pod_url'] = edkURI::page("kill_detail", $kll[$i]['kll_id'], "kll_id");
                                unset($this->pilots[$side][$id][$i]);
                            } else {
                                // update stats for previously used ship
                                $this->pilots[$side][$id][$i - 1]['times'] += $this->pilots[$side][$id][$i]['times'];
                                $this->pilots[$side][$id][$i - 1]['damage'] += $this->pilots[$side][$id][$i]['damage'];
                                unset($this->pilots[$side][$id][$i]);
                            }
                        }
                    }
                }
            }
        }
        // update battles with current stats
        $this->updateBattles();
    }
Esempio n. 14
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     global $smarty;
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     switch ($this->view) {
         case "kills":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addInvolvedPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('kills', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_kills'));
             break;
         case "losses":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addVictimPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobships(config::get('podnoobs'));
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('losses', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_losses'));
             break;
         case "ships_weapons":
             $shiplist = new TopList_Ship();
             $shiplist->addInvolvedPilot($this->pilot);
             $shiplisttable = new TopTable_Ship($shiplist);
             $smarty->assign('ships', $shiplisttable->generate());
             $weaponlist = new TopList_Weapon();
             $weaponlist->addInvolvedPilot($this->pilot);
             $weaponlisttable = new TopTable_Weapon($weaponlist);
             $smarty->assign('weapons', $weaponlisttable->generate());
             return $smarty->fetch(get_tpl('detail_kl_ships_weapons'));
             break;
         case 'history':
             $pltsum = new pilotSummary($this->plt_id);
             $smarty->assign('title', Language::get('history'));
             $smarty->assign('summary', $pltsum->getMonthlySummary());
             return $smarty->fetch(get_tpl('detail_history'));
             break;
         default:
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addInvolvedPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobships(config::get('podnoobs'));
             }
             $table = new KillListTable($list);
             $smarty->assign('kills', $table->generate());
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addVictimPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobships(config::get('podnoobs'));
             }
             $table = new KillListTable($list);
             $smarty->assign('losses', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_default'));
             break;
     }
     return $html;
 }
Esempio n. 15
0
<?php

/**
 * @package EDK
 */
require_once "common/admin/admin_menu.php";
$page = new Page("Settings - Kill Log API");
$page->setCachable(false);
$page->setAdmin();
if ($key_id = (int) edkURI::getArg('delete')) {
    $qry2 = new DBQuery();
    $sql = "DELETE from kb3_api_keys WHERE key_id = '" . $key_id . "' AND key_kbsite = '" . KB_SITE . "'";
    $qry2->execute($sql);
}
function clearcache($pattern)
{
    $files = glob($pattern . "*.xml");
    foreach ((array) $files as $file) {
        if ($file == '..' || $file == '.') {
            continue;
        }
        if (is_file($file)) {
            unlink($file);
        }
    }
    $dirs = glob($pattern . "*");
    foreach ((array) $dirs as $dir) {
        if ($dir == '..' || $dir == '.') {
            continue;
        }
        if (is_dir($dir)) {
Esempio n. 16
0
 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());
         }
     }
 }
Esempio n. 17
0
 public static function killListCorp($corporationDetail)
 {
     require_once "toplist/class.expensivekills.php";
     require_once "toptable/class.expensivekill.php";
     global $smarty;
     // arguments for URL building
     $args = array();
     if ($corporationDetail->all_external_id) {
         $args[] = array('crp_ext_id', $corporationDetail->crp_external_id, true);
     } else {
         $args[] = array('crp_id', $corporationDetail->crp_id, true);
     }
     // we need to figure this out ourselves, older versions of the corp detail page don't have this information accessible
     $crp_id = $corporationDetail->getCorp()->getID();
     $view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2));
     if ($view) {
         $year = (int) edkURI::getArg('y', 3);
         $month = (int) edkURI::getArg('m', 4);
     } else {
         $year = (int) edkURI::getArg('y', 2);
         $month = (int) edkURI::getArg('m', 3);
     }
     if (!$month) {
         $month = kbdate('m');
     }
     if (!$year) {
         $year = kbdate('Y');
     }
     if ($month == 12) {
         $nmonth = 1;
         $nyear = $year + 1;
     } else {
         $nmonth = $month + 1;
         $nyear = $year;
     }
     if ($month == 1) {
         $pmonth = 12;
         $pyear = $year - 1;
     } else {
         $pmonth = $month - 1;
         $pyear = $year;
     }
     $monthname = kbdate("F", strtotime("2000-" . $month . "-2"));
     if ($view == 'expensive_kills') {
         $smarty->assign('title', "Most Expensive Kills");
         $smarty->assign('month', $monthname);
         $smarty->assign('year', $year);
         $smarty->assign('pmonth', $pmonth);
         $smarty->assign('pyear', $pyear);
         $smarty->assign('nmonth', $nmonth);
         $smarty->assign('nyear', $nyear);
         $smarty->assign('crp_id', $crp_id);
         $smarty->assign('value_class', 'kl-kill');
         $smarty->assign('url_previous', edkURI::build($args, array('view', 'expensive_kills', true), array('y', $pyear, true), array('m', $pmonth, true)));
         $smarty->assign('url_next', edkURI::build($args, array('view', 'expensive_kills', true), array('y', $nyear, true), array('m', $nmonth, true)));
         $list = new TopList_ExpensiveKills();
         $list->addInvolvedCorp($corporationDetail->getCorp());
         $list->setPodsNoobShips(TRUE);
         $list->setMonth($month);
         $list->setYear($year);
         $table = new TopTable_ExpensiveKill($list, "ISK");
         $smarty->assign('monthly_stats', $table->generate());
         $list = new TopList_ExpensiveKills();
         $list->addInvolvedCorp($corporationDetail->getCorp());
         $list->setPodsNoobShips(TRUE);
         $table = new TopTable_ExpensiveKill($list, "ISK");
         $smarty->assign('total_stats', $table->generate());
         return $smarty->fetch(getcwd() . "/mods/most_expensive_toplist/templates/detail_kl_expensive.tpl");
     } else {
         if ($view == 'expensive_losses') {
             $smarty->assign('title', "Most Expensive Losses");
             $smarty->assign('month', $monthname);
             $smarty->assign('year', $year);
             $smarty->assign('pmonth', $pmonth);
             $smarty->assign('pyear', $pyear);
             $smarty->assign('nmonth', $nmonth);
             $smarty->assign('nyear', $nyear);
             $smarty->assign('crp_id', $crp_id);
             $smarty->assign('value_class', 'kl-loss');
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'expensive_losses', true), array('y', $pyear, true), array('m', $pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'expensive_losses', true), array('y', $nyear, true), array('m', $nmonth, true)));
             $list = new TopList_ExpensiveKills();
             $list->addVictimCorp($corporationDetail->getCorp());
             $list->setPodsNoobShips(TRUE);
             $list->setMonth($month);
             $list->setYear($year);
             $table = new TopTable_ExpensiveKill($list, "ISK");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_ExpensiveKills();
             $list->addVictimCorp($corporationDetail->getCorp());
             $list->setPodsNoobShips(TRUE);
             $table = new TopTable_ExpensiveKill($list, "ISK");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(getcwd() . "/mods/most_expensive_toplist/templates/detail_kl_expensive.tpl");
         }
     }
 }
Esempio n. 18
0
// load the config from the database
$config = new Config();
if (!config::get('cfg_kbhost')) {
    config::put('cfg_kbhost', "http://" . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/")));
}
if (!config::get('cfg_img')) {
    config::put('cfg_img', config::get('cfg_kbhost') . "/img");
}
define('KB_HOST', config::get('cfg_kbhost'));
define('IMG_URL', config::get('cfg_img'));
if (substr(IMG_URL, -4) == '/img') {
    define('IMG_HOST', substr(IMG_URL, 0, strpos(IMG_URL, "/img")));
} else {
    define('IMG_HOST', KB_HOST);
}
$page = preg_replace('/[^\\w\\d_-]/', '', edkURI::getArg('a', 0));
edkURI::usePath(config::get('cfg_pathinfo'));
if (defined('KB_PHP')) {
    edkURI::setRoot(KB_PHP);
}
if (isset($_GET['xajax'])) {
    require_once 'common/includes/xajax.functions.php';
}
// Serve feeds to feed fetchers.
if (strpos($_SERVER['HTTP_USER_AGENT'], 'EDK IDFeedfetcher') !== false) {
    // Serve idfeeds to idfeed fetchers.
    $page = 'idfeed';
} else {
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'EVE-IGB') !== false) {
        // check for the igb
        define('IS_IGB', true);
Esempio n. 19
0
<?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();
 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 .= "&amp;";
     }
     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;
 }
Esempio n. 21
0
    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();
Esempio n. 22
0
 /**
  * Start constructing the page.
  *
  * Prepare all the shared variables such as dates and check alliance ID.
  */
 function start()
 {
     $this->kll_id = (int) edkURI::getArg('kll_id');
     $this->kll_external_id = 0;
     if (!$this->kll_id) {
         $this->kll_external_id = (int) edkURI::getArg('kll_ext_id');
         if (!$this->kll_external_id) {
             // internal and external ids easily overlap so we can't guess which
             $this->kll_id = (int) edkURI::getArg('id', 1);
         }
     }
     $this->nolimit = edkURI::getArg('nolimit', 2);
     $this->menuOptions = array();
     $this->page = new Page('Kill details');
     if (!$this->kll_id && !$this->kll_external_id) {
         $html = "No kill id specified.";
         $this->page->setContent($html);
         $this->page->generate($html);
         exit;
     }
     if ($this->kll_id) {
         $this->kill = Cacheable::factory('Kill', $this->kll_id);
     } else {
         $this->kill = new Kill($this->kll_external_id, true);
         $this->kll_id = $this->kill->getID();
     }
     if (!$this->kill->exists()) {
         $html = "That kill doesn't exist.";
         $this->page->setContent($html);
         $this->page->generate($html);
         exit;
     }
     if ($this->kll_external_id) {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('kll_ext_id', $this->kll_external_id, true)) . "' />");
     } else {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('kll_id', $this->kll_id, true)) . "' />");
     }
     $this->finalblow = false;
     $this->commenthtml = '';
     // Check for posted comments.
     // If a comment is being posted then we won't exit this block.
     if (isset($_POST['comment']) && config::get('comments')) {
         $comments = new Comments($this->kll_id);
         $pw = false;
         if (!config::get('comments_pw') || $this->page->isAdmin()) {
             $pw = true;
         }
         if ($pw || crypt($_POST['password'], config::get("comment_password")) == config::get("comment_password")) {
             if ($_POST['comment'] == '') {
                 $this->commenthtml = 'Error: The silent type, hey? Good for' . ' you, bad for a comment.';
             } else {
                 $comment = $_POST['comment'];
                 $name = $_POST['name'];
                 if ($name == null) {
                     $name = 'Anonymous';
                 }
                 $comments->addComment($name, $comment);
                 //Redirect to avoid refresh reposting comments.
                 header('Location: ' . $_SERVER['REQUEST_URI'], TRUE, 303);
                 die;
             }
         } else {
             // Password is wrong
             $this->commenthtml = 'Error: Wrong Password';
         }
     }
     global $smarty;
     if (!file_exists('img/panel/' . config::get('fp_theme') . '.png')) {
         config::set('fp_theme', 'tyrannis');
     }
     $smarty->assign('panel_colour', config::get('fp_theme'));
     $smarty->assign('showiskd', config::get('kd_showiskd'));
     $smarty->assign('formURL', edkURI::build(edkURI::parseURI()));
     // Check admin update options.
     if ($this->page->isAdmin()) {
         $smarty->assign('admin', true);
         $this->updatePrices();
     }
     $this->involvedSetup();
     $this->fittingSetup();
 }
Esempio n. 23
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     global $smarty;
     $html = '';
     $smarty->assign('view', $this->view);
     switch ($this->view) {
         case "":
             $targets = array();
             $curtarget = array();
             while ($target =& $this->contract->getContractTarget()) {
                 $kl =& $target->getKillList();
                 $ll =& $target->getLossList();
                 $summary = new KillSummaryTable($kl, $ll);
                 $summary->setVerbose(true);
                 $summary->setView('combined');
                 $curtargets['type'] = $target->getType();
                 $curtargets['id'] = $target->getID();
                 $curtargets['name'] = $target->getName();
                 $curtargets['summary'] = $summary->generate();
                 if ($summary->getTotalKillISK()) {
                     $curtargets['efficiency'] = round($summary->getTotalKillISK() / ($summary->getTotalKillISK() + $summary->getTotalLossISK()) * 100, 2);
                 } else {
                     $curtargets['efficiency'] = 0;
                 }
                 $curtargets['total_kills'] = $summary->getTotalKills();
                 $curtargets['total_losses'] = $summary->getTotalLosses();
                 $curtargets['total_kill_isk'] = round($summary->getTotalKillISK() / 1000000000, 2);
                 $curtargets['total_loss_isk'] = round($summary->getTotalLossISK() / 1000000000, 2);
                 $bar = new BarGraph($curtargets['efficiency'], 100, 120);
                 $curtargets['bar'] = $bar->generate();
                 $targets[] = $curtargets;
             }
             $smarty->assignByRef('targets', $targets);
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
         case "recent_activity":
             $this->contract = new Contract($this->ctr_id);
             $klist = $this->contract->getKillList();
             $klist->setOrdered(true);
             if ($scl_id) {
                 $klist->addVictimShipClass($scl_id);
             } else {
                 $klist->setPodsNoobShips(config::get('podnoobs'));
             }
             $table = new KillListTable($klist);
             $table->setLimit(10);
             $smarty->assign('killtable', $table->generate());
             $llist = $this->contract->getLossList();
             $llist->setOrdered(true);
             if ($scl_id) {
                 $llist->addVictimShipClass($scl_id);
             } else {
                 $llist->setPodsNoobShips(config::get('podnoobs'));
             }
             $table = new KillListTable($llist);
             $table->setLimit(10);
             $smarty->assign('losstable', $table->generate());
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
         case "kills":
             $this->contract = new Contract($this->ctr_id);
             $list = $this->contract->getKillList();
             $list->setOrdered(true);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('killtable', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
         case "losses":
             $this->contract = new Contract($this->ctr_id);
             $llist = $this->contract->getLossList();
             $llist->setOrdered(true);
             if ($scl_id) {
                 $llist->addVictimShipClass($scl_id);
             } else {
                 $llist->setPodsNoobShips(config::get('podnoobs'));
             }
             $llist->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($llist->getCount(), config::get('killcount'));
             $table = new KillListTable($llist);
             $smarty->assign('losstable', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
     }
     return $html;
 }
Esempio n. 24
0
$killID = edkURI::getArg('kll_id');
if ($killID !== false) {
    $killID = (int) $killID;
} else {
    unset($killID);
}
$extKillID = edkURI::getArg('kll_ext_id');
if ($extKillID !== false) {
    $kill = new Kill($extKillID, true);
    $killID = $killID->getID();
}
unset($extKillID);
if (isset($killID) && $killID != 0) {
    $comments = new Comments($killID);
    $comments = $comments->getXml();
    if ($comments !== false) {
        sxe_append($sxe, $comments->{$comments->getName()});
    }
}
if (edkURI::getArg('html')) {
    foreach ($sxe->comments->comment as $comment) {
        //move to xajax_functions?
        $html .= 'Time: ' . $comment->time . '<br />';
        $html .= 'Name: ' . $comment->name . '<br />';
        $html .= 'Text: ' . $comment->text . '<br />';
    }
    echo $html;
} else {
    header("Content-Type: text/xml");
    echo $sxe->asXML();
}
Esempio n. 25
0
				<a href="' . $playerKillsLink . '"><img src="?a=map&region_id=' . $regionID . '&size=300&mode=ship" border="0" /></a></td>
		  </tr>
		  <tr>
				<td>&nbsp;</td>
		  </tr>
		  <tr>
			<td align="center" class="kb-table">NPC ship kills of the last hour<br />
				<a href="' . $npcKillsLink . '"><img src="?a=map&region_id=' . $regionID . '&size=300&mode=faction" width="300" height="300" border="0" /></a></td>
		  </tr>
		  <tr>
			<td>&nbsp;</td>
		  </tr>';
    if (isset($_GET['sys'])) {
        $html .= '	  <tr>
			<td align="center" class="kb-table">System location<br />
				<img src="?a=map&mode=sys&sys_id=' . (int) edkURI::getArg('sys') . '&size" width="300" height="300" border="0" /><br /><a href="' . edkURI::build(array('region_id', $regionID, true)) . '">Clear Filter</a></td>
		  </tr>
		  <tr>
			<td>&nbsp;</td>
		  </tr>';
    }
    $html .= '</table></td>
		<td align="center" valign="top">
			<table width="98%" border="0" cellspacing="1" cellpadding="1">
			 <tr>
			<th colspan="2">Details</th>
			</tr>
		  <tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		  </tr>
Esempio n. 26
0
 /**
  * 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;
     }
 }
Esempio n. 27
0
                $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>";
Esempio n. 28
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page('Corporation details');
     $this->scl_id = (int) edkURI::getArg('scl_id');
     $this->crp_id = (int) edkURI::getArg('crp_id');
     if (!$this->crp_id) {
         $this->crp_external_id = (int) edkURI::getArg('crp_ext_id');
         if (!$this->crp_external_id) {
             $id = (int) edkURI::getArg('id', 1);
             // True for NPC corps too, but NPC alliances recorded as corps
             // fail here. Use Jedi mind tricks?
             if ($id > 1000000) {
                 $this->crp_external_id = $id;
             } else {
                 $this->crp_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->crp_id) {
         if ($this->crp_external_id) {
             $this->corp = new Corporation($this->crp_external_id, true);
             $this->crp_id = $this->corp->getID();
         } else {
             $html = 'That corporation does not exist.';
             $this->page->setContent($html);
             $this->page->generate();
             exit;
         }
     } else {
         $this->corp = Cacheable::factory('Corporation', $this->crp_id);
         $this->crp_external_id = $this->corp->getExternalID();
     }
     if ($this->crp_external_id) {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_ext_id', $this->crp_external_id, true)) . "' />");
     } else {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_id', $this->crp_id, true)) . "' />");
     }
     $this->alliance = $this->corp->getAlliance();
     if ($this->view) {
         $this->year = (int) edkURI::getArg('y', 3);
         $this->month = (int) edkURI::getArg('m', 4);
     } else {
         $this->year = (int) edkURI::getArg('y', 2);
         $this->month = (int) edkURI::getArg('m', 3);
     }
     if (!$this->month) {
         $this->month = kbdate('m');
     }
     if (!$this->year) {
         $this->year = kbdate('Y');
     }
     if ($this->month == 12) {
         $this->nmonth = 1;
         $this->nyear = $this->year + 1;
     } else {
         $this->nmonth = $this->month + 1;
         $this->nyear = $this->year;
     }
     if ($this->month == 1) {
         $this->pmonth = 12;
         $this->pyear = $this->year - 1;
     } else {
         $this->pmonth = $this->month - 1;
         $this->pyear = $this->year;
     }
     $this->monthname = kbdate("F", strtotime("2000-" . $this->month . "-2"));
 }