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'));
 }
Beispiel #2
0
$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 {
    $list->setOrderBy(' kll.kll_id ASC ');
}
if (isset($_GET['limit'])) {
    $list->setLimit(min($maxkillsreturned, (int) $_GET['limit']));
} else {
    $list->setLimit($maxkillsreturned);
}
$qry = DBFactory::getDBQuery();
if (isset($_GET['alliance'])) {
    $arr = explode(',', $_GET['alliance']);
    foreach ($arr as &$val) {
        $val = intval($val);
    }
    $qry->execute("SELECT all_id FROM kb3_alliances WHERE all_external_id IN (" . implode(',', $arr) . ")");
 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);
 }