예제 #1
0
 function details()
 {
     global $smarty;
     $item = new dogma($this->typeID);
     if (!$item->isValid()) {
         $this->page->setTitle('Error');
         return 'This ID is not a valid dogma ID.';
     }
     $this->page->setTitle('Item details - ' . $item->get('typeName'));
     $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
     $smarty->assignByRef('item', $item);
     if ($item->get('itt_cat') == 6) {
         //we have a ship, so get it from the db
         $ship = Ship::getByID($item->get('typeID'));
         $smarty->assign('shipImage', $ship->getImage(64));
         $smarty->assign('armour', array('armorHP', 'armorEmDamageResonance', 'armorExplosiveDamageResonance', 'armorKineticDamageResonance', 'armorThermalDamageResonance'));
         $smarty->assign('shield', array('shieldCapacity', 'shieldRechargeRate', 'shieldEmDamageResonance', 'shieldExplosiveDamageResonance', 'shieldKineticDamageResonance', 'shieldThermalDamageResonance'));
         $smarty->assign('propulsion', array('maxVelocity', 'agility', 'droneCapacity', 'capacitorCapacity', 'rechargeRate'));
         $smarty->assign('fitting', array('hiSlots', 'medSlots', 'lowSlots', 'rigSlots', 'upgradeCapacity', 'droneBandwidth', 'launcherSlotsLeft', 'turretSlotsLeft', 'powerOutput', 'cpuOutput'));
         $smarty->assign('targetting', array('maxTargetRange', 'scanResolution', 'maxLockedTargets', 'scanRadarStrength', 'scanLadarStrength', 'scanMagnetometricStrength', 'scanGravimetricStrength', 'signatureRadius'));
         $smarty->assign('miscellaneous', array('techLevel', 'propulsionFusionStrength', 'propulsionIonStrength', 'propulsionMagpulseStrength', 'propulsionPlasmaStrength'));
         $html = $smarty->fetch(get_tpl('invtype_ship'));
     } else {
         $i = new Item($this->typeID);
         $smarty->assign('itemImage', $i->getIcon(64, false));
         $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
         $html = $smarty->fetch(get_tpl('invtype_item'));
     }
     return $html;
 }
예제 #2
0
 /**
  * Retrieve formatted html comments for a kill.
  *
  * The kill id is set when the Comments object is constructed.
  *
  * @global Smarty $smarty
  * @param boolean $commentsOnly
  * @return string
  */
 function getHtml($commentsOnly = false)
 {
     global $smarty;
     if (empty($this->comments_)) {
         $this->getComments();
     }
     $smarty->assignByRef('comments', $this->comments_);
     $smarty->assign('norep', time() % 3700);
     $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
     if ($commentsOnly) {
         return $smarty->fetch(get_tpl('comments_comments'));
     } else {
         return $smarty->fetch(get_tpl('block_comments'));
     }
 }
예제 #3
0
 public function generateMenu()
 {
     $this->execQuery();
     $menu = new Menu();
     while ($row = $this->getRow()) {
         $url = $row['url'];
         if ($row['intern'] == 1 && session::isAdmin()) {
             if (strpos($url, "?") === false) {
                 $url .= "?";
             } else {
                 $url .= "&";
             }
             $url .= "akey=" . session::makeKey();
         }
         // Note that changing the standard naming will also remove any translations.
         $menu->add($url, Language::get($row['descr']));
     }
     return $menu;
 }
예제 #4
0
파일: login.php 프로젝트: biow0lf/evedev-kb
 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'));
 }
예제 #5
0
            if ($typ == 'p') {
                $pilot = new Pilot($id);
                $text = $pilot->getName();
                $link = KB_HOST . '/?a=admin_postperm&amp;del=' . $typ . $id . '&amp;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&amp;del=' . $typ . $id . '&amp;akey=' . session::makeKey();
                $permt[$typ][] = array('text' => $text, 'link' => $link);
            }
        }
    }
    $perm = array();
    if ($permt['a']) {
        $perm[] = array('name' => 'Alliances', 'list' => $permt['a']);
    }
    if ($permt['p']) {
        $perm[] = array('name' => 'Pilots', 'list' => $permt['p']);
    }
    if ($permt['c']) {
        $perm[] = array('name' => 'Corporations', 'list' => $permt['c']);
    }
    $smarty->assignByRef('permissions', $perm);
}
$smarty->assign('akey', session::makeKey());
$html = $smarty->fetch(get_tpl('admin_postperm'));
$page->addContext($menubox->generate());
$page->setContent($html);
$page->generate();
$html .= "</tr><tr>";
$html .= "<td><input id=searchphrase name=searchphrase type=text size=30/></td>";
$html .= "<td><input type=submit name=submit value=Search></td>";
$html .= "</tr></table>";
$html .= "</form>";
if ($_POST['searchphrase'] != "" && strlen($_POST['searchphrase']) >= 3) {
    $sql = "select plt.plt_id, plt.plt_name, crp.crp_name\r\n                  from kb3_pilots plt, kb3_corps crp\r\n                 where lower( plt.plt_name ) like lower( '%" . slashfix($_POST['searchphrase']) . "%' )\r\n                   and plt.plt_crp_id = crp.crp_id\r\n                 order by plt.plt_name";
    $header = "<td>Pilot</td><td>Corporation</td>";
    $qry = DBFactory::getDBQuery();
    if (!$qry->execute($sql)) {
        die($qry->getErrorMsg());
    }
    $html .= "<div class=block-header>Search results</div>";
    if ($qry->recordCount() > 0) {
        $html .= "<table class=kb-table width=450 cellspacing=1>";
        $html .= "<tr class=kb-table-header>" . $header . "</tr>";
    } else {
        $html .= "No results.";
    }
    while ($row = $qry->getRow()) {
        $html .= "<tr class=kb-table-row-even>";
        $html .= '<td><a href="?a=admin_kill_export_csv&amp;plt_id=' . $row['plt_id'] . '&amp;akey=' . session::makeKey() . '">' . $row['plt_name'] . '</a></td><td>' . $row['crp_name'] . '</td>';
        $html .= "</tr>";
    }
    if ($qry->recordCount() > 0) {
        $html .= "</table>";
    }
}
$page->setContent($html);
$page->addContext($menubox->generate());
$page->generate();
예제 #7
0
                    break;
                }
                if ($num >= $_SESSION['kill_import']['num']) {
                    $html .= "{$i}/" . $_SESSION['kill_import']['count'] . " - {$num} files read, {$p} new, {$posted} old, {$inv} invalid<br>\n";
                    $_SESSION['kill_import']['numcount'] = $i;
                    break;
                }
            }
        }
    } else {
        $html .= 'Killmail folder does not exist. Press reset to check settings.<br/>';
    }
    if ($_SESSION['kill_import']['count'] - $_SESSION['kill_import']['numcount'] > 0) {
        $html .= '<meta http-equiv="refresh" content="5; URL=' . edkURI::page("admin_kill_import") . '" />';
        $html .= 'Automatic refresh in 5s<br/>';
        $html .= '<a href="' . edkURI::page("admin_kill_import") . '">Read next ' . $_SESSION['kill_import']['num'] . '</a>&nbsp;<a href="' . KB_HOST . '/?a=admin_kill_import&amp;submit=Reset&amp;akey=' . session::makeKey() . '">Reset</a>';
        $_SESSION['kill_import']['read'] += $read;
        $_SESSION['kill_import']['p_all'] += $p_all;
        $_SESSION['kill_import']['posted_all'] += $posted_all;
        $_SESSION['kill_import']['invalid'] += $invalid;
    } else {
        $html .= 'Import complete, ' . $_SESSION['kill_import']['read'] . ' files read, ' . $_SESSION['kill_import']['p_all'] . ' kills added, ' . $_SESSION['kill_import']['posted_all'] . ' already posted, ' . $_SESSION['kill_import']['invalid'] . ' malformed<br>';
        $html .= '<hr/>The following files contained malformed mails:<br/>';
        foreach ($_SESSION['kill_import']['malformed'] as $mal_file) {
            $html .= $mal_file . '<br/>';
        }
        $html .= '<a href="' . edkURI::page("admin_kill_import") . '">Ok</a>';
        unset($_SESSION['kill_import']);
    }
}
$page->addContext($menubox->generate());
예제 #8
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;
 }
예제 #9
0
파일: index.php 프로젝트: biow0lf/evedev-kb
header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: Mon, 26 Jul 1997 05:00:00 GMT");
$smarty = new Smarty();
$smarty->compile_dir = getcwd() . "/" . KB_CACHEDIR . '/templates_c';
$smarty->cache_dir = getcwd() . "/" . KB_CACHEDIR . '/data';
$smarty->template_dir = getcwd() . '/update/';
$smarty->assign('url', $url);
if (!session::isAdmin()) {
    if (isset($_POST['usrpass']) && (crypt($_POST['usrpass'], ADMIN_PASSWORD) == ADMIN_PASSWORD || $_POST['usrpass'] == ADMIN_PASSWORD)) {
        session::create(true);
        $_SESSION['admin_key'] = session::makeKey();
        if (strpos($url, '?') === false) {
            header('Location: ' . $url . '?akey=' . session::makeKey());
        } else {
            header('Location: ' . $url . '&akey=' . session::makeKey());
        }
        die;
    } else {
        $smarty->assign('content', $smarty->fetch('update_login.tpl'));
        $smarty->display('update.tpl');
        die;
    }
}
if (phpversion() < "5.1.2") {
    $smarty->assign('content', "PHP version 5.1.2 or higher is required. You have version " . phpversion());
    $smarty->display('update.tpl');
    die;
}
if (isset($_GET['do']) && $_GET['do'] == 'force') {
    $url = preg_replace('/(\\?|&)do=force/', '', $url);
예제 #10
0
 /**
  * Create a board URI from the given arguments.
  *
  * This takes an ordered array of parameter arrays. Each parameter array
  * contains name, value (or true if no value), true/false depending on
  * whether it was in the pathinfo or querystring. If a page is not specified
  * then the current page will be assumed.
  *
  * e.g.
  * 0=>(a, kill_detail, true), 1=>(id, 45, true), 2=>(unlimited,true, true)
  *
  * If path URIs are enabled this returns:
  * kburl/index/kill_detail/45/unlimited/
  *
  * If path URIs are disabled this returns:
  * kburl/?a=kill_detail&id=45&unlimited
  *
  * Passing in no arguments would return:
  * kburl/index/home/
  * or kburl/?a=home
  *
  * @param array $parameters
  * @return string valid URI to an EDK page.
  */
 private static function make($parameters)
 {
     if (is_null(self::$kb_host)) {
         if (defined('KB_HOST')) {
             self::$kb_host = KB_HOST . "/";
             if (self::$pathinfo) {
                 self::$kb_host .= "index.php/";
             }
         } else {
             if (class_exists('Config', true)) {
                 self::$kb_host = Config::get('cfg_kbhost') . "/";
                 if (self::$pathinfo) {
                     self::$kb_host .= "index.php/";
                 }
             } else {
                 self::$kb_host = $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
                 if (self::$pathinfo) {
                     self::$kb_host .= "/";
                 }
             }
         }
     }
     // Let's be nice and accept a single argument to not be nested.
     if (!is_array($parameters[0])) {
         $parameters = array($parameters);
     }
     if (session::isAdmin()) {
         $parameters[] = array("akey", session::makeKey(), false);
     }
     $url = self::$kb_host;
     $patharr = array();
     $qryarr = array();
     foreach ($parameters as $param) {
         if ($param[2] && self::$pathinfo) {
             if ($param[1] === true) {
                 $patharr[] = $param[0];
             } else {
                 $patharr[] = $param[1];
             }
         } else {
             if ($param[1] === true) {
                 $qryarr[] = $param[0];
             } else {
                 $qryarr[] = $param[0] . '=' . $param[1];
             }
         }
     }
     if (self::$pathinfo) {
         // If no page is specified then use the current page
         if (!$parameters || $parameters[0][0] != 'a') {
             $url .= self::getArg('a', 0) . '/';
         }
         if ($patharr) {
             $url .= join('/', $patharr) . '/';
         }
         if ($qryarr) {
             $url .= '?';
         }
     } else {
         // If no page is specified then use the current page
         if (!$qryarr) {
             $url .= '?a=' . self::getArg('a', 0);
         } else {
             if ($parameters[0][0] != 'a') {
                 $url .= '?a=' . self::getArg('a', 0) . "&";
             } else {
                 $url .= '?';
             }
         }
     }
     $url .= join('&amp;', $qryarr);
     return $url;
 }
예제 #11
0
 /**
  *  Show the overall statistics for this alliance.
  */
 function stats()
 {
     $this->summary->generate();
     if ($this->pilot->getExternalID()) {
         $apiInfo = new API_CharacterInfo();
         $apiInfo->setID($this->pilot->getExternalID());
         $result .= $apiInfo->fetchXML();
         // Update the name if it has changed.
         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->pilot = Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']);
         }
     }
     global $smarty;
     $smarty->assign('portrait_URL', $this->pilot->getPortraitURL(128));
     $smarty->assign('corp_id', $this->corp->getID());
     $smarty->assign('corp_name', $this->corp->getName());
     $smarty->assign('all_name', $this->alliance->getName());
     $smarty->assign('all_id', $this->alliance->getID());
     $smarty->assign('klist_count', $this->summary->getTotalKills());
     $smarty->assign('klist_real_count', $this->summary->getTotalRealKills());
     //$this->klist->getRealCount());
     $smarty->assign('llist_count', $this->summary->getTotalLosses());
     $smarty->assign('klist_isk_B', round($this->summary->getTotalKillISK() / 1000000000, 2));
     $smarty->assign('llist_isk_B', round($this->summary->getTotalLossISK() / 1000000000, 2));
     //Pilot Efficiency Mod Begin (K Austin)
     if ($this->summary->getTotalKills() == 0) {
         $pilot_survival = 100;
         $pilot_efficiency = 0;
     } else {
         if ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) {
             $pilot_survival = round($this->summary->getTotalLosses() / ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) * 100, 2);
         } else {
             $pilot_survival = 0;
         }
         if ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) {
             $pilot_efficiency = round($this->summary->getTotalKillISK() / ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) * 100, 2);
         } else {
             $pilot_efficiency = 0;
         }
     }
     $smarty->assign('pilot_survival', $pilot_survival);
     $smarty->assign('pilot_efficiency', $pilot_efficiency);
     $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
     $this->lpoints = $this->summary->getTotalLossPoints();
     $this->points = $this->summary->getTotalKillPoints();
     return $smarty->fetch(get_tpl('pilot_detail_stats'));
 }
예제 #12
0
if ($_REQUEST['crp']) {
    $corp = new Corporation(intval($_GET['crp']));
    $html .= "<form id=change method=post action=><table class=kb-subtable>";
    $html .= "<tr><td><input name=crp_id type=hidden value=" . htmlentities($_GET['crp']) . ">";
    $html .= "<input name=plt_id type=hidden value=" . htmlentities($_GET['plt_id']) . ">";
    $html .= "Confirm move<b> " . $pilot->getName() . "</b> to <b>" . $corp->getName() . "</b></td></tr>";
    $html .= "<tr><td><input type=submit name=confirm value=\"Move\"></td></tr>";
    $html .= "</table>";
}
if ($_POST['search']) {
    $qry = DBFactory::getDBQuery();
    $sql = "SELECT * FROM `kb3_corps` WHERE crp_name LIKE '%" . $qry->escape($_POST['search']) . "%'";
    $qry->execute($sql);
    //$html .= $sql ;
    $html .= "<div class=block-header2>Results</div>";
    $html .= "<table class=kb-subtable>";
    while ($row = $qry->getRow()) {
        $html .= '<tr><td><a href="?a=admin_move_pilot&plt_id=' . intval($_GET['plt_id']) . '&crp=' . intval($row['crp_id']) . '&akey=' . session::makeKey() . '">';
        $html .= $row['crp_name'] . "<br/>";
        $html .= "</td><tr>";
    }
    $html .= "</table>";
}
$html .= "<div class=block-header2>Search</div>";
$html .= "<form id=options name=options method=post action=>";
$html .= "<table class=kb-subtable>";
$html .= "<tr><td>Seach for corp</td><td><input name=search id=serach type=text size=10 /></td></tr>";
$html .= "<tr><td><input type=submit name=find value=\"Find\"></td><td></td></tr>";
$html .= "</table>";
$page->setContent($html);
$page->generate();