Пример #1
0
 /**
  * Build a new summary table for a pilot.
  *
  * @param integer $plt_id
  * @return boolean Returns false on error.
  */
 private static function buildSummary($plt_id)
 {
     $plt_id = (int) $plt_id;
     if (!$plt_id) {
         return false;
     }
     $qry = DBFactory::getDBQuery();
     $qry->autocommit(false);
     $klist = new KillList();
     $klist->addInvolvedPilot($plt_id);
     $klist->getAllKills();
     $kpoints = $klist->getPoints();
     unset($klist);
     $llist = new KillList();
     $llist->addVictimPilot($plt_id);
     $llist->getAllKills();
     $lpoints = $llist->getPoints();
     unset($llist);
     $qry->execute("UPDATE kb3_pilots SET plt_kpoints = {$kpoints},\n\t\t\t plt_lpoints = {$lpoints} WHERE plt_id = {$plt_id}");
     $qry->autocommit(true);
     return;
 }
Пример #2
0
 /**
  *
  * @param KillList $killList
  * @return string KillList as XML
  */
 public static function killListToXML($killList)
 {
     global $idfeedversion;
     $qry = DBFactory::getDBQuery();
     $date = gmdate('Y-m-d H:i:s');
     $xml = "<?xml version='1.0' encoding='UTF-8'?>\n\t\t<eveapi version='2' edkapi='" . $idfeedversion . "'>\n\t\t</eveapi>";
     $sxe = new SimpleXMLElement($xml);
     // Let's start making the xml.
     $sxe->addChild('currentTime', $date);
     $result = $sxe->addChild('result');
     $kills = $result->addChild('rowset');
     $kills->addAttribute('name', 'kills');
     $kills->addAttribute('key', 'killID');
     $kills->addAttribute('columns', 'killID,solarSystemID,killTime,moonID,hash,trust');
     $count = 0;
     $timing = '';
     while ($kill = $killList->getKill()) {
         if (config::get('km_cache_enabled') && CacheHandler::exists($kill->getID() . ".xml", 'mails')) {
             $cachedRow = new SimpleXMLElement(CacheHandler::get($kill->getID() . ".xml", 'mails'));
             IDFeed::addXMLElement($kills, $cachedRow);
             continue;
         }
         $count++;
         if ($kill->isClassified()) {
             continue;
         }
         //$kill = Kill::getByID($kill->getID());
         $row = $kills->addChild('row');
         $row->addAttribute('killID', intval($kill->getExternalID()));
         $row->addAttribute('killInternalID', intval($kill->getID()));
         $row->addAttribute('solarSystemID', $kill->getSystem()->getExternalID());
         $row->addAttribute('killTime', $kill->getTimeStamp());
         $row->addAttribute('moonID', '0');
         $row->addAttribute('hash', bin2hex(IDFeed::getHash($kill, true)));
         $row->addAttribute('trust', 3);
         $victim = Pilot::getByID($kill->getVictimID());
         $victimCorp = Corporation::getByID($kill->getVictimCorpID());
         $victimAlliance = Alliance::getByID($kill->getVictimAllianceID());
         $victimrow = $row->addChild('victim');
         if ($victim->getName() == $kill->getVictimShipName()) {
             $victimrow->addAttribute('characterID', "0");
             $victimrow->addAttribute('characterName', "");
         } else {
             $victimrow->addAttribute('characterID', $victim->getExternalID());
             $victimrow->addAttribute('characterName', $victim->getName());
         }
         $victimrow->addAttribute('corporationID', $victimCorp->getExternalID());
         $victimrow->addAttribute('corporationName', $victimCorp->getName());
         if ($victimAlliance->isFaction()) {
             $victimrow->addAttribute('allianceID', 0);
             $victimrow->addAttribute('allianceName', '');
             $victimrow->addAttribute('factionID', $victimAlliance->getFactionID());
             $victimrow->addAttribute('factionName', $victimAlliance->getName());
         } else {
             $victimrow->addAttribute('allianceID', $victimAlliance->getExternalID());
             $victimrow->addAttribute('allianceName', $victimAlliance->getName());
             $victimrow->addAttribute('factionID', 0);
             $victimrow->addAttribute('factionName', '');
         }
         $victimrow->addAttribute('damageTaken', $kill->getDamageTaken());
         $victimrow->addAttribute('shipTypeID', $kill->getVictimShipExternalID());
         $involved = $row->addChild('rowset');
         $involved->addAttribute('name', 'attackers');
         $involved->addAttribute('columns', 'characterID,characterName,corporationID,corporationName,allianceID,allianceName,factionID,factionName,securityStatus,damageDone,finalBlow,weaponTypeID,shipTypeID');
         $sql = "SELECT ind_sec_status, ind_all_id, ind_crp_id,\n\t\t\t\tind_shp_id, ind_wep_id, ind_order, ind_dmgdone, plt_id, plt_name,\n\t\t\t\tplt_externalid, crp_name, crp_external_id,\n\t\t\t\twtype.typeName AS wep_name FROM kb3_inv_detail\n\t\t\t\tJOIN kb3_pilots ON (plt_id = ind_plt_id)\n\t\t\t\tJOIN kb3_corps ON (crp_id = ind_crp_id)\n\t\t\t\tJOIN kb3_invtypes wtype ON (ind_wep_id = wtype.typeID)\n\t\t\t\tWHERE ind_kll_id = " . $kill->getID() . " ORDER BY ind_order ASC";
         $qry->execute($sql);
         while ($inv = $qry->getRow()) {
             $invrow = $involved->addChild('row');
             if (strpos($inv['plt_name'], '- ') !== false) {
                 $inv['plt_name'] = substr($inv['plt_name'], strpos($inv['plt_name'], '- ') + 2);
             } else {
                 if (strpos($inv['plt_name'], '#') !== false) {
                     $name = explode("#", $inv['plt_name']);
                     $inv['plt_name'] = $name[3];
                 }
             }
             if ($inv['plt_name'] == $inv['wep_name']) {
                 $invrow->addAttribute('characterID', 0);
                 $invrow->addAttribute('characterName', "");
                 $invrow->addAttribute('weaponTypeID', 0);
                 $invrow->addAttribute('shipTypeID', $inv['ind_wep_id']);
             } else {
                 $invrow->addAttribute('characterID', $inv['plt_externalid']);
                 $invrow->addAttribute('characterName', $inv['plt_name']);
                 $invrow->addAttribute('weaponTypeID', $inv['ind_wep_id']);
                 $invrow->addAttribute('shipTypeID', $inv['ind_shp_id']);
             }
             $invrow->addAttribute('corporationID', $inv['crp_external_id']);
             $invrow->addAttribute('corporationName', $inv['crp_name']);
             $invAlliance = Alliance::getByID($inv['ind_all_id']);
             if ($invAlliance->isFaction()) {
                 $invrow->addAttribute('allianceID', 0);
                 $invrow->addAttribute('allianceName', '');
                 $invrow->addAttribute('factionID', $invAlliance->getFactionID());
                 $invrow->addAttribute('factionName', $invAlliance->getName());
             } else {
                 if (strcasecmp($invAlliance->getName(), "None") == 0) {
                     $invrow->addAttribute('allianceID', 0);
                     $invrow->addAttribute('allianceName', "");
                 } else {
                     $invrow->addAttribute('allianceID', $invAlliance->getExternalID());
                     $invrow->addAttribute('allianceName', $invAlliance->getName());
                 }
                 $invrow->addAttribute('factionID', 0);
                 $invrow->addAttribute('factionName', '');
             }
             $invrow->addAttribute('securityStatus', number_format($inv['ind_sec_status'], 1));
             $invrow->addAttribute('damageDone', $inv['ind_dmgdone']);
             if ($inv['plt_id'] == $kill->getFBPilotID()) {
                 $final = 1;
             } else {
                 $final = 0;
             }
             $invrow->addAttribute('finalBlow', $final);
         }
         $sql = "SELECT * FROM kb3_items_destroyed WHERE itd_kll_id = " . $kill->getID();
         $qry->execute($sql);
         $qry2 = DBFactory::getDBQuery();
         $sql = "SELECT * FROM kb3_items_dropped WHERE itd_kll_id = " . $kill->getID();
         $qry2->execute($sql);
         if ($qry->recordCount() || $qry2->recordCount()) {
             $items = $row->addChild('rowset');
             $items->addAttribute('name', 'items');
             $items->addAttribute('columns', 'typeID,flag,qtyDropped,qtyDestroyed, singleton');
             while ($iRow = $qry->getRow()) {
                 $itemRow = $items->addChild('row');
                 $itemRow->addAttribute('typeID', $iRow['itd_itm_id']);
                 $itemRow->addAttribute('flag', $iRow['itd_itl_id']);
                 if ($iRow['itd_itl_id'] == -1) {
                     $itemRow->addAttribute('singleton', 2);
                 } else {
                     $itemRow->addAttribute('singleton', 0);
                 }
                 $itemRow->addAttribute('qtyDropped', 0);
                 $itemRow->addAttribute('qtyDestroyed', $iRow['itd_quantity']);
             }
             while ($iRow = $qry2->getRow()) {
                 $itemRow = $items->addChild('row');
                 $itemRow->addAttribute('typeID', $iRow['itd_itm_id']);
                 $itemRow->addAttribute('flag', $iRow['itd_itl_id']);
                 if ($iRow['itd_itl_id'] == -1) {
                     $itemRow->addAttribute('singleton', 2);
                 } else {
                     $itemRow->addAttribute('singleton', 0);
                 }
                 $itemRow->addAttribute('qtyDropped', $iRow['itd_quantity']);
                 $itemRow->addAttribute('qtyDestroyed', 0);
             }
         }
         if (config::get('km_cache_enabled')) {
             CacheHandler::put($kill->getID() . ".xml", $row->asXML(), 'mails');
         }
         $timing .= $kill->getID() . ": " . (microtime(true) - $starttime) . "<br />";
     }
     $sxe->addChild('cachedUntil', $date);
     return $sxe->asXML();
 }
Пример #3
0
 public static function GenerateRow($pods = false, $header = true)
 {
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     $klist->setOrderBy("kll_isk_loss DESC");
     if ($pods == false) {
         $klist->setPodsNoobShips(false);
     } else {
         $klist->addVictimShipClass(2);
     }
     $klist->setLimit(self::NUM_DISPLAYED);
     if (isset($_GET["w"])) {
         self::$week = intval($_GET["w"]);
     }
     if (isset($_GET["m"])) {
         self::$month = intval($_GET["m"]);
     }
     if (isset($_GET["y"])) {
         self::$year = intval($_GET["y"]);
     }
     self::setTime(self::$week, self::$year, self::$month);
     $view = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['view']);
     if (config::get('show_monthly')) {
         $start = makeStartDate(0, self::$year, self::$month);
         $end = makeEndDate(0, self::$year, self::$month);
         $klist->setStartDate(gmdate('Y-m-d H:i', $start));
         $klist->setEndDate(gmdate('Y-m-d H:i', $end));
         $smarty->assign("displaylist", date('F', mktime(0, 0, 0, self::$month, 1, self::$year)) . ", " . self::$year);
     } else {
         $klist->setWeek(self::$week);
         $klist->setYear(self::$year);
         $plist->setWeek(self::$week);
         $plist->setYear(self::$year);
         $smarty->assign("displaylist", "Week " . self::$week . ", " . self::$year);
     }
     if (config::get("exp_incloss")) {
         $smarty->assign("displaytype", "Kills and Losses");
         involved::load($klist, "combined");
     } else {
         $smarty->assign("displaytype", "Kills");
         involved::load($klist, "kill");
     }
     $kills = array();
     while ($kill = $klist->getKill()) {
         $kll = array();
         $plt = new Pilot($kill->getVictimID());
         if ($kill->isClassified() && !Session::isAdmin()) {
             $kll['systemsecurity'] = "-";
             $kll['system'] = Language::get("classified");
         } else {
             $kll['systemsecurity'] = $kill->getSolarSystemSecurity();
             $kll['system'] = $kill->getSolarSystemName();
         }
         $kll["id"] = $kill->getID();
         $kll["victim"] = $kill->getVictimName();
         $kll["victimid"] = $kill->getVictimID();
         $kll["victimship"] = $kill->getVictimShipName();
         $kll["victimshipid"] = $kill->getVictimShipExternalID();
         $kll["victimshipclass"] = $kill->getVictimShipClassName();
         $kll["victimcorp"] = $kill->getVictimCorpName();
         $kll["victimcorpid"] = $kill->getVictimCorpID();
         $alliance = Alliance::getByID($kill->getVictimAllianceID());
         if ($pods == false) {
             $kll["victimimageurl"] = $kill->getVictimShipImage(128);
         } else {
             $kll["victimimageurl"] = $plt->getPortraitURL(128);
         }
         $kll["victimallimage"] = $alliance->getPortraitURL(32);
         $kll["victimallname"] = $alliance->getName();
         if ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000000) {
             $kll["isklost"] = number_format($kill->getISKLoss() / 1000000000, 2, ".", "") . " Billion";
         } elseif ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000) {
             $kll["isklost"] = number_format($kill->getISKLoss() / 1000000, 2, ".", "") . " Million";
         } else {
             $kll["isklost"] = number_format($kill->getISKLoss(), 0, ".", ",");
         }
         if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color="#AA0000">&bull;</font>';
         } elseif (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color=\\"#AA0000\\">&bull;</font>';
         } elseif (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color="#AA0000">&bull;</font>';
         } else {
             $kll["class"] = "kl-kill";
             $kll["classlink"] = '<font color="#00AA00">&bull;</font>';
         }
         $kills[] = $kll;
     }
     if ($header == true) {
         $smarty->assign("header", true);
     } else {
         $smarty->assign("header", false);
     }
     $smarty->assign("killlist", $kills);
     $smarty->assign("width", 100 / self::NUM_DISPLAYED);
     return $smarty->fetch(get_tpl('most_expensive_summary'));
 }
Пример #4
0
/**
 * Author: Doctor Z
 * eMail:  east4now11@hotmail.com
 * @package EDK
 */
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);
}
Пример #5
0
        $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_export'));
}
if (isset($_SESSION['admin_kill_export']['do'])) {
    if ($string = $_SESSION['admin_kill_export']['to_export']) {
        $klist = new KillList();
        $llist = new KillList();
        $tmp = explode(',', $string);
        foreach ($tmp as $item) {
            if (!$item) {
                continue;
            }
            $typ = substr($item, 0, 1);
            $id = substr($item, 1);
            if ($typ == 'a') {
                $klist->addInvolvedAlliance(new Alliance($id));
                $llist->addVictimAlliance(new Alliance($id));
            } elseif ($typ == 'c') {
                $klist->addInvolvedCorp(new Corporation($id));
                $llist->addVictimCorp(new Corporation($id));
            } elseif ($typ == 'p') {
                $klist->addInvolvedPilot(new Pilot($id));
Пример #6
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 '';
 }
Пример #7
0
 * corpname =  corp name to retrieve kills for
 * alliancename = alliance name to retrieve kills for
 * system = restrict kills to a specific system
 * region = restrict kills to a specific region
 * kll_id = show one kill only.
 * kll_ext_id = show one kill only.
 * limit = maximum number of kills to return.
 *
 * @package EDK
 */
$starttime = microtime(true);
global $idfeedversion;
$maxkillsreturned = 200;
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n<eveapi version='2' edkapi='{$idfeedversion}'>\n</eveapi>";
$sxe = new SimpleXMLElement($xml);
$list = new KillList();
if (isset($_GET['kll_id'])) {
    $_GET['lastintID'] = $_GET['kll_id'];
    $_GET['allkills'] = 1;
    $_GET['range'] = 0;
}
if (isset($_GET['kll_ext_id'])) {
    $_GET['lastID'] = $_GET['kll_ext_id'];
    $_GET['allkills'] = 0;
    $_GET['range'] = 0;
}
$list->setOrdered(true);
if (isset($_GET['allkills']) && $_GET['allkills'] == 0) {
    $list->setAPIKill();
    $list->setOrderBy(' kll.kll_external_id ASC ');
} else {
 private function killList($date)
 {
     $result = array();
     $klist = new KillList();
     $klist->setStartDate($date . ' 00:00');
     $klist->setEndDate($date . '23:59');
     $klist->setPodsNoobShips(Config::get('podnoobs'));
     involved::load($klist, 'kill');
     $llist = new KillList();
     $llist->setStartDate($date . ' 00:00');
     $llist->setEndDate($date . '23:59');
     $llist->setPodsNoobShips(Config::get('podnoobs'));
     involved::load($llist, 'loss');
     while ($kill = $klist->getKill()) {
         if ($kill) {
             $result[$kill->getFBPilotName()]['kills']++;
         }
     }
     while ($loss = $llist->getKill()) {
         if ($loss) {
             $result[$loss->getVictimName()]['losses']++;
         }
     }
     return $result;
 }
Пример #9
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;
 }
Пример #10
0
 /**
  * Return the main killlists
  * @global Smarty $smarty
  * @return string HTML string for killlist tables
  */
 function killList()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     // We'll be needing comment counts so set the killlist to retrieve them
     if (config::get('comments_count')) {
         $klist->setCountComments(true);
     }
     // We'll be needing involved counts so set the killlist to retrieve them
     if (config::get('killlist_involved')) {
         $klist->setCountInvolved(true);
     }
     // Select between kills, losses or both.
     if ($this->view == 'combined' || $this->view == '' && $this->showcombined) {
         involved::load($klist, 'combined');
     } else {
         if ($this->view == 'losses') {
             involved::load($klist, 'loss');
         } else {
             involved::load($klist, 'kill');
         }
     }
     if ($this->scl_id) {
         $klist->addVictimShipClass($this->scl_id);
     } else {
         $klist->setPodsNoobShips(config::get('podnoobs'));
     }
     // If no week is set then show the most recent kills. Otherwise
     // show all kills for the week using the page splitter.
     if (config::get("cfg_fillhome") && !$this->dateSet) {
         $klist->setLimit(config::get('killcount'));
         $table = new KillListTable($klist);
         if ($this->showcombined) {
             $table->setCombined(true);
         }
         $table->setLimit(config::get('killcount'));
         $html = $table->generate();
     } else {
         $this->loadTime($klist);
         //$klist->setWeek($this->week);
         //$klist->setYear($this->year);
         $klist->setPageSplit(config::get('killcount'));
         //$pagesplitter = new PageSplitter($klist->getCount(), config::get('killcount'));
         $table = new KillListTable($klist);
         if ($this->showcombined) {
             $table->setCombined(true);
         }
         //$pagesplit = $pagesplitter->generate();
         //$html = $pagesplit.$table->generate().$pagesplit;
         $html = $table->generate();
     }
     return $html;
 }
Пример #11
0
        foreach ($ts[$h] as $timestamp) {
            $times[] = $timestamp;
        }
    }
    unset($ts);
    asort($times);
    // we got 2 resulting timestamps
    $firstts = array_shift($times);
    $lastts = array_pop($times);
    $kslist = new KillList();
    $kslist->setOrdered(true);
    $kslist->addSystem($system);
    $kslist->setStartDate($firstts);
    $kslist->setEndDate($lastts);
    involved::load($kslist, 'kill');
    $lslist = new KillList();
    $lslist->setOrdered(true);
    $lslist->addSystem($system);
    $lslist->setStartDate($firstts);
    $lslist->setEndDate($lastts);
    involved::load($lslist, 'loss');
    $killsummary = new KillSummaryTable($kslist, $lslist);
    $killsummary->setBreak(6);
    $name = $system->getName() . " " . substr($firstts, 0, 16) . " " . substr($lastts, -8, 5);
}
?>
<form>
<table class="popup-table" height="100%" width="355px">
<tr>
	<td align="center"><strong>Forum Post</strong></td>
</tr>
 public function __construct()
 {
     //get latest kill
     $kill_list = new KillList();
     $kill_list->setOrdered(true);
     $kill_list->setOrderBy('kll_timestamp DESC');
     $kill_list->setLimit(1);
     $kill_list->setPodsNoobShips(Config::get('podnoobs'));
     involved::load($kill_list);
     $this->kill = $kill_list->getKill();
     //are we replacing the kb banner?
     $bannerreplace = Config::get('mod_bannerpic_bannerreplace');
     if ($bannerreplace == 1) {
         Config::set('style_banner', 'bannerpic.jpg');
     }
     //if this is already cached we don't need to go any further..
     if (Config::get('mod_bannerpic_nocache') == 1) {
         $this->nocache = true;
     }
     $this->cache = KB_CACHEDIR . '/data/bannerpic' . $this->kill->getID() . '.jpg';
     $basepic = Config::get('mod_bannerpic_basepic');
     if (file_exists($basepic)) {
         $this->basepic = $basepic;
     }
     if (file_exists($this->cache) && !$this->nocache) {
         $this->img = imagecreatefromjpeg($this->cache);
         if ($bannerreplace == 1) {
             imagejpeg($this->img, 'banner/bannerpic.jpg', 100);
         }
         return;
     }
     //no kills?
     if ($this->kill === null) {
         $killstr = "No kills yet - how sad!";
         imagefttext($this->img, $this->lfont, 0, 20, 30, $red, $this->font, $killstr);
         imagejpeg($this->img);
         imagedestroy($this->img);
         return;
     }
     //killer
     $killername = $this->kill->getFBPilotName();
     //get victim info
     $victimid = $this->kill->getVictimExternalID();
     $victimname = $this->kill->getVictimName();
     $victimcorp = $this->kill->getVictimCorpName();
     $victimalli = $this->kill->getVictimAllianceName();
     //get the 64 x 64 victim portrait;
     $victimgfile = KB_HOST . '/?a=thumb&id=' . $victimid . '&size=64';
     $victimimg = imagecreatefromjpeg($victimgfile);
     $victimshipname = $this->kill->getVictimShipName();
     $url = KB_HOST . '/?a=thumb&id=' . $this->kill->getVictimShipExternalID() . '&size=64';
     $victimshipimg = imagecreatefromjpeg($url);
     //set variables for positions
     //Config::get('mod_bannerpic_basepic') == null ? Config::set('mod_bannerpic_basepic', $this->basepic) : $this->basepic = Config::get('mod_bannerpic_basepic');
     //victim picture
     $vicpicLeft = 1;
     Config::get('mod_bannerpic_vicpicleft') == null ? Config::set('mod_bannerpic_vicpicleft', $vicpicLeft) : ($vicpicLeft = Config::get('mod_bannerpic_vicpicleft'));
     $vicpicTop = 1;
     Config::get('mod_bannerpic_vicpictop') == null ? Config::set('mod_bannerpic_vicpictop', $vicpicTop) : ($vicpicTop = Config::get('mod_bannerpic_vicpictop'));
     $vicpicTrans = 100;
     Config::get('mod_bannerpic_vicpictrans') == null ? Config::set('mod_bannerpic_vicpictrans', $vicpicTrans) : ($vicpicTrans = Config::get('mod_bannerpic_vicpictrans'));
     //ship picture
     $shippicLeft = 70;
     Config::get('mod_bannerpic_shippicleft') == null ? Config::set('mod_bannerpic_shippicleft', $shippicLeft) : ($shippicLeft = Config::get('mod_bannerpic_shippicleft'));
     $shippicTop = 1;
     Config::get('mod_bannerpic_shippictop') == null ? Config::set('mod_bannerpic_shippictop', $shippicTop) : ($shippicTop = Config::get('mod_bannerpic_shippictop'));
     $shippicTrans = 100;
     Config::get('mod_bannerpic_shippictrans') == null ? Config::set('mod_bannerpic_shippictrans', $shippicTrans) : ($shippicTrans = Config::get('mod_bannerpic_shippictrans'));
     //killer
     $killstrLeft = 145;
     Config::get('mod_bannerpic_killstrleft') == null ? Config::set('mod_bannerpic_killstrleft', $killstrLeft) : ($killstrLeft = Config::get('mod_bannerpic_killstrleft'));
     $killstrTop = 15;
     Config::get('mod_bannerpic_killstrtop') == null ? Config::set('mod_bannerpic_killstrtop', $killstrTop) : ($killstrTop = Config::get('mod_bannerpic_killstrtop'));
     //victim corp
     $corpstrLeft = 145;
     Config::get('mod_bannerpic_corpstrleft') == null ? Config::set('mod_bannerpic_corpstrleft', $corpstrLeft) : ($corpstrLeft = Config::get('mod_bannerpic_corpstrleft'));
     $corpstrTop = 30;
     Config::get('mod_bannerpic_corpstrtop') == null ? Config::set('mod_bannerpic_corpstrtop', $corpstrTop) : ($corpstrTop = Config::get('mod_bannerpic_corpstrtop'));
     //victim alliance
     $allistrLeft = 145;
     Config::get('mod_bannerpic_allistrleft') == null ? Config::set('mod_bannerpic_allistrleft', $allistrLeft) : ($allistrLeft = Config::get('mod_bannerpic_allistrleft'));
     $allistrTop = 45;
     Config::get('mod_bannerpic_allistrtop') == null ? Config::set('mod_bannerpic_allistrtop', $allistrTop) : ($allistrTop = Config::get('mod_bannerpic_allistrtop'));
     //victim ship name
     $shipstrLeft = 145;
     Config::get('mod_bannerpic_shipstrleft') == null ? Config::set('mod_bannerpic_shipstrleft', $shipstrLeft) : ($shipstrLeft = Config::get('mod_bannerpic_shipstrleft'));
     $shipstrTop = 60;
     Config::get('mod_bannerpic_shipstrtop') == null ? Config::set('mod_bannerpic_shipstrtop', $shipstrTop) : ($shipstrTop = Config::get('mod_bannerpic_shipstrtop'));
     //border box colours
     $boxr = 186;
     Config::get('mod_bannerpic_boxr') == null ? Config::set('mod_bannerpic_boxr', $boxr) : ($boxr = Config::get('mod_bannerpic_boxr'));
     $boxg = 185;
     Config::get('mod_bannerpic_boxg') == null ? Config::set('mod_bannerpic_boxg', $boxg) : ($boxg = Config::get('mod_bannerpic_boxg'));
     $boxb = 183;
     Config::get('mod_bannerpic_boxb') == null ? Config::set('mod_bannerpic_boxb', $boxb) : ($boxb = Config::get('mod_bannerpic_boxb'));
     //text colours
     $textr = 255;
     Config::get('mod_bannerpic_textr') == null ? Config::set('mod_bannerpic_textr', $textr) : ($textr = Config::get('mod_bannerpic_textr'));
     $textg = 255;
     Config::get('mod_bannerpic_textg') == null ? Config::set('mod_bannerpic_textg', $textg) : ($textg = Config::get('mod_bannerpic_textg'));
     $textb = 255;
     Config::get('mod_bannerpic_textb') == null ? Config::set('mod_bannerpic_textb', $textb) : ($textb = Config::get('mod_bannerpic_textb'));
     //font
     Config::get('mod_bannerpic_fontfile') == null ? Config::set('mod_bannerpic_fontfile', $this->font) : ($this->font = Config::get('mod_bannerpic_fontfile'));
     Config::get('mod_bannerpic_fontfile') == null ? Config::set('mod_bannerpic_fontfilesize', $this->sfont) : ($this->sfont = Config::get('mod_bannerpic_fontsize'));
     $killstr = "{$victimname} was killed by {$killername}";
     $corpstr = "Corporation : {$victimcorp}";
     $allistr = "Alliance : {$victimalli}";
     $shipstr = "Ship : {$victimshipname}";
     //open base picture
     $this->img = imagecreatefromjpeg($this->basepic);
     $red = imagecolorallocate($this->img, 255, 0, 0);
     $black = imagecolorallocate($this->img, 0, 0, 0);
     $textcol = imagecolorallocate($this->img, $textr, $textg, $textb);
     $box = imagecreate(68, 68);
     $bxcol = imagecolorallocate($box, $boxr, $boxg, $boxb);
     //pics to base pic
     imagecopymerge($this->img, $box, $vicpicLeft, $vicpicTop, 0, 0, 68, 68, $vicpicTrans);
     imagecopymerge($this->img, $victimimg, $vicpicLeft + 2, $vicpicTop + 2, 0, 0, 64, 64, $vicpicTrans);
     imagecopymerge($this->img, $box, $shippicLeft, $shippicTop, 0, 0, 68, 68, 100);
     imagecopymerge($this->img, $victimshipimg, $shippicLeft + 2, $shippicTop + 2, 0, 0, 64, 64, 100);
     //add text to image
     imagefttext($this->img, $this->sfont, 0, $killstrLeft, $killstrTop, $textcol, $this->font, $killstr);
     imagefttext($this->img, $this->sfont, 0, $corpstrLeft, $corpstrTop, $textcol, $this->font, $corpstr);
     imagefttext($this->img, $this->sfont, 0, $allistrLeft, $allistrTop, $textcol, $this->font, $allistr);
     imagefttext($this->img, $this->sfont, 0, $shipstrLeft, $shipstrTop, $textcol, $this->font, $shipstr);
     //cache the file
     imagejpeg($this->img, $this->cache, 100);
     //if the board banner option is checked then put a copy in the banners dir.
     if ($bannerreplace == 1) {
         imagejpeg($this->img, 'banner/bannerpic.jpg', 100);
     }
     //destroy the images
     imagedestroy($box);
     imagedestroy($victimimg);
     imagedestroy($victimshipimg);
 }
Пример #13
0
/**
 * @package EDK
 */
define('MFONT', dirname(__FILE__) . '/evesansmm.ttf');
define('FSIZE', 12);
$im = imagecreatefromjpeg(dirname(__FILE__) . '/base.jpg');
$red = imagecolorallocate($im, 255, 10, 10);
$orange = imagecolorallocate($im, 150, 120, 20);
$blue = imagecolorallocate($im, 0, 0, 200);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$grey_trans = imagecolorallocatealpha($im, 50, 50, 50, 50);
$grey_transblue = imagecolorallocatealpha($im, 50, 50, 110, 10);
$grey_transbluel = imagecolorallocatealpha($im, 50, 50, 110, 100);
$name = strtoupper($pilot->getName());
$list = new KillList();
$list->setOrdered(true);
$list->setPodsNoobships(false);
$list->addInvolvedPilot($pilot);
$kill = $list->getKill();
$list->getallKills();
imagettftext($im, FSIZE, 0, 80, 21, $grey_trans, MFONT, $name);
imagettftext($im, FSIZE, 0, 80, 20, $white, MFONT, $name);
$no = $list->getCount();
$string = 'KILL# ' . $no;
imagettftext($im, FSIZE, 0, 80, 41, $grey_trans, MFONT, $string);
imagettftext($im, FSIZE, 0, 80, 40, $white, MFONT, $string);
$string = strtoupper($kill->getVictimName() . ' - ' . $kill->getVictimCorpName());
$box = imagettfbbox(FSIZE, 0, MFONT, $string);
$width = $box[4];
imagettftext($im, FSIZE, 0, 80, 76, $grey_trans, MFONT, $string);
Пример #14
0
 /**
  * gets all the dropped loot int $dest_array
  * @param KillList $killList
  * @param array $droppedLoot
  * @return string 
  */
 protected static function getDroppedLoot($killList, &$droppedLoot)
 {
     $killList->rewind();
     $totalValue = 0;
     $qry = DBFactory::getDBQuery();
     while ($kill = $killList->getKill()) {
         $query = "SELECT kb3_items_dropped.itd_itm_id AS 'ID', kb3_invtypes.typeName AS 'Name', SUM( kb3_items_dropped.itd_quantity ) AS 'Quantity', AVG( kb3_item_price.price ) AS Price\n                FROM kb3_items_dropped, kb3_invtypes, kb3_item_price\n                WHERE \n                (\n                    (\n                        kb3_items_dropped.itd_itm_id = kb3_invtypes.typeID\n                    )\n                    AND \n                    (\n                        kb3_items_dropped.itd_itm_id = kb3_item_price.typeID\n                    )\n                    AND \n                    (\n                        kb3_items_dropped.itd_kll_id = " . $kill->getID() . ")\n                )\n                GROUP BY kb3_items_dropped.itd_itm_id";
         $qry->execute($query);
         while ($row = $qry->getRow()) {
             if (isset($droppedLoot[$row['Name']]['Quantity']) && is_numeric($droppedLoot[$row['Name']]['Quantity'])) {
                 $droppedLoot[$row['Name']]['Quantity'] += $row['Quantity'];
             } else {
                 $droppedLoot[$row['Name']]['Quantity'] = $row['Quantity'];
             }
             if (config::get('item_values')) {
                 $droppedLoot[$row['Name']]['TValue'] = self::formatIskValue($row['Price'] * $droppedLoot[$row['Name']]['Quantity']);
                 $droppedLoot[$row['Name']]['Value'] = self::formatIskValue($row['Price']);
                 $droppedLoot[$row['Name']]['RawValue'] = $row['Price'];
                 if (!isset($droppedLoot[$row['Name']]['Icon'])) {
                     $item = Cacheable::factory('Item', $row['ID']);
                     $droppedLoot[$row['Name']]['Icon'] = $item->getIcon(24, false);
                 }
                 $totalValue += $row['Quantity'] * $row['Price'];
             }
         }
     }
     return self::formatIskValue($totalValue);
 }
Пример #15
0
    exit;
}
$html .= "<form><textarea class=killmail id=killmail name=killmail cols=\"55\" rows=\"35\" readonly=readonly>";
// Setup the lists
$klist = new KillList();
$klist->setOrdered(true);
$klist->addInvolvedPilot($pilot);
$klist->rewind();
while ($kll_id = $klist->getKill()) {
    $kill = new Kill($kll_id->getID());
    $html .= "\"";
    $html .= $kill->getRawMail();
    $html .= "\",\n\n";
}
// Losses
$llist = new KillList();
$llist->setOrdered(true);
// $list->setPodsNoobships( true ); // Not working!!
$llist->addVictimPilot($pilot);
$llist->rewind();
while ($lss_id = $llist->getKill()) {
    $html .= "\"";
    $loss = new Kill($lss_id->getID());
    $html .= $loss->getRawMail();
    $html .= "\",\n\n";
}
$html .= "</textarea><br>";
$html .= "<input type=\"button\" value=\"Select All\" onClick=\"this.form.killmail.select();this.form.killmail.focus(); document.execCommand('Copy')\"></form><br>";
$html .= "Copy content of textbox to another location (eg. a textfile)";
$page->setContent($html);
$page->addContext($menubox->generate());
 function generate()
 {
     global $smarty;
     $prevdate = "";
     $this->kill_list_->rewind();
     $smarty->assign('daybreak', $this->daybreak_);
     $smarty->assign('comments_count', config::get('comments_count'));
     // evil hardcode-hack, don't do this at home kids ! ;)
     if (config::get('style_name') == 'revelations') {
         $smarty->assign('comment_white', '_white');
     }
     $c = 0;
     $kdpage = array('a', 'kill_detail', true);
     $krpage = array('a', 'kill_related', true);
     $kills = array();
     while ($kill = $this->kill_list_->getKill()) {
         if ($this->limit_ && $c >= $this->limit_) {
             break;
         } else {
             $c++;
         }
         $curdate = substr($kill->getTimeStamp(), 0, 10);
         if ($curdate != $prevdate) {
             if (count($kills) && $this->daybreak_) {
                 $kl[] = array('kills' => $kills, 'date' => strtotime($prevdate));
                 $kills = array();
             }
             $prevdate = $curdate;
         }
         $kll = array();
         $kll['id'] = $kill->getID();
         $kll['victimshipimage'] = $kill->getVictimShipImage(32);
         $kll['victimshipname'] = $kill->getVictimShipName();
         $kll['victimshipclass'] = $kill->getVictimShipClassName();
         $kll['victim'] = $kill->getVictimName();
         $kll['victimiskloss'] = $kill->getISKLoss();
         if ($kll['victimiskloss'] > 1000000000) {
             $kll['victimiskloss'] = sprintf("%.01fb", $kll['victimiskloss'] / 1000000000);
         } elseif ($kll['victimiskloss'] > 1000000) {
             $kll['victimiskloss'] = sprintf("%.01fm", $kll['victimiskloss'] / 1000000);
         } elseif ($kll['victimiskloss'] > 1000) {
             $kll['victimiskloss'] = sprintf("%.0fk", $kll['victimiskloss'] / 1000);
         }
         $kll['victimcorp'] = $kill->getVictimCorpName();
         $kll['victimalliancename'] = $kill->getVictimAllianceName();
         $kll['fb'] = $kill->getFBPilotName();
         $kll['fbcorp'] = $kill->getFBCorpName();
         if ($kill->isClassified() && !Session::isAdmin()) {
             if (config::get('killlist_regionnames')) {
                 $kll['region'] = Language::get("classified");
             }
             $kll['systemsecurity'] = "-";
             $kll['system'] = Language::get("classified");
         } else {
             if (config::get('killlist_regionnames')) {
                 $kll['region'] = $kill->getSystem()->getRegionName();
             }
             $kll['systemsecurity'] = $kill->getSolarSystemSecurity();
             $kll['system'] = $kill->getSolarSystemName();
         }
         $kll['victimid'] = $kill->getVictimID();
         $kll['victimcorpid'] = $kill->getVictimCorpID();
         $kll['victimallianceid'] = $kill->getVictimAllianceID();
         $kll['victimshipid'] = $kill->getVictimShipExternalID();
         $kll['fbid'] = $kill->getFBPilotID();
         $kll['fbcorpid'] = $kill->getFBCorpID();
         $kll['inv'] = 0;
         if (config::get('killlist_involved')) {
             $kll['inv'] = $kill->getInvolvedPartyCount();
         }
         $kll['timestamp'] = $kill->getTimeStamp();
         if (config::get('killlist_alogo')) {
             // Need to return yet another value from killlists.
             $all = new Alliance($kill->getVictimAllianceID());
             if (strcasecmp($all->getName(), "None") != 0) {
                 $kll['allianceexists'] = true;
                 $kll['victimallianceicon'] = $all->getPortraitURL(32);
             } else {
                 $kll['allianceexists'] = true;
                 $crp = new Corporation($kill->getVictimCorpID());
                 $kll['victimallianceicon'] = $crp->getPortraitURL(32);
             }
         }
         if (isset($kill->_tag)) {
             $kll['tag'] = $kill->_tag;
         }
         $kll['fbplext'] = $kill->getFBPilotExternalID();
         $kll['plext'] = $kill->getFBPilotExternalID();
         if (config::get('comments_count')) {
             $kll['commentcount'] = $kill->countComment();
         }
         $kll['loss'] = false;
         $kll['kill'] = false;
         if ($this->combined_) {
             if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) {
                 $kll['loss'] = true;
             } else {
                 if (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) {
                     $kll['loss'] = true;
                 } else {
                     if (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
                         $kll['loss'] = true;
                     }
                 }
             }
             $kll['kill'] = !$kll['loss'];
         }
         $kll['urldetail'] = edkURI::build($kdpage, array('kll_id', $kll['id'], true));
         if (!$kill->isClassified()) {
             $kll['urlrelated'] = edkURI::build($krpage, array('kll_id', $kll['id'], true));
         }
         $kll['victimextid'] = $kill->getVictimExternalID();
         $kll['urlvictim'] = edkURI::page('pilot_detail', $kll['victimextid'] ? $kll['victimextid'] : $kll['victimid'], $kll['victimextid'] ? 'plt_ext_id' : 'plt_id');
         $kll['urlfb'] = edkURI::page('pilot_detail', $kll['fbplext'] ? $kll['fbplext'] : $kll['fbid'], $kll['fbplext'] ? 'plt_ext_id' : 'plt_id');
         if ($kll['allianceexists']) {
             $kll['urlvictimall'] = edkURI::page('alliance_detail', $kll['victimallianceid'], 'all_id');
         }
         $kll['urlvictimcorp'] = edkURI::page('corp_detail', $kll['victimcorpid'], 'crp_id');
         $kll['urlfbcorp'] = edkURI::page('corp_detail', $kll['fbcorpid'], 'crp_id');
         event::call('killlist_table_kill', $kll);
         $kills[] = $kll;
     }
     event::call('killlist_table_kills', $kills);
     if (count($kills)) {
         $kl[] = array('kills' => $kills, 'date' => strtotime($prevdate));
     }
     $smarty->assignByRef('killlist', $kl);
     $smarty->assign('killlist_iskloss', config::get('killlist_iskloss'));
     return $smarty->fetch(getcwd() . "/mods/highlight_capitals/templates/killlisttable.tpl");
 }
Пример #17
0
/**
 * @package EDK
 */
define('MFONT', dirname(__FILE__) . '/evesansmm.ttf');
define('FSIZE', 12);
$im = imagecreatefromjpeg(dirname(__FILE__) . '/base.jpg');
$red = imagecolorallocate($im, 255, 10, 10);
$orange = imagecolorallocate($im, 150, 120, 20);
$blue = imagecolorallocate($im, 0, 0, 200);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$grey_trans = imagecolorallocatealpha($im, 50, 50, 50, 50);
$grey_transblue = imagecolorallocatealpha($im, 50, 50, 110, 10);
$grey_transbluel = imagecolorallocatealpha($im, 50, 50, 110, 100);
$name = strtoupper($pilot->getName());
$list = new KillList();
$list->setOrdered(true);
$list->setPodsNoobships(false);
$list->addInvolvedPilot($pilot);
$kill = $list->getKill();
$list->getallKills();
imagefttext($im, FSIZE, 0, 80, 21, $grey_trans, MFONT, $name);
imagefttext($im, FSIZE, 0, 80, 20, $white, MFONT, $name, array('hdpi' => 200));
$no = $list->getCount();
$string = 'KILL# ' . $no . '     TOTAL POINTS ' . $list->getPoints();
imagettftext($im, FSIZE, 0, 80, 41, $grey_trans, MFONT, $string);
imagettftext($im, FSIZE, 0, 80, 40, $white, MFONT, $string);
$string = strtoupper($kill->getVictimName() . ' ' . $kill->getVictimCorpName());
$box = imagettfbbox(FSIZE, 0, MFONT, $string);
$width = $box[4];
imagettftext($im, FSIZE, 0, 349 - $width, 21, $grey_trans, MFONT, $string);
 function killList()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     // We'll be needing comment counts so set the killlist to retrieve them
     if (config::get('comments_count')) {
         $klist->setCountComments(true);
     }
     // We'll be needing involved counts so set the killlist to retrieve them
     if (config::get('killlist_involved')) {
         $klist->setCountInvolved(true);
     }
     // Set time limit to 1 day.
     $klist->setStartDate($this->period . " 00:00");
     $klist->setEndDate($this->period . " 23:59");
     // Select between kills, losses or both.
     if ($this->view == 'combined' || $this->view == '' && $this->showcombined) {
         involved::load($klist, 'combined');
     } elseif ($this->view == 'losses') {
         involved::load($klist, 'loss');
     } else {
         involved::load($klist, 'kill');
     }
     if ($this->scl_id) {
         $klist->addVictimShipClass($this->scl_id);
     } else {
         $klist->setPodsNoobShips(config::get('podnoobs'));
     }
     $table = new KillListTable($klist);
     if ($this->showcombined) {
         $table->setCombined(true);
     }
     $html = $table->generate();
     return $html;
 }
Пример #19
0
 /**
  * Return the html for the known members of this corp.
  * @param pCorpDetail $home 
  * @return string 
  */
 public static function view($home)
 {
     if (config::get('mod_knownmembers_own')) {
         if (array_search($home->alliance->getID(), config::get('cfg_allianceid')) !== false) {
             $can_view = 1;
         } else {
             if (array_search($home->crp_id, config::get('cfg_corpid')) !== false) {
                 $can_view = 1;
             }
         }
     }
     if ($can_view == 1) {
         $html .= "Cannot View this corps Member List";
     } else {
         $query = "SELECT * FROM `kb3_pilots`  WHERE plt_crp_id =" . $home->crp_id . " ORDER BY `plt_name` ASC";
         $qry = DBFactory::getDBQuery();
         $qry->execute($query);
         $cnt = $qry->recordCount();
         $html .= "<div class=block-header2>Known Pilots (" . $cnt . ")</div>";
         $html .= "<table class=kb-table align=center>";
         $html .= '<tr class=kb-table-header>';
         if (config::get('mod_knownmembers_img')) {
             $html .= '<td class=kb-table-header align="center"></td>';
         }
         $html .= '<td class=kb-table-header align="center">Pilot</td>';
         if (config::get('mod_knownmembers_kllpnts')) {
             $html .= '<td class=kb-table-header align="center">Kill Points</td>';
         }
         if (config::get('mod_knownmembers_dmgdn')) {
             $html .= '<td class=kb-table-header align="center">Dmg Done (isk)</td>';
         }
         if (config::get('mod_knownmembers_dmgrcv')) {
             $html .= '<td class=kb-table-header align="center">Dmg Received (isk)</td>';
         }
         if (config::get('mod_knownmembers_eff')) {
             $html .= '<td class=kb-table-header align="center">Efficiency</td>';
         }
         if ($home->page->isAdmin()) {
             $html .= '<td class=kb-table-header align="center">Admin - Move</td>';
         }
         $html .= '</tr>';
         while ($data = $qry->getRow()) {
             $pilot = new Pilot($data['plt_id']);
             $plist = new KillList();
             $plist->addInvolvedPilot($pilot);
             $plist->getAllKills();
             $points = $plist->getPoints();
             $pllist = new KillList();
             $pllist->addVictimPilot($pilot);
             $pllist->getAllKills();
             $plistisk = $plist->getISK();
             $pllistisk = $pllist->getISK();
             if ($plistisk == 0) {
                 $plistisk = 1;
                 //Remove divide by 0
             }
             if ($pllistisk == 0) {
                 $pllistisk = 1;
                 //Remove divide by 0
             }
             $efficiency = round($plistisk / ($plistisk + $pllistisk) * 100, 2);
             if (!$odd) {
                 $odd = true;
                 $class = 'kb-table-row-odd';
             } else {
                 $odd = false;
                 $class = 'kb-table-row-even';
             }
             $html .= "<tr class=" . $class . " style=\"height: 32px;\">";
             if (config::get('mod_knownmembers_img')) {
                 $html .= '<td width="64" align="center"><img src=' . $pilot->getPortraitURL(32) . '></td>';
             }
             $html .= '<td align="center"><a href=?a=pilot_detail&plt_id=' . $pilot->getID() . '>' . $pilot->getName() . '</a></td>';
             if (config::get('mod_knownmembers_kllpnts')) {
                 $html .= '<td align="center">' . $points . '</td>';
             }
             if (config::get('mod_knownmembers_dmgdn')) {
                 $html .= '<td align="center">' . round($plist->getISK(), 2) / 1000000 . 'M</td>';
             }
             if (config::get('mod_knownmembers_dmgrcv')) {
                 $html .= '<td align="center">' . round($pllist->getISK(), 2) / 1000000 . 'M</td>';
             }
             if (config::get('mod_knownmembers_eff')) {
                 $html .= '<td align="center">' . $efficiency . '%</td>';
             }
             if ($home->page->isAdmin()) {
                 $html .= "<td align=center><a href=\"javascript:openWindow('?a=admin_move_pilot&plt_id=" . $data['plt_id'] . "', null, 500, 500, '' )\">Move</a></td>";
             }
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
Пример #20
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;
 }
Пример #21
0
<?php

/**
 * @package EDK
 */
define('MPATH', dirname(__FILE__) . "/");
$im = imagecreatefrompng(MPATH . 'default.png');
$red = imagecolorallocate($im, 255, 10, 10);
$orange = imagecolorallocate($im, 150, 120, 20);
$blue = imagecolorallocate($im, 0, 0, 200);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$grey_trans = imagecolorallocatealpha($im, 50, 50, 50, 50);
$greyred_trans = imagecolorallocatealpha($im, 50, 10, 10, 50);
$name = $pilot->getName();
$list = new KillList();
$list->setOrdered(true);
$list->setLimit(1);
$list->setPodsNoobships(false);
$list->addInvolvedPilot($pilot);
$kill = $list->getKill();
// corp
$box = imagettfbbox(10, 0, MPATH . 'GUNSHIP2.TTF', $corp->getName());
$width = $box[4];
imagettftext($im, 10, 0, 319 - $width, 71, $black, MPATH . 'GUNSHIP2.TTF', $corp->getName());
imagettftext($im, 10, 0, 318 - $width, 70, $red, MPATH . 'GUNSHIP2.TTF', $corp->getName());
// player
$box = imagettfbbox(16, 0, MPATH . 'GUNSHIP2.TTF', $name);
$width = $box[4];
imagettftext($im, 16, 0, 319 - $width, 91, $black, MPATH . 'GUNSHIP2.TTF', $name);
imagettftext($im, 16, 0, 318 - $width, 90, $red, MPATH . 'GUNSHIP2.TTF', $name);
Пример #22
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));
     }
     $args = array();
     if ($this->crp_external_id) {
         $args[] = array('crp_ext_id', $this->crp_external_id, true);
     } else {
         $args[] = array('crp_id', $this->crp_id, true);
     }
     $pyear = array('y', $this->pyear, true);
     $nyear = array('y', $this->nyear, true);
     $pmonth = array('m', $this->pmonth, true);
     $nmonth = array('m', $this->nmonth, true);
     switch ($this->view) {
         case "":
             $list = new KillList();
             $list->setOrdered(true);
             $list->setLimit(10);
             $list->addInvolvedCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $ktab = new KillListTable($list);
             $ktab->setLimit(10);
             $smarty->assign('kills', $ktab->generate());
             $list = new KillList();
             $list->setOrdered(true);
             $list->setLimit(10);
             $list->addVictimCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $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->addInvolvedCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->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('kills', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_kills'));
             break;
         case "losses":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addVictimCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->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 "pilot_kills":
             $smarty->assign('title', 'Top Killers');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_kills', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_kills', true), $nyear, $nmonth));
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_scores":
             $smarty->assign('title', 'Top Scorers');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_scores', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_scores', true), $nyear, $nmonth));
             $list = new TopList_Score();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Points");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Score();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Points");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_solo":
             $smarty->assign('title', 'Top Solokillers');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_solo', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_solo', true), $nyear, $nmonth));
             $list = new TopList_SoloKiller();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Solokills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_SoloKiller();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Solokills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_damage":
             $smarty->assign('title', 'Top Damagedealers');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_damage', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_damage', true), $nyear, $nmonth));
             $list = new TopList_DamageDealer();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_DamageDealer();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_griefer":
             $smarty->assign('title', 'Top Griefers');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_griefer', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_griefer', true), $nyear, $nmonth));
             $list = new TopList_Kills();
             $list->addVictimShipClass(20);
             // freighter
             $list->addVictimShipClass(22);
             // exhumer
             $list->addVictimShipClass(7);
             // industrial
             $list->addVictimShipClass(12);
             // barge
             $list->addVictimShipClass(14);
             // transport
             $list->addInvolvedCorp($this->crp_id);
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Kills();
             $list->addVictimShipClass(20);
             // freighter
             $list->addVictimShipClass(22);
             // exhumer
             $list->addVictimShipClass(7);
             // industrial
             $list->addVictimShipClass(12);
             // barge
             $list->addVictimShipClass(14);
             // transport
             $list->addInvolvedCorp($this->crp_id);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_losses":
             $smarty->assign('title', 'Top Losers');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_losses', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_losses', true), $nyear, $nmonth));
             $list = new TopList_Losses();
             $list->addVictimCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Losses");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Losses();
             $list->addVictimCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Losses");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "ships_weapons":
             $shiplist = new TopList_Ship();
             $shiplist->addInvolvedCorp($this->crp_id);
             $shiplisttable = new TopTable_Ship($shiplist);
             $smarty->assign('ships', $shiplisttable->generate());
             $weaponlist = new TopList_Weapon();
             $weaponlist->addInvolvedCorp($this->crp_id);
             $weaponlisttable = new TopTable_Weapon($weaponlist);
             $smarty->assign('weapons', $weaponlisttable->generate());
             return $smarty->fetch(get_tpl('detail_kl_ships_weapons'));
             break;
         case 'history':
             $crpsum = new corpSummary($this->crp_id);
             $smarty->assign('title', Language::get('history'));
             $smarty->assign('summary', $crpsum->getMonthlySummary());
             return $smarty->fetch(get_tpl('detail_history'));
             break;
         case 'violent_systems':
             $smarty->assign('title', 'Most violent systems');
             $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('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'violent_systems', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'violent_systems', true), $nyear, $nmonth));
             $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_crp inc\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand inc.inc_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand inc.inc_crp_id = " . $this->crp_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 inc.inc_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand inc.inc_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" => edkURI::build(array(array('a', 'system_detail', true), array('sys_id', $row['sys_id'], true))), "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => $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_crp inc\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand inc.inc_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand inc.inc_crp_id = " . $this->crp_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" => edkURI::build(array(array('a', 'system_detail', true), array('sys_id', $row['sys_id'], true))), "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => $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;
     }
     return $html;
 }