$qry = new DBQuery(); switch ($_POST['add_type']) { case 0: $sql = "select crp.crp_id as id, crp.crp_name as name\n from kb3_corps crp\n where lower( crp.crp_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; case 1: $sql = "select ali.all_id as id, ali.all_name as name\n from kb3_alliances ali\n where lower( ali.all_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; case 2: $sql = "select reg_id as id, reg_name as name\n from kb3_regions\n where lower( reg_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; case 3: $sql = "select sys_id as id, sys_name as name\n from kb3_systems\n where lower( sys_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; } $qry->execute($sql) or die($qry->getErrorMsg()); if ($qry->recordCount()) { $html .= "<table class='kb-table' width='450'>"; $html .= "<tr class='kb-table-header'><td width='340'>Name</td><td width='80' align='center'>Action</td></tr>"; } else { $html .= "No matches found for '" . htmlentities($_POST['add_name']) . "'."; } while ($row = $qry->getRow()) { $html .= "<tr class='kb-table-row-even'>"; $editURL = edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'edit', false), array('add_type', (int) $_POST['add_type'], false), array('add_id', $row['id'], false))); switch ($_POST['add_type']) { case 0: $html .= '<td><a href="' . edkURI::page('corp_detail', $row['id'], 'crp_id') . '">' . $row['name'] . "</a></td><td align='center'><button id='submit' name='submit' onclick=\"window.location.href='" . $editURL . "'\">Select</button></td>"; break; case 1: $html .= '<td><a href="' . edkURI::page('alliance_detail', $row['id'], 'all_id') . '">' . $row['name'] . "</a></td><td align='center'><button id='submit' name='submit' onclick=\"window.location.href='" . $editURL . "'\">Select</button></td>";
function showactivityoverview() { $week = $this->getWeek(); $month = $this->getMonth(); $year = $this->getYear(); if (config::get('show_activity_overview')) { if (!config::get('show_monthly')) { $weekly = 1; } else { $weekly = 0; } $row_counter = 0; $html .= '<table class=kb-table width="100%" border=0 cellspacing="1">'; if ($weekly == 1) { $html .= '<tr ><td colspan="3" class=kb-table-header>Activity Map for Week ' . $week . '</td></tr>'; } else { $html .= '<tr ><td colspan="3" class=kb-table-header>Activity Map for ' . date('F', mktime(0, 1, 0, $month, 1, $year)) . '</td></tr>'; } $html .= '<tr>'; $sql2 = "select reg.reg_id, count(distinct kll.kll_id) as kills\n\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\tand inv.ind_kll_id = kll.kll_id"; if (count(config::get('cfg_allianceid'))) { $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") "; } if (count(config::get('cfg_corpid'))) { $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") "; } if (count(config::get('cfg_pilotid'))) { $orargs[] = 'inv.ind_plt_id IN (' . implode(",", config::get('cfg_pilotid')) . ") "; } $sql2 .= " AND (" . implode(" OR ", $orargs) . ")"; if ($weekly == 1) { $sql2 .= "\t\tand date_format( kll.kll_timestamp, \"%u\" ) = " . $week . " "; } else { $sql2 .= "\t\tand date_format( kll.kll_timestamp, \"%m\" ) = " . $month . " "; } $sql2 .= "\t\tand date_format( kll.kll_timestamp, \"%Y\" ) = " . $year . "\n\t\t\t\t\t\tand con.con_id = sys.sys_con_id\n\t\t\t\t\t\tand reg.reg_id = con.con_reg_id\n\t\t\t\t\t\tgroup by reg.reg_id\n\t\t\t\t\t\torder by kills desc\n\t\t\t\t\t\tLIMIT 0,3;"; $qry2 = new DBQuery(); $qry2->execute($sql2) or die($qry2->getErrorMsg()); while ($row2 = $qry2->getRow()) { $row_counter++; $link = edkuri::build(array(array('a', 'detail_view', true), array('region_id', $row2['reg_id'], true))); if ($weekly == 1) { $html .= '<td align="center"><a href="' . $link . '"><img src="?a=map&mode=activity&size=250®ion_id=' . $row2['reg_id'] . '&week=' . $week . '&year=' . $year . '" border=0 /></a></td>'; } else { $html .= '<td align="center"><a href="' . $link . '"><img src="?a=map&mode=activity&size=250®ion_id=' . $row2['reg_id'] . '&month=' . $month . '&year=' . kbdate("Y") . '" border=0 /></a></td>'; } } while ($row_counter < 3) { $row_counter++; $html .= '<td align="center"><img width="250" height="250" src="?a=map&mode=na&size=250"></td>'; } $html .= '</tr></table><br />'; } return $html; }
function TrovaInvolvedParty($kill, &$killers) { $qry = new DBQuery(); /* $qry->execute("SELECT kb3_pilots.plt_name as pilot, kb3_corps.crp_name as corp, kb3_pilots.plt_id as id, kb3_pilots.plt_externalid as xid FROM kb3_inv_detail, kb3_pilots, kb3_corps WHERE (kb3_inv_detail.ind_plt_id = kb3_pilots.plt_id)and (kb3_inv_detail.ind_crp_id = kb3_corps.crp_id)and(kb3_inv_detail.ind_kll_id =" . $kill->getID() .")") or die($qry->getErrorMsg()); */ $qry->execute("SELECT kb3_pilots.plt_name AS pilot, kb3_corps.crp_name AS corp, kb3_pilots.plt_id AS id, kb3_pilots.plt_externalid AS xid, kb3_ships.shp_class AS SClass\n FROM kb3_inv_detail, kb3_pilots, kb3_corps, kb3_ships\n WHERE (\n kb3_inv_detail.ind_plt_id = kb3_pilots.plt_id\n )\n AND (\n kb3_inv_detail.ind_crp_id = kb3_corps.crp_id\n )\n AND (\n kb3_inv_detail.ind_shp_id = kb3_ships.shp_id\n )\n AND (\n kb3_inv_detail.ind_kll_id = " . $kill->getID() . ")") or die($qry->getErrorMsg()); $bs = 0; while ($row = $qry->getRow()) { $pilot = TestPilotName($row['pilot']); $killers[$pilot]['punti'] += $kill->getKillPoints(); if ($pilot == TestPilotName($kill->getFBPilotName())) { $killers[$pilot]['punti'] += 1; } $killers[$pilot]['portrait'] = "?a=thumb&id=" . $row['xid'] . "&size=32"; $killers[$pilot]['corp'] = $row['corp']; $killers[$pilot]['id'] = $row['id']; if ($row['SClass'] == 1) { //battleship $bs++; } } return $bs; }
function generate() { $regioncache = KB_CACHEDIR . '/img/map/' . KB_SITE . '_' . $this->regionid_ . '_' . $this->imgwidth_ . '.png'; $is_cached = 0; //INIT $title_caption = $this->regname_; if (file_exists($regioncache)) { $cfgttl = '6'; $ttyl_sec = $cfgttl * 3600; $ttl = filemtime($regioncache) + $ttyl_sec; if ($ttl <= time()) { $is_cached = 0; unlink($regioncache); unlink($regioncache . ".txt"); } else { $img = imagecreatefrompng($regioncache); $is_cached = 1; } } if ($is_cached == 0) { $sql = 'SELECT sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, sys.sys_name, sys.sys_id, sjp.sjp_to, con.con_id, con.con_name, reg.reg_id, reg.reg_name, reg.reg_x, reg.reg_z FROM kb3_systems sys LEFT JOIN kb3_system_jumps sjp ON sys.sys_id = sjp.sjp_from JOIN kb3_constellations con ON con.con_id = sys.sys_con_id JOIN kb3_regions reg ON reg.reg_id = con.con_reg_id'; if ($this->mode_ == "sys") { $sql .= " and reg.reg_id = '" . $this->regionid_ . "'"; } else { $sql .= " and reg.reg_id = " . $this->regionid2_; } $qry = new DBQuery(); $qry->execute($sql) or die($qry->getErrorMsg()); if (!$img) { $img = imagecreatetruecolor($this->imgwidth_, $this->imgheight_); } $white = imagecolorallocate($img, 255, 255, 255); $red = imagecolorallocate($img, 255, 0, 0); if (config::get('map_act_cl_bg')) { $bcolor = explode(",", config::get('map_act_cl_bg')); mapview::setbgcolor($bcolor[0], $bcolor[1], $bcolor[2]); } $bgcolor = imagecolorallocate($img, $this->bgcolor_[0], $this->bgcolor_[1], $this->bgcolor_[2]); imagefilledrectangle($img, 0, 0, $this->imgwidth_, $this->imgheight_, $bgcolor); $color = $white; $fov = 0; //INIT $i = 0; $minx = 0; $minz = 0; $maxx = 0; $maxz = 0; $mini = 0; $maxi = 0; $pi = 0; $sc = 0; $systems = array(); while ($row = $qry->getRow()) { $i = $row['sys_id']; $systems[] = $i; if ($i < $mini || $mini == 0) { $mini = $i; } if ($i > $maxi || $maxi == 0) { $maxi = $i; } $x = $row['sys_x'] * $this->ly_; $z = $row['sys_z'] * $this->ly_; if ($x < $minx || $minx == 0) { $minx = $x; } if ($x > $maxx || $maxx == 0) { $maxx = $x; } if ($z < $minz || $minz == 0) { $minz = $z; } if ($z > $maxz || $maxz == 0) { $maxz = $z; } $sys[$i][0] = $x; $sys[$i][1] = $z; if ($i == $pi || $pi == 0) { $sys[$i][2][$sc] = $row['sjp_to']; $sys[$i][3] = $sc++; } else { $sc = 0; } $sys[$i][4] = $row['sys_id']; $sys[$i][5] = $row['sys_name']; $sys[$i][6] = $row['sys_sec']; $sys[$i][7] = $row['con_id']; $sys[$i][8] = $row['con_name']; $sys[$i][9] = $row['reg_id']; $sys[$i][10] = $row['reg_name']; $pi = $i; } $dx = abs($maxx - $minx); $dz = abs($maxz - $minz); $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2)); $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2)); // draw lines if ($this->showlines_) { if (config::get('map_act_cl_line')) { $lcolor = explode(",", config::get('map_act_cl_line')); mapview::setlinecolor($lcolor[0], $lcolor[1], $lcolor[2]); } foreach ($systems as $n) { $px = $this->offset_ + ($sys[$n][0] - $minx) * $xscale; $py = $this->offset_ + ($sys[$n][1] - $minz) * $yscale; $line_col = imagecolorallocate($img, $this->linecolor_[0], $this->linecolor_[1], $this->linecolor_[2]); for ($m = 0; $m <= $sys[$n][3]; $m++) { $sys_to = $sys[$n][2][$m]; if ($sys[$sys_to][4] != "") { $px_to = $this->offset_ + ($sys[$sys_to][0] - $minx) * $xscale; $py_to = $this->offset_ + ($sys[$sys_to][1] - $minz) * $yscale; imageline($img, $px, $py, $px_to, $py_to, $line_col); } } $n++; } } //---------------------------------------------- // draw systems //---------------------------------------------- foreach ($systems as $n) { if (config::get('map_act_cl_normal')) { $scolor = explode(",", config::get('map_act_cl_normal')); mapview::setnormalcolor($scolor[0], $scolor[1], $scolor[2]); } $px = round($this->offset_ + ($sys[$n][0] - $minx) * $xscale); $py = round($this->offset_ + ($sys[$n][1] - $minz) * $yscale); $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]); imagefilledellipseaa($img, $px, $py, 4, 4, $color); //gm this is the white system dot, shrunkg it down from 6x6 size $n++; } imagepng($img, $regioncache); $fp = fopen($regioncache . ".txt", "w"); // writting offset data into file if ($fp) { // This step is needed cause when the image is cached only 1 system is queried from the DB // therefor it is impossible to calculcate the offset again. fwrite($fp, $maxx . "\n" . $minx . "\n" . $maxz . "\n" . $minz); } fclose($fp); } //--------------------------------------------------------------------------------------- //System Highlight starts here //--------------------------------------------------------------------------------------- if ($this->mode_ == "sys") { $sql = "SELECT sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, sys.sys_name, sys.sys_id\n\t\t\t\t\tFROM kb3_systems sys\n\t\t\t\t\tWHERE sys.sys_id = '" . $this->systemid_ . "'"; $qry = new DBQuery(); $qry->execute($sql) or die($qry->getErrorMsg()); $fov = 0; //INIT $row = $qry->getRow(); $x = $row['sys_x'] * $this->ly_; $z = $row['sys_z'] * $this->ly_; $sys[0] = $x; $sys[1] = $z; $sys[4] = $row['sys_id']; $sys[5] = $row['sys_name']; $sys[6] = $row['sys_sec']; $fp = fopen($regioncache . ".txt", "r"); // getting offset data from file if ($fp == FALSE) { echo "failt to open {$regioncache}"; exit; } $maxx = fgets($fp); $minx = fgets($fp); $maxz = fgets($fp); $minz = fgets($fp); fclose($fp); $dx = abs($maxx - $minx); $dz = abs($maxz - $minz); $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2)); $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2)); $px = round($this->offset_ + ($sys[0] - $minx) * $xscale); $py = round($this->offset_ + ($sys[1] - $minz) * $yscale); if (config::get('map_act_cl_hl2')) { $hscolor = explode(",", config::get('map_act_cl_hl2')); $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]); } else { $color = imagecolorallocate($img, '255', '0', '0'); } $tlen = 5 * strlen($sys[5]); if ($px + $tlen > $this->imgwidth_ - 20) { $sx = $px - $tlen; } else { $sx = $px + 5; } if ($py + 5 > $this->imgheight_ - 20) { $sy = $py - 5; } else { $sy = $py + 5; } imagestring($img, 1, $sx, $sy, $sys[5], $color); imagefilledellipseaa($img, $px, $py, 6, 6, $color); } //--------------------------------------------------------------------------------------- // Activity starts here //--------------------------------------------------------------------------------------- if ($this->mode_ == "activity") { $kills = 0; //INIT $overall_kill = 0; $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]); $paint_name = config::get('map_act_shownames'); $sql2 = "SELECT sys.sys_name, sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, count( DISTINCT kll.kll_id ) AS kills\n\t\t\t\tFROM kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\tWHERE kll.kll_system_id = sys.sys_id\n\t\t\t\tAND inv.ind_kll_id = kll.kll_id"; if (count(config::get('cfg_allianceid'))) { $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") "; } if (count(config::get('cfg_corpid'))) { $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") "; } if (count(config::get('cfg_pilotid'))) { $orargs[] = 'inv.ind_plt_id IN (' . implode(",", config::get('cfg_pilotid')) . ") "; } $sql2 .= " AND (" . implode(" OR ", $orargs) . ")"; if (isset($this->week_)) { $sql2 .= " and date_format( kll.kll_timestamp, \"%u\" ) = " . $this->week_; } if (isset($this->month_)) { $sql2 .= " and date_format( kll.kll_timestamp, \"%m\" ) = " . $this->month_; } $sql2 .= " AND date_format( kll.kll_timestamp, \"%Y\" ) = " . $this->year_ . "\n\t\t\t\t\tAND con.con_id = sys.sys_con_id\n\t\t\t\t\tAND reg.reg_id = con.con_reg_id\n\t\t\t\t\tAND reg.reg_id =" . $this->regionid2_ . "\n\t\t\t\t\tGROUP BY sys.sys_name\n\t\t\t\t\tORDER BY kills desc"; $qry2 = new DBQuery(); $qry2->execute($sql2) or die($qry2->getErrorMsg()); while ($row2 = $qry2->getRow()) { $kills = $row2['kills']; $overall_kill = $overall_kill + $kills; //OFFSET CALCULATION $x = $row2['sys_x'] * $this->ly_; $z = $row2['sys_z'] * $this->ly_; $sys[0] = $x; $sys[1] = $z; $sys[4] = $row2['sys_id']; $sys[5] = $row2['sys_name']; $sys[6] = $row2['sys_sec']; $fp = fopen($regioncache . ".txt", "r"); // getting offset data from file $maxx = fgets($fp); $minx = fgets($fp); $maxz = fgets($fp); $minz = fgets($fp); fclose($fp); $dx = abs($maxx - $minx); $dz = abs($maxz - $minz); $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2)); $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2)); $px = round($this->offset_ + ($sys[0] - $minx) * $xscale); $py = round($this->offset_ + ($sys[1] - $minz) * $yscale); if ($kills == 1) { // If there is only one kill we use normal highlight color $ratio = 1; if (config::get('map_act_cl_hl')) { $hscolor = explode(",", config::get('map_act_cl_hl')); $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]); } else { $color = imagecolorallocate($img, '255', '209', '57'); } } else { //more then one kill... $ratio = $kills + 5; // ...then we add a bit to the ratio if (config::get('map_act_cl_hl2')) { // Set the color to Highlight 2 and the sphere color with alpha $hscolor = explode(",", config::get('map_act_cl_hl2')); $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]); $color4 = imagecolorresolvealpha($img, $hscolor[0], $hscolor[1], $hscolor[2], '117'); } else { $color = imagecolorallocate($img, '255', '0', '0'); $color4 = imagecolorresolvealpha($img, 255, 0, 0, 117); } } if ($ratio > 100) { //now we limit the max-size of the sphere so it doesnt grow to big $ratio = 100; } imagefilledellipse($img, $px, $py, $ratio, $ratio, $color4); //paint the sphere -- can not use AA function cause it doesnt work with alpha imagefilledellipseaa($img, $px, $py, 6, 6, $color); // use AA function to paint the system dot if ($ratio > 10) { // extend the sphere $ratio2 = $ratio - 10; imagefilledellipse($img, $px, $py, $ratio2, $ratio2, $color4); } if ($ratio > 20) { // add another inner layer to the sphere, if it gets big enough $ratio3 = $ratio - 20; imagefilledellipse($img, $px, $py, $ratio3, $ratio3, $color4); } if ($paint_name == 1) { $tlen = 5 * strlen($sys[5]); if ($px + $tlen > $this->imgwidth_ - 20) { $sx = $px - $tlen; } else { $sx = $px + 5; } if ($py + 5 > $this->imgheight_ - 20) { $sy = $py - 5; } else { $sy = $py + 5; } imagestring($img, 1, $sx, $sy, $sys[5], $color); } } } //--------------------------------------------------------------------------------------- // Ship / Faction starts here //--------------------------------------------------------------------------------------- if ($this->mode_ == "ship" || $this->mode_ == "faction") { $kills = 0; //INIT $overall_kill = 0; $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]); $paint_name = config::get('map_act_shownames'); $sql2 = 'select sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, sys.sys_name, sys.sys_id, con.con_id, con.con_name, reg.reg_id, reg.reg_name, reg.reg_x, reg.reg_z from kb3_systems sys, kb3_constellations con, kb3_regions reg where con.con_id = sys.sys_con_id and reg.reg_id = con.con_reg_id'; $sql2 .= " and reg.reg_id = " . $this->regionid2_; $xml_kills = $this->update_kill_cache(); $qry2 = new DBQuery(); $qry2->execute($sql2) or die($qry2->getErrorMsg()); while ($row2 = $qry2->getRow()) { $paint = 0; foreach ($xml_kills as $key => $value) { if ($row2['sys_id'] == $key) { $kills = $value; $paint = 1; } } if ($paint == 1) { $overall_kill = $overall_kill + $kills; //OFFSET CALCULATION $x = $row2['sys_x'] * $this->ly_; $z = $row2['sys_z'] * $this->ly_; $sys[0] = $x; $sys[1] = $z; $sys[4] = $row2['sys_id']; $sys[5] = $row2['sys_name']; $sys[6] = $row2['sys_sec']; $fp = fopen($regioncache . ".txt", "r"); // getting offset data from file $maxx = fgets($fp); $minx = fgets($fp); $maxz = fgets($fp); $minz = fgets($fp); fclose($fp); $dx = abs($maxx - $minx); $dz = abs($maxz - $minz); $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2)); $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2)); $px = round($this->offset_ + ($sys[0] - $minx) * $xscale); $py = round($this->offset_ + ($sys[1] - $minz) * $yscale); if ($kills == 1) { // If there is only one kill we use normal highlight color $ratio = 1; if (config::get('map_act_cl_hl')) { $hscolor = explode(",", config::get('map_act_cl_hl')); $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]); } else { $color = imagecolorallocate($img, '255', '209', '57'); } } else { //more then one kill... $ratio = $kills + 5; // ...then we add a bit to the ratio if (config::get('map_act_cl_hl2')) { // Set the color to Highlight 2 and the sphere color with alpha $hscolor = explode(",", config::get('map_act_cl_hl2')); $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]); $color4 = imagecolorresolvealpha($img, $hscolor[0], $hscolor[1], $hscolor[2], '117'); } else { $color = imagecolorallocate($img, '255', '0', '0'); $color4 = imagecolorresolvealpha($img, 255, 0, 0, 117); } } if ($ratio > 100) { //now we limit the max-size of the sphere so it doesnt grow to big $ratio = 100; } imagefilledellipse($img, $px, $py, $ratio, $ratio, $color4); //paint the sphere -- can not use AA function cause it doesnt work with alpha imagefilledellipseaa($img, $px, $py, 6, 6, $color); // use AA function to paint the system dot if ($ratio > 10) { // extend the sphere $ratio2 = $ratio - 10; imagefilledellipse($img, $px, $py, $ratio2, $ratio2, $color4); } if ($ratio > 20) { // add another inner layer to the sphere, if it gets big enough $ratio3 = $ratio - 20; imagefilledellipse($img, $px, $py, $ratio3, $ratio3, $color4); } if ($paint_name == 1) { $tlen = 5 * strlen($sys[5]); if ($px + $tlen > $this->imgwidth_ - 20) { $sx = $px - $tlen; } else { $sx = $px + 5; } if ($py + 5 > $this->imgheight_ - 20) { $sy = $py - 5; } else { $sy = $py + 5; } imagestring($img, 1, $sx, $sy, $sys[5] . '(' . $kills . ')', $color); } } } } //--------------------------------------------------------------------------------------- // Activity end here //--------------------------------------------------------------------------------------- // Draw the region name and total kill count. if (config::get('map_act_cl_capt')) { $scolor = explode(",", config::get('map_act_cl_capt')); mapview::setcaptcolor($scolor[0], $scolor[1], $scolor[2]); } $captioncolor = imagecolorallocate($img, $this->captioncolor_[0], $this->captioncolor_[1], $this->captioncolor_[2]); switch ($this->mode_) { case "ship": case "faction": $title_kill = "Total Kills in the last hour: " . $overall_kill; break; case "activity": if (isset($this->week_)) { $title_kill = "Total Kills in Week " . $this->week_ . ": " . $overall_kill; } if (isset($this->month_)) { $title_kill = "Total Kills in " . date('F', mktime(0, 1, 0, $this->month_, 1, $this->year_)) . ": " . $overall_kill; } break; default: $title_kill = ''; break; } $str_loc = $this->imgheight_ - 10; imagestring($img, 1, 2, $str_loc, $title_kill, $captioncolor); imagestring($img, 1, 2, 2, $title_caption, $captioncolor); if ($this->mode_ == 'ship' || $this->mode_ == 'faction') { clearstatcache(); $filetime = filemtime($this->killcache); $stringpos = $this->imgwidth_ - strlen("Data from: " . date("G:i Y-m-d", $filetime)) * 5 - 5; imagestring($img, 1, $stringpos, 2, "Data from: " . date("G:i Y-m-d", $filetime), $captioncolor); } header("Content-type: image/png"); imagepng($img); }
for ($i = 1; $i <= 12; $i++) { if ($region_set == 0) { $sql2 = "select reg.reg_id, count(distinct kll.kll_id) as kills \n\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\twhere kll.kll_system_id = sys.sys_id \n\t\t\t\tand inv.ind_kll_id = kll.kll_id"; if (count(config::get('cfg_allianceid'))) { $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") "; } if (count(config::get('cfg_corpid'))) { $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") "; } if (count(config::get('cfg_pilotid'))) { $orargs[] = 'inv.ind_plt_id IN (' . implode(",", config::get('cfg_pilotid')) . ") "; } $sql2 .= " AND (" . implode(" OR ", $orargs) . ")"; $sql2 .= " and date_format( kll.kll_timestamp, \"%m\" ) = " . $i . "\n\t\t\t\tand date_format( kll.kll_timestamp, \"%Y\" ) = " . $year . "\n\t\t\t\tand con.con_id = sys.sys_con_id\n and reg.reg_id = con.con_reg_id\n\t\t\t\tgroup by reg.reg_id\n\t\t\t\t\n\t\t\t\torder by kills desc\n\t\t\t\tLIMIT 0,1;"; $qry2 = new DBQuery(); $qry2->execute($sql2) or die($qry2->getErrorMsg()); while ($row2 = $qry2->getRow()) { $region = $row2['reg_id']; } } else { $region = $region_set; $region_nav = '®ion_id=' . $region_set; } if ($i % 2) { $html .= '<tr >'; } if ($region != 0) { $html .= ' <td align="center"><img src="?a=map&mode=activity&size=350®ion_id=' . $region . '&month=' . $i . '&year=' . $year . '" /></td>'; } else { $html .= ' <td align="center"><img src="?a=map&mode=na&size=250" width="350" height="350"></td>'; }