- Timestamp:
- 12/15/06 06:33:49 (14 years ago)
- Location:
- dev
- Files:
-
- 4 added
- 15 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/admin.php
r135 r154 22 22 check_tblstrct4(); 23 23 check_tblstrct5(); 24 chk_kb3_items(); 24 25 25 26 if ($_POST['submit']) … … 42 43 $config->checkCheckbox('comments_count'); 43 44 $config->checkCheckbox('item_values'); 45 $config->checkCheckbox('readd_dupes'); 44 46 $config->setPostPassword($_POST['post_password']); 45 47 $config->setPostMailto($_POST['post_mailto']); … … 181 183 } 182 184 $html .= "> (This is in case we can't supply a dump with the new items when Kali goes live)</td></tr>"; 185 $html .= "<tr><td width=120><b>ReAdd known killmails</b></td><td><input type=checkbox name=readd_dupes id=readd_dupes"; 186 if ($config->getConfig('readd_dupes')) 187 { 188 $html .= " checked=\"checked\""; 189 } 190 $html .= "> (This internally reparses a dupe on submit)</td></tr>"; 183 191 $html .= "</table>"; 184 192 -
dev/common/admin_mods.php
r28 r154 1 <? 1 <?php 2 2 require_once("db.php"); 3 3 require_once("class.killboard.php"); 4 require_once( "class.page.php");5 require_once( "admin_menu.php");4 require_once("class.page.php"); 5 require_once("admin_menu.php"); 6 6 7 $page = new Page( "Administration - Mods");7 $page = new Page("Administration - Mods"); 8 8 $killboard = new Killboard(KB_SITE); 9 9 $page->setAdmin(); 10 10 $config = $killboard->getConfig(); 11 11 12 if($_POST['set_mods'] != ""){ 13 foreach($_POST as $key => $val){ 14 if(substr($key,0,4) == "mod_" && $val == "on"){ 15 $activemods .= substr($key,4,strlen($key)-4) . ","; 16 17 } 18 } 19 $activemods = substr($activemods,0,strlen($activemods)-1); 20 $config->setConfig("mods_active",$activemods); 12 if ($_POST['set_mods'] != "") 13 { 14 foreach($_POST as $key => $val) 15 { 16 if (substr($key, 0, 4) == "mod_" && $val == "on") 17 { 18 if (substr($key, 4, strlen($key)-4) != 'item_values') 19 { 20 $activemods .= substr($key, 4, strlen($key)-4).","; 21 } 22 } 23 } 24 $activemods = substr($activemods, 0, strlen($activemods)-1); 25 $config->setConfig("mods_active", $activemods); 21 26 } 22 $activemods = explode(",", $config->getConfig("mods_active"));27 $activemods = explode(",", $config->getConfig("mods_active")); 23 28 $html = <<<HTML 24 29 <form action="?a=admin_mods" method="post"> … … 27 32 <tr class=kb-table-header> 28 33 <td class=kb-table-header>Name</td> 29 <td class=kb-table-header align="center">Active</td> 34 <td class=kb-table-header align="center">Active</td> 30 35 </tr> 31 36 HTML; 32 if ($handle = opendir('mods')) { 33 while ($file = readdir($handle)) { 34 if(is_dir("mods/$file") && $file != ".." & $file != "." & $file != ".svn"){ 35 $html .= "<tr class=kb-table-row-odd style=\"height: 34px;\">"; 36 $id = $file; 37 if(in_array($id,$activemods)) $checked = "checked=\"checked\""; else $checked = ""; 38 if(file_exists("mods/$file/settings.php")) $file .= " [<a href=\"?a=settings_$file\">settings</a>]"; 39 $html .= "<td>$file</td><td align=center><input name=\"mod_$id\" type=\"checkbox\"$checked/></td></tr>"; 40 } 41 } 42 closedir($handle); 37 if ($handle = opendir('mods')) 38 { 39 while ($file = readdir($handle)) 40 { 41 if (is_dir("mods/$file") && $file != ".." &$file != "." &$file != ".svn") 42 { 43 $html .= "<tr class=kb-table-row-odd style=\"height: 34px;\">"; 44 $id = $file; 45 46 if (in_array($id, $activemods)) 47 { 48 $checked = "checked=\"checked\""; 49 } 50 else 51 { 52 $checked = ""; 53 } 54 if (file_exists("mods/$file/settings.php")) 55 { 56 $file .= " [<a href=\"?a=settings_$file\">settings</a>]"; 57 } 58 $html .= "<td>$file</td><td align=center><input name=\"mod_$id\" type=\"checkbox\"$checked/></td></tr>"; 59 } 60 } 61 closedir($handle); 43 62 } 44 $html .= "<tr><td colspan=2 align=center><input type=submit name=submit value=\"Save\"></table></form>"; 45 $page->setContent( $html);46 $page->addContext( $menubox->generate());63 $html .= "<tr><td colspan=2 align=center><input type=submit name=submit value=\"Save\"></table></form>"; 64 $page->setContent($html); 65 $page->addContext($menubox->generate()); 47 66 $page->generate(); 48 67 ?> -
dev/common/admin_sync.php
r44 r154 33 33 if ($do_sync && $fp) 34 34 { 35 $content_file = gzdeflate( &$content_file);35 $content_file = gzdeflate($content_file); 36 36 37 $http->set_postdata('data', &$content_file);37 $http->set_postdata('data', $content_file); 38 38 $http->set_useragent("EVE-KB SYNC (VER ".KB_VERSION.")"); 39 39 $file = $http->get_content(); … … 46 46 47 47 // the response ($file) contains ids new to us 48 $data = @gzinflate( &$file);48 $data = @gzinflate($file); 49 49 if ($data == false) 50 50 { … … 57 57 58 58 // get all names we'll find 59 preg_match_all("^!(.*?)\|(.*?)-^", &$data, $matches);59 preg_match_all("^!(.*?)\|(.*?)-^", $data, $matches); 60 60 unset($data); 61 61 $results = count($matches[1]); -
dev/common/autoupgrade.php
r135 r154 194 194 $qry->execute($query); 195 195 } 196 197 function chk_kb3_items() 198 { 199 $qry = new DBQuery(); 200 $query = 'select count(*) from kb3_item_values where itt_id = 771'; 201 $result = mysql_query($query); 202 if ($result['cnt'] == 1) 203 { 204 return; 205 } 206 $qry->execute("INSERT INTO kb3_item_types VALUES (737,'Gas Cloud Harvester',1)"); 207 $qry->execute("INSERT INTO kb3_item_types VALUES (762,'Inertia Stabilizer',3)"); 208 $qry->execute("INSERT INTO kb3_item_types VALUES (763,'Nanofiber Internal Structure',3)"); 209 $qry->execute("INSERT INTO kb3_item_types VALUES (764,'Overdrive Injector System',3)"); 210 $qry->execute("INSERT INTO kb3_item_types VALUES (765,'Expanded Cargohold',3)"); 211 $qry->execute("INSERT INTO kb3_item_types VALUES (766,'Power Diagnostic System',3)"); 212 $qry->execute("INSERT INTO kb3_item_types VALUES (767,'Capacitor Power Relay',3)"); 213 $qry->execute("INSERT INTO kb3_item_types VALUES (768,'Capacitor Flux Coil',3)"); 214 $qry->execute("INSERT INTO kb3_item_types VALUES (769,'Reactor Control Unit',3)"); 215 $qry->execute("INSERT INTO kb3_item_types VALUES (770,'Shield Flux Coil',3)"); 216 $qry->execute("INSERT INTO kb3_item_types VALUES (771,'Missile Launcher Heavy Assault',1)"); 217 } 196 218 ?> -
dev/common/class.item.php
r134 r154 80 80 function lookup($name) 81 81 { 82 $name = trim($name); 82 83 $qry = new DBQuery(); 83 84 $qry->execute("select * from kb3_items itm … … 95 96 where itm_name = '".slashfix(substr($name,0,-1))."'"); 96 97 $row = $qry->getRow(); 98 if (!$row['itm_type']) 99 { 100 return false; 101 } 97 102 $qry->execute("INSERT INTO kb3_items (itm_name,itm_volume,itm_type,itm_externalid,itm_techlevel,itm_icon) 98 103 VALUES ('".slashfix($name)."','".$row['itm_volume']."','".$row['itm_type']."','".$row['itm_externalid']."','2','".$row['itm_icon']."')"); -
dev/common/class.kill.php
r133 r154 270 270 from kb3_kills 271 271 where kll_timestamp <= 272 date_add( '".$this->timestamp_."', INTERVAL ' 3:0' MINUTE_SECOND )272 date_add( '".$this->timestamp_."', INTERVAL '5:0' MINUTE_SECOND ) 273 273 and kll_timestamp >= 274 date_sub( '".$this->timestamp_."', INTERVAL ' 3:0' MINUTE_SECOND )274 date_sub( '".$this->timestamp_."', INTERVAL '5:0' MINUTE_SECOND ) 275 275 and kll_victim_id = ".$this->victimid_." 276 276 and kll_ship_id = ".$this->victimship_->getID()." … … 299 299 kll.kll_crp_id, kll.kll_points, 300 300 fbplt.plt_id as fbplt_id, 301 fbplt.plt_externalid as fbplt_externalid, 301 302 fbcrp.crp_id as fbcrp_id, 302 303 fbali.all_id as fbali_id, … … 333 334 $this->setFBAllianceName($row['fbali_name']); 334 335 $this->setKillPoints($row['kll_points']); 336 $this->plt_ext_ = $row['plt_externalid']; 337 $this->fbplt_ext_ = $row['fbplt_externalid']; 335 338 336 339 if (!$row) … … 571 574 function add($id = null) 572 575 { 576 global $config; 573 577 if (!$this->solarsystem_->getID()) 574 578 { … … 584 588 $this->realadd(); 585 589 } 586 else 590 elseif ($config->getConfig('readd_dupes')) 587 591 { 588 592 $this->dupeid_ = $dupe; … … 590 594 $this->remove(false); 591 595 $this->realadd($dupe); 596 $this->id_ = -1; 597 } 598 else 599 { 600 $this->dupeid_ = $dupe; 592 601 $this->id_ = -1; 593 602 } -
dev/common/class.killlist.php
r149 r154 31 31 if (!count($this->groupby_)) 32 32 $this->sql_ = 'select distinct kll.kll_id, kll.kll_timestamp, plt.plt_name, 33 crp.crp_name, ali.all_name, kll.kll_ship_id,33 crp.crp_name, crp.crp_id, ali.all_name, ali.all_id, kll.kll_ship_id, 34 34 kll.kll_system_id, kll.kll_ship_id, 35 35 kll.kll_victim_id, plt.plt_externalid, 36 36 kll.kll_crp_id, kll.kll_points, 37 shp.shp_class, shp.shp_name,38 shp.shp_externalid,39 scl.scl_id, scl.scl_class, scl.scl_value,40 sys.sys_name, sys.sys_sec,37 shp.shp_class, shp.shp_name, 38 shp.shp_externalid, shp.shp_id, 39 scl.scl_id, scl.scl_class, scl.scl_value, 40 sys.sys_name, sys.sys_sec, 41 41 fbplt.plt_name as fbplt_name, 42 42 fbplt.plt_externalid as fbplt_externalid, … … 50 50 if (count($this->groupby_)) 51 51 { 52 $this->sql_ .= "select count(*) as cnt, " .implode(",", $this->groupby_);52 $this->sql_ .= "select count(*) as cnt, ".implode(",", $this->groupby_); 53 53 } 54 54 … … 81 81 if ($this->inv_plt_) 82 82 $this->sql_ .= " inner join kb3_inv_plt inp 83 on ( inp.inp_plt_id in ( " . substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2) ." ) and kll.kll_id = inp.inp_kll_id ) ";83 on ( inp.inp_plt_id in ( ".substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2)." ) and kll.kll_id = inp.inp_kll_id ) "; 84 84 if ($this->inv_crp_) 85 85 $this->sql_ .= " inner join kb3_inv_crp inc 86 on ( inc.inc_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) ." ) and kll.kll_id = inc.inc_kll_id ) ";86 on ( inc.inc_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." ) and kll.kll_id = inc.inc_kll_id ) "; 87 87 if ($this->inv_all_) 88 88 $this->sql_ .= " inner join kb3_inv_all ina 89 on ( ina.ina_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) ." ) and kll.kll_id = ina.ina_kll_id ) ";89 on ( ina.ina_all_id in ( ".substr($this->inv_all_, 0, strlen($this->inv_all_) - 2)." ) and kll.kll_id = ina.ina_kll_id ) "; 90 90 } 91 91 else … … 101 101 inner join kb3_regions reg 102 102 on ( reg.reg_id = con.con_reg_id 103 and reg.reg_id in ( " . implode($this->regions_, ",") ." ) )";103 and reg.reg_id in ( ".implode($this->regions_, ",")." ) )"; 104 104 } 105 105 106 106 if (count($this->systems_)) 107 107 { 108 $this->sql_ .= " and kll.kll_system_id in ( " .implode($this->systems_, ",").")";108 $this->sql_ .= " and kll.kll_system_id in ( ".implode($this->systems_, ",").")"; 109 109 } 110 110 // victim filter … … 117 117 118 118 if ($this->vic_plt_) 119 $this->sql_ .= " " . $op . " kll.kll_victim_id in ( " . substr($this->vic_plt_, 0, strlen($this->vic_plt_) - 2) ." )";119 $this->sql_ .= " ".$op." kll.kll_victim_id in ( ".substr($this->vic_plt_, 0, strlen($this->vic_plt_) - 2)." )"; 120 120 if ($this->vic_crp_) 121 $this->sql_ .= " " . $op . " kll.kll_crp_id in ( " . substr($this->vic_crp_, 0, strlen($this->vic_crp_) - 2) ." )";121 $this->sql_ .= " ".$op." kll.kll_crp_id in ( ".substr($this->vic_crp_, 0, strlen($this->vic_crp_) - 2)." )"; 122 122 if ($this->vic_all_) 123 $this->sql_ .= " " . $op . " kll.kll_all_id in ( " . substr($this->vic_all_, 0, strlen($this->vic_all_) - 2) ." )";123 $this->sql_ .= " ".$op." kll.kll_all_id in ( ".substr($this->vic_all_, 0, strlen($this->vic_all_) - 2)." )"; 124 124 125 125 if ($this->mixedvictims_) … … 129 129 if (count($this->exclude_scl_)) 130 130 { 131 $this->sql_ .= " and scl.scl_id not in ( " . implode(",", $this->exclude_scl_) ." )";131 $this->sql_ .= " and scl.scl_id not in ( ".implode(",", $this->exclude_scl_)." )"; 132 132 } 133 133 if (count($this->vic_scl_id_)) 134 134 { 135 $this->sql_ .= " and scl.scl_id in ( " . implode(",", $this->vic_scl_id_) ." )";135 $this->sql_ .= " and scl.scl_id in ( ".implode(",", $this->vic_scl_id_)." )"; 136 136 } 137 137 // related … … 139 139 { 140 140 $rqry = new DBQuery(); 141 $rsql = "select kll_timestamp, kll_system_id 142 from kb3_kills 143 where kll_id = " . $this->related_; 144 145 $rqry->execute($rsql) or die($rqry->getErrorMsg()); 141 $rsql = "select kll_timestamp, kll_system_id from kb3_kills where kll_id = ".$this->related_; 142 143 $rqry->execute($rsql); 146 144 $rrow = $rqry->getRow(); 147 145 148 $this->sql_ .= " and kll.kll_system_id = " . $rrow['kll_system_id'] ."146 $this->sql_ .= " and kll.kll_system_id = ".$rrow['kll_system_id']." 149 147 and kll.kll_timestamp <= 150 date_add( '" . $rrow['kll_timestamp'] ."', INTERVAL '15:0' MINUTE_SECOND )148 date_add( '".$rrow['kll_timestamp']."', INTERVAL '15:0' MINUTE_SECOND ) 151 149 and kll.kll_timestamp >= 152 date_sub( '" . $rrow['kll_timestamp'] ."', INTERVAL '15:0' MINUTE_SECOND )";150 date_sub( '".$rrow['kll_timestamp']."', INTERVAL '15:0' MINUTE_SECOND )"; 153 151 } 154 152 // timeframe … … 164 162 { 165 163 $replace = " inner join kb3_inv_plt inp 166 on ( inp.inp_plt_id in ( " . substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2) ." ) and kll.kll_id = inp.inp_kll_id ) ";164 on ( inp.inp_plt_id in ( ".substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2)." ) and kll.kll_id = inp.inp_kll_id ) "; 167 165 $psql = str_replace("<ph>", $replace, $this->sql_); 168 166 } … … 170 168 { 171 169 $replace = " inner join kb3_inv_crp inc 172 on ( inc.inc_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) ." ) and kll.kll_id = inc.inc_kll_id ) ";170 on ( inc.inc_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." ) and kll.kll_id = inc.inc_kll_id ) "; 173 171 $csql = str_replace("<ph>", $replace, $this->sql_); 174 172 } … … 176 174 { 177 175 $replace = " inner join kb3_inv_all ina 178 on ( ina.ina_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) ." ) and kll.kll_id = ina.ina_kll_id ) ";176 on ( ina.ina_all_id in ( ".substr($this->inv_all_, 0, strlen($this->inv_all_) - 2)." ) and kll.kll_id = ina.ina_kll_id ) "; 179 177 $asql = str_replace("<ph>", $replace, $this->sql_); 180 178 } 181 179 182 180 if ($psql) 183 $nsql = $psql ." union ";181 $nsql = $psql." union "; 184 182 if ($csql) 185 $nsql .= $csql ." union ";183 $nsql .= $csql." union "; 186 184 if ($asql) 187 185 $nsql .= $asql; … … 195 193 196 194 // group by 197 if ($this->groupby_) $this->sql_ .= " group by " .implode(",", $this->groupby_);195 if ($this->groupby_) $this->sql_ .= " group by ".implode(",", $this->groupby_); 198 196 // order/limit 199 197 if ($this->ordered_) 200 198 { 201 199 if (!$this->orderby_) $this->sql_ .= " order by kll_timestamp desc"; 202 else $this->sql_ .= " order by " .$this->orderby_;203 } 204 if ($this->limit_) $this->sql_ .= " limit " . $this->offset_ . ", " .$this->limit_;200 else $this->sql_ .= " order by ".$this->orderby_; 201 } 202 if ($this->limit_) $this->sql_ .= " limit ".$this->offset_.", ".$this->limit_; 205 203 // echo '<p>'.$this->sql_."</p>"; 206 204 $this->qry_->execute($this->sql_); … … 276 274 $kill->setVictimName($row['plt_name']); 277 275 $kill->setVictimCorpName($row['crp_name']); 278 $kill->setVictimAllianceName($row['ali_name']); 276 $kill->setVictimCorpID($row['crp_id']); 277 $kill->setVictimAllianceName($row['all_name']); 278 $kill->setVictimAllianceID($row['all_id']); 279 279 $kill->setVictimShipName($row['shp_name']); 280 280 $kill->setVictimShipExternalID($row['shp_externalid']); 281 281 $kill->setVictimShipClassName($row['scl_class']); 282 282 $kill->setVictimShipValue(round($row['scl_value'] / 1000000, 2)); 283 $kill->setVictimID($row['kll_victim_id']); 283 284 $kill->setFBPilotName($row['fbplt_name']); 284 285 $kill->setFBCorpName($row['fbcrp_name']); … … 286 287 $kill->plt_ext_ = $row['plt_externalid']; 287 288 $kill->fbplt_ext_ = $row['fbplt_externalid']; 289 $kill->_sclid = $row['scl_id']; 290 $kill->_shpid = $row['shp_id']; 291 288 292 return $kill; 289 293 } … … 301 305 function addInvolvedPilot($pilot) 302 306 { 303 $this->inv_plt_ .= $pilot->getID() .", ";307 $this->inv_plt_ .= $pilot->getID().", "; 304 308 if ($this->inv_crp_ || $this->inv_all_) 305 309 $this->mixedinvolved_ = true; … … 308 312 function addInvolvedCorp($corp) 309 313 { 310 $this->inv_crp_ .= $corp->getID() .", ";314 $this->inv_crp_ .= $corp->getID().", "; 311 315 if ($this->inv_plt_ || $this->inv_all_) 312 316 $this->mixedinvolved_ = true; … … 315 319 function addInvolvedAlliance($alliance) 316 320 { 317 $this->inv_all_ .= $alliance->getID() .", ";321 $this->inv_all_ .= $alliance->getID().", "; 318 322 if ($this->inv_plt_ || $this->inv_crp_) 319 323 $this->mixedinvolved_ = true; … … 322 326 function addVictimPilot($pilot) 323 327 { 324 $this->vic_plt_ .= $pilot->getID() .", ";328 $this->vic_plt_ .= $pilot->getID().", "; 325 329 if ($this->vic_crp_ || $this->vic_all_) 326 330 $this->mixedvictims_ = true; … … 329 333 function addVictimCorp($corp) 330 334 { 331 $this->vic_crp_ .= $corp->getID() .", ";335 $this->vic_crp_ .= $corp->getID().", "; 332 336 if ($this->vic_plt_ || $this->vic_all_) 333 337 $this->mixedvictims_ = true; … … 336 340 function addVictimAlliance($alliance) 337 341 { 338 $this->vic_all_ .= $alliance->getID() .", ";342 $this->vic_all_ .= $alliance->getID().", "; 339 343 if ($this->vic_plt_ || $this->vic_crp_) 340 344 $this->mixedvictims_ = true; … … 399 403 function setStartDate($timestamp) 400 404 { 401 $this->timeframe_ .= " and kll.kll_timestamp >= '" . $timestamp ."'";405 $this->timeframe_ .= " and kll.kll_timestamp >= '".$timestamp."'"; 402 406 } 403 407 404 408 function setEndDate($timestamp) 405 409 { 406 $this->timeframe_ .= " and kll.kll_timestamp <= '" . $timestamp ."'";410 $this->timeframe_ .= " and kll.kll_timestamp <= '".$timestamp."'"; 407 411 } 408 412 -
dev/common/feed.php
r152 r154 1 1 <?php 2 ////// 3 ////// ////// 4 ////// liq's feed syndication mod v1.3 5 //////////// 6 //////////// 7 //////////// 8 //////////// 9 2 // liq's feed syndication mod v1.3 10 3 11 4 @set_time_limit(0); … … 14 7 require_once("class.killlist.php"); 15 8 require_once("class.kill.php"); 16 require_once("db.php");17 require_once("globals.php");18 9 19 $html .= " 20 <rss version=\"2.0\"> 21 <channel> 22 <title>" . KB_TITLE . "</title> 23 <description>Kill Feed v1.3</description> 24 <link>" . KB_HOST . "</link> 25 <copyright>" . KB_TITLE . "</copyright>\n"; 26 27 $klist = new KillList(); 28 $klist->setPodsNoobShips(true); 29 30 if ($_GET['week']) 31 { 32 $klist->setWeek($_GET['week']); 33 } 34 elseif (!$_GET['lastkllid']) 35 { 36 $klist->setWeek(date("W")); 37 } 38 if ($_GET['lastkllid']) 39 { 40 if (method_exists($klist, 'setMinKllID')) 41 { 42 $klist->setMinKllID($_GET['lastkllid']); 43 } 44 } 45 46 if ($_GET['corp'] || $_GET['corp_name']) 47 { 48 if ($_GET['corp']) 49 { 50 $c = $_GET['corp']; 51 } 52 if ($_GET['corp_name']) 53 { 54 $c = $_GET['corp_name']; 55 } 56 $corp = new Corporation(); 57 $corp->lookup(urldecode($c)); 58 } 59 60 if ($_GET['alli'] || $_GET['alliance_name']) 61 { 62 if ($_GET['alli']) 63 { 64 $a = $_GET['alli']; 65 } 66 if ($_GET['alliance_name']) 67 { 68 $a = $_GET['alliance_name']; 69 } 70 $alli = new Alliance(); 71 $alli->add(urldecode($a)); 72 } 73 74 if ($_GET['week']) 75 { 76 $klist->setWeek($_GET['week']); 77 } 78 elseif (!$_GET['lastkllid']) 79 { 80 $klist->setWeek(date("W")); 81 } 82 83 if ($_GET['losses']) 84 { 85 if (CORP_ID) 86 { 87 $klist->addVictimCorp(new Corporation(CORP_ID)); 88 } 89 if (ALLIANCE_ID) 90 { 91 $klist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 92 } 93 if ($corp) 94 { 95 $klist->addInvolvedCorp($corp); 96 } 97 if ($alli) 98 { 99 $klist->addInvolvedAlliance($alli); 100 } 101 } 102 else 103 { 104 if (CORP_ID) 105 { 106 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 107 } 108 if (ALLIANCE_ID) 109 { 110 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 111 } 112 if ($corp) 113 { 114 $klist->addVictimCorp($corp); 115 } 116 if ($alli) 117 { 118 $klist->addVictimAlliance($alli); 119 } 120 } 121 122 $kills = array(); 123 while ($kill = $klist->getKill()) 124 { 125 $kills[$kill->getID()] = $kill->getTimestamp(); 126 } 127 asort($kills); 128 129 foreach ($kills as $id => $timestamp) 130 { 131 $kill = new Kill($id); 132 $html .= "<item> 133 <title>" . $id . "</title> 134 <description> <![CDATA[ " . $kill->getRawMail() . " ]]> </description> 135 <guid>?a=kill_detail&kll_id=" . $id . "</guid> 136 <pubDate>" . strftime("%a, %d %b %Y %T %Z", strtotime($timestamp)) . "</pubDate> 10 $html .= "<rss version=\"2.0\"> 11 <channel> 12 <title>".KB_TITLE."</title> 13 <description>Kill Feed v1.3</description> 14 <link>".KB_HOST."</link> 15 <copyright>".KB_TITLE."</copyright>\n"; 16 17 $klist = new KillList(); 18 $klist->setPodsNoobShips(true); 19 20 if ($_GET['week']) 21 { 22 $klist->setWeek($_GET['week']); 23 } 24 elseif (!$_GET['lastkllid']) 25 { 26 $klist->setWeek(date("W")); 27 } 28 if ($_GET['lastkllid']) 29 { 30 if (method_exists($klist, 'setMinKllID')) 31 { 32 $klist->setMinKllID($_GET['lastkllid']); 33 } 34 } 35 36 if ($_GET['corp'] || $_GET['corp_name']) 37 { 38 if ($_GET['corp']) 39 { 40 $c = $_GET['corp']; 41 } 42 if ($_GET['corp_name']) 43 { 44 $c = $_GET['corp_name']; 45 } 46 $corp = new Corporation(); 47 $corp->lookup(urldecode($c)); 48 } 49 50 if ($_GET['alli'] || $_GET['alliance_name']) 51 { 52 if ($_GET['alli']) 53 { 54 $a = $_GET['alli']; 55 } 56 if ($_GET['alliance_name']) 57 { 58 $a = $_GET['alliance_name']; 59 } 60 $alli = new Alliance(); 61 $alli->add(urldecode($a)); 62 } 63 64 if ($_GET['week']) 65 { 66 $klist->setWeek($_GET['week']); 67 } 68 elseif (!$_GET['lastkllid']) 69 { 70 $klist->setWeek(date("W")); 71 } 72 73 if ($_GET['losses']) 74 { 75 if (CORP_ID) 76 { 77 $klist->addVictimCorp(new Corporation(CORP_ID)); 78 } 79 if (ALLIANCE_ID) 80 { 81 $klist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 82 } 83 if ($corp) 84 { 85 $klist->addInvolvedCorp($corp); 86 } 87 if ($alli) 88 { 89 $klist->addInvolvedAlliance($alli); 90 } 91 } 92 else 93 { 94 if (CORP_ID) 95 { 96 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 97 } 98 if (ALLIANCE_ID) 99 { 100 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 101 } 102 if ($corp) 103 { 104 $klist->addVictimCorp($corp); 105 } 106 if ($alli) 107 { 108 $klist->addVictimAlliance($alli); 109 } 110 } 111 112 $kills = array(); 113 while ($kill = $klist->getKill()) 114 { 115 $kills[$kill->getID()] = $kill->getTimestamp(); 116 } 117 asort($kills); 118 119 foreach ($kills as $id => $timestamp) 120 { 121 $kill = new Kill($id); 122 $html .= "<item> 123 <title>".$id."</title> 124 <description> <![CDATA[ ".$kill->getRawMail()." ]]> </description> 125 <guid>?a=kill_detail&kll_id=".$id."</guid> 126 <pubDate>".strftime("%a, %d %b %Y %T %Z", strtotime($timestamp))."</pubDate> 137 127 </item>\n"; 138 } 139 $html .= " 140 </channel> 128 } 129 $html .= "</channel> 141 130 </rss>"; 142 143 if ($_GET['gz'])144 145 146 147 148 149 150 131 132 if ($_GET['gz'] || $_GET['compress'] == 1) 133 { 134 echo gzdeflate($html, 9); 135 } 136 else 137 { 138 echo $html; 139 } 151 140 ?> 152 -
dev/common/igb.php
r134 r154 3 3 4 4 $page = new Page("Killboard IGB Menu"); 5 $html = "<a href=\"?a=post_igb\">Post killmail</a> | <a href=\"?a=portrait_grab\">Update portrait</a>";6 5 7 $page->setContent($ html);6 $page->setContent($smarty->fetch(get_tpl('igb'))); 8 7 $page->generate(); 9 8 ?> -
dev/common/kill_detail.php
r135 r154 174 174 } 175 175 176 if ($TotalValue > 0)176 if ($TotalValue >= 0) 177 177 { 178 178 $Formatted = number_format($TotalValue, 2); -
dev/common/kill_import.php
r123 r154 178 178 if ($_SESSION['kill_import']['count'] - $_SESSION['kill_import']['numcount'] > 0) 179 179 { 180 $html .= '<meta http-equiv="refresh" content="5; URL=?a=kill_import" />'; 181 $html .= 'Automatic refresh in 5s<br/>'; 180 182 $html .= '<a href="?a=kill_import">Read next '.$_SESSION['kill_import']['num'].'</a> <a href="?a=kill_import&submit=Reset">Reset</a>'; 181 183 $_SESSION['kill_import']['read'] += $read; -
dev/common/kill_related.php
r125 r154 1 <? 2 require_once( "class.page.php" ); 3 require_once( "class.corp.php" ); 4 require_once( "class.alliance.php" ); 5 require_once( "class.killlist.php" ); 6 require_once( "class.killlisttable.php" ); 7 require_once( "class.killsummarytable.php" ); 8 require_once( "class.box.php" ); 9 10 $kll_id = $_GET['kll_id']; 11 12 $page = new Page( "Related kills & losses" ); 13 14 $kslist = new KillList(); 15 $kslist->setRelated( $kll_id ); 16 if ( CORP_ID ) 17 $kslist->addInvolvedCorp( new Corporation( CORP_ID ) ); 18 if ( ALLIANCE_ID ) 19 $kslist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) ); 20 21 $lslist = new KillList(); 22 $lslist->setRelated( $kll_id ); 23 if ( CORP_ID ) 24 $lslist->addVictimCorp( new Corporation( CORP_ID ) ); 25 if ( ALLIANCE_ID ) 26 $lslist->addVictimAlliance( new Alliance( ALLIANCE_ID ) ); 27 28 $summarytable = new KillSummaryTable( $kslist, $lslist ); 29 $summarytable->setBreak( 6 ); 30 $html .= $summarytable->generate(); 31 32 $klist = new KillList(); 33 $klist->setOrdered( true ); 34 $klist->setRelated( $kll_id ); 35 if ( CORP_ID ) 36 $klist->addInvolvedCorp( new Corporation( CORP_ID ) ); 37 if ( ALLIANCE_ID ) 38 $klist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) ); 39 40 $llist = new KillList(); 41 $llist->setOrdered( true ); 42 $llist->setRelated( $kll_id ); 43 if ( CORP_ID ) 44 $llist->addVictimCorp( new Corporation( CORP_ID ) ); 45 if ( ALLIANCE_ID ) 46 $llist->addVictimAlliance( new Alliance( ALLIANCE_ID ) ); 47 48 if ( $_GET['scl_id'] ) { 49 $klist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ) ); 50 $llist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ) ); 51 } 52 53 $html .= "<div class=kb-kills-header>Related kills</div>"; 54 55 $ktable = new KillListTable( $klist ); 56 $html .= $ktable->generate(); 57 58 $html .= "<div class=kb-losses-header>Related losses</div>"; 59 60 $ltable = new KillListTable( $llist ); 61 $html .= $ltable->generate(); 62 63 $menubox = new Box("Menu"); 64 $menubox->setIcon("menu-item.gif"); 65 $menubox->addOption("caption", "View" ); 66 $menubox->addOption("link", "Kills & losses", "?a=kill_related&kll_id=".$_GET['kll_id'] ); 67 $page->addContext( $menubox->generate() ); 68 69 $page->setContent( $html ); 70 $page->generate(); 1 <?php 2 require_once("class.page.php"); 3 require_once("class.corp.php"); 4 require_once("class.alliance.php"); 5 require_once("class.killlist.php"); 6 require_once("class.killlisttable.php"); 7 require_once("class.killsummarytable.php"); 8 require_once("class.box.php"); 9 10 if (!$kll_id = intval($_GET['kll_id'])) 11 { 12 echo 'No valid kill id specified'; 13 exit; 14 } 15 16 $page = new Page("Related kills & losses"); 17 18 // this is a fast query to get the system and timestamp 19 $rqry = new DBQuery(); 20 $rsql = 'SELECT kll_timestamp, kll_system_id from kb3_kills where kll_id = '.$kll_id; 21 $rqry->execute($rsql); 22 $rrow = $rqry->getRow(); 23 $system = new SolarSystem($rrow['kll_system_id']); 24 25 // now we get all kills in that system for +-12 hours 26 $query = 'SELECT kll.kll_timestamp AS ts FROM kb3_kills kll WHERE kll.kll_system_id='.$rrow['kll_system_id'].' 27 AND kll.kll_timestamp <= date_add( \''.$rrow['kll_timestamp'].'\', INTERVAL \'12\' HOUR ) 28 AND kll.kll_timestamp >= date_sub( \''.$rrow['kll_timestamp'].'\', INTERVAL \'12\' HOUR ) 29 ORDER BY kll.kll_timestamp ASC'; 30 $qry = new DBQuery(); 31 $qry->execute($query); 32 $ts = array(); 33 while ($row = $qry->getRow()) 34 { 35 $time = strtotime($row['ts']); 36 $ts[date('H', $time)][] = $row['ts']; 37 } 38 39 // this tricky thing looks for gaps of more than 1 hour and creates an intersection 40 $baseh = date('H', strtotime($rrow['kll_timestamp'])); 41 $maxc = count($ts); 42 $times = array(); 43 for ($i = 0; $i < $maxc; $i++) 44 { 45 $h = ($baseh+$i) % 24; 46 if (!isset($ts[$h])) 47 { 48 break; 49 } 50 foreach ($ts[$h] as $timestamp) 51 { 52 $times[] = $timestamp; 53 } 54 } 55 for ($i = 0; $i < $maxc; $i++) 56 { 57 $h = ($baseh-$i) % 24; 58 if (!isset($ts[$h])) 59 { 60 break; 61 } 62 foreach ($ts[$h] as $timestamp) 63 { 64 $times[] = $timestamp; 65 } 66 } 67 unset($ts); 68 asort($times); 69 70 // we got 2 resulting timestamps 71 $firstts = array_shift($times); 72 $lastts = array_pop($times); 73 74 $kslist = new KillList(); 75 $kslist->addSystem($system); 76 $kslist->setStartDate($firstts); 77 $kslist->setEndDate($lastts); 78 if (CORP_ID) 79 $kslist->addInvolvedCorp(new Corporation(CORP_ID)); 80 if (ALLIANCE_ID) 81 $kslist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 82 83 $lslist = new KillList(); 84 $lslist->addSystem($system); 85 $lslist->setStartDate($firstts); 86 $lslist->setEndDate($lastts); 87 if (CORP_ID) 88 $lslist->addVictimCorp(new Corporation(CORP_ID)); 89 if (ALLIANCE_ID) 90 $lslist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 91 92 $summarytable = new KillSummaryTable($kslist, $lslist); 93 $summarytable->setBreak(6); 94 $html .= $summarytable->generate(); 95 96 $klist = new KillList(); 97 $klist->setOrdered(true); 98 $klist->addSystem($system); 99 $klist->setStartDate($firstts); 100 $klist->setEndDate($lastts); 101 if (CORP_ID) 102 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 103 if (ALLIANCE_ID) 104 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 105 106 $llist = new KillList(); 107 $llist->setOrdered(true); 108 $llist->addSystem($system); 109 $llist->setStartDate($firstts); 110 $llist->setEndDate($lastts); 111 if (CORP_ID) 112 $llist->addVictimCorp(new Corporation(CORP_ID)); 113 if (ALLIANCE_ID) 114 $llist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 115 116 if ($_GET['scl_id']) 117 { 118 $klist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 119 $llist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 120 } 121 122 function handle_involved($kill, $side) 123 { 124 global $pilots; 125 $qry = new DBQuery(); 126 $sql = "select ind_plt_id, ind_crp_id, ind_all_id, ind_sec_status, 127 ind_shp_id, ind_wep_id 128 from kb3_inv_detail 129 where ind_kll_id = ".$kill->getID()." 130 order by ind_order"; 131 132 $qry->execute($sql); 133 while ($row = $qry->getRow()) 134 { 135 $ship = new Ship($row['ind_shp_id']); 136 $shipc = $ship->getClass(); 137 138 // dont set pods as ships for pilots we already have 139 if (isset($pilots[$side][$row['ind_plt_id']])) 140 { 141 if ($shipc->getID() == 18 || $shipc->getID() == 2) 142 { 143 continue; 144 } 145 } 146 $weapon = new Item($row['ind_wep_id']); 147 $pilot = new Pilot($row['ind_plt_id']); 148 $corp = new Corporation($row['ind_crp_id']); 149 $alliance = new Alliance($row['ind_all_id']); 150 151 $pilots[$side][$row['ind_plt_id']] = array('name' => $pilot->getName(), 'sid' => $ship->getID(), 'spic' => $ship->getImage(32), 'aid' => $row['ind_all_id'], 152 'corp' => $corp->getName(), 'alliance' => $alliance->getName(), 'scl' => $shipc->getPoints(), 153 'ship' => $ship->getName(), 'weapon' => $weapon->getName(), 'cid' => $row['ind_crp_id']); 154 } 155 } 156 157 function handle_destroyed($kill, $side) 158 { 159 global $destroyed, $pilots; 160 161 $destroyed[$kill->getID()] = $kill->getVictimID(); 162 163 $ship = new Ship(); 164 $ship->lookup($kill->getVictimShipName()); 165 $shipc = $ship->getClass(); 166 167 // mark the pilot as podded 168 if ($shipc->getID() == 18 || $shipc->getID() == 2) 169 { 170 global $pods; 171 $pods[] = $kill->getVictimID(); 172 173 // return when we've added him already 174 if (isset($pilots[$side][$kill->getVictimId()])) 175 { 176 return; 177 } 178 } 179 180 $pilots[$side][$kill->getVictimId()] = array('name' => $kill->getVictimName(), 'spic' => $ship->getImage(32), 'scl' => $shipc->getPoints(), 181 'corp' => $kill->getVictimCorpName(), 'alliance' => $kill->getVictimAllianceName(), 'aid' => $kill->getVictimAllianceID(), 182 'ship' => $kill->getVictimShipname(), 'sid' => $ship->getID(), 'cid' => $kill->getVictimCorpID()); 183 } 184 185 $pilots = $destroyed = $pods = array(); 186 $kslist->rewind(); 187 while ($kill = $kslist->getKill()) 188 { 189 handle_involved($kill, 'a'); 190 handle_destroyed($kill, 'e'); 191 } 192 $lslist->rewind(); 193 while ($kill = $lslist->getKill()) 194 { 195 handle_involved($kill, 'e'); 196 handle_destroyed($kill, 'a'); 197 } 198 function cmp_func($a, $b) 199 { 200 if ($a['scl'] > $b['scl']) 201 { 202 return -1; 203 } 204 elseif ($a['scl'] == $b['scl']) 205 { 206 if ($a['ship'] > $b['ship']) 207 { 208 return 1; 209 } 210 return -1; 211 } 212 return 1; 213 } 214 215 function is_destroyed($pilot) 216 { 217 global $destroyed; 218 219 if ($result = array_search((string)$pilot, $destroyed)) 220 { 221 global $smarty; 222 223 $smarty->assign('kll_id', $result); 224 return true; 225 } 226 return false; 227 } 228 229 function podded($pilot) 230 { 231 global $pods; 232 233 if (in_array((string)$pilot, $pods)) 234 { 235 return true; 236 } 237 return false; 238 } 239 240 // sort arrays, ships with high points first 241 uasort($pilots['a'], 'cmp_func'); 242 uasort($pilots['e'], 'cmp_func'); 243 $smarty->assign_by_ref('pilots_a', $pilots['a']); 244 $smarty->assign_by_ref('pilots_e', $pilots['e']); 245 246 $pod = new Ship(6); 247 $smarty->assign('podpic', $pod->getImage(32)); 248 $smarty->assign('friendlycnt', count($pilots['a'])); 249 $smarty->assign('hostilecnt', count($pilots['e'])); 250 $smarty->assign('system', $system->getName()); 251 $smarty->assign('firstts', $firstts); 252 $smarty->assign('lastts', $lastts); 253 254 $html .= $smarty->fetch(get_tpl('battle_overview')); 255 256 $html .= "<div class=kb-kills-header>Related kills</div>"; 257 258 $ktable = new KillListTable($klist); 259 $html .= $ktable->generate(); 260 261 $html .= "<div class=kb-losses-header>Related losses</div>"; 262 263 $ltable = new KillListTable($llist); 264 $html .= $ltable->generate(); 265 266 $menubox = new Box("Menu"); 267 $menubox->setIcon("menu-item.gif"); 268 $menubox->addOption("caption", "View"); 269 $menubox->addOption("link", "Kills & losses", "?a=kill_related&kll_id=".$_GET['kll_id']); 270 $page->addContext($menubox->generate()); 271 272 $page->setContent($html); 273 $page->generate(); 71 274 ?> -
dev/common/portrait.php
r134 r154 28 28 } 29 29 30 if (file_exists("cache/portraits/".$id."_ 128.jpg"))30 if (file_exists("cache/portraits/".$id."_256.jpg")) 31 31 { 32 $img = imagecreatefromjpeg("cache/portraits/".$id."_ 128.jpg");32 $img = imagecreatefromjpeg("cache/portraits/".$id."_256.jpg"); 33 33 } 34 34 else 35 35 { 36 $file = @file_get_contents("http://img.eve.is/serv.asp?s= 128&c=".$id);36 $file = @file_get_contents("http://img.eve.is/serv.asp?s=256&c=".$id); 37 37 if ($img = imagecreatefromstring($file)) 38 38 { 39 $fp = fopen("cache/portraits/".$id."_ 128.jpg", "w");39 $fp = fopen("cache/portraits/".$id."_256.jpg", "w"); 40 40 fwrite($fp, $file); 41 41 fclose($fp); … … 47 47 require_once("class.http.php"); 48 48 49 $url = "http://img.eve.is/serv.asp?s= 128&c=".$id;49 $url = "http://img.eve.is/serv.asp?s=256&c=".$id; 50 50 $http = new http_request($url); 51 51 $file = $http->get_content(); … … 53 53 if ($img = imagecreatefromstring($file)) 54 54 { 55 $fp = fopen("cache/portraits/".$id."_ 128.jpg", "w");55 $fp = fopen("cache/portraits/".$id."_256.jpg", "w"); 56 56 fwrite($fp, $file); 57 57 } … … 62 62 { 63 63 $newimg = imagecreatetruecolor($size, $size); 64 imagecopyresampled($newimg, $img, 0, 0, 0, 0, $size, $size, 128, 128);65 imagejpeg($newimg, $portrait, 9 5);64 imagecopyresampled($newimg, $img, 0, 0, 0, 0, $size, $size, 256, 256); 65 imagejpeg($newimg, $portrait, 90); 66 66 header("Content-Type: image/jpeg"); 67 67 readfile($portrait); -
dev/templates/index.tpl
r132 r154 12 12 </head> 13 13 <body bgcolor="#222222" {$on_load} style="height: 100%"> 14 <div align="center" id="popup" style="display:none; 15 position:absolute; 16 top:217px; width:99%; 14 <div align="center" id="popup" style="display:none; 15 position:absolute; 16 top:217px; width:99%; 17 17 z-index:3; 18 18 padding: 5px;"></div> -
dev/templates/killlisttable.tpl
r123 r154 20 20 onmouseover="this.className='kb-table-row-hover';" onClick="window.location.href='?a=kill_detail&kll_id={$k.id}';"> 21 21 <td width="32" align="center"><img src="{$k.victimshipimage}" border="0" width="32" heigth="32"></td> 22 <td height="34" width=150 valign=" center"><div class="kb-shiptype"><b>{$k.victimshipname}</b><br>{$k.victimshipclass}</div><div class="kb-shipicon"><img src="{$k.victimshipindicator}" border="0"></div></td>22 <td height="34" width=150 valign="middle"><div class="kb-shiptype"><b>{$k.victimshipname}</b><br>{$k.victimshipclass}</div><div class="kb-shipicon"><img src="{$k.victimshipindicator}" border="0"></div></td> 23 23 <td width="200" class="kb-table-cell"><b>{$k.victim}</b><br/>{$k.victimcorp|truncate:30}</td> 24 24 <td width="200" class="kb-table-cell"><b>{$k.fb}</b><br>{$k.fbcorp|truncate:30}</td>