Changeset 370
- Timestamp:
- 06/14/09 06:51:49 (13 years ago)
- Location:
- dev
- Files:
-
- 76 added
- 1 removed
- 160 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/README.txt
r317 r370 1 This is the EDK - EVE Development Network Killboard v1.4 - Trinity Edition 1 ------------------------------------------- 2 Eve Development Network Killboard v2.0.0 3 ------------------------------------------- 2 4 3 Check out the EVE-Development Network for support, 4 bugfixes and new versions at www.eve-dev.net... 5 Incorporates changes and additional mods from Alvar's EDK Full Package v150.13Apoc.33.2622.0 6 7 VERSION HISTORY 8 ------------------------------------------- 9 v2.0.0 RC1 (svn 370) 10 - Database structure changed 11 - SQL queries optimised for speed and error protection. 12 - feed syndication optimised 13 - front page includes optional clock and optional kill/loss display 14 - mysqli support added 15 - transaction protection of kills added where supported 16 - summary tables and contracts show total destroyed value instead of ship value 17 - html errors reduced 18 - related kill calculation improved 19 - query caching errors reduced 20 - minor bugfixes 21 - Smarty 2.6.25 added 22 - apoc fitting mod added and modified 23 - code optimisations 24 - comments added (doxygen format) 25 - conflicting mods are now identified 26 27 // Alvar Package VERSION HISTORY 28 ------------------------------------------- 29 v150.10Apoc.29.2622.0 - Initial Release 30 - This was the basic build as above but only for the QR information. 31 - Included updated Smarty to 2.6.2.2 32 33 v150.11Apoc.30.2622.0 - Updates for Apocrypha 34 - Updated the API to 3.0 35 - Added the Corp Logo mod 36 - Added the Apoc dB dump 1.1 from FriedRoadKill 37 38 v150.11Apoc.30.2622.1 - Updates for Missing files 39 - Added missing files for core mod: rank mod 40 - Added the missing parser files for the latest version 41 - class.registry.php included to fix borking api 42 43 v150.12Apoc.32.2622.0 - Updates for 44 - Update to API to 3.2 45 - Added the Apoc dB dump 1.2 from FriedRoadKill 46 - Updated the Version nomenclature. 47 48 v150.13Apoc.33.2622.0 - Updates for 49 - Update API to 3.3 50 - Updated the Apoc dB dump 1.3 from FRK 51 - Added the Apoc Fitting screen 1.3 by btcentral 52 - Removed the "Non Installed Mods" folder 53 - Removed the "Alvar" style 54 55 56 57 // VERSION NOMENCLATURE 58 ------------------------------------------- 59 [Base Ver].[dB Ver].[API Ver].[Smarty Ver].[Change Release TB] 60 v150.12Apoc.32.2622.0 is 61 - Base 1.5.0 62 - Database 1.2 for Apocrypha 63 - API module is to 3.2 64 - Smarty 2.6.2.2 65 - Change release for undetailed fixes (missing class files etc) 66 67 68 69 // BUILT FROM 1.4 CORE v368 70 ------------------------------------------- 71 72 73 // MODS INCLUDED IN THIS PACKAGE 74 ------------------------------------------- 75 API v3.3 ....................... Capt Thunk 76 Corp Logo Generator ............ Capt Thunk 77 Mail Editor 0.9.1 ........... FriedRoadKill 78 Extended Fitting Mod .......... Unknown ATM 79 Apoc Fitting Mod................. btcentral 80 81 82 // SUPPORT 83 ------------------------------------------- 84 Web: http://eve-id.net/forum/ 85 86 Check out the EVE-Development Network for 87 general support, bugfixes and new versions 88 at http://www.eve-id.net 89 5 90 Developers wanted! 6 If you'd like to contribute to further version of this killboard, sign up for the EVE-Dev forums! 91 If you'd like to contribute to further version 92 of this killboard, sign up for the EVE-Dev forums! 7 93 8 Requirements: 9 94 // REQUIREMENTS 95 ------------------------------------------- 10 96 - Webserver (apache) 11 97 - PHP 4.0.9+ 12 - Mysql 3.23.+98 - Mysql 4.10.+ 13 99 - GD 2 or higher 14 100 15 Setup:16 101 17 - Upload the whole package to a webhost 18 - Point your webbrowser to /install inside the EDK-Directory 102 // SETUP 103 ------------------------------------------- 104 - Upload the whole package to a webhost** 105 - Point your webbrowser to /install inside the 106 EDK-Directory 19 107 - Follow the instructions 20 - Don't forget to delete the install folder after installation or restrict the access to it! 108 - Don't forget to delete the install folder after 109 installation or restrict the access to it! 21 110 - Have fun ;) 22 111 112 o/ EVE Development Network 23 113 24 o/ EVE Development Network 114 115 ** Alvar recommends the use of FileZilla (free) to 116 upload the files, as it has a built in easy to use 117 error log, that allows you to upload files if they 118 time out or error on the upload due to server 119 settings. 120 -
dev/cache
- Property svn:ignore
-
old new 1 * 1
-
- Property svn:ignore
-
dev/common/about.php
r355 r370 6 6 // i store the names here for an easy edit 7 7 $developer = array('exi (Lead Developer)', 8 'Beansman (Developer)', 9 'Ralle030583 (Developer)'); 8 'Beansman (Developer)', 9 'Ralle030583 (Developer)', 10 'Hon Kovell (Developer)'); 10 11 11 12 $contributor = array('JaredC01', 12 13 14 15 16 17 18 13 'liquidism', 14 'Mitchman', 15 'Coni', 16 'FriedRoadKill', 17 'bunjiboys', 18 'Karbowiak', 19 'EDG'); 19 20 sort($contributor); 20 21 … … 24 25 // Remember to share any modifications to the EVE-Dev Killboard. 25 26 $html .= "This is the EVE Development Network Killboard running version ".KB_VERSION." ".KB_RELEASE." rev ".SVN_REV.", created for <a href=\"http://www.eve-online.com/\">EVE Online</a> corporations and alliances. Based on the EVE-Killboard created by rig0r, it is now developed and maintained by the <a href=\"http://www.eve-dev.net/\">EVE-Dev</a> group.<br/>" 26 27 ."All EVE graphics and data used are property of <a href=\"http://www.ccpgames.com/\">CCP</a>.<br/><br/>"; 27 28 $html .= '<a href="http://www.eve-dev.net/" target="_blank"><img src="http://www.eve-dev.net/logo.png" border="0"/></a><br/><br/>'; 28 29 … … 53 54 $html .= "This killboard currently contains: <b>" . number_format($kills, 0, ',', '.') . "</b> killmails, <b>" . number_format($items, 0, ',', '.') . "</b> destroyed items, <b>" . number_format($pilots, 0, ',', '.') . "</b> pilots, <b>" . number_format($corps, 0, ',', '.') . "</b> corporations and <b>" . number_format($alliances, 0, ',', '.') . "</b> alliances.<br><br>"; 54 55 55 $html .= "<div class=block-header2>Portraits</div>";56 $html .= "In order to make your charater portrait visable on the killboard, please take the time to visit the killboard using the ingame browser and choose the option: 'Update portrait'.<br><br>";57 $html .= "When prompted to trust the site choose YES, at this point the killboard will obtain your character ID and record it within the database.<br><br>";58 59 56 $html .= "<div class=block-header2>Kills & Real kills</div>"; 60 57 $html .= "'Kills' - The count of all kills by an entity. <br>'Real kills' - This is the count of recorded kills minus any pod, shuttle and noobship kills. <br><p> The 'Real kills' value is used throughout all award and statistic pages.<br><br>"; … … 82 79 while ($row = $qry->getRow()) 83 80 { 84 85 81 $shipclass = new ShipClass($row['scl_id']); 82 $html .= "<tr class=kb-table-row-odd><td>".$shipclass->getName()."</td><td align=\"right\">".number_format($shipclass->getValue()*1000000,0,',','.')."</td><td align=\"right\">".number_format($shipclass->getPoints(),0,',','.')."</td><td align=center><img class=ship src=\"" . $shipclass->getValueIndicator() . "\" border=\"0\"></td></tr>"; 86 83 } 87 84 $html .= "</table>"; … … 89 86 function getVictimShipValueIndicator($value) 90 87 { 91 92 93 94 95 96 97 98 99 100 101 102 103 104 88 if ($value >= 0 && $value <= 1) 89 $color = "gray"; 90 elseif ($value > 1 && $value <= 15) 91 $color = "blue"; 92 elseif ($value > 15 && $value <= 25) 93 $color = "green"; 94 elseif ($value > 25 && $value <= 40) 95 $color = "yellow"; 96 elseif ($value > 40 && $value <= 80) 97 $color = "red"; 98 elseif ($value > 80 && $value <= 250) 99 $color = "orange"; 100 elseif ($value > 250 && $value) 101 $color = "purple"; 105 102 106 103 return IMG_URL . "/ships/ship-" . $color . ".gif"; 107 104 } 108 105 109 106 if (config::get('ship_values')) 110 107 { 111 108 $sql = 'select kbs.shp_id as id, shp.shp_name, kbs.shp_value, 112 109 shp.shp_techlevel, scl.scl_class, scl.scl_points 113 110 from kb3_ships_values kbs … … 115 112 inner join kb3_ship_classes scl on (shp.shp_class = scl.scl_id) 116 113 order by shp.shp_name asc'; 117 118 119 120 121 122 123 124 125 126 127 128 129 130 114 $html .= "<br/>Custom shipvalues which override the value from shipclasses:<br><br>"; 115 $qry = new DBQuery(); 116 $qry->execute($sql); 117 $html .= "<table class=kb-table cellspacing=1>"; 118 $html .= "<tr class=kb-table-header><td width=160>Ship Name</td><td>Ship Class</td><td>Points</td><td align=\"right\">Value in ISK</td></tr>"; 119 while ($row = $qry->getRow()) 120 { 121 if ($row['shp_techlevel'] == 2) 122 { 123 $row['shp_name'] = '<img src="'.IMG_URL.'/items/32_32/t2.gif">'.$row['shp_name']; 124 } 125 $html .= "<tr class=kb-table-row-odd><td>".$row['shp_name']." </td><td>".$row['scl_class']." </td><td align=\"right\">".number_format($row['scl_points'],0,',','.')."</td><td align=\"right\"> ".number_format($row['shp_value'],0,',','.')." <img src=\"".getVictimShipValueIndicator($row['shp_value']/1000000)."\"></td></tr>"; 126 } 127 $html .= "</table>"; 131 128 } 132 129 -
dev/common/admin/admin_apimod.php
r365 r370 6 6 7 7 require_once('common/includes/class.eveapi.php'); 8 require_once('common/includes/class.apicache.php'); 8 9 require_once("common/admin/admin_menu.php"); 9 10 10 $page = new Page("Settings - API Mod " . APIVERSION . ' (<a href="http://eve-id.net/forum/viewtopic.php?f=505&t=8827" ><font size="3">Support</font></a>)');11 $page = new Page("Settings - API Mod " . APIVERSION); 11 12 $page->setCachable(false); 12 13 $page->setAdmin(); … … 14 15 $isupdated = false; 15 16 17 // check db update for API fields 18 if (config::get('API_DBUpdate') != 1) 19 checkDBforAPI(); 20 16 21 if ($_GET['CharID']) 17 22 { 18 23 if ($_GET['SetNum']) 19 24 { 20 $config->set("API_CharID_" . $_GET["SetNum"], $_GET["CharID"]);25 config::set("API_CharID_" . $_GET["SetNum"], $_GET["CharID"]); 21 26 $html .= "Character updated."; 22 27 } … … 51 56 } 52 57 } 58 59 // Set cachetimes in variable array (solves unable to read last cachetime problem when importing 60 $apicachetime[$i] = ApiCache::get("API_CachedUntil_" . $i); 53 61 } 54 62 … … 57 65 $deld = 0; 58 66 $dsize = 0; 59 $cachepath = 'cache/api/*';67 $cachepath = getcwd().'/cache/api/*'; 60 68 $match = "*"; 61 69 … … 69 77 } 70 78 } 79 // drop table 80 $db = new DBQuery(true); 81 $db->execute("TRUNCATE TABLE `kb3_apicache`"); 71 82 $html .= "Cache cleared.<br>"; 83 $html .= "<script type=\"text/javascript\">window.location = \"?a=admin_apimod\"</script>"; //*/ 72 84 } 73 85 … … 85 97 config::del('API_CharID_' . $i); 86 98 config::del('API_Type_' . $i); 87 config::del('API_CachedUntil_' . $i);99 ApiCache::del('API_CachedUntil_' . $i); 88 100 } 89 101 } 90 102 for ($i = 1; $i <= $keycount; $i++) 91 103 { 92 $config->set("API_Name_" . $i . "", $_POST["API_Name_" . $i]);93 $config->set("API_Key_" . $i . "", $_POST["API_Key_" . $i]);94 $config->set("API_UserID_" . $i . "", $_POST["API_UserID_" . $i]);95 $config->set("API_CharID_" . $i . "", $_POST["API_CharID_" . $i]);104 config::set("API_Name_" . $i . "", $_POST["API_Name_" . $i]); 105 config::set("API_Key_" . $i . "", $_POST["API_Key_" . $i]); 106 config::set("API_UserID_" . $i . "", $_POST["API_UserID_" . $i]); 107 config::set("API_CharID_" . $i . "", $_POST["API_CharID_" . $i]); 96 108 if ($_POST["API_Type_". $i] == "char") 97 $config->set("API_Type_" . $i, "char");109 config::set("API_Type_" . $i, "char"); 98 110 else 99 $config->set("API_Type_" . $i, "corp");111 config::set("API_Type_" . $i, "corp"); 100 112 } 101 113 … … 150 162 config::set('API_MultipleMode', '1'); 151 163 164 if ($_POST['API_CCPErrorCorrecting']) 165 config::set('API_CCPErrorCorrecting', '0'); 166 else 167 config::set('API_CCPErrorCorrecting', '1'); 168 169 if ($_POST['API_extendedtimer_sovereignty']) 170 config::set('API_extendedtimer_sovereignty', '0'); 171 else 172 config::set('API_extendedtimer_sovereignty', '1'); 173 174 if ($_POST['API_extendedtimer_alliancelist']) 175 config::set('API_extendedtimer_alliancelist', '0'); 176 else 177 config::set('API_extendedtimer_alliancelist', '1'); 178 179 if ($_POST['API_extendedtimer_conq']) 180 config::set('API_extendedtimer_conq', '0'); 181 else 182 config::set('API_extendedtimer_conq', '1'); 183 184 if ($_POST['API_extendedtimer_facwarsystems']) 185 config::set('API_extendedtimer_facwarsystems', '0'); 186 else 187 config::set('API_extendedtimer_facwarsystems', '1'); 188 189 //if ($_POST['API_ForceDST']) 190 //config::set('API_ForceDST', '0'); 191 //else 192 //config::set('API_ForceDST', '1'); 193 194 if ($_POST['API_ConvertTimestamp']) 195 config::set('API_ConvertTimestamp', '0'); 196 else 197 config::set('API_ConvertTimestamp', '1'); 198 152 199 $html .= "Settings Saved.<br>"; 153 200 } … … 155 202 if ($_POST['import'] || isset($_GET['Process'])) 156 203 { 157 158 204 // Importing of mails 159 205 $myEveAPI = new API_KillLog(); … … 172 218 { // save output to file and load when complete 173 219 $i = $processindex; 174 $myEveAPI->Output_ .= "Importing Mails for " . $config->get("API_Name_" . $i) . "<br>";220 $myEveAPI->Output_ .= "Importing Mails for " . config::get("API_Name_" . $i) . "<br>"; 175 221 $keystring = 'userID=' . config::get('API_UserID_' . $i) . '&apiKey=' . config::get('API_Key_' . $i) . '&characterID=' . config::get('API_CharID_' . $i); 176 222 $typestring = config::get("API_Type_" . $i); 177 $ keyindex = $i;178 $outputdata .= $myEveAPI->Import($keystring, $typestring, $keyindex);223 $outputdata .= $myEveAPI->Import($keystring, $typestring, $i); 224 $apicachetime[$i] = $myEveAPI->CachedUntil_; 179 225 180 $file = @fopen( 'cache/data/report.txt', 'a');226 $file = @fopen(getcwd().'/cache/data/report.txt', 'a'); 181 227 fwrite($file, $outputdata); 182 228 fclose($file); 183 229 184 config::set('API_CachedUntil_' . $keyindex, $myEveAPI->cachetext_);230 //ApiCache::set('API_CachedUntil_' . $keyindex, $myEveAPI->cachetext_); 185 231 $processindex++; 186 232 if ($processindex <= $keycount) … … 189 235 $html .= "<script type=\"text/javascript\">window.location = \"?a=admin_apimod&Process=" .$processindex . "\"</script>"; //*/ 190 236 } else { // load report.txt to $html 191 $fp = @fopen( 'cache/data/report.txt', 'r');192 $html .= fread($fp, 1000000);237 $fp = @fopen(getcwd().'/cache/data/report.txt', 'r'); 238 $html .= fread($fp, filesize(getcwd().'/cache/data/report.txt')); 193 239 fclose($fp); 194 @unlink('cache/data/report.txt'); // delete file, it was temporary 240 @unlink(getcwd().'/cache/data/report.txt'); // delete file, it was temporary 241 195 242 } 196 243 } else { 197 244 for ( $i = 1; $i <= $keycount; $i++ ) 198 245 { 199 $myEveAPI->Output_ .= "Importing Mails for " . $config->get("API_Name_" . $i) . "<br>";246 $myEveAPI->Output_ .= "Importing Mails for " . config::get("API_Name_" . $i) . "<br>"; 200 247 $keystring = 'userID=' . config::get('API_UserID_' . $i) . '&apiKey=' . config::get('API_Key_' . $i) . '&characterID=' . config::get('API_CharID_' . $i); 201 248 $typestring = config::get("API_Type_" . $i); 202 $html .= $myEveAPI->Import($keystring, $typestring, $keyindex); 203 config::set('API_CachedUntil_' . $i, $myEveAPI->cachetext_); 249 //$myEveAPI->cachetext_ = ""; 250 //$myEveAPI->cacheflag_ = false; 251 $html .= $myEveAPI->Import($keystring, $typestring, $i); 252 $apicachetime[$i] = $myEveAPI->CachedUntil_; 204 253 } 205 254 } … … 210 259 $deld = 0; 211 260 $dsize = 0; 212 $cachepath = 'cache/api/*';261 $cachepath = getcwd().'/cache/api/*'; 213 262 $match = "*"; 214 263 … … 221 270 } 222 271 223 // API Settings 224 $html .= "<div class=block-header2>API Key Details (must be CEO/Director to retrieve corp mails)</div>"; 225 $html .= "<form id=options name=options method=post action=?a=admin_apimod>"; 226 227 // Key Details 228 for ( $i = 1; $i <= $keycount; $i++ ) 229 { 230 $characteridentitifier = $config->get("API_CharID_" . $i); 231 $html .= "<table class=kb-subtable>"; 232 $html .= "<tr><td>Key Name #" . $i .":</td><td><input type=\"text\" name=\"API_Name_" . $i . "\" value=\"".$config->get("API_Name_" . $i) . "\"> (This is just to remind yourself which key is being used)</td></tr>"; 233 $html .= "<tr><td>Full API Key #" . $i . ":</td><td><input type=\"password\" size=26 name=\"API_Key_" . $i . "\" value=\"".$config->get("API_Key_" . $i) . "\"></td></tr>"; 234 $html .= "<tr><td>API CharID #" . $i . ":</td><td><input type=\"text\" name=\"API_CharID_" . $i . "\" value=\"" . $characteridentitifier . "\">"; 235 if ($characteridentitifier != "") { 236 $html .= getPlayerDetails($characteridentitifier); 237 } 238 if ($config->get("API_Key_" . $i) != "" && $config->get("API_UserID_" . $i) != "") { 239 $html .= "</td></td><td colspan=\"2\"><input type=submit id=\"w00t\"" . " name=select" . $i . " value=\"Select Character\">"; 240 } 241 $html .= "<td></tr>"; 242 $html .= "<tr><td>API UserID #" . $i . ":</td><td><input type=\"text\" name=\"API_UserID_" . $i . "\" value=\"".$config->get("API_UserID_" . $i) . "\"></td></tr>"; 243 $html .= "<tr><td>Key Type #" . $i .":</td>"; 244 $html .= "<td>Corp <input type=\"radio\" name=\"API_Type_" . $i . "\" value=\"corp\" "; 245 if ($config->get("API_Type_" . $i) != "char") { 246 $html .= "checked"; 247 } 248 $html .= ">"; 249 $html .= " Player <input type=\"radio\" name=\"API_Type_" . $i . "\" value=\"char\" "; 250 if ($config->get("API_Type_" . $i) == "char") { 251 $html .= "checked"; 252 } 253 $html .= "></td></tr>"; 254 $cachetime = $config->get("API_CachedUntil_" . $i); 255 if ($cachetime == "") 256 { 257 $cachetime = "unknown"; 258 $txtcolour = "<font color = \"#FF0000\">"; 259 } else { 260 if (strtotime(gmdate("M d Y H:i:s")) - strtotime($cachetime) > 0) 261 { 262 $txtcolour = "<font color = \"#00FF00\">"; 263 //$txtcolour = "<style=\"color:green\">"; 264 } else { 265 $txtcolour = "<font color = \"#FF0000\">"; 266 } 267 } 268 $html .= "<tr><td>Data is cached until:</td><td>" . $txtcolour . $cachetime . "</font></td></tr>"; 269 $html .= "</table><br>"; 270 } 271 $html .= "<table class=api-keys>"; 272 $html .= "<tr><td height=30px width=150px>Number of API Keys:</td>"; 273 $html .= "<td><input type=text name=API_Key_count size=2 maxlength=2 class=password value=\"" . $keycount . "\"></td></tr>"; 274 $html .= "</table><br>"; 275 $html .= "<i> Your UserID and API FULL Key can be obtained <a href=\"http://myeve.eve-online.com/api/default.asp\">here</a></i><br>"; 276 $html .= "<i> Once your UserID and API Key have been entered and the settings saved you can then select the available character IDs if you don't know them by clicking the \"select character\" button that appears and then clicking the character name</i><br><br>"; 277 // General API Options 278 $html .= "<div class=block-header2>General API Options</div><table>"; 279 280 $html .= "<tr><td height=30px width=150px>Enable API XML Caching?</td>"; 281 $html .= "<td><input type=checkbox name=API_UseCache id=API_UseCache"; 282 if (!config::get('API_UseCache')) 283 $html .= " checked=\"checked\""; 284 $html .= "></tr>"; 285 $html .= "<tr><td>(" . $deld . " files with a total size of " . $dsize . " bytes)</td></tr>"; 286 287 $html .= "<tr><td height=\"10\"></td></tr>"; // spacer 288 $html .= "<tr><td colspan=\"2\"><input type=submit id=submit name=clearapicache value=\"Clear Cache\"><td></tr>"; 289 290 $html .= "</table>"; 291 // Killmail Parser Options 292 $html .= "<div class=block-header2>Killmail API Parsing Options</div><table>"; 293 $html .= "<tr><td height=50px width=150px>Comment for automatically parsed killmails?</td>"; 294 $html .= "<td><input type=text size=50 class=password name=API_Comment id=API_Comment value=\""; 295 if (config::get('API_Comment')) 296 $html .= config::get('API_Comment'); 297 $html .= "\"><br><i> (leave blank for none)</i><br></td></tr>"; 298 $html .= "<tr><td height=30px width=150px>Update Portraits?</td>"; 299 $html .= "<td><input type=checkbox name=API_Update id=API_Update"; 300 if (!config::get('API_Update')) 301 $html .= " checked=\"checked\""; 302 $html .= "></tr>"; 303 304 $html .= "<tr><td height=30px width=150px>Ignore NPC only deaths? <i>(This includes kills by POSs)</i></td>"; 305 $html .= "<td><input type=checkbox name=API_IgnoreNPC id=API_IgnoreNPC"; 306 if (!config::get('API_IgnoreNPC')) 307 $html .= " checked=\"checked\""; 308 $html .= "></tr>"; 309 310 $html .= "<tr><td height=30px width=150px>Ignore Friendly Fire? </td>"; 311 $html .= "<td><input type=checkbox name=API_IgnoreCorpFF id=API_IgnoreCorpFF"; 312 if (!config::get('API_IgnoreCorpFF')) 313 $html .= " checked=\"checked\""; 314 $html .= "<td> Corps <input type=checkbox name=API_IgnoreAllianceFF id=API_IgnoreAllianceFF"; 315 if (!config::get('API_IgnoreAllianceFF')) 316 $html .= " checked=\"checked\""; 317 $html .= "> Alliance</tr>"; 318 319 $html .= "<tr><td height=30px width=150px>Ignore POS Structures? </td>"; 320 $html .= "<td><input type=checkbox name=API_IgnoreFriendPos id=API_IgnoreFriendPos"; 321 if (!config::get('API_IgnoreFriendPos')) 322 $html .= " checked=\"checked\""; 323 $html .= "<td> Friend <input type=checkbox name=API_IgnoreEnemyPos id=API_IgnoreEnemyPos"; 324 if (!config::get('API_IgnoreEnemyPos')) 325 $html .= " checked=\"checked\""; 326 $html .= "> Enemy</tr>"; 327 328 $html .= "<tr><td height=30px width=150px>Concise cronjob e-mail? </td>"; 329 $html .= "<td><input type=checkbox name=API_NoSpam id=API_NoSpam"; 330 if (!config::get('API_NoSpam')) 331 $html .= " checked=\"checked\""; 332 $html .= "></tr>"; 333 334 $html .= "<tr><td height=30px width=150px>Import multiple keys one at a time? </td>"; 335 $html .= "<td><input type=checkbox name=API_MultipleMode id=API_MultipleMode"; 336 if (!config::get('API_MultipleMode')) 337 $html .= " checked=\"checked\""; 338 $html .= "></tr>"; 339 // Import 340 $html .= "<tr><td height=\"10\"></td></tr>"; // spacer 341 $html .= "<tr><td colspan=\"2\"><input type=submit id=submit name=import value=\"Import Mails\"><td></tr>"; 342 $html .= "</table>"; 343 // Save 272 if ($_POST['apilog']) 273 { 274 $html .= "<div class=block-header2>API Log</div>"; 275 $html .= "<form id=options name=options method=post action=?a=admin_apimod>"; 276 277 $sql = 'SELECT * 278 FROM kb3_apilog 279 WHERE log_site = "' .KB_SITE . '" 280 ORDER BY log_timestamp DESC limit 250'; 281 282 $qry = new DBQuery(); 283 $qry->execute($sql) or die($qry->getErrorMsg()); 284 285 $html .= '<table class="kb-table">'; 286 $html .= "<tr class=kb-table-header><td align=center width=150>Key Name</td><td width=60>Posted</td><td width=60>Malformed</td><td width=60>Ignored</td><td width=60>Verified</td><td width=80>Total Mails</td><td width=60>Source</td><td width=60>Type</td><td width=150>Time Stamp</td></tr>"; 287 $odd = false; 288 while ($row = $qry->getRow()) 289 { 290 if ($odd) 291 { 292 $class = "kb-table-row-even"; 293 $odd = false; 294 } 295 else 296 { 297 $class = "kb-table-row-odd"; 298 $odd = true; 299 } 300 // colour checks - makes things clearer 301 $numposted = $row['log_posted']; 302 $numerrors = $row['log_errors']; 303 $numverified = $row['log_verified']; 304 $numignored = $row['log_ignored']; 305 $datasource = $row['log_source']; 306 307 if ( $numposted > 0 ) 308 $numposted = "<font color = \"#00FF00\">" . $numposted . "</font>"; 309 if ( $numverified > 0 ) 310 $numverified = "<font color = \"#00FF00\">" . $numverified . "</font>"; 311 if ( $numerrors > 0 ) 312 $numerrors = "<font color = \"#FF0000\">" . $numerrors . "</font>"; 313 if ( $numignored > 0 ) 314 $numignored = "<font color = \"#FF0000\">" . $numignored . "</font>"; 315 if ( $datasource == "Error" ) 316 $datasource = "<font color = \"#FF0000\">" . $datasource . "</font>"; 317 if ( $datasource == "New XML" ) 318 $datasource = "<font color = \"#00FF00\">" . $datasource . "</font>"; 319 320 $html .= "<tr class=" . $class . ">"; 321 $html .= "<td align=center><b>" . $row['log_keyname'] . "</b></td>"; 322 $html .= "<td>" . $numposted . "</td>"; 323 $html .= "<td>" . $numerrors . "</td>"; 324 $html .= "<td>" . $numignored . "</td>"; 325 $html .= "<td>" . $numverified . "</td>"; 326 $html .= "<td>" . $row['log_totalmails'] . "</td>"; 327 $html .= "<td>" . $datasource . "</td>"; 328 $html .= "<td>" . $row['log_type'] . "</td>"; 329 $html .= "<td>" . $row['log_timestamp'] . "</td>"; 330 $html .= "</tr>"; 331 } 332 $html .= "</table>"; 333 334 $html .= "<br>"; 335 $html .= "<table><tr><td width=60><input type=\"submit\" name=\"back\" value=\"Back\" width=60></td></tr></table>"; 336 $html .= "</form>"; 337 338 } else { 339 // API Settings 340 $html .= "<div class=block-header2>API Key Details (must be CEO/Director to retrieve corp mails)</div>"; 341 $html .= "<form id=options name=options method=post action=?a=admin_apimod>"; 342 343 // show current server time 344 $html .= "Servers current time: <font color = \"#00FF00\">" . date("M d Y H:i") . "</font><br><br>"; 345 346 // Key Details 347 for ( $i = 1; $i <= $keycount; $i++ ) 348 { 349 $characteridentitifier = config::get("API_CharID_" . $i); 350 $html .= "<table class=kb-subtable>"; 351 $html .= "<tr><td>Key Name #" . $i .":</td><td><input type=\"text\" name=\"API_Name_" . $i . "\" value=\"".config::get("API_Name_" . $i) . "\"> (This is just to remind yourself which key is being used)</td></tr>"; 352 $html .= "<tr><td>Full API Key #" . $i . ":</td><td><input type=\"password\" size=26 name=\"API_Key_" . $i . "\" value=\"".config::get("API_Key_" . $i) . "\"></td></tr>"; 353 $html .= "<tr><td>API CharID #" . $i . ":</td><td><input type=\"text\" name=\"API_CharID_" . $i . "\" value=\"" . $characteridentitifier . "\">"; 354 if ($characteridentitifier != "") { 355 $html .= getPlayerDetails($characteridentitifier); 356 } 357 if (config::get("API_Key_" . $i) != "" && config::get("API_UserID_" . $i) != "") { 358 $html .= "</td></td><td colspan=\"2\"><input type=submit id=\"w00t\"" . " name=select" . $i . " value=\"Select Character\">"; 359 } 360 $html .= "<td></tr>"; 361 $html .= "<tr><td>API UserID #" . $i . ":</td><td><input type=\"text\" name=\"API_UserID_" . $i . "\" value=\"".config::get("API_UserID_" . $i) . "\"></td></tr>"; 362 $html .= "<tr><td>Key Type #" . $i .":</td>"; 363 $html .= "<td>Corp <input type=\"radio\" name=\"API_Type_" . $i . "\" value=\"corp\" "; 364 if (config::get("API_Type_" . $i) != "char") { 365 $html .= "checked"; 366 } 367 $html .= ">"; 368 $html .= " Player <input type=\"radio\" name=\"API_Type_" . $i . "\" value=\"char\" "; 369 if (config::get("API_Type_" . $i) == "char") { 370 $html .= "checked"; 371 } 372 $html .= "></td></tr>"; 373 $cachetime = ConvertTimestamp($apicachetime[$i]); 374 //$cachetime = date("Y-m-d H:i:s", strtotime($apicachetime[$i]) + $gmoffset); 375 if ($cachetime == "") 376 { 377 $cachetime = "unknown"; 378 $txtcolour = "<font color = \"#FF0000\">"; 379 } else { 380 if (strtotime(gmdate("M d Y H:i:s")) - strtotime($apicachetime[$i]) > 0) 381 { 382 $txtcolour = "<font color = \"#00FF00\">"; 383 //$txtcolour = "<style=\"color:green\">"; 384 } else { 385 $txtcolour = "<font color = \"#FF0000\">"; 386 } 387 } 388 $html .= "<tr><td>Data is cached until:</td><td>" . $txtcolour . $cachetime . "</font></td></tr>"; 389 $html .= "</table><br>"; 390 } 391 $html .= "<table class=api-keys>"; 392 $html .= "<tr><td height=30px width=150px>Number of API Keys:</td>"; 393 $html .= "<td><input type=text name=API_Key_count size=2 maxlength=2 class=password value=\"" . $keycount . "\"></td></tr>"; 394 $html .= "</table><br>"; 395 $html .= "<i> Your UserID and API FULL Key can be obtained <a href=\"http://myeve.eve-online.com/api/default.asp\">here</a></i><br>"; 396 $html .= "<i> Once your UserID and API Key have been entered and the settings saved you can then select the available character IDs if you don't know them by clicking the \"select character\" button that appears and then clicking the character name</i><br><br>"; 397 398 // API Caching Options 399 $html .= "<div class=block-header2>API XML Caching Options</div><table>"; 400 401 $html .= "<tr><td height=30px width=150px>Enable API XML Caching?</td>"; 402 $html .= "<td><input type=checkbox name=API_UseCache id=API_UseCache"; 403 if (!config::get('API_UseCache')) 404 $html .= " checked=\"checked\""; 405 $html .= "></tr>"; 406 407 $html .= "<tr><td height=30px width=150px>Convert Cache Times to local time?</i></td>"; 408 $html .= "<td><input type=checkbox name=API_ConvertTimestamp id=API_ConvertTimestamp"; 409 if (!config::get('API_ConvertTimestamp')) 410 $html .= " checked=\"checked\""; 411 $html .= "></tr>"; 412 413 //$html .= "<tr><td height=30px width=150px>Force Daylight Saving Time on displayed cache times?</i></td>"; 414 //$html .= "<td><input type=checkbox name=API_ForceDST id=API_ForceDST"; 415 //if (!config::get('API_ForceDST')) 416 //$html .= " checked=\"checked\""; 417 //$html .= "></tr>"; 418 419 $html .= "<tr><td height=30px width=150px>Use Extended 24hr cache timer for Sovereignty.xml?</td>"; 420 $html .= "<td><input type=checkbox name=API_extendedtimer_sovereignty id=API_extendedtimer_sovereignty"; 421 if (!config::get('API_extendedtimer_sovereignty')) 422 $html .= " checked=\"checked\""; 423 $html .= ">"; 424 //$tempcachetime = date("Y-m-d H:i:s", strtotime(ApiCache::get('API_map_Sovereignty')) + $gmoffset); 425 $tempcachetime = ConvertTimestamp(ApiCache::get('API_map_Sovereignty')); 426 if ($tempcachetime == "") 427 { 428 $html .= "</tr>"; 429 } else { 430 if (strtotime(gmdate("M d Y H:i:s")) - strtotime(ApiCache::get('API_map_Sovereignty')) > 0) 431 { 432 $txtcolour = "<font color = \"#00FF00\">"; 433 //$txtcolour = "<style=\"color:green\">"; 434 } else { 435 $txtcolour = "<font color = \"#FF0000\">"; 436 } 437 $html .= "<td>Data is cached until:</td><td>" . $txtcolour . $tempcachetime . "</font></td></tr>"; 438 } 439 440 $html .= "<tr><td height=30px width=150px>Use Extended 24hr cache timer for AllianceList.xml?</td>"; 441 $html .= "<td><input type=checkbox name=API_extendedtimer_alliancelist id=API_extendedtimer_alliancelist"; 442 if (!config::get('API_extendedtimer_alliancelist')) 443 $html .= " checked=\"checked\""; 444 $html .= ">"; 445 //$tempcachetime = date("Y-m-d H:i:s", strtotime(ApiCache::get('API_eve_AllianceList')) + $gmoffset); 446 $tempcachetime = ConvertTimestamp(ApiCache::get('API_eve_AllianceList')); 447 if ($tempcachetime == "") 448 { 449 $html .= "</tr>"; 450 } else { 451 if (strtotime(gmdate("M d Y H:i:s")) - strtotime(ApiCache::get('API_eve_AllianceList')) > 0) 452 { 453 $txtcolour = "<font color = \"#00FF00\">"; 454 //$txtcolour = "<style=\"color:green\">"; 455 } else { 456 $txtcolour = "<font color = \"#FF0000\">"; 457 } 458 $html .= "<td>Data is cached until:</td><td>" . $txtcolour . $tempcachetime . "</font></td></tr>"; 459 } 460 461 $html .= "<tr><td height=30px width=150px>Use Extended 24hr cache timer for ConquerableStationList.xml?</td>"; 462 $html .= "<td><input type=checkbox name=API_extendedtimer_conq id=API_extendedtimer_conq"; 463 if (!config::get('API_extendedtimer_conq')) 464 $html .= " checked=\"checked\""; 465 $html .= ">"; 466 //$tempcachetime = date("Y-m-d H:i:s", strtotime(ApiCache::get('API_eve_ConquerableStationList')) + $gmoffset); 467 $tempcachetime = ConvertTimestamp(ApiCache::get('API_eve_ConquerableStationList')); 468 if ($tempcachetime == "") 469 { 470 $html .= "</tr>"; 471 } else { 472 if (strtotime(gmdate("M d Y H:i:s")) - strtotime(ApiCache::get('API_eve_ConquerableStationList')) > 0) 473 { 474 $txtcolour = "<font color = \"#00FF00\">"; 475 //$txtcolour = "<style=\"color:green\">"; 476 } else { 477 $txtcolour = "<font color = \"#FF0000\">"; 478 } 479 $html .= "<td>Data is cached until:</td><td>" . $txtcolour . $tempcachetime . "</font></td></tr>"; 480 } 481 482 $html .= "<tr><td height=30px width=150px>Use Extended 24hr cache timer for FacWarSystems.xml?</td>"; 483 $html .= "<td><input type=checkbox name=API_extendedtimer_facwarsystems id=API_extendedtimer_facwarsystems"; 484 if (!config::get('API_extendedtimer_facwarsystems')) 485 $html .= " checked=\"checked\""; 486 $html .= ">"; 487 //$tempcachetime = date("Y-m-d H:i:s", strtotime(ApiCache::get('API_map_FacWarSystems')) + $gmoffset); 488 $tempcachetime = ConvertTimestamp(ApiCache::get('API_map_FacWarSystems')); 489 if ($tempcachetime == "") 490 { 491 $html .= "</tr>"; 492 } else { 493 if (strtotime(gmdate("M d Y H:i:s")) - strtotime(ApiCache::get('API_map_FacWarSystems')) > 0) 494 { 495 $txtcolour = "<font color = \"#00FF00\">"; 496 //$txtcolour = "<style=\"color:green\">"; 497 } else { 498 $txtcolour = "<font color = \"#FF0000\">"; 499 } 500 $html .= "<td>Data is cached until:</td><td>" . $txtcolour . $tempcachetime . "</font></td></tr>"; 501 } 502 503 $html .= "<tr><td height=\"10\"></td></tr>"; // spacer 504 $html .= "<tr><td>(" . $deld . " files with a total size of " . number_format($dsize,"0",".",",") . " bytes)</td></tr>"; 505 506 $html .= "<tr><td height=\"10\"></td></tr>"; // spacer 507 $html .= "<tr><td colspan=\"2\"><input type=submit id=submit name=clearapicache value=\"Clear Cache\"><td></tr>"; 508 509 $html .= "</table>"; 510 511 // Killmail Parser Options 512 $html .= "<div class=block-header2>Killmail API Parsing Options</div><table>"; 513 $html .= "<tr><td height=50px width=150px>Comment for automatically parsed killmails?</td>"; 514 $html .= "<td><input type=text size=50 class=password name=API_Comment id=API_Comment value=\""; 515 if (config::get('API_Comment')) 516 $html .= config::get('API_Comment'); 517 $html .= "\"><br><i> (leave blank for none)</i><br></td></tr>"; 518 519 $html .= "<tr><td height=30px width=150px>Update Portraits?</td>"; 520 $html .= "<td><input type=checkbox name=API_Update id=API_Update"; 521 if (!config::get('API_Update')) 522 $html .= " checked=\"checked\""; 523 $html .= "></td></tr>"; 524 525 $html .= "<tr><td height=30px width=150px>Ignore NPC only deaths? <i>(This includes kills by POSs)</i></td>"; 526 $html .= "<td><input type=checkbox name=API_IgnoreNPC id=API_IgnoreNPC"; 527 if (!config::get('API_IgnoreNPC')) 528 $html .= " checked=\"checked\""; 529 $html .= "></td></tr>"; 530 531 $html .= "<tr><td height=30px width=150px>Ignore Friendly Fire? </td>"; 532 $html .= "<td><input type=checkbox name=API_IgnoreCorpFF id=API_IgnoreCorpFF"; 533 if (!config::get('API_IgnoreCorpFF')) 534 $html .= " checked=\"checked\""; 535 $html .= "<td> Corps <input type=checkbox name=API_IgnoreAllianceFF id=API_IgnoreAllianceFF"; 536 if (!config::get('API_IgnoreAllianceFF')) 537 $html .= " checked=\"checked\""; 538 $html .= "> Alliance</td></tr>"; 539 540 $html .= "<tr><td height=30px width=150px>Ignore POS Structures? </td>"; 541 $html .= "<td><input type=checkbox name=API_IgnoreFriendPos id=API_IgnoreFriendPos"; 542 if (!config::get('API_IgnoreFriendPos')) 543 $html .= " checked=\"checked\""; 544 $html .= "<td> Friend <input type=checkbox name=API_IgnoreEnemyPos id=API_IgnoreEnemyPos"; 545 if (!config::get('API_IgnoreEnemyPos')) 546 $html .= " checked=\"checked\""; 547 $html .= "> Enemy</td></tr>"; 548 549 $html .= "<tr><td height=30px width=150px>Concise cronjob e-mail? </td>"; 550 $html .= "<td><input type=checkbox name=API_NoSpam id=API_NoSpam"; 551 if (!config::get('API_NoSpam')) 552 $html .= " checked=\"checked\""; 553 $html .= "></td></tr>"; 554 555 $html .= "<tr><td height=30px width=150px>Import multiple keys one at a time? </td>"; 556 $html .= "<td><input type=checkbox name=API_MultipleMode id=API_MultipleMode"; 557 if (!config::get('API_MultipleMode')) 558 $html .= " checked=\"checked\""; 559 $html .= "></td></tr>"; 560 561 $html .= "<tr><td height=30px width=150px>Enable CCP error correction? </td>"; 562 $html .= "<td><input type=checkbox name=API_CCPErrorCorrecting id=API_CCPErrorCorrecting"; 563 if (!config::get('API_CCPErrorCorrecting')) 564 $html .= " checked=\"checked\""; 565 $html .= "></td></tr>"; 566 // Import 567 $html .= "<tr><td height=\"10\"></td></tr>"; // spacer 568 $html .= "<tr><td colspan=\"2\"><input type=submit id=submit name=import value=\"Import Mails\"></td></tr>"; 569 $html .= "</table>"; 570 // Save 571 $html .= "<div class=block-header2></div>"; 572 $html .= "<table><tr><td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Save Settings\"></td><td> </td><td colspan=\"2\"><input type=\"submit\" name=\"apilog\" value=\"View Log\"></td></tr>"; 573 $html .= "</table>"; 574 $html .= "</form>"; 575 } 344 576 $html .= "<div class=block-header2></div>"; 345 $html .= "<table><tr><td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Save Settings\"><td></tr>"; 346 $html .= "</table>"; 347 $html .= "<div class=block-header2></div>"; 348 $html .= "</form>"; 349 $html .= "<div>Written by " . FindThunk() . "</div>"; 350 577 $html .= "<div>Written by " . FindThunk() . " (<a href=\"http://eve-id.net/forum/viewtopic.php?f=505&t=8827\" >Support</a>)</div>"; 578 351 579 $page->setContent($html); 352 580 $page->addContext($menubox->generate()); … … 370 598 } 371 599 } 600 601 function checkDBforAPI() 602 { 603 $qry = new DBQuery(); 604 605 // check kb3_kills table and if necessary add extra field for API kll_external_id 606 $isKB3KillsUpdated = false; 607 $qry->execute("SHOW COLUMNS FROM kb3_kills"); 608 609 while ($row = $qry->getRow()) 610 { 611 if ($row['Field'] == "kll_external_id") 612 $isKB3KillsUpdated = true; 613 } 614 if (!$isKB3KillsUpdated) 615 { 616 // add new column 617 $qry->execute("ALTER TABLE `kb3_kills` 618 ADD `kll_external_id` INT( 11 ) UNSIGNED NULL DEFAULT NULL , 619 ADD UNIQUE ( kll_external_id )"); 620 } 621 622 // check kb3_alliances table and if necessary add extra field for API all_external_id 623 $isKB3AllianceUpdated = false; 624 $qry->execute("SHOW COLUMNS FROM kb3_alliances"); 625 626 while ($row = $qry->getRow()) 627 { 628 if ($row['Field'] == "all_external_id") 629 $isKB3AllianceUpdated = true; 630 } 631 if (!$isKB3AllianceUpdated) 632 { 633 // add new column 634 $qry->execute("ALTER TABLE `kb3_alliances` 635 ADD `all_external_id` INT( 11 ) UNSIGNED NULL DEFAULT NULL , 636 ADD UNIQUE ( all_external_id )"); 637 } 638 639 // check kb3_corps table and if necessary add extra field for API crp_external_id 640 $isKB3CorpsUpdated = false; 641 $qry->execute("SHOW COLUMNS FROM kb3_corps"); 642 643 while ($row = $qry->getRow()) 644 { 645 if ($row['Field'] == "crp_external_id") 646 $isKB3CorpsUpdated = true; 647 } 648 if (!$isKB3CorpsUpdated) 649 { 650 // add new column 651 $qry->execute("ALTER TABLE `kb3_corps` 652 ADD `crp_external_id` INT( 11 ) UNSIGNED NULL DEFAULT NULL , 653 ADD UNIQUE ( crp_external_id )"); 654 } 655 656 // create kb3_apilog table 657 $qry->execute("CREATE TABLE IF NOT EXISTS `kb3_apilog` ( 658 `log_site` VARCHAR( 20 ) NOT NULL , 659 `log_keyname` VARCHAR( 20 ) NOT NULL , 660 `log_posted` INT NOT NULL , 661 `log_errors` INT NOT NULL , 662 `log_ignored` INT NOT NULL , 663 `log_verified` INT NOT NULL , 664 `log_totalmails` INT NOT NULL , 665 `log_source` VARCHAR( 20 ) NOT NULL , 666 `log_type` VARCHAR( 20 ) NOT NULL , 667 `log_timestamp` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' 668 ) ENGINE = MYISAM "); 669 670 // set update complete 671 config::set('API_DBUpdate', '1'); 672 } 372 673 ?> -
dev/common/admin/admin_cc.php
r361 r370 33 33 $html .= "<td class=kb-table-cell>".substr($contract->getStartDate(), 0, 10)."</td>"; 34 34 $html .= "<td class=kb-table-cell>".substr($contract->getEndDate(), 0, 10)."</td>"; 35 $html .= "<td class=kb-table-cell align=center width=70><a href=\"?a=admin_cc& ctr_id=".$contract->getID()."&op=edit&type=".$type."\">Edit</a></td><td align=center><a href=\"?a=admin_cc&ctr_id=".$contract->getID()."&op=del&type=".$type."\">Delete</a></td>";35 $html .= "<td class=kb-table-cell align=center width=70><a href=\"?a=admin_cc&ctr_id=".$contract->getID()."&op=edit&type=".$type."\">Edit</a></td><td align=center><a href=\"?a=admin_cc&ctr_id=".$contract->getID()."&op=del&type=".$type."\">Delete</a></td>"; 36 36 $html .= "</tr>"; 37 37 } 38 38 if ($list->getCount() > 0) 39 39 $html .= "</table><br>"; 40 $html .= "[<a href=\"?a=admin_cc& op=add&type=".$type."\">Add ".$type."</a>]";40 $html .= "[<a href=\"?a=admin_cc&op=add&type=".$type."\">Add ".$type."</a>]"; 41 41 } 42 42 // delete … … 49 49 $contract->remove(); 50 50 51 Header("Location: ?a=admin_cc& op=view&type=".$_GET['type']);51 Header("Location: ?a=admin_cc&op=view&type=".$_GET['type']); 52 52 } 53 53 else … … 55 55 $page->setTitle("Administration - Delete ".$_GET['type']); 56 56 $html .= "Confirm deletion: "; 57 $html .= "<button onClick=\"window.location.href='?a=admin_cc&ctr_id=".$_GET['ctr_id']."&op=del& type=".$_GET['type']."&confirm=yes'\">Yes</button> ";57 $html .= "<button onClick=\"window.location.href='?a=admin_cc&ctr_id=".$_GET['ctr_id']."&op=del&type=".$_GET['type']."&confirm=yes'\">Yes</button> "; 58 58 $html .= "<button onClick=\"window.history.back();\">No</button>"; 59 59 } … … 69 69 $_POST['ctr_started'], $_POST['ctr_ended']); 70 70 71 Header("Location: ?a=admin_cc&op=view& type=".$_GET['type']);71 Header("Location: ?a=admin_cc&op=view&type=".$_GET['type']); 72 72 } 73 73 … … 131 131 $sql = "select crp.crp_id as id, crp.crp_name as name 132 132 from kb3_corps crp 133 where lower( crp.crp_name ) like '%".s trtolower($_POST['add_name'])."%'";133 where lower( crp.crp_name ) like '%".slashfix(strtolower($_POST['add_name']))."%'"; 134 134 break; 135 135 case 1: 136 136 $sql = "select ali.all_id as id, ali.all_name as name 137 137 from kb3_alliances ali 138 where lower( ali.all_name ) like '%".s trtolower($_POST['add_name'])."%'";138 where lower( ali.all_name ) like '%".slashfix(strtolower($_POST['add_name']))."%'"; 139 139 break; 140 140 case 2: 141 141 $sql = "select reg_id as id, reg_name as name 142 142 from kb3_regions 143 where lower( reg_name ) like '%".s trtolower($_POST['add_name'])."%'";143 where lower( reg_name ) like '%".slashfix(strtolower($_POST['add_name']))."%'"; 144 144 break; 145 145 case 3: 146 146 $sql = "select sys_id as id, sys_name as name 147 147 from kb3_systems 148 where lower( sys_name ) like '%".s trtolower($_POST['add_name'])."%'";148 where lower( sys_name ) like '%".slashfix(strtolower($_POST['add_name']))."%'"; 149 149 break; 150 150 } -
dev/common/admin/admin_feedsyndication.php
r361 r370 2 2 // //// 3 3 // //// ////// 4 // //// liq's feed syndication mod v1.5 4 // //// liq's feed syndication mod v1.6 5 // Kovell: last kill function activated and current year = 2008 changed in 1.6 5 6 // ////////// 6 7 // ////////// … … 11 12 define(MASTER, 0); 12 13 13 $version = "v1. 5";14 $version = "v1.6"; 14 15 @set_time_limit(0); 15 16 require_once('feed_fetcher.php'); … … 36 37 { 37 38 $feedcount = $_POST['fetch_feed_count']; 39 for ($i = config::get('fetch_feed_count'); $i > $feedcount; $i--) 40 { 41 config::del('fetch_url_' . $i); 42 } 38 43 config::set('fetch_feed_count', $feedcount); 39 for ($i = 99; $i >= $feedcount; $i--)40 {41 config::del('fetch_url_' . $i);42 }43 44 } 44 45 if ($_POST['fetch_verbose']) … … 65 66 $friends = "on"; 66 67 else $friends = ""; 67 config::set($url, $_POST[$url] . ':::' . $time[$i] . ':::' . $friends); 68 $feed[$i] = $_POST[$url]; 68 $fstr = config::get('fetch_url_' . $i); 69 $ftmp = explode(':::', $fstr); 70 // reset the feed lastkill details if the URL or friends has changed 71 if($_POST[$url] != $ftmp[0] || $friends != $ftmp[2] || ($_POST['newkills'] && !in_array ($i, $_POST['newkills'])) ) 72 config::set($url, $_POST[$url] . ':::' . 0 . ':::' . $friends); 69 73 } 70 74 else … … 74 78 } 75 79 $feed = array(); 80 $feedlast = array(); 76 81 for ($i = 1; $i <= $feedcount; $i++) 77 82 { … … 79 84 $tmp = explode(':::', $str); 80 85 $feed[$i] = $tmp[0]; 81 $ time[$i] = $tmp[1];86 $feedlast[$i] = $tmp[1]; 82 87 if ($tmp[2] == "on") 83 88 $friend[$i] = $tmp[2]; … … 103 108 { 104 109 $str = ''; 105 // if ($time[$i])106 // $str .= '&lastkllid='.$time[$i];110 if ($feedlast[$i]) 111 $str .= '&lastkllid='.$feedlast[$i]; 107 112 if ($friend[$i]) 108 113 $str .= '&friend=1'; … … 126 131 { 127 132 $html .= "<b>Week: " . $l . "</b><br>"; 128 $html .= $feedfetch->grab($feed[$i] . "&year=" . $_POST['year'] . "&week=" . $l, $myid . $str );133 $html .= $feedfetch->grab($feed[$i] . "&year=" . $_POST['year'] . "&week=" . $l, $myid . $str, $friend[$i], $cfg); 129 134 } 130 135 } … … 132 137 $html .= $feedfetch->grab($feed[$i], $myid . $str); 133 138 } 134 config::set($cfg, $feed[$i] . ':::' . $lastkllid . ':::' . $friend[$i]); 135 $time[$i] = $lastkllid; 139 // If kills are fetched then change the last kill id for the feed 140 if(intval($feedfetch->lastkllid_)) 141 { 142 config::set($cfg, $feed[$i] . ':::' . intval($feedfetch->lastkllid_) . ':::' . $friend[$i]); 143 $feedlast[$i] = intval($feedfetch->lastkllid); 144 } 136 145 } 137 146 } … … 153 162 $html .= "><b>Friend?</b></td>"; 154 163 164 $html .= "<td><input type=checkbox name=newkills[] id=newkills value=" . $i; 165 if ($feed[$i]) 166 $html .= " checked=\"checked\""; 167 $html .= "><b>New kills only?</b><br>"; 168 155 169 $html .= "<td><input type=checkbox name=fetch_feed[] id=fetch value=" . $i; 156 170 if ($feed[$i]) 157 171 $html .= " checked=\"checked\""; 158 172 $html .= "><b>Fetch?</b><br>"; 173 174 $html .= "<input type=hidden name=fetch_time_" . $i . " value=\""; 175 if($feedlast[$i]) $html .= $feedlast[$i]; 176 $html .= "\"></td>"; 159 177 $html .= "</td></tr>"; 160 178 } … … 166 184 $html .= "<table><tr><td height=20px width=150px><b>First week:</b></td>"; 167 185 $html .= '<td><select name="range1">'; 168 $now = date("W");186 $now = gmdate("W"); 169 187 for ($i = 1; $i <= 52; $i++) 170 188 { … … 178 196 $html .= "<tr><td height=20px width=150px><b>Last week:</b></td>"; 179 197 $html .= '<td><select name="range2">'; 180 for ($i = 1; $i <= 5 2; $i++)198 for ($i = 1; $i <= 53; $i++) 181 199 { 182 200 if ($now == $i) … … 190 208 $html .= "<tr><td height=20px width=150px><b>Year:</b></td>"; 191 209 $html .= '<td><select name="year">'; 192 $html .= '<option "value="2005">2005</option>'; 193 $html .= '<option "value="2006">2006</option>'; 194 $html .= '<option "value="2007">2007</option>'; 195 $html .= '<option selected="selected" value="2008">2008</option>'; 196 $html .= '<option "value="2009">2009</option>'; 210 for($dateit = 2005; $dateit <= gmdate('Y'); $dateit++) 211 { 212 $html .='<option '; 213 if($dateit == gmdate('Y')) $html .= 'selected="selected"'; 214 $html .=' value="'.$dateit.'">'.$dateit.'</option> '; 215 } 197 216 $html .= '</select>'; 198 217 $html .= "</td></tr>"; -
dev/common/admin/admin_menu.php
r361 r370 43 43 $menubox = new Box2(); 44 44 45 options::oldMenu('Features', "Contracts", "?a=admin_cc& op=view&type=contract");46 options::oldMenu('Features', "Campaigns", "?a=admin_cc& op=view&type=campaign");45 options::oldMenu('Features', "Contracts", "?a=admin_cc&op=view&type=contract"); 46 options::oldMenu('Features', "Campaigns", "?a=admin_cc&op=view&type=campaign"); 47 47 options::oldMenu('Features', "Standings", "?a=admin_standings"); 48 48 options::oldMenu('Appearance', "Map Options", "?a=admin_mapoptions"); -
dev/common/admin/admin_sync.php
r361 r370 86 86 { 87 87 $update->execute("update kb3_pilots set plt_externalid='".addslashes($matches[2][$i])."' where plt_name='".addslashes($matches[1][$i])."' limit 1"); 88 if ( mysql_affected_rows() == 1)88 if ($update->dbconn_->affectedRows() == 1) 89 89 { 90 90 $new++; -
dev/common/admin/feed_fetcher.php
r361 r370 1 1 <?php 2 2 ////// 3 3 ////// ////// 4 ////// liq's feed syndication mod v1.5 4 ////// liq's feed syndication mod v1.6 5 // Kovell: last kill function activated in 1.6 5 6 //////////// 6 //////////// 7 //////////// 8 //////////// 9 7 // Fetcher class used with common/feed.php on a remote board to fetch kills 8 // with a given pilot, corp or alliance 9 10 11 // Fetches $this->lastkllid_ = last kill in feed 12 // $this->finalkllid_ = last kill on board including kills not in feed 10 13 11 14 @set_time_limit(0); … … 15 18 require_once( "common/includes/class.parser.php" ); 16 19 if ( file_exists("common/includes/class.comments.php") ) // for the Eve-Dev Comment Class 17 20 require_once( "common/includes/class.comments.php" ); 18 21 if ( file_exists("../../common/class.comment.php") ) // for the D2 Killboard Comment Class 19 22 require_once( "common/class.comment.php" ); 20 23 21 24 $insideitem = false; … … 25 28 $link = ""; 26 29 $x=0; 27 28 class Fetcher { 29 30 function grab($url, $str) { 30 //! EDK Feed Syndication fetcher class. 31 32 /*! This class is used to fetch the feed from another EDK board. It adds all 33 * fetched kills to the board and returns the id of the highest kill fetched. 34 */ 35 class Fetcher 36 { 37 //! Construct the Fetcher class and initialise variables. 38 function Fetcher() 39 { 40 $this->lastkllid_ = 0; 41 $this->finalkllid_ = 0; 42 // $this->trackurl_ = ''; 43 $this->trackfriend_ = ''; 44 $this->trackkey_ = ''; 45 $this->tracklast_ = 0; 46 $this->combined_ = false; 47 } 48 //! Fetch a new feed. 49 50 /*! Use the input parameters to fetch a feed, parse it and add new kills 51 * to the db. 52 * \param $url The base URL of the feed to fetch 53 * \param $str The query string to add to the base URL. 54 * \param $trackfriend Either 'on' or blank. Defines whether to fetch 55 * friendly kills 56 * \param $trackkey The configuration key to use when storing feed in 57 * the db. 58 * \return HTML output summarising the results of the fetch. 59 */ 60 61 function grab($url, $str, $trackfriend = '', $trackkey = '') 62 { 31 63 global $x, $uurl; 64 // $this->trackurl_ = $trackurl; 65 $this->trackfriend_ = $trackfriend; 66 $this->trackkey_ = $trackkey; 32 67 $x=0; 33 68 $fetchurl = $url.$str; 34 69 $uurl = $url; 35 $xml_parser = xml_parser_create();70 $xml_parser = xml_parser_create("UTF-8"); 36 71 xml_set_object ( $xml_parser, $this ); 37 72 xml_set_element_handler($xml_parser, "startElement", "endElement"); … … 48 83 $data = trim(preg_replace('<<!--.*?-->>', '', $data)); // remove <!-- Cached --> message, else it will break gzinflate 49 84 50 if (!@gzinflate($data)) { 85 if (!@gzinflate($data)) 86 { 51 87 $cprs = "raw HTML stream"; 52 } else { 88 } else 89 { 53 90 $data = gzinflate($data); 54 91 $cprs = "GZip compressed stream"; … … 60 97 xml_parser_free($xml_parser); 61 98 62 if (config::get('fetch_verbose') ) { 99 if (config::get('fetch_verbose') ) 100 { 63 101 if ($x) 64 102 $html .= "<div class=block-header2>".$x." kills added from feed: ".$url."<br>".$str." <i><br>(".$cprs.")</i><br><br></div>"; 65 103 else 66 104 $html .= "<div class=block-header2>No kills added from feed: ".$url."<br>".$str." <i><br>(".$cprs.")</i><br><br></div>"; 67 } else { 105 } else 106 { 68 107 if ($x) 69 108 $html .= "<div class=block-header2>".$x." kills added from feed: ".$url." <i>(".$cprs.")</i><br><br></div>"; … … 72 111 } 73 112 74 return $html; 75 } 76 77 function startElement($parser, $name, $attrs) { 78 global $insideitem, $tag, $title, $description, $link; 79 if ($insideitem) 113 return $html; 114 } 115 //! XML start of element parser. 116 function startElement($parser, $name, $attrs) 117 { 118 global $insideitem, $tag, $title, $description, $link; 119 // if ($insideitem) 80 120 $tag = $name; 81 elseif ($name == "ITEM") 82 $insideitem = true; 83 } 84 85 function endElement($parser, $name) { 86 global $insideitem, $tag, $title, $description, $link, $html, $x, $uurl; 87 88 if ($name == "ITEM") { 89 if ( isset( $description ) ) { 90 $parser = new Parser( $description ); 91 $killid = $parser->parse( true ); 92 if ( $killid == 0 || $killid == -1 || $killid == -2 ) { 93 if ( $killid == 0 && config::get('fetch_verbose') ) 94 $html .= "Killmail is malformed.<br>"; 95 if ( $killid == -2 && config::get('fetch_verbose') ) 96 $html .= "Killmail is not related to ".KB_TITLE.".<br>"; 97 if ( $killid == -1 && config::get('fetch_verbose') ) 98 $html .= "Killmail already posted <a href=\"?a=kill_detail&kll_id=".$parser->dupeid_."\">here</a>.<br>"; 121 //else 122 if ($name == "ITEM") 123 $insideitem = true; 124 } 125 126 //! XML end of element parser. 127 function endElement($parser, $name) 128 { 129 global $insideitem, $tag, $title, $description, $link, $html, $x, $uurl; 130 131 if ($name == "ITEM") 132 { 133 if ( isset( $description ) ) 134 { 135 $parser = new Parser( $description ); 136 $killid = $parser->parse( true ); 137 if($this->trackkey_ != '' && $this->tracklast_ < intval($title) && intval($title) > 0) 138 { 139 config::set($this->trackkey_, $uurl . ':::' . intval($title) . ':::' . $this->trackfriend_); 140 } 141 if ( $killid == 0 || $killid == -1 || $killid == -2 ) 142 { 143 if ( $killid == 0 && config::get('fetch_verbose') ) 144 $html .= "Killmail is malformed. ".$uurl." Kill ID = ".$title." <br>"; 145 if ( $killid == -2 && config::get('fetch_verbose') ) 146 $html .= "Killmail is not related to ".KB_TITLE.".<br>"; 147 if ( $killid == -1 && config::get('fetch_verbose') ) 148 $html .= "Killmail already posted <a href=\"?a=kill_detail&kll_id=".$parser->dupeid_."\">here</a>.<br>"; 149 } 150 else 151 { 152 153 $qry = new DBQuery(); 154 $qry->execute( "insert into kb3_log (log_kll_id, log_site, log_ip_address, log_timestamp) values( ". 155 $killid.", '".KB_SITE."','".$_SERVER['REMOTE_ADDR']."',now() )" ); 156 $html .= "Killmail successfully posted <a href=\"?a=kill_detail&kll_id=".$killid."\">here</a>.<br>"; 157 158 if (class_exists('Comments') && config::get('fetch_comment')) 159 { // for the Eve-Dev Comment Class 160 $comments = new Comments($killid); 161 $comments->addComment("Feed Syndication", config::get('fetch_comment')." mail fetched from: ".$uurl.")"); 162 } 163 if (class_exists('Comment') && config::get('fetch_comment')) 164 { // for the D2 Killboard Comment Class 165 $comment = new Comment($killid); 166 $comment->postComment(config::get('fetch_comment')." \n\n\n <i>mail fetched from:\n ".$uurl."</i>", "liquidism"); 167 } 168 $x++; 169 } 99 170 } 100 else { 101 $qry = new DBQuery(); 102 $qry->execute( "insert into kb3_log values( ".$killid.", '".KB_SITE."','".$_SERVER['REMOTE_ADDR']."',now() )" ); 103 $html .= "Killmail succsessfully posted <a href=\"?a=kill_detail&kll_id=".$killid."\">here</a>.<br>"; 104 105 if (class_exists('Comments') && config::get('fetch_comment')) { // for the Eve-Dev Comment Class 106 $comments = new Comments($killid); 107 $comments->addComment("liq's feed syndication", config::get('fetch_comment')." mail fetched from: ".$uurl.")"); 108 } 109 if (class_exists('Comment') && config::get('fetch_comment')) { // for the D2 Killboard Comment Class 110 $comment = new Comment($killid); 111 $comment->postComment(config::get('fetch_comment')." \n\n\n <i>mail fetched from:\n ".$uurl."</i>", "liquidism"); 112 } 113 $x++; 171 if($title && intval($title) > $this->lastkllid_) $this->lastkllid_ = intval($title); 172 $title = ""; 173 $description = ""; 174 $link = ""; 175 $insideitem = false; 176 } 177 } 178 //! XML character data parser. 179 function characterData($parser, $data) 180 { 181 global $insideitem, $tag, $title, $description, $link; 182 if ($insideitem) 183 { 184 switch ($tag) 185 { 186 case "TITLE": 187 $title .= $data; 188 break; 189 case "DESCRIPTION": 190 $description .= $data; 191 break; 192 case "LINK": 193 $link .= $data; 194 break; 114 195 } 115 } 116 $title = ""; 117 $description = ""; 118 $link = ""; 119 $insideitem = false; 120 } 121 } 122 123 function characterData($parser, $data) { 124 global $insideitem, $tag, $title, $description, $link; 125 if ($insideitem) { 126 switch ($tag) { 127 case "TITLE": 128 $title .= $data; 129 break; 130 case "DESCRIPTION": 131 $description .= $data; 132 break; 133 case "LINK": 134 $link .= $data; 135 break; 136 } 137 } 138 } 196 } 197 elseif($tag=="FINALKILL") 198 { 199 if(!($this->finalkllid_ > intval($data))) $this->finalkllid_ = intval($data); 200 } 201 elseif($tag=="COMBINED") 202 { 203 $this->combined_ = true; 204 } 205 } 139 206 140 207 } -
dev/common/admin/option_acache.php
r361 r370 16 16 options::fadd('Memcached port', 'cfg_memcache_port', 'edit:size:8'); 17 17 options::fadd('Halt on SQLError', 'cfg_sqlhalt', 'checkbox'); 18 options::fadd('Enable SQL-Query File Cache', 'cfg_qcache', 'checkbox' );18 options::fadd('Enable SQL-Query File Cache', 'cfg_qcache', 'checkbox', '', array('admin_acache', 'clearQCache')); 19 19 20 20 options::cat('Advanced', 'Cache', 'Killmail Cache'); … … 24 24 25 25 options::cat('Advanced', 'Cache', 'Reinforce Control'); 26 options::fadd('Enable Reinforced Management', 'auto_reinforced', 'checkbox' );26 options::fadd('Enable Reinforced Management', 'auto_reinforced', 'checkbox', '', array('admin_acache', 'setNotReinforced')); 27 27 options::fadd('Current Load', 'none', 'custom', array('admin_acache', 'showLoad')); 28 28 options::fadd('Reinforcement threshold', 'reinforced_threshold', 'edit:size:4'); … … 67 67 return $count; 68 68 } 69 function clearQCache() 70 { 71 $dir = opendir(KB_CACHEDIR); 72 while ($line = readdir($dir)) 73 { 74 if (strstr($line, 'qcache_qry') !== false) 75 { 76 @unlink(KB_CACHEDIR.'/'.$line); 77 } 78 elseif (strstr($line, 'qcache_tbl') !== false) 79 { 80 @unlink(KB_CACHEDIR.'/'.$line); 81 } 82 } 83 } 84 function setNotReinforced() 85 { 86 config::set('is_reinforced', '0'); 87 } 69 88 } 70 89 ?> -
dev/common/admin/option_appearance.php
r367 r370 6 6 7 7 options::cat('Appearance', 'Global Options', 'Global Options'); 8 options::fadd('Display Standings', 'show_standings', 'checkbox');9 options::fadd('Enable Lost Item Values', 'item_values', 'checkbox');8 options::fadd('Display standings', 'show_standings', 'checkbox'); 9 options::fadd('Enable lost item values', 'item_values', 'checkbox'); 10 10 options::fadd('Use custom shipvalues', 'ship_values', 'checkbox'); 11 11 options::fadd('Display a link instead of POD on Battlesummary', 'bs_podlink', 'checkbox'); … … 21 21 22 22 options::cat('Appearance', 'Front Page', 'Front Page'); 23 options::fadd('Display Comment Count on Front Page', 'comments_count', 'checkbox'); 24 options::fadd('Display Alliance Logos on Front Page', 'killlist_alogo', 'checkbox'); 25 options::fadd('Display Involved Count on Front Page', 'killlist_involved', 'checkbox'); 23 options::fadd('Display combined kills and losses on Front Page', 'show_comb_home', 'checkbox'); 24 options::fadd('Display comment count on Front Page', 'comments_count', 'checkbox'); 25 options::fadd('Display alliance logos on Front Page', 'killlist_alogo', 'checkbox'); 26 options::fadd('Display involved count on Front Page', 'killlist_involved', 'checkbox'); 26 27 options::fadd('Show Corp: / Alliance: on Front Page', 'corpalliance-name', 'checkbox'); 28 options::fadd('Display clock on Front Page', 'show_clock', 'checkbox'); 27 29 28 30 options::cat('Appearance', 'Front Page', 'Kill Summary Tables'); … … 37 39 options::fadd('Display losspoints', 'loss_points', 'checkbox'); 38 40 options::fadd('Display totalpoints', 'total_points', 'checkbox'); 39 options::fadd('Include dropped value in tototal loss', 'kd_droptototal', 'checkbox');41 options::fadd('Include dropped value in total loss', 'kd_droptototal', 'checkbox'); 40 42 options::fadd('Use lighter green for dropped items', 'kd_lgreen', 'checkbox'); 41 43 options::fadd('Show Faction items tag', 'kd_ftag', 'checkbox'); -
dev/common/alliance_detail.php
r343 r370 58 58 if (file_exists("img/alliances/".$alliance->getUnique().".png")) 59 59 { 60 $html .= "<img src=\"".IMG_URL."/alliances/".$alliance->getUnique().".png\" border=\"0\" ></td>";60 $html .= "<img src=\"".IMG_URL."/alliances/".$alliance->getUnique().".png\" border=\"0\" alt=\"$alliance->getName()\"></td>"; 61 61 } 62 62 else 63 63 { 64 $html .= "<img src=\"".IMG_URL."/alliances/default.gif\" border=\"0\" ></td>";64 $html .= "<img src=\"".IMG_URL."/alliances/default.gif\" border=\"0\" alt=\"$alliance->getName()\"></td>"; 65 65 } 66 66 $kill_summary = new KillSummaryTable(); … … 99 99 $list = new KillList(); 100 100 $list->setOrdered(true); 101 $list->setCountComments(true); 102 $list->setCountInvolved(true); 101 103 $list->setLimit(10); 102 104 $list->setPodsNoobships(true); … … 114 116 $list = new KillList(); 115 117 $list->setOrdered(true); 118 $list->setCountComments(true); 119 $list->setCountInvolved(true); 116 120 $list->setLimit(10); 117 121 $list->setPodsNoobships(true); … … 131 135 $list = new KillList(); 132 136 $list->setOrdered(true); 137 $list->setCountComments(true); 138 $list->setCountInvolved(true); 133 139 $list->addInvolvedAlliance($alliance); 134 140 if ($_GET['scl_id']) … … 147 153 $list = new KillList(); 148 154 $list->setOrdered(true); 155 $list->setCountComments(true); 156 $list->setCountInvolved(true); 149 157 $list->setPodsNoobships(true); 150 158 $list->addVictimAlliance($alliance); … … 174 182 $html .= $table->generate(); 175 183 176 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail& view=corp_kills&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>";177 $html .= "<td align='right'><a href='?a=alliance_detail& view=corp_kills&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";184 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail&view=corp_kills&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>"; 185 $html .= "<td align='right'><a href='?a=alliance_detail&view=corp_kills&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 178 186 179 187 $html .= "</td><td valign=top width=400>"; … … 352 360 $html .= $table->generate(); 353 361 354 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail& view=corp_losses&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>";355 $html .= "<td align='right'><a href='?a=alliance_detail& view=corp_losses&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";362 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail&view=corp_losses&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>"; 363 $html .= "<td align='right'><a href='?a=alliance_detail&view=corp_losses&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 356 364 357 365 $html .= "</td><td valign=top width=400>"; … … 381 389 $html .= $table->generate(); 382 390 383 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail& view=pilot_kills&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>";384 $html .= "<td align='right'><a href='?a=alliance_detail& view=pilot_kills&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";391 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail&view=pilot_kills&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>"; 392 $html .= "<td align='right'><a href='?a=alliance_detail&view=pilot_kills&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 385 393 386 394 $html .= "</td><td valign=top width=400>"; … … 410 418 $html .= $table->generate(); 411 419 412 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail& view=pilot_scores&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>";413 $html .= "<td align='right'><a href='?a=alliance_detail& view=pilot_scores&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";420 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail&view=pilot_scores&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>"; 421 $html .= "<td align='right'><a href='?a=alliance_detail&view=pilot_scores&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 414 422 415 423 $html .= "</td><td valign=top width=400>"; … … 439 447 $html .= $table->generate(); 440 448 441 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail& view=pilot_losses&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>";442 $html .= "<td align='right'><a href='?a=alliance_detail& view=pilot_losses&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";449 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=alliance_detail&view=pilot_losses&m=$pmonth&all_id=$all_id&y=$pyear'>previous</a></td>"; 450 $html .= "<td align='right'><a href='?a=alliance_detail&view=pilot_losses&all_id=$all_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 443 451 444 452 $html .= "</td><td valign=top width=400>"; … … 455 463 break; 456 464 case "ships_weapons": 457 $html .= "<div class=block-header2>Ships & weapons used</div>";465 $html .= "<div class=block-header2>Ships & weapons used</div>"; 458 466 459 467 $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; … … 564 572 $menubox = new Box("Menu"); 565 573 $menubox->setIcon("menu-item.gif"); 566 $menubox->addOption("caption","Kills & losses");567 $menubox->addOption("link","Recent activity", "?a=alliance_detail&a ll_id=" . $alliance->getID());568 $menubox->addOption("link","Kills", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=kills");569 $menubox->addOption("link","Losses", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=losses");574 $menubox->addOption("caption","Kills & losses"); 575 $menubox->addOption("link","Recent activity", "?a=alliance_detail&all_id=" . $alliance->getID()); 576 $menubox->addOption("link","Kills", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=kills"); 577 $menubox->addOption("link","Losses", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=losses"); 570 578 $menubox->addOption("caption","Corp statistics"); 571 $menubox->addOption("link","Top killers", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=corp_kills");572 $menubox->addOption("link","Top losers", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=corp_losses");573 $menubox->addOption("link","Destroyed ships", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=corp_kills_class");574 $menubox->addOption("link","Lost ships", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=corp_losses_class");579 $menubox->addOption("link","Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_kills"); 580 $menubox->addOption("link","Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_losses"); 581 $menubox->addOption("link","Destroyed ships", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_kills_class"); 582 $menubox->addOption("link","Lost ships", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_losses_class"); 575 583 $menubox->addOption("caption","Pilot statistics"); 576 $menubox->addOption("link","Top killers", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=pilot_kills");584 $menubox->addOption("link","Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_kills"); 577 585 if (config::get('kill_points')) 578 586 { 579 $menubox->addOption('link', "Top scorers", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=pilot_scores");580 } 581 $menubox->addOption("link","Top losers", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=pilot_losses");582 $menubox->addOption("link","Destroyed ships", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=kills_class");583 $menubox->addOption("link","Lost ships", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=losses_class");587 $menubox->addOption('link', "Top scorers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_scores"); 588 } 589 $menubox->addOption("link","Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_losses"); 590 $menubox->addOption("link","Destroyed ships", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=kills_class"); 591 $menubox->addOption("link","Lost ships", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=losses_class"); 584 592 $menubox->addOption("caption","Global statistics"); 585 $menubox->addOption("link","Ships & weapons", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=ships_weapons");586 $menubox->addOption("link","Most violent systems", "?a=alliance_detail&a ll_id=" . $alliance->getID() . "&view=violent_systems");593 $menubox->addOption("link","Ships & weapons", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=ships_weapons"); 594 $menubox->addOption("link","Most violent systems", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=violent_systems"); 587 595 $page->addContext($menubox->generate()); 588 596 -
dev/common/cc_detail.php
r343 r370 56 56 $summary = new KillSummaryTable($kl, $ll); 57 57 $summary->setVerbose(true); 58 $summary->setBreak(15); 58 $qrylength=new DBQuery(); 59 // set break at half of the number of valid classes - excludes noob ships, drones and unknown 60 $qrylength->execute("SELECT count(*) - 3 AS cnt FROM kb3_ship_classes"); 61 if($qrylength->recordCount()) 62 { 63 $res = $qrylength->getRow(); 64 $summary->setBreak($res['cnt']/2); 65 } 66 else $summary->setBreak(15); 59 67 $summary->setView('combined'); 60 68 -
dev/common/corp_detail.php
r343 r370 6 6 require_once('common/includes/class.killsummarytable.php'); 7 7 require_once('common/includes/class.toplist.php'); 8 require_once("common/includes/evelogo.php"); 9 require_once("common/includes/class.eveapi.php"); 8 10 9 11 if (!$crp_id = intval($_GET['crp_id'])) … … 51 53 $monthname = kbdate("F", strtotime("2000-".$month."-2")); 52 54 53 54 55 $all_id = $_GET['all_id']; 55 56 $corp = new Corporation($crp_id); … … 61 62 $summary_html = $kill_summary->generate(); 62 63 63 $page = new Page('Corporation details - '.$corp->getName()); 64 $corpname = str_replace(" ", "%20", $corp->getName() ); 65 $myID = new API_NametoID(); 66 $myID->setNames($corpname); 67 $html .= $myID->fetchXML(); 68 $myNames = $myID->getNameData(); 69 70 $myAPI = new API_CorporationSheet(); 71 $myAPI->setCorpID($myNames[0]['characterID']); 72 73 $result .= $myAPI->fetchXML(); 74 75 if ($result == "Corporation is not part of alliance.") 76 { 77 $page = new Page('Corporation details - '.$corp->getName()); 78 } else { 79 $page = new Page('Corporation details - '.$corp->getName() . " [" . $myAPI->getTicker() . "]"); 80 } 64 81 $html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center bgcolor=black>"; 65 82 66 83 if (file_exists("img/corps/".$corp->getID().".jpg") || file_exists("img/corps/".$corp->getUnique().".jpg")) 67 84 { 68 $html .= "<img src=\"".$corp->getPortraitURL(128)."\" border=\"0\" ></td>";85 $html .= "<img src=\"".$corp->getPortraitURL(128)."\" border=\"0\" alt=\"\"></td>"; 69 86 } 70 87 else 71 88 { 72 $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\"></td>"; 73 } 74 75 $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; 76 if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 77 { 78 $html .= "<b>".$alliance->getName()."</b>"; 79 } 80 else 81 { 82 $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 83 } 84 $html .= "</td></tr>"; 85 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td></tr>"; 86 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td></tr>"; 87 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000000, 2)."B</td></tr>"; 88 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000000, 2)."B</td></tr>"; 89 if ($kill_summary->getTotalKillISK()) 90 { 91 $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); 92 } 93 else 94 { 95 $efficiency = 0; 96 } 97 98 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $efficiency . "%</b></td></tr>"; 99 $html .= "</table>"; 100 $html .= "<br/>"; 89 if ($alliance != 0) 90 { 91 $mylogo = $myAPI->getLogo(); 92 93 if ($result == "Corporation is not part of alliance.") 94 { 95 $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\" alt=\"\"></td>"; 96 } elseif ($result == "") { 97 // create two sized logo's in 2 places - this allows checks already in place not to keep requesting corp logos each time page is viewed 98 // class.thumb.php cannot work with png (although saved as jpg these are actually pngs) therefore we have to create the 128 size for it 99 // doing this prevents the images being rendered each time the function is called and allows it to use one in the cache instead. 100 CorporationLogo( $mylogo, 64, $corp->getID() ); 101 CorporationLogo( $mylogo, 128, $corp->getID() ); 102 103 $html .= "<img src=\"".$corp->getPortraitURL(128)."\" border=\"0\" alt=\"\"></td>"; 104 } else { 105 // some kind of error getting details from CCP so abort writing file(s) allowing us to try again later - in the meantime, lets print trusty default 106 // error text will also appear where the picture is, which is nice 107 $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\" alt=\"\"></td>"; 108 } 109 } else { 110 $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" border=\"0\" alt=\"\"></td>"; 111 } 112 } 113 114 if ($result == "Corporation is not part of alliance.") 115 { 116 $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; 117 if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 118 { 119 $html .= "<b>".$alliance->getName()."</b>"; 120 } 121 else 122 { 123 $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 124 } 125 $html .= "</td></tr>"; 126 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td></tr>"; 127 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td></tr>"; 128 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000000, 2)."B</td></tr>"; 129 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000000, 2)."B</td></tr>"; 130 if ($kill_summary->getTotalKillISK()) 131 { 132 $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); 133 } 134 else 135 { 136 $efficiency = 0; 137 } 138 139 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $efficiency . "%</b></td></tr>"; 140 $html .= "</table>"; 141 $html .= "<br/>"; 142 } else { 143 $html .= "<td class=kb-table-cell width=150><b>Alliance:</b></td><td class=kb-table-cell>"; 144 if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") 145 { 146 $html .= "<b>".$alliance->getName()."</b>"; 147 } 148 else 149 { 150 $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; 151 } 152 $html .= "</td><td class=kb-table-cell width=65><b>CEO:</b></td><td class=kb-table-cell><a href=\"?a=search&searchtype=pilot&searchphrase=" . urlencode($myAPI->getCeoName()) . "\">" . $myAPI->getCeoName() . "</a></td></tr>"; 153 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td>"; 154 $html .= "<td class=kb-table-cell><b>HQ:</b></td><td class=kb-table-cell>" . $myAPI->getStationName() . "</td></tr>"; 155 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td>"; 156 $html .= "<td class=kb-table-cell><b>Members:</b></td><td class=kb-table-cell>" . $myAPI->getMemberCount() . "</td></tr>"; 157 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000000, 2)."B</td>"; 158 $html .= "<td class=kb-table-cell><b>Shares:</b></td><td class=kb-table-cell>" . $myAPI->getShares() . "</td></tr>"; 159 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000000, 2)."B</td>"; 160 $html .= "<td class=kb-table-cell><b>Tax Rate:</b></td><td class=kb-table-cell>" . $myAPI->getTaxRate() . "%</td></tr>"; 161 if ($kill_summary->getTotalKillISK()) 162 { 163 $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); 164 } 165 else 166 { 167 $efficiency = 0; 168 } 169 170 $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $efficiency . "%</b></td>"; 171 $html .= "<td class=kb-table-cell><b>Website:</b></td><td class=kb-table-cell><a href=\"" . $myAPI->getUrl() . "\">" . $myAPI->getUrl() . "</a></td></tr>"; 172 $html .= "</table>"; 173 //$html .= "Corporation Description:"; 174 $html .= "<div class=kb-table-row-even style='width:100%;height:100px;overflow:auto'>"; 175 $html .= $myAPI->getDescription(); 176 $html .= "</div>"; 177 $html .= "<br/>"; 178 } 101 179 102 180 if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses") … … 187 265 $html .= $table->generate(); 188 266 189 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail& view=pilot_kills&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>";190 $html .= "<td align='right'><a href='?a=corp_detail& view=pilot_kills&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";267 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail&view=pilot_kills&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>"; 268 $html .= "<td align='right'><a href='?a=corp_detail&view=pilot_kills&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 191 269 192 270 $html .= "</td><td valign=top width=400>"; … … 216 294 $html .= $table->generate(); 217 295 218 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail& view=pilot_scores&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>";219 $html .= "<td align='right'><a href='?a=corp_detail& view=pilot_scores&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";296 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail&view=pilot_scores&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>"; 297 $html .= "<td align='right'><a href='?a=corp_detail&view=pilot_scores&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 220 298 221 299 $html .= "</td><td valign=top width=400>"; … … 245 323 $html .= $table->generate(); 246 324 247 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail& view=pilot_solo&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>";248 $html .= "<td align='right'><a href='?a=corp_detail& view=pilot_solo&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";325 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail&view=pilot_solo&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>"; 326 $html .= "<td align='right'><a href='?a=corp_detail&view=pilot_solo&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 249 327 250 328 $html .= "</td><td valign=top width=400>"; … … 275 353 $html .= $table->generate(); 276 354 277 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail& view=pilot_damage&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>";278 $html .= "<td align='right'><a href='?a=corp_detail& view=pilot_damage&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";355 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail&view=pilot_damage&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>"; 356 $html .= "<td align='right'><a href='?a=corp_detail&view=pilot_damage&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 279 357 280 358 $html .= "</td><td valign=top width=400>"; … … 304 382 $html .= $table->generate(); 305 383 306 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail& view=pilot_griefer&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>";307 $html .= "<td align='right'><a href='?a=corp_detail& view=pilot_griefer&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";384 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail&view=pilot_griefer&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>"; 385 $html .= "<td align='right'><a href='?a=corp_detail&view=pilot_griefer&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 308 386 309 387 $html .= "</td><td valign=top width=400>"; … … 333 411 $html .= $table->generate(); 334 412 335 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail& view=pilot_losses&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>";336 $html .= "<td align='right'><a href='?a=corp_detail& view=pilot_losses&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>";413 $html .= "<table width=300 cellspacing=1><tr><td><a href='?a=corp_detail&view=pilot_losses&m=$pmonth&crp_id=$crp_id&y=$pyear'>previous</a></td>"; 414 $html .= "<td align='right'><a href='?a=corp_detail&view=pilot_losses&crp_id=$crp_id&m=$nmonth&y=$nyear'>next</a></p></td></tr></table>"; 337 415 338 416 $html .= "</td><td valign=top width=400>"; … … 349 427 break; 350 428 case "ships_weapons": 351 $html .= "<div class=block-header2>Ships & weapons used</div>";429 $html .= "<div class=block-header2>Ships & weapons used</div>"; 352 430 353 431 $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; … … 456 534 } 457 535 536 $html .= "<hr><b>Extended Corp Detail " . EVELOGOVERSION . " by " . FindThunk() . ". Logo generation by Entity. Thanks to Arkady and Exi.</b><br/>"; 537 458 538 $menubox = new box("Menu"); 459 539 $menubox->setIcon("menu-item.gif"); 460 $menubox->addOption("caption","Kills & losses");461 $menubox->addOption("link","Recent activity", "?a=corp_detail& crp_id=" . $corp->getID());462 $menubox->addOption("link","Kills", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=kills");463 $menubox->addOption("link","Losses", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=losses");540 $menubox->addOption("caption","Kills & losses"); 541 $menubox->addOption("link","Recent activity", "?a=corp_detail&crp_id=" . $corp->getID()); 542 $menubox->addOption("link","Kills", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=kills"); 543 $menubox->addOption("link","Losses", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=losses"); 464 544 $menubox->addOption("caption","Pilot statistics"); 465 $menubox->addOption("link","Top killers", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=pilot_kills");545 $menubox->addOption("link","Top killers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_kills"); 466 546 467 547 if (config::get('kill_points')) 468 $menubox->addOption("link","Top scorers", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=pilot_scores");469 $menubox->addOption("link","Top solokillers", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=pilot_solo");470 $menubox->addOption("link","Top damagedealers", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=pilot_damage");471 $menubox->addOption("link","Top griefers", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=pilot_griefer");472 $menubox->addOption("link","Top losers", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=pilot_losses");548 $menubox->addOption("link","Top scorers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_scores"); 549 $menubox->addOption("link","Top solokillers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_solo"); 550 $menubox->addOption("link","Top damagedealers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_damage"); 551 $menubox->addOption("link","Top griefers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_griefer"); 552 $menubox->addOption("link","Top losers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_losses"); 473 553 $menubox->addOption("caption","Global statistics"); 474 $menubox->addOption("link","Ships & weapons", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=ships_weapons");475 $menubox->addOption("link","Most violent systems", "?a=corp_detail& crp_id=" . $corp->getID() . "&view=violent_systems");554 $menubox->addOption("link","Ships & weapons", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=ships_weapons"); 555 $menubox->addOption("link","Most violent systems", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=violent_systems"); 476 556 $page->addContext($menubox->generate()); 477 557 $page->setContent($html); -
dev/common/feed.php
r351 r370 1 1 <?php 2 2 /* 3 * Create a syndication feed of kills stored on this board. 4 */ 3 5 @set_time_limit(120); 4 6 require_once('kbconfig.php'); … … 10 12 11 13 $config = new Config(KB_SITE); 12 13 $html .= '<rss version="2.0"> 14 $qry = new DBQuery(); 15 if(config::get('kill_classified')) 16 { 17 $qry->execute('SELECT max(kll_id) as finalkill FROM kb3_kills WHERE kll_timestamp < "'.(date('Y-m-d H:i:s',time()-config::get('kill_classified')*60*60)).'"'); 18 } 19 else $qry->execute('SELECT max(kll_id) as finalkill FROM kb3_kills'); 20 $row=$qry->getRow(); 21 $finalkill = intval($row['finalkill']); 22 $html .= '<?xml version="1.0" encoding="UTF-8" ?> 23 <rss version="2.0"> 14 24 <channel> 15 25 <title>'.KB_TITLE.'</title> 16 <link>http://'.KB_HOST.'</link> 17 <description>Kill Feed v1.5</description> 18 <copyright>'.KB_TITLE.'</copyright>'."\n"; 19 26 <link>'.KB_HOST.'</link> 27 <description>Kill Feed v1.6</description> 28 <copyright>'.KB_TITLE.'</copyright> 29 <finalkill>'.$finalkill.'</finalkill>\n'; 30 if($_GET['combined']) $html .= '<combined>true</combined>\n'; 20 31 $klist = new KillList(); 21 32 $klist->setPodsNoobShips(true); … … 24 35 if ($w) 25 36 { 26 37 $klist->setWeek($w); 27 38 } 28 39 elseif (!$_GET['lastkllid']) 29 40 { 30 41 $klist->setWeek(kbdate("W")); 31 42 } 32 43 … … 34 45 if ($y) 35 46 { 36 47 $klist->setYear($y); 37 48 } 38 49 elseif (!$_GET['lastkllid']) 39 50 { 40 51 $klist->setYear(kbdate("Y")); 41 52 } 42 53 … … 44 55 if ($kid && method_exists($klist, 'setMinKllID')) 45 56 { 46 $klist->setMinKllID($kid); 57 $klist->setMinKllID($kid); 58 $klist->setOrderBy(' kll.kll_id ASC'); 59 $klist->setOrdered(true); 60 } 61 62 if ($_GET['pilot'] || $_GET['pilot_name']) 63 { 64 if ($_GET['pilot']) 65 { 66 $p = $_GET['pilot']; 67 } 68 if ($_GET['pilot_name']) 69 { 70 $p = $_GET['pilot_name']; 71 } 72 $pilot = new Pilot(); 73 $pilot->lookup(urldecode($p)); 47 74 } 48 75 49 76 if ($_GET['corp'] || $_GET['corp_name']) 50 77 { 51 52 53 54 55 56 57 58 59 60 78 if ($_GET['corp']) 79 { 80 $c = $_GET['corp']; 81 } 82 if ($_GET['corp_name']) 83 { 84 $c = $_GET['corp_name']; 85 } 86 $corp = new Corporation(); 87 $corp->lookup(urldecode($c)); 61 88 } 62 89 63 90 if ($_GET['alli'] || $_GET['alliance_name']) 64 91 { 65 66 67 68 69 70 71 72 73 74 92 if ($_GET['alli']) 93 { 94 $a = $_GET['alli']; 95 } 96 if ($_GET['alliance_name']) 97 { 98 $a = $_GET['alliance_name']; 99 } 100 $alli = new Alliance(); 101 $alli->add(urldecode($a)); 75 102 } 76 103 … … 82 109 if (!$master && $_GET['losses']) 83 110 { 84 if (CORP_ID && !$corp && !$alli) // local 85 { 86 $klist->addVictimCorp(new Corporation(CORP_ID)); 87 } 88 if (ALLIANCE_ID && !$corp && !$alli) // local 89 { 90 $klist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 91 } 92 if ($corp && $_GET['friend']) // remote friend 93 { 94 $klist->addVictimCorp($corp); 95 } 96 if ($alli && $_GET['friend']) // remote friend 97 { 98 $klist->addVictimAlliance($alli); 99 } 100 if ($corp && !$_GET['friend']) // remote 101 { 102 $klist->addInvolvedCorp($corp); 103 } 104 if ($alli && !$_GET['friend']) // remote 105 { 106 $klist->addInvolvedAlliance($alli); 107 } 108 } 109 else if (!$master) 110 { 111 if (CORP_ID && !$corp && !$alli) // local 112 { 113 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 114 } 115 if (ALLIANCE_ID && !$corp && !$alli) // local 116 { 117 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 118 } 119 if ($corp && $_GET['friend']) // remote friend 120 { 121 $klist->addInvolvedCorp($corp); 122 } 123 if ($alli && $_GET['friend']) // remote friend 124 { 125 $klist->addInvolvedAlliance($alli); 126 } 127 if ($corp && !$_GET['friend']) // remote 128 { 129 $klist->addVictimCorp($corp); 130 } 131 if ($alli && !$_GET['friend']) // remote 132 { 133 $klist->addVictimAlliance($alli); 134 } 135 } 111 if (PILOT_ID && !$pilot && !corp && !$alli) // local 112 { 113 $klist->addVictimPilot(new Pilot(PILOT_ID)); 114 } 115 if (CORP_ID && !pilot && !$corp && !$alli) // local 116 { 117 $klist->addVictimCorp(new Corporation(CORP_ID)); 118 } 119 if (ALLIANCE_ID && !pilot && !$corp && !$alli) // local 120 { 121 $klist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 122 } 123 if ($pilot && $_GET['friend']) // remote friend 124 { 125 $klist->addVictimPilot($pilot); 126 } 127 if ($corp && $_GET['friend']) // remote friend 128 { 129 $klist->addVictimCorp($corp); 130 } 131 if ($alli && $_GET['friend']) // remote friend 132 { 133 $klist->addVictimAlliance($alli); 134 } 135 if ($pilot && !$_GET['friend']) // remote 136 { 137 $klist->addInvolvedPilot($pilot); 138 } 139 if ($corp && !$_GET['friend']) // remote 140 { 141 $klist->addInvolvedCorp($corp); 142 } 143 if ($alli && !$_GET['friend']) // remote 144 { 145 $klist->addInvolvedAlliance($alli); 146 } 147 } 148 else if(!$master && $_GET['combined']) 149 { 150 if($pilot) $klist->addCombinedPilot($pilot); 151 if($corp) $klist->addCombinedCorp($corp); 152 if($alli) $klist->addCombinedAlliance($alli); 153 } 154 else if (!$master) 155 { 156 if (PILOT_ID && !$pilot && !corp && !$alli) // local 157 { 158 $klist->addInvolvedPilot(new Pilot(PILOT_ID)); 159 } 160 if (CORP_ID && !$pilot && !$corp && !$alli) // local 161 { 162 $klist->addInvolvedCorp(new Corporation(CORP_ID)); 163 } 164 if (ALLIANCE_ID && !$pilot && !$corp && !$alli) // local 165 { 166 $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 167 } 168 if ($pilot && $_GET['friend']) // remote friend 169 { 170 $klist->addInvolvedPilot($pilot); 171 } 172 if ($corp && $_GET['friend']) // remote friend 173 { 174 $klist->addInvolvedCorp($corp); 175 } 176 if ($alli && $_GET['friend']) // remote friend 177 { 178 $klist->addInvolvedAlliance($alli); 179 } 180 if ($pilot && !$_GET['friend']) // remote 181 { 182 $klist->addVictimPilot($pilot); 183 } 184 if ($corp && !$_GET['friend']) // remote 185 { 186 $klist->addVictimCorp($corp); 187 } 188 if ($alli && !$_GET['friend']) // remote 189 { 190 $klist->addVictimAlliance($alli); 191 } 192 } 136 193 137 194 $kills = array(); 138 195 while ($kill = $klist->getKill()) 139 196 { 140 if ($kill->isClassified()) 141 { 142 continue; 143 } 144 145 $kills[$kill->getID()] = $kill->getTimestamp(); 146 } 147 asort($kills); 148 197 if ($kill->isClassified()) 198 { 199 continue; 200 } 201 202 $kills[$kill->getID()] = $kill->getTimestamp(); 203 } 204 if (!$kid) 205 { 206 asort($kills); 207 } 149 208 foreach ($kills as $id => $timestamp) 150 209 { 151 152 210 $kill = new Kill($id); 211 $html .= '<item> 153 212 <title>'.$id.'</title> 154 213 <description><![CDATA[ '.$kill->getRawMail().' ]]></description> … … 161 220 if ($_GET['gz']) 162 221 { 163 echo gzdeflate($html, 9);222 echo gzdeflate($html,6); 164 223 } 165 224 else 166 225 { 167 226 echo $html; 168 227 } 169 228 ?> -
dev/common/home.php
r368 r370 1 1 <?php 2 2 require_once('common/includes/class.killsummarytable.public.php'); 3 require_once('common/includes/class.corp.php');4 require_once('common/includes/class.alliance.php');5 3 require_once('common/includes/class.killlist.php'); 6 4 require_once('common/includes/class.killlisttable.php'); 7 5 require_once('common/includes/class.contract.php'); 8 6 require_once('common/includes/class.toplist.php'); 9 10 $week = kbdate('W'); 11 $year = getYear(); 7 if(config::get('show_clock')) require_once('common/includes/class.clock.php'); 8 9 // If a valid week and year are given then show that week. 10 if(((int)$_GET['w']) >0 && ((int)$_GET['w']) < 54 && ((int)$_GET['y']) > 2000) $prevweek = true; 11 else $prevweek = false; 12 if($prevweek) 13 { 14 $week = (int)$_GET['w']; 15 if($week<10) $week='0'.$week; 16 $year = (int)$_GET['y']; 17 } 18 else 19 { 20 $week = kbdate('W'); 21 $year = getYear(); 22 } 23 if ($week == 1) 24 { 25 $pyear = $year - 1; 26 $pweek = 53; 27 } 28 else 29 { 30 $pyear = $year; 31 $pweek = $week - 1; 32 } 33 34 $killcount = config::get('killcount'); 35 $hourlimit = config::get('limit_hours'); 36 if(!$hourlimit) $hourlimit = 1; 37 $klreturnmax = 3; 12 38 13 39 $page = new Page('Week '.$week); 14 40 41 // Display the summary table. 15 42 $kslist = new KillList(); 16 43 involved::load($kslist,'kill'); … … 34 61 } 35 62 36 if ($week == 1) 37 { 38 $pyear = $year - 1; 39 $pweek = 52; 40 } 41 else 42 { 43 $pyear = $year; 44 $pweek = $week - 1; 45 } 46 63 // Display campaigns, if any. 47 64 if ($page->killboard_->hasCampaigns(true)) 48 65 { … … 55 72 } 56 73 74 // Display contracts, if any. 57 75 if ($page->killboard_->hasContracts(true)) 58 76 { … … 68 86 if (strpos(config::get('mods_active'), 'rss_feed') !== false) 69 87 { 70 $html .= "<div class=kb-kills-header><a href=\"?a=rss\"><img src=\"mods/rss_feed/rss_icon.png\" alt=\"RSS-Feed\" border=\"0\"></a> 20 most recent kills</div>"; 71 } 72 else 73 { 74 $html .= "<div class=kb-kills-header>20 most recent kills</div>"; 75 } 76 77 $klist = new KillList(); 78 $klist->setOrdered(true); 79 involved::load($klist,'kill'); 80 81 82 // boards with low killcount could not display 20 kills with those limits 83 //$klist->setStartWeek($week - 1); 84 //$klist->setYear($year); 85 $klist->setLimit(config::get('killcount')); 86 87 if ($_GET['scl_id']) 88 $klist->addVictimShipClass(new ShipClass($_GET['scl_id'])); 89 else 90 $klist->setPodsNoobShips(false); 91 92 $table = new KillListTable($klist); 93 $table->setLimit(config::get('killcount')); 94 $html .= $table->generate(); 95 88 $html .= "<div class=kb-kills-header><a href=\"?a=rss\"><img src=\"mods/rss_feed/rss_icon.png\" alt=\"RSS-Feed\" border=\"0\"></a> ".$killcount." most recent kills</div>"; 89 } 90 else 91 { 92 $html .= "<div class=kb-kills-header>".$killcount." most recent kills</div>"; 93 } 94 95 // Retrieve kills to be displayed limited by the date. If too few are returned 96 // extend the date range. If too many are returned reduce the date range. 97 while(true) 98 { 99 $klist = new KillList(); 100 $klist->setOrdered(true); 101 // We'll be needing comment counts so set the killlist to retrieve them 102 if (config::get('comments_count')) $klist->setCountComments(true); 103 // We'll be needing involved counts so set the killlist to retrieve them 104 if (config::get('killlist_involved')) $klist->setCountInvolved(true); 105 // limiting doesn't work well with grouping and ordering sql but in case 106 // it improves a limit one higher than the size test is used 107 if (!$prevweek) $klist->setLimit($killcount * $klreturnmax + 1); 108 else 109 { 110 $klist->setWeek($week); 111 $klist->setYear($year); 112 } 113 // $klist->setLimit($killcount); 114 // Select between combined kills and losses or just kills. 115 if(config::get('show_comb_home')) 116 { 117 if(ALLIANCE_ID >0) $klist->addCombinedAlliance(ALLIANCE_ID); 118 if(CORP_ID >0) $klist->addCombinedCorp(CORP_ID); 119 if(PILOT_ID>0) $klist->addCombinedPilot(PILOT_ID); 120 } 121 else involved::load($klist,'kill'); 122 123 124 if ($_GET['scl_id']) 125 $klist->addVictimShipClass(intval($_GET['scl_id'])); 126 else 127 $klist->setPodsNoobShips(false); 128 129 if($prevweek ) break; // If showing a previous week then don't limit results 130 $klist->setStartDate(gmdate("Y-m-d H:i", time()-$hourlimit*3600)); 131 132 if($klist->getRealCount() < $killcount) 133 { 134 // Find oldest kill with board owner as victim or involved 135 $qry = new DBQuery(); 136 $sql = "SELECT kll_timestamp AS oldest FROM kb3_kills "; 137 if($_GET['scl_id']) $sql .= "JOIN kb3_ships ON shp_id = kll_ship_id "; 138 if(ALLIANCE_ID) $sql .= "JOIN kb3_inv_detail ON kll_id = ind_kll_id WHERE kll_all_id != ".ALLIANCE_ID." AND ind_all_id = ".ALLIANCE_ID." "; 139 else if(CORP_ID) $sql .= "JOIN kb3_inv_detail ON kll_id = ind_kll_id WHERE kll_crp_id != ".CORP_ID." AND ind_crp_id = ".CORP_ID." "; 140 else if(PILOT_ID) $sql .= "JOIN kb3_inv_detail ON kll_id = ind_plt_id WHERE ind_plt_id = ".PILOT_ID." "; 141 if($_GET['scl_id']) $sql .="and shp_class = ".intval($_GET['scl_id'])." "; 142 $sql .="ORDER BY kll_timestamp LIMIT 1"; 143 $qry->execute($sql); 144 // If there are no kills there's no point changing the date range 145 if($qry->recordCount() == 0) break; 146 // If the date range already includes the oldest kill then no kills are 147 // relevant so there's no point changing the date range 148 $row = $qry->getRow(); 149 if($hourlimit > abs(strtotime($row['oldest'])-time())/3600 ) break; 150 if( !($hourlimit > 1) ) $hourlimit = 1; 151 $hourlimit = $hourlimit * 2; 152 if(!$_GET['scl_id']) config::set('limit_hours', $hourlimit); 153 $limitDate=date('Y-m-d H:i',strtotime('-'.$hourlimit.'hours') ); 154 continue; 155 } 156 // If more than the needed kills are retrieved 157 // reduce the hour count by 1 with a minimum of 4 158 else if($klist->getRealCount() > $killcount * $klreturnmax) 159 { 160 if($hourlimit > 4) config::set('limit_hours', intval($hourlimit * 0.8) ); 161 } 162 break; 163 } 164 165 // If this is the current week then show the most recent kills. If a previous 166 // week show all kills for the week using the page splitter. 167 if($prevweek) 168 { 169 $pagesplitter = new PageSplitter($klist->getCount(), $killcount); 170 $klist->setPageSplitter($pagesplitter); 171 $table = new KillListTable($klist); 172 if(config::get('show_comb_home')) $table->setCombined(true); 173 $html .= $table->generate(); 174 $html .= $pagesplitter->generate(); 175 } 176 else 177 { 178 $table = new KillListTable($klist); 179 if(config::get('show_comb_home')) $table->setCombined(true); 180 $table->setLimit($killcount); 181 $html .= $table->generate(); 182 } 183 184 // Display the menu for previous and next weeks. 96 185 $page->setContent($html); 97 186 $menubox = new box("Menu"); 98 187 $menubox->setIcon("menu-item.gif"); 99 188 $menubox->addOption("caption","Navigation"); 100 $menubox->addOption("link","Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear); 189 if($prevweek) 190 { 191 $menubox->addOption("link","Previous week", "?a=home&w=" . $pweek . "&y=" . $pyear); 192 if(kbdate('W') != $week) 193 { 194 if ($week == 53) 195 { 196 $nweek = 1; 197 $nyear = $year + 1; 198 $pyear = $year - 1; 199 } 200 else 201 { 202 $nweek = $week + 1; 203 $nyear = $year; 204 } 205 $menubox->addOption("link","Next week", "?a=home&w=" . $nweek . "&y=" . $nyear); 206 } 207 } 208 else 209 { 210 $menubox->addOption("link","Whole week", "?a=home&w=" . $week . "&y=" . $year); 211 $menubox->addOption("link","Previous week", "?a=home&w=" . $pweek . "&y=" . $pyear); 212 } 101 213 $page->addContext($menubox->generate()); 102 214 215 // Show the Eve time. 216 if(config::get('show_clock')) 217 { 218 $clock = new Clock(); 219 $page->addContext($clock->generate()); 220 } 221 // Display the top pilot lists. 103 222 $tklist = new TopKillsList(); 104 223 $tklist->setWeek($week); -
dev/common/includes/autoupgrade.php
r355 r370 12 12 define(CURRENT_DB_UPDATE,config::get("DBUpdate")); 13 13 //Update version of this autoupgrade.php 14 define(LASTEST_DB_UPDATE,"00 5");14 define(LASTEST_DB_UPDATE,"007"); 15 15 16 16 function updateDB(){ 17 17 // if update nesseary run updates 18 18 if (CURRENT_DB_UPDATE < LASTEST_DB_UPDATE ){ 19 19 20 update001(); 20 21 update002(); … … 22 23 update004(); 23 24 update005(); 24 } 25 } 26 27 function update001(){ 25 26 update007(); 27 } 28 } 29 30 /* 31 * Too much has changed between update005 and current status for a clean 32 * update006. Restarting from update007 in the hope that the differences 33 * between 5 and 7 are worked out and an update006 implemented 34 */ 35 36 function update001(){ 28 37 //Checking if this Update already done 29 38 if (CURRENT_DB_UPDATE < "001" ) … … 168 177 } 169 178 179 function update007() 180 { 181 //Checking if this Update already done 182 if (CURRENT_DB_UPDATE < "007" ) 183 { 184 $qry = new DBQuery(true); 185 // Add columns for external ids. 186 $qry->execute("SHOW COLUMNS FROM kb3_alliances LIKE 'all_external_id'"); 187 $testresult = $qry->recordCount(); 188 if(!$testresult) 189 { 190 $sql = "ALTER TABLE `kb3_alliances` ". 191 "ADD `all_external_id` INT( 11 ) UNSIGNED NULL ". 192 "DEFAULT NULL , ADD UNIQUE ( all_external_id )"; 193 $qry->execute($sql); 194 } 195 196 $qry->execute("SHOW COLUMNS FROM kb3_corps LIKE 'crp_external_id'"); 197 $testresult = $qry->recordCount(); 198 if(!$testresult) 199 { 200 $sql = "ALTER TABLE `kb3_corps` ". 201 "ADD `crp_external_id` INT( 11 ) UNSIGNED NULL ". 202 "DEFAULT NULL , ADD UNIQUE ( crp_external_id )"; 203 $qry->execute($sql); 204 } 205 206 /* 207 * Needs more code changes first to change 208 * plt_externalid == 0 checks to plt_externalid IS NULL 209 * 210 $sql = " ALTER TABLE `kb3_pilots` CHANGE `plt_externalid` `plt_externalid` INT( 11 ) UNSIGNED NULL DEFAULT NULL "; 211 $qry->execute($sql); 212 213 // Remove bugged non-unique external ids. 214 $sql = "UPDATE kb3_pilots old JOIN ". 215 "(SELECT DISTINCT a.plt_id ". 216 "FROM kb3_pilots a, kb3_pilots b ". 217 "WHERE a.plt_externalid = b.plt_externalid ". 218 "AND a.plt_id <> b.plt_id AND a.plt_externalid > 0) new ". 219 "ON old.plt_id = new.plt_id SET old.plt_externalid = 0 "; 220 $qry->execute($sql); 221 222 $sql = "UPDATE kb3_pilots set plt_externalid = NULL WHERE plt_externalid = 0"; 223 if( $qry->execute($sql)) 224 { 225 $qry->execute(" ALTER TABLE `kb3_pilots` ". 226 "DROP INDEX `plt_externalid` , ". 227 "ADD UNIQUE `plt_externalid` ( `plt_externalid` ) "); 228 } 229 */ 230 $qry->execute("SHOW COLUMNS FROM kb3_kills LIKE 'kll_external_id'"); 231 $testresult = $qry->recordCount(); 232 if(!$testresult) 233 { 234 $sql = "ALTER TABLE `kb3_kills` ". 235 "ADD `kll_external_id` INT( 11 ) UNSIGNED NULL ". 236 "DEFAULT NULL , ADD UNIQUE ( kll_external_id )"; 237 $qry->execute($sql); 238 } 239 // Add isk loss column to kb3_kills 240 $sql = "ALTER TABLE `kb3_kills` ADD `kll_isk_loss` FLOAT NOT NULL DEFAULT '0'"; 241 $qry->execute($sql); 242 // Update price with items destroyed and ship value, excluding 243 // blueprints since default cost is for BPO and BPC looks identical 244 $sql = "UPDATE kb3_kills NATURAL JOIN (SELECT kll_id, ". 245 "sum(if(typeName LIKE '%Blueprint%',0,if(isnull(itd_quantity), ". 246 "0,itd_quantity * if(price = 0 OR isnull(price),basePrice,price)))) ". 247 "+ if(isnull(shp_value),shp_baseprice,shp_value) AS killcost ". 248 "FROM kb3_kills ". 249 "LEFT JOIN kb3_items_destroyed ON kll_id = itd_kll_id ". 250 "INNER JOIN kb3_ships ON kb3_ships.shp_id = kll_ship_id ". 251 "LEFT JOIN kb3_ships_values ON kb3_ships_values.shp_id = kll_ship_id ". 252 "LEFT JOIN kb3_item_price ON kb3_item_price.typeID = itd_itm_id ". 253 "LEFT JOIN kb3_invtypes ON itd_itm_id = kb3_invtypes.typeID ". 254 "GROUP BY kll_id) cost ". 255 "SET kll_isk_loss = killcost"; 256 $qry->execute($sql); 257 258 $qry->execute("SHOW COLUMNS FROM kb3_kills LIKE 'kll_fb_crp_id'"); 259 if($qry->recordCount()) $qry->execute("ALTER TABLE `kb3_kills` DROP `kll_fb_crp_id`"); 260 $qry->execute("SHOW COLUMNS FROM kb3_kills LIKE 'kll_fb_all_id'"); 261 if($qry->recordCount()) $qry->execute("ALTER TABLE `kb3_kills` DROP `kll_fb_all_id`"); 262 // Drop unused columns 263 $qry->execute("SHOW COLUMNS FROM kb3_corps LIKE 'crp_trial'"); 264 if($qry->recordCount()) $qry->execute("ALTER TABLE kb3_corps DROP crp_trial"); 265 $qry->execute("SHOW COLUMNS FROM kb3_pilots LIKE 'plt_killpoints'"); 266 if($qry->recordCount()) $qry->execute("ALTER TABLE kb3_pilots DROP plt_killpoints"); 267 $qry->execute("SHOW COLUMNS FROM kb3_pilots LIKE 'plt_losspoints'"); 268 if($qry->recordCount()) $qry->execute("ALTER TABLE kb3_pilots DROP plt_losspoints"); 269 $qry->execute("SHOW INDEX FROM kb3_inv_detail"); 270 271 // Add corp and alliance index to kb3_inv_detail 272 $indexcexists = false; 273 $indexaexists = false; 274 while($testresult = $qry->getRow()) 275 if($testresult['Column_name'] == 'ind_crp_id') 276 $indexcexists = true; 277 if($testresult['Column_name'] == 'ind_all_id') 278 $indexaexists = true; 279 if(!indexcexists) 280 $qry->execute("ALTER TABLE `kb3_inv_detail` ADD INDEX ( `ind_crp_id` ) "); 281 if(!indexaexists) 282 $qry->execute("ALTER TABLE `kb3_inv_detail` ADD INDEX ( `ind_all_id` ) "); 283 // Add table for api cache 284 $sql = "CREATE TABLE IF NOT EXISTS `kb3_apicache` ( 285 `cfg_site` varchar(16) NOT NULL default '', 286 `cfg_key` varchar(32) NOT NULL default '', 287 `cfg_value` text NOT NULL, 288 PRIMARY KEY (`cfg_site`,`cfg_key`) 289 )"; 290 $qry->execute($sql); 291 $qry->execute("CREATE TABLE IF NOT EXISTS `kb3_apilog` ( 292 `log_site` VARCHAR( 20 ) NOT NULL , 293 `log_keyname` VARCHAR( 20 ) NOT NULL , 294 `log_posted` INT NOT NULL , 295 `log_errors` INT NOT NULL , 296 `log_ignored` INT NOT NULL , 297 `log_verified` INT NOT NULL , 298 `log_totalmails` INT NOT NULL , 299 `log_source` VARCHAR( 20 ) NOT NULL , 300 `log_type` VARCHAR( 20 ) NOT NULL , 301 `log_timestamp` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' 302 ) ENGINE = MYISAM "); 303 304 // set update complete 305 config::set('API_DBUpdate', '1'); 306 307 // Add subsystem slot 308 $qry->execute("SELECT 1 FROM kb3_inv_detail WHERE itt_slot = 7"); 309 if(!$qry->recordCount()) 310 { 311 $qry->execute("INSERT INTO `kb3_item_locations` (`itl_id`, `itl_location`) VALUES(7, 'Subsystem Slot')"); 312 $qry->execute("UPDATE `kb3_item_types` SET `itt_slot` = '7' WHERE `kb3_item_types`.`itt_id` = 954 LIMIT 1"); 313 $qry->execute("UPDATE `kb3_item_types` SET `itt_slot` = '7' WHERE `kb3_item_types`.`itt_id` = 955 LIMIT 1"); 314 $qry->execute("UPDATE `kb3_item_types` SET `itt_slot` = '7' WHERE `kb3_item_types`.`itt_id` = 956 LIMIT 1"); 315 $qry->execute("UPDATE `kb3_item_types` SET `itt_slot` = '7' WHERE `kb3_item_types`.`itt_id` = 957 LIMIT 1"); 316 $qry->execute("UPDATE `kb3_item_types` SET `itt_slot` = '7' WHERE `kb3_item_types`.`itt_id` = 958 LIMIT 1"); 317 } 318 $qry->execute("TRUNCATE kb3_inv_all"); 319 $qry->execute("TRUNCATE kb3_inv_crp"); 320 $qry->execute("TRUNCATE kb3_inv_plt"); 321 322 config::set("DBUpdate","007"); 323 } 324 } 325 170 326 function update_slot_of_group($id,$oldSlot = 0 ,$newSlot){ 171 327 $qry = new DBQuery(); -
dev/common/includes/class.alliance.php
r343 r370 1 1 <?php 2 2 //! Creates a new Alliance or fetches an existing one from the database. 3 3 class Alliance 4 4 { 5 //! Create a new Alliance object from the given $id. 6 7 /*! 8 * \param $id The alliance ID. 9 */ 5 10 function Alliance($id = null) 6 11 { … … 10 15 $this->sql_ = "select * from kb3_alliances where all_id = " . $this->id_; 11 16 } 12 13 function getID()17 //! Return the alliance ID. 18 function getID() 14 19 { 15 20 return $this->id_; 16 21 } 17 22 //! Return the alliance name stripped of all non-ASCII non-alphanumeric characters. 18 23 function getUnique() 19 24 { 20 25 return preg_replace('/[^a-zA-Z0-9]/', '', $this->getName()); 21 26 } 22 27 //! Return the alliance name. 23 28 function getName() 24 29 { … … 26 31 return $this->row_['all_name']; 27 32 } 28 33 //! Fetch the alliance details from the database using the id given on construction. 29 34 function execQuery() 30 35 { … … 35 40 } 36 41 } 37 42 //! Add a new alliance to the database or update the details of an existing one. 43 44 /*! 45 * \param $name An alliance name for this object. 46 */ 38 47 function add($name) 39 48 { -
dev/common/includes/class.box.php
r212 r370 1 1 <?php 2 2 require_once("class.graph.php"); 3 //! Create a box to display information in. 3 4 5 //! Box will contain a title, an icon and an array of items. 4 6 class Box 5 7 { 8 //! Create a box and set the title. 6 9 function Box($title = '') 7 10 { … … 10 13 } 11 14 12 // its called setIcon... and it setsthe Icon.15 //! Set the Icon. 13 16 function setIcon($icon) 14 17 { … … 16 19 } 17 20 18 // add something to the array that we send to smarty later...19 // types can be caption, img, link, points. Only link needs all 3 attribues21 //! Add something to the array that we send to smarty later. 22 //! Types can be caption, img, link, points. Only links need all 3 attributes 20 23 function addOption($type, $name, $url = '') 21 24 { 22 25 $this->box_array[] = array('type' => $type, 'name' => $name, 'url' => $url); 23 26 } 24 27 //! Generate the html from the template. 25 28 function generate() 26 29 { … … 38 41 } 39 42 } 40 43 //! Create a box to display TopList awards. 41 44 class AwardBox 42 45 { 46 //! Create an AwardBox from the given TopList and descriptions. 43 47 function AwardBox($list, $title, $comment, $entity, $award) 44 48 { … … 49 53 $this->award_ = $award; 50 54 } 51 55 //!! Generate the output html from the template file. 52 56 function generate() 53 57 { … … 79 83 $smarty->assign('pilot_portrait', $pilot->getPortraitURL(64)); 80 84 $smarty->assign('award_img', IMG_URL."/awards/".$this->award_.".gif"); 81 $smarty->assign('url', "?a=pilot_detail& plt_id=".$rows[0]['plt_id'] );85 $smarty->assign('url', "?a=pilot_detail&plt_id=".$rows[0]['plt_id'] ); 82 86 $smarty->assign('name', $pilot->getName() ); 83 87 … … 92 96 break; 93 97 } 94 $pilot = new Pilot($rows[$i - 1]['plt_id']); 98 if(!$rows[$i - 1]['plt_name']) 99 { 100 $pilot = new Pilot($rows[$i - 1]['plt_id']); 101 $pilotname = $pilot->getName(); 102 } 103 else $pilotname = $rows[$i - 1]['plt_name']; 95 104 $bar = new BarGraph($rows[$i - 1]['cnt'], $max, 60); 96 $top[$i] = array('url'=> "?a=pilot_detail& plt_id=".$rows[$i - 1]['plt_id'], 'name'=>$pilot->getName(), 'bar'=>$bar->generate(), 'cnt'=>$rows[$i - 1]['cnt']);105 $top[$i] = array('url'=> "?a=pilot_detail&plt_id=".$rows[$i - 1]['plt_id'], 'name'=>$pilotname, 'bar'=>$bar->generate(), 'cnt'=>$rows[$i - 1]['cnt']); 97 106 } 98 107 -
dev/common/includes/class.cache.php
r317 r370 40 40 } 41 41 42 if (config::get(' is_reinforced') && count($_POST) == 0)42 if (config::get('auto_reinforced') && config::get('is_reinforced') && count($_POST) == 0) 43 43 { 44 44 return true; -
dev/common/includes/class.comments.php
r348 r370 1 1 <?php 2 //! Store and retrieve comments for each killmail. 2 3 4 //! This class is used when the details of a kill are viewed. 3 5 class Comments 4 6 { 5 7 //! Create a Comments object for a particular kill. 8 9 /* 10 * \param $kll_id The kill id to attach comments to or retrieve for. 11 */ 6 12 function Comments($kll_id) 7 13 { … … 10 16 11 17 $this->comments_ = array(); 18 } 19 //! Retrieve comments for a kill. 20 21 //! The kill id is set when the Comments object is constructed. 22 function getComments() 23 { 24 global $smarty; 25 12 26 $qry = new DBQuery(true); 13 $qry->execute("SELECT *,id FROM kb3_comments WHERE `kll_id` = '".$kll_id."' order by posttime asc"); 27 $qry->execute("SELECT *,id FROM kb3_comments WHERE `kll_id` = '". 28 $kll_id."' order by posttime asc"); 14 29 while ($row = $qry->getRow()) 15 30 { 16 $this->comments_[] = array('time' => $row['posttime'], 'name' => $row['name'], 'comment' => stripslashes($row['comment']), 'id' => $row['id']); 31 $this->comments_[] = array('time' => $row['posttime'], 'name' => $row['name'], 32 'comment' => stripslashes($row['comment']), 'id' => $row['id']); 17 33 } 18 }19 20 function getComments()21 {22 global $smarty;23 24 34 $smarty->assign_by_ref('comments', $this->comments_); 25 35 return $smarty->fetch(get_tpl('block_comments')); 26 36 } 27 37 //! Add a comment to a kill. 38 39 /*! 40 * The kill id is set when the Comments object is constructed. 41 * \param $name The name of the comment poster. 42 * \param $text The text of the comment to post. 43 */ 28 44 function addComment($name, $text) 29 45 { … … 35 51 VALUES ('".$this->id_."','".$comment."','".$name."','".kbdate('Y-m-d H:i:s')."')"); 36 52 $id = $qry->getInsertID(); 37 $this->comments_[] = array('time' => kbdate('Y-m-d H:i:s'), 'name' => $name, 'comment' => stripslashes($comment), 'id' => $id); 53 $this->comments_[] = array('time' => kbdate('Y-m-d H:i:s'), 54 'name' => $name, 'comment' => stripslashes($comment), 'id' => $id); 38 55 39 56 // create comment_added event 40 57 event::call('comment_added', $this); 41 58 } 42 59 //! Delete a comment. 60 61 /* 62 * \param $c_id The id of the comment to delete. 63 */ 43 64 function delComment($c_id) 44 65 { 45 66 $qry = new DBQuery(true); 46 $qry->execute("DELETE FROM kb3_comments WHERE id='".$c_id ."' LIMIT 1");67 $qry->execute("DELETE FROM kb3_comments WHERE id='".$c_id); 47 68 } 48 69 //! Set whether to post the raw comment text or bbencode it. 49 70 function postRaw($bool) 50 71 { 51 72 $this->raw_ = $bool; 52 73 } 53 74 //! bbencode a string. 75 76 //! Used before posting a comment. 54 77 function bbencode($string) 55 78 { -
dev/common/includes/class.config.php
r369 r370 1 1 <?php 2 3 require_once('common/includes/class.registry.php'); 4 2 5 class Config 3 6 { -
dev/common/includes/class.contract.php
r343 r370 45 45 from kb3_contract_details ctd 46 46 where ctd.ctd_ctr_id = ".$row['ctr_id']." 47 order by 3, 2, 1 ";47 order by 3, 2, 1 -- get corps & alliances for contract"; 48 48 49 49 $caqry = new DBQuery(); … … 61 61 if ($carow['ctd_crp_id']) 62 62 { 63 $this->klist_->addVictimCorp( new Corporation($carow['ctd_crp_id']));64 $this->llist_->addInvolvedCorp( new Corporation($carow['ctd_crp_id']));63 $this->klist_->addVictimCorp($carow['ctd_crp_id']); 64 $this->llist_->addInvolvedCorp($carow['ctd_crp_id']); 65 65 } 66 66 elseif ($carow['ctd_all_id']) 67 67 { 68 $this->klist_->addVictimAlliance( new Alliance($carow['ctd_all_id']));69 $this->llist_->addInvolvedAlliance( new Alliance($carow['ctd_all_id']));68 $this->klist_->addVictimAlliance($carow['ctd_all_id']); 69 $this->llist_->addInvolvedAlliance($carow['ctd_all_id']); 70 70 } 71 71 elseif ($carow['ctd_reg_id']) 72 72 { 73 $this->klist_->addRegion( new Region($carow['ctd_reg_id']));74 $this->llist_->addRegion( new Region($carow['ctd_reg_id']));73 $this->klist_->addRegion($carow['ctd_reg_id']); 74 $this->llist_->addRegion($carow['ctd_reg_id']); 75 75 } 76 76 elseif ($carow['ctd_sys_id']) 77 77 { 78 $this->klist_->addSystem( new SolarSystem($carow['ctd_sys_id']));79 $this->llist_->addSystem( new SolarSystem($carow['ctd_sys_id']));78 $this->klist_->addSystem($carow['ctd_sys_id']); 79 $this->llist_->addSystem($carow['ctd_sys_id']); 80 80 } 81 81 } … … 212 212 if (!$this->ctr_id_) 213 213 { 214 $sql = "insert into kb3_contracts values ( null, '". $name."',214 $sql = "insert into kb3_contracts values ( null, '".slashfix($name)."', 215 215 '".KB_SITE."', ".$campaign.", 216 216 '".$startdate." 00:00:00', … … 221 221 else 222 222 { 223 $sql = "update kb3_contracts set ctr_name = '". $name."',223 $sql = "update kb3_contracts set ctr_name = '".slashfix($name)."', 224 224 ctr_started = '".$startdate." 00:00:00', 225 225 ctr_ended = ".$enddate." … … 268 268 { 269 269 $this->type_ = "corp"; 270 $this->klist_->addVictimCorp( new Corporation($this->crp_id_));271 $this->llist_->addInvolvedCorp( new Corporation($this->crp_id_));270 $this->klist_->addVictimCorp($this->crp_id_); 271 $this->llist_->addInvolvedCorp($this->crp_id_); 272 272 $this->id_ = $this->crp_id_; 273 273 } … … 275 275 { 276 276 $this->type_ = "alliance"; 277 $this->klist_->addVictimAlliance( new Alliance($this->all_id_));278 $this->llist_->addInvolvedAlliance( new Alliance($this->all_id_));277 $this->klist_->addVictimAlliance($this->all_id_); 278 $this->llist_->addInvolvedAlliance($this->all_id_); 279 279 $this->id_ = $this->all_id_; 280 280 } … … 282 282 { 283 283 $this->type_ = "region"; 284 $this->klist_->addRegion( new Region($this->reg_id_));285 $this->llist_->addRegion( new Region($this->reg_id_));284 $this->klist_->addRegion($this->reg_id_); 285 $this->llist_->addRegion($this->reg_id_); 286 286 $this->id_ = $this->reg_id_; 287 287 } … … 289 289 { 290 290 $this->type_ = "system"; 291 $this->klist_->addSystem( new SolarSystem($this->sys_id_));292 $this->llist_->addSystem( new SolarSystem($this->sys_id_));291 $this->klist_->addSystem($this->sys_id_); 292 $this->llist_->addSystem($this->sys_id_); 293 293 $this->id_ = $this->sys_id_; 294 294 } … … 549 549 if (KB_MYSQL41) 550 550 { 551 $sql = 'select count(kll_id) AS ships, sum( lossisk) as isk from (select distinct kll_id,';551 $sql = 'select count(kll_id) AS ships, sum(kll_isk_loss) as isk from (select distinct kll_id,'; 552 552 } 553 553 else … … 556 556 } 557 557 558 559 if (config::get('ship_values')) 560 { 561 $sql .= ' ifnull(ksv.shp_value,scl.scl_value) AS lossisk FROM kb3_kills kll 558 /* 559 $sql .= ' kll_isk_loss FROM kb3_kills kll 562 560 INNER JOIN kb3_ships shp ON ( shp.shp_id = kll.kll_ship_id ) 563 left join kb3_ships_values ksv on (shp.shp_id = ksv.shp_id)'; 564 } 565 else 566 { 567 $sql .= ' scl.scl_value AS lossisk FROM kb3_kills kll 568 INNER JOIN kb3_ships shp ON ( shp.shp_id = kll.kll_ship_id )'; 569 } 570 $sql .= ' INNER JOIN kb3_ship_classes scl ON ( scl.scl_id = shp.shp_class ) 561 INNER JOIN kb3_ship_classes scl ON ( scl.scl_id = shp.shp_class ) 571 562 inner join kb3_systems sys on ( sys.sys_id = kll.kll_system_id )'; 572 563 */ 564 $sql .= ' kll_isk_loss FROM kb3_kills kll 565 inner join kb3_systems sys on ( sys.sys_id = kll.kll_system_id )'; 573 566 if ($list->regions_) 574 567 { 575 568 $sql .= ' inner join kb3_constellations con 576 on ( con.con_id = sys.sys_con_id ) 577 inner join kb3_regions reg on ( reg.reg_id = con.con_reg_id 578 and reg.reg_id in ( '.join(',', $list->regions_).' ) )'; 569 on ( con.con_id = sys.sys_con_id 570 and con.con_reg_id in ( '.join(',', $list->regions_).' ) )'; 579 571 } 580 572 if ($list->systems_) … … 582 574 $sql .= ' and kll.kll_system_id in ( '.join(',', $list->systems_).')'; 583 575 } 584 if ($list->inv_crp_) 585 { 586 $sql .= ' inner join kb3_inv_crp inc on ( kll.kll_id = inc.inc_kll_id ) '; 587 } 588 if ($list->inv_all_) 589 { 590 $sql .= ' inner join kb3_inv_all ina on ( kll.kll_id = ina.ina_kll_id ) '; 591 } 592 if ($list->inv_plt_) 593 { 594 $sql .= ' inner join kb3_inv_plt inp on ( kll.kll_id = inp.inp_kll_id ) '; 595 } 596 597 $sql .= ' where 1=1 '; 576 if ($list->inv_crp_ || $list->inv_all_ || $list->inv_plt_) 577 { 578 $sql .= ' inner join kb3_inv_detail ind on ( kll.kll_id = ind.ind_kll_id ) '; 579 } 580 581 if($list->getDateFilter()) 582 { 583 $sql .= " WHERE ".$list->getDateFilter(); 584 $sqlwhereop = ' AND '; 585 } 586 else $sqlwhereop = ' WHERE '; 598 587 599 588 $tmp = array(); … … 612 601 if (count($tmp)) 613 602 { 614 $sql .= ' and(';603 $sql .= $sqlwhereop.' ('; 615 604 $sql .= join(' or ', $tmp); 616 605 $sql .= ')'; 606 $sqlwhereop = ' AND '; 617 607 } 618 608 … … 621 611 if ($list->inv_crp_) 622 612 { 623 $tmp[] = 'in c.inc_crp_id in ( '.join(',', $list->inv_crp_).')';613 $tmp[] = 'ind.ind_crp_id in ( '.join(',', $list->inv_crp_).')'; 624 614 } 625 615 if ($list->inv_all_) 626 616 { 627 $tmp[] = 'in a.ina_all_id in ( '.join(',', $list->inv_all_).')';617 $tmp[] = 'ind.ind_all_id in ( '.join(',', $list->inv_all_).')'; 628 618 } 629 619 if ($list->inv_plt_) 630 620 { 631 $tmp[] = 'in p.inp_plt_id in ( '.join(',', $list->inv_plt_).')';621 $tmp[] = 'ind.ind_plt_id in ( '.join(',', $list->inv_plt_).')'; 632 622 } 633 623 if (count($tmp)) 634 624 { 635 $sql .= ' and(';625 $sql .= $sqlwhereop.' ('; 636 626 $sql .= join(' or ', $tmp); 637 627 $sql .= ')'; 638 } 639 640 if ($list->timeframe_) 641 { 642 $sql .= $list->timeframe_; 643 } 628 $sqlwhereop = ' AND '; 629 } 630 644 631 if (KB_MYSQL41) 645 632 { … … 647 634 $sql .= ') as kb3_shadow'; 648 635 } 649 636 $sql .= " -- contract: getTableStats"; 650 637 $result = $qry->execute($sql); 651 638 if (KB_MYSQL41) … … 661 648 { 662 649 $sum['ships'] += 1; 663 $sum['isk'] += $row[' lossisk'];650 $sum['isk'] += $row['kll_isk_loss']; 664 651 } 665 652 $row = $sum; -
dev/common/includes/class.corp.php
r357 r370 2 2 require_once('class.alliance.php'); 3 3 4 //! Creates a new Corporation or fetches an existing one from the database. 4 5 class Corporation 5 6 { 7 //! Create a new Corporation object from the given $id. 8 9 /*! 10 * \param $id The corporation ID. 11 */ 6 12 function Corporation($id = 0) 7 13 { … … 9 15 $this->qry_ = new DBQuery(); 10 16 } 11 17 //! Return whether this corporation is an NPC corporation. 12 18 function isNPCCorp() 13 19 { … … 19 25 } 20 26 27 //! Return the corporation name stripped of all non-ASCII non-alphanumeric characters. 21 28 function getUnique() 22 29 { 23 30 return preg_replace('/[^a-z0-9]/', '', strtolower($this->getName())); 24 31 } 25 32 //! Return a URL for the icon of this corporation. 26 33 function getPortraitURL($size = 64) 27 34 { 28 35 if ($this->isNPCCorp() || file_exists('img/corps/'.$this->getUnique().'.jpg')) 29 36 { 30 return '?a=thumb& type=corp&id='.$this->getUnique().'&size='.$size;37 return '?a=thumb&type=corp&id='.$this->getUnique().'&size='.$size; 31 38 } 32 return '?a=thumb& type=corp&id='.$this->id_.'&size='.$size;39 return '?a=thumb&type=corp&id='.$this->id_.'&size='.$size; 33 40 } 34 41 42 //! Return the corporation ID. 35 43 function getID() 36 44 { 37 45 return $this->id_; 38 46 } 39 47 //! Return the corporation name. 40 48 function getName() 41 49 { … … 44 52 } 45 53 54 //! Return an alliance object for the alliance this corporation belongs to. 46 55 function getAlliance() 47 56 { … … 49 58 return new Alliance($this->row_['crp_all_id']); 50 59 } 51 60 //! Lookup a corporation name and set this object to use the details found. 61 62 /*! 63 * \param $name The corporation name to look up. 64 */ 52 65 function lookup($name) 53 66 { … … 58 71 if ($row['crp_id']) $this->id_ = $row['crp_id']; 59 72 } 60 73 //! Search the database for the corporation details for this object. 61 74 function execQuery() 62 75 { … … 69 82 } 70 83 } 71 84 //! Add a new corporation to the database or update the details of an existing one. 85 86 /*! 87 * \param $name The name of the new corporation. 88 * \param $alliance The alliance this corporation belongs to. 89 * \param $timestamp The timestamp the corporation's details were updated. 90 */ 72 91 function add($name, $alliance, $timestamp) 73 92 { … … 78 97 if ($qry->recordCount() == 0) 79 98 { 80 $qry->execute("insert into kb3_corps (crp_id, crp_name, crp_all_id, crp_ trial, crp_updated) values ( null,'".slashfix($name)."',"81 .$alliance->getID().", 0,date_format('".$timestamp."','%Y.%m.%d %H:%i:%s'))");99 $qry->execute("insert into kb3_corps (crp_id, crp_name, crp_all_id, crp_updated) values ( null,'".slashfix($name)."'," 100 .$alliance->getID().",date_format('".$timestamp."','%Y.%m.%d %H:%i:%s'))"); 82 101 $this->id_ = $qry->getInsertID(); 83 102 } … … 97 116 return $this->id_; 98 117 } 99 118 //! Return whether this corporation was updated before the given timestamp. 119 120 /*! 121 * \param $timestamp A timestamp to compare this corporation's details with. 122 */ 100 123 function isUpdatable($timestamp) 101 124 { -
dev/common/includes/class.db.php
r350 r370 12 12 return; 13 13 } 14 if (!$this->id_ = mysql_connect(DB_HOST, DB_USER, DB_PASS)) 15 die("Unable to connect to mysql database."); 16 14 if(defined('DB_PORT')) 15 { 16 if (!$this->id_ = mysql_connect(DB_HOST.':'.DB_PORT, DB_USER, DB_PASS)) 17 die("Unable to connect to mysql database."); 18 } 19 else 20 { 21 if (!$this->id_ = mysql_connect(DB_HOST, DB_USER, DB_PASS)) 22 die("Unable to connect to mysql database."); 23 } 17 24 mysql_select_db(DB_NAME); 18 25 $conn_id = $this->id_; … … 39 46 function __construct($forceNormal = false) 40 47 { 41 if (DB_USE_MEMCACHE === true && !$forceNormal) 48 if (DB_TYPE_USED === 'mysqli' ) 49 { 50 if (DB_USE_MEMCACHE === true && !$forceNormal) 51 { 52 $object = new DBMemCachedQuery_mysqli(); 53 } 54 elseif (DB_USE_QCACHE === true && !$forceNormal) 55 { 56 $object = new DBCachedQuery_mysqli(); 57 } 58 else 59 { 60 $object = new DBNormalQuery_mysqli(); 61 } 62 } 63 elseif (DB_USE_MEMCACHE === true && !$forceNormal) 42 64 { 43 65 $object = new DBMemCachedQuery(); … … 86 108 { 87 109 $object = &$this->getRef($this); 88 if (DB_USE_MEMCACHE === true && !$forceNormal) 110 if (DB_TYPE_USED === 'mysqli' ) 111 { 112 if (DB_USE_MEMCACHE === true && !$forceNormal) 113 { 114 $object = new DBMemCachedQuery_mysqli(); 115 } 116 elseif (DB_USE_QCACHE === true && !$forceNormal) 117 { 118 $object = new DBCachedQuery_mysqli(); 119 } 120 else 121 { 122 $object = new DBNormalQuery_mysqli(); 123 } 124 } 125 elseif (DB_USE_MEMCACHE === true && !$forceNormal) 89 126 { 90 127 $object = new DBMemCachedQuery(); … … 106 143 } 107 144 145 //! mysql uncached query class. Manages SQL queries to a MySQL DB using mysql. 108 146 class DBNormalQuery 109 147 { 148 //! Prepare a connection for a new mysql query. 110 149 function DBNormalQuery() 111 150 { 151 static $totalexectime = 0; 152 $this->totalexectime_ = &$totalexectime; 112 153 $this->executed_ = false; 113 154 $this->dbconn_ = new DBConnection; 114 155 } 115 156 157 //! Return the count of queries performed. 158 159 /*! 160 * \param $increase if true then increment the count. 161 * \return the count of queries so far. 162 */ 116 163 function queryCount($increase = false) 117 164 { … … 126 173 } 127 174 175 //! Return the count of cached queries performed - 0 for uncaches queries. 176 function queryCachedCount($increase = false) 177 { 178 return 0; 179 } 180 181 //! Execute an SQL string. 182 183 /* 184 * If DB_HALTONERROR is set then this will exit on an error. 185 * \return false on error or true if successful. 186 */ 128 187 function execute($sql) 129 188 { … … 132 191 $this->resid_ = mysql_query($sql, $this->dbconn_->id()); 133 192 134 if ($this->resid_ === false) 135 { 193 if (!$this->resid_ || mysql_errno($this->dbconn_->id())) 194 { 195 if(defined('KB_PROFILE')) 196 { 197 DBDebug::recordError("Database error: ".$this->dbconn_->id()->error); 198 DBDebug::recordError("SQL: ".$this->_sql); 199 } 136 200 if (defined('DB_HALTONERROR') && DB_HALTONERROR) 137 201 { … … 147 211 148 212 $this->exectime_ = strtok(microtime(), ' ') + strtok('') - $t1; 213 $this->totalexectime_ += $this->exectime_; 149 214 $this->executed_ = true; 150 215 151 if (KB_PROFILE == 2) 152 { 153 file_put_contents('/tmp/profile.lst', $sql . "\nExecution time: " . $this->exectime_ . "\n", FILE_APPEND); 154 } 216 if(defined('KB_PROFILE')) DBDebug::profile($sql, $this); 155 217 156 218 $this->queryCount(true); … … 159 221 } 160 222 223 //! Return the number of rows returned by the last query. 161 224 function recordCount() 162 225 { … … 164 227 } 165 228 229 //! Return the next row of results from the last query. 166 230 function getRow() 167 231 { … … 173 237 } 174 238 239 //! Reset list of results to return the first row from the last query. 175 240 function rewind() 176 241 { … … 178 243 } 179 244 245 //! Return the auto-increment ID from the last insert operation. 180 246 function getInsertID() 181 247 { … … 183 249 } 184 250 251 //! Return the execution time of the last query. 185 252 function execTime() 186 253 { … … 188 255 } 189 256 257 //! Return true if a query has been executed or false if none has been. 190 258 function executed() 191 259 { … … 193 261 } 194 262 263 //! Return the most recent error message for the DB connection. 195 264 function getErrorMsg() 196 265 { … … 200 269 return $msg; 201 270 } 271 //! Set the autocommit status. 272 273 //! Not implemented with mysql library 274 function autocommit($commit = true) 275 { 276 return false; 277 } 278 279 //! Rollback all queries in the current transaction. 280 281 //! Not implemented with mysql library 282 function rollback() 283 { 284 return false; 285 } 202 286 } 287 288 class DBDebug 289 { 290 function recordError($text) 291 { 292 $qerrfile = "/tmp/EDKprofile.lst"; 293 if($text) file_put_contents($qerrfile, $text."\n", FILE_APPEND); 294 } 295 function profile($sql, $text='') 296 { 297 $qerrfile = "/tmp/EDKprofile.lst"; 298 if($text) file_put_contents($qerrfile, $text."\n", FILE_APPEND); 299 if (KB_PROFILE == 2) 300 { 301 file_put_contents($qerrfile, $sql . "\nExecution time: " . $this->exectime_ . "\n", FILE_APPEND); 302 } 303 if (KB_PROFILE == 3) 304 { 305 if(strtolower(substr($sql,0,6))=='select') 306 { 307 $prof_qry= mysqli_query($this->dbconn_->id(),'EXPLAIN extended '.$sql.";"); 308 while($prof_row = mysqli_fetch_assoc($prof_qry)) 309 $prof_out_exp .= implode(' | ', $prof_row)."\n"; 310 $prof_qry= mysqli_query($this->dbconn_->id(),'show warnings'); 311 312 while($prof_row = mysqli_fetch_assoc($prof_qry)) 313 $prof_out_ext .= implode(' | ', $prof_row)."\n"; 314 file_put_contents($qerrfile, $sql . "\n". 315 $prof_out_ext. $prof_out_exp. 316 "\n-- Execution time: " . $this->exectime_ . " --\n", FILE_APPEND); 317 } 318 else file_put_contents($qerrfile, $sql."\nExecution time: ".$this->exectime_."\n", FILE_APPEND); 319 } 320 321 if (KB_PROFILE == 4) 322 { 323 if($this->exectime_ > 0.1 && strtolower(substr($sql,0,6))=='select') 324 { 325 $prof_qry= mysqli_query($this->dbconn_->id(),'EXPLAIN extended '.$sql); 326 while($prof_row = mysqli_fetch_assoc($prof_qry)) 327 $prof_out_exp .= implode(' | ', $prof_row)."\n"; 328 $prof_qry= mysqli_query($this->dbconn_->id(),'show warnings'); 329 330 while($prof_row = mysqli_fetch_assoc($prof_qry)) 331 $prof_out_ext .= implode(' | ', $prof_row)."\n"; 332 file_put_contents($qerrfile, $sql . "\n". 333 $prof_out_ext. $prof_out_exp. 334 "\n-- Execution time: " . $this->exectime_ . " --\n", FILE_APPEND); 335 } 336 } 337 338 } 339 } 340 203 341 ?> -
dev/common/includes/class.db_cache.php
r369 r370 1 1 <?php 2 2 3 //! mysqli file-cached query class. Manages SQL queries to a MySQL DB using mysqli. 3 4 class DBCachedQuery 4 5 { 6 //! Set up a mysql cached query object with default values. 5 7 function DBCachedQuery() 6 8 { 9 static $totalexectime = 0; 10 $this->totalexectime_ = &$totalexectime; 7 11 $this->executed_ = false; 8 12 $this->_cache = array(); … … 11 15 // this is the minimum runtime a query has to run to be 12 16 // eligible for caching in seconds 13 $this->_minruntime = 0. 1;17 $this->_minruntime = 0.05; 14 18 15 19 // maximum size of a cached result set (512kB) … … 18 22 } 19 23 24 //! Check if this query has been cached and the cache valid. 25 26 /* 27 * \return true if this query has been cached and the cache is valid. 28 */ 20 29 function checkCache() 21 30 { … … 33 42 { 34 43 $this->_mtime = filemtime(KB_CACHEDIR.'/qcache_qry_'.$this->_hash); 44 /// Remove cached queries more than an hour old. 45 if (time() - $this->_mtime > 3600 ) 46 { 47 unlink(KB_CACHEDIR.'/qcache_qry_'.$this->_hash); 48 return false; 49 } 35 50 if ($this->isCacheValid()) 36 51 { … … 42 57 } 43 58 59 //! Extract all tables affected by a database modification. 60 61 //! The resulting list is set internally to this object. 44 62 function parseSQL() 45 63 { … … 79 97 } 80 98 99 //! Check if the cached query is valid. 100 101 /*! Determines whether the tables used by a query have been modified 102 * since the query was cached 103 */ 81 104 function isCacheValid() 82 105 { … … 101 124 } 102 125 126 //! Marks all tables affected by a database modification 103 127 function markAffectedTables() 104 128 { … … 107 131 $text = str_replace(array('ignore','`', "\r\n", "\n"), '', $text); 108 132 $text = str_replace('(', ' (', $text); 133 $text = str_replace(',', ', ', $text); 109 134 $ta = preg_split('/\s/', $text, 0, PREG_SPLIT_NO_EMPTY); 110 135 … … 123 148 $tables[] = $ta[2]; 124 149 } 150 elseif ($ta[0] == 'delete' && $ta[1] == 'from') 151 { 152 $tables[] = $ta[2]; 153 } 125 154 elseif ($ta[0] == 'delete') 126 155 { 156 $i = 1; 157 while($ta[$i] != 'from') 158 { 159 $tables[] = $ta[$i]; 160 $i++; 161 } 162 }elseif ($ta[0] == 'drop') 163 { 127 164 $tables[] = $ta[2]; 128 }elseif ($ta[0] == 'drop') 129 { 130 $tables[] = $ta[2]; 131 } 165 } 132 166 elseif ($ta[0] == 'alter') 133 167 { 134 168 return false; 135 169 } 136 170 elseif ($ta[0] == 'create') 137 171 { 138 172 return false; … … 154 188 } 155 189 190 //! Generate the query cache. 191 192 //! Serialise a query and write to file. 156 193 function genCache() 157 194 { … … 171 208 // if the bytesize of the table exceeds the limit we'll abort 172 209 // the cache generation and leave this query unbuffered 173 $bsize += join('', $row);210 $bsize += strlen(join('', $row)); 174 211 if ($bsize > $this->_maxcachesize) 175 212 { … … 189 226 } 190 227 228 //! Read a cached query from file. 191 229 function loadCache() 192 230 { … … 199 237 } 200 238 239 //! Execute an SQL string. 240 241 /* 242 * If DB_HALTONERROR is set then this will exit on an error. 243 * \return false on error or true if successful. 244 */ 201 245 function execute($sql) 202 246 { … … 220 264 $this->resid_ = mysql_query($sql, $this->dbconn_->id()); 221 265 222 if ($this->resid_ == false) 223 { 266 if (!$this->resid_ || mysql_errno($this->dbconn_->id())) 267 { 268 if(defined('KB_PROFILE')) 269 { 270 DBDebug::recordError("Database error: ".$this->dbconn_->id()->error); 271 DBDebug::recordError("SQL: ".$this->_sql); 272 } 224 273 if (DB_HALTONERROR === true) 225 274 { … … 235 284 236 285 $this->exectime_ = strtok(microtime(), ' ') + strtok('') - $t1; 286 $this->totalexectime_ += $this->exectime_; 237 287 $this->executed_ = true; 238 288 239 if (KB_PROFILE == 2) 240 { 241 file_put_contents('/tmp/profile.lst', $sql."\nExecution time: ".$this->exectime_."\n", FILE_APPEND); 242 } 289 if(defined('KB_PROFILE')) DBDebug::profile($sql); 243 290 244 291 // if the query was too slow we'll fetch all rows and run it cached … … 252 299 } 253 300 301 //! Return the count of queries performed. 302 303 /*! 304 * \param $increase if true then increment the count. 305 * \return the count of queries so far. 306 */ 254 307 function queryCount($increase = false) 255 308 { … … 264 317 } 265 318 319 //! Return the count of cached queries performed. 320 321 /*! 322 * \param $increase if true then increment the count. 323 * \return the count of queries so far. 324 */ 266 325 function queryCachedCount($increase = false) 267 326 { … … 276 335 } 277 336 337 //! Return the number of rows returned by the last query. 278 338 function recordCount() 279 339 { … … 285 345 } 286 346 347 //! Return the next row of results from the last query. 287 348 function getRow() 288 349 { … … 303 364 } 304 365 366 //! Reset list of results to return the first row from the last query. 305 367 function rewind() 306 368 { … … 312 374 } 313 375 376 //! Return the auto-increment ID from the last insert operation. 314 377 function getInsertID() 315 378 { … … 317 380 } 318 381 382 //! Return the execution time of the last query. 319 383 function execTime() 320 384 { … … 322 386 } 323 387 388 //! Return true if a query has been executed or false if none has been. 324 389 function executed() 325 390 { … … 327 392 } 328 393 394 //! Return the most recent error message for the DB connection. 329 395 function getErrorMsg() 330 396 { … … 334 400 return $msg; 335 401 } 402 //Not implemented with mysql library 403 function autocommit($commit = true) 404 { 405 return false; 406 } 407 408 //Not implemented with mysql library 409 function rollback() 410 { 411 return false; 412 } 336 413 } 337 414 ?> -
dev/common/includes/class.db_memcache.php
r350 r370 5 5 function DBMemcachedQuery() 6 6 { 7 static $totalexectime = 0; 8 $this->totalexectime_ = &$totalexectime; 7 9 $this->executed_ = false; 8 10 $this->_cache = array(); … … 137 139 if ($this->resid_ === false) 138 140 { 141 if(defined('KB_PROFILE')) 142 { 143 DBDebug::recordError("Database error: ".$this->dbconn_->id()->error); 144 DBDebug::recordError("SQL: ".$this->_sql); 145 } 139 146 if (DB_HALTONERROR === true) 140 147 { … … 150 157 151 158 $this->exectime_ = strtok(microtime(), ' ') + strtok('') - $t1; 159 $this->totalexectime_ += $this->exectime_; 152 160 $this->executed_ = true; 153 161 … … 246 254 return $msg; 247 255 } 256 //Not implemented with mysql library 257 function autocommit($commit = true) 258 { 259 return false; 260 } 261 262 //Not implemented with mysql library 263 function rollback() 264 { 265 return false; 266 } 248 267 } 249 268 ?> -
dev/common/includes/class.eveapi.php
r365 r370 2 2 // Report all PHP errors (bitwise 63 may be used in PHP 3) 3 3 @error_reporting(E_ALL ^ E_NOTICE); 4 define ("APIVERSION", "V 2.71");4 define ("APIVERSION", "V3.3"); 5 5 6 6 // 7 7 // Eve-Dev API Killmail parser by Captain Thunk! (ISK donations are all gratefully received) 8 // (Hypothetically, if someone were to copy this class and retroengineer it with simplexml statements instead, they could conceivably end up leaving a line resembling the one above with my name changed)9 8 // 9 10 10 require_once( "common/includes/class.kill.php" ); 11 11 require_once( "common/includes/class.parser.php" ); … … 14 14 require_once('common/includes/class.alliance.php'); 15 15 require_once( "common/includes/db.php" ); 16 if ( file_exists("common/includes/class.comments.php") ) 17 require_once( "common/includes/class.comments.php" ); 18 19 // ********************************************************************************************************************************************** 20 // **************** API KillLog - /char & /corp/Killlog.xml.aspx **************** 21 // ********************************************************************************************************************************************** 22 23 class API_KillLog { 24 25 function Import($keystring, $typestring, $keyindex) { 26 16 require_once('common/includes/class.apicache.php'); 17 18 // Checks for configuration of files and folders 19 if (!file_exists("cache/api")) 20 { 21 if (!mkdir("cache/api", 0777)) 22 { 23 // creating folder failed - spam something about that 24 echo "Failed to create folder 'cache/api' you should create the folder yourself and set chmod 777"; 25 } 26 } 27 28 // ********************************************************************************************************************************************** 29 // **************** API KillLog - /corp/Killlog.xml.aspx **************** 30 // ********************************************************************************************************************************************** 31 32 class API_KillLog 33 { 34 function Import($keystring, $typestring, $keyindex) 35 { 27 36 $this->mailcount_ = 0; 28 37 $this->ignoredmails_ = 0; 38 $this->malformedmails_ = 0; 39 $this->verified_ = 0; 29 40 $this->totalmails_ = 0; 41 $this->errorcode_ = 0; 42 $this->Output_ = ""; 43 $this->isContainer = false; 44 $this->hasdownloaded_ = false; 45 $this->errortext_ = ""; 46 $this->CachedUntil_ = ""; 47 $this->killmailExists_ = false; 30 48 31 49 // reduces strain on DB 50 if(function_exists("set_time_limit")) 51 set_time_limit(0); 52 32 53 $this->API_IgnoreFriendPos_ = config::get('API_IgnoreFriendPos'); 33 54 $this->API_IgnoreEnemyPos_ = config::get('API_IgnoreEnemyPos'); … … 36 57 $this->API_IgnoreAllianceFF_ = config::get('API_IgnoreAllianceFF'); 37 58 $this->API_NoSpam_ = config::get('API_NoSpam'); 38 $this->API_CacheTime_ = config::get('API_CachedUntil_' . $keyindex);59 $this->API_CacheTime_ = ApiCache::get('API_CachedUntil_' . $keyindex); 39 60 $this->API_UseCaching_ = config::get('API_UseCache'); 40 61 $this->API_CCPErrorCorrecting = config::get('API_CCPErrorCorrecting'); 41 62 $this->keyindex_ = $keyindex; 42 $allianceNameList = new AllianceAPI(); 43 $this->alliancearray_ = $allianceNameList->fetchalliances($this->iscronjob_); 63 64 65 // Initialise for error correcting and missing itemID resolution 66 $this->myIDName = new API_IDtoName(); 67 $this->myNameID = new API_NametoID(); 44 68 45 69 $lastdatakillid = 1; … … 52 76 } 53 77 54 if (is_file( 'cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml'))78 if (is_file(getcwd().'/cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml')) 55 79 $cacheexists = true; 56 80 else 57 81 $cacheexists = false; 58 59 if ((strtotime(gmdate("M d Y H:i:s")) - strtotime($this->API_CacheTime_) > 0) || ($this->API_UseCaching_ == 1) || !$cacheexists )// if API_UseCache = 1 (off) then don't use cache 82 83 // if API_UseCache = 1 (off) then don't use cache 84 if ((strtotime(gmdate("M d Y H:i:s")) - strtotime($this->API_CacheTime_) > 0) || ($this->API_UseCaching_ == 1) || !$cacheexists ) 60 85 { 61 86 // Load new XML 62 $this->Output_ .= "<i>Downloading latest XML file</i><br><br>"; 87 $logsource = "New XML"; 88 $this->Output_ .= "<i>Downloading latest XML file for " . config::get('API_Name_'.$keyindex) . "</i><br><br>"; 63 89 $data = '<myxml thunkage="1">'; 64 90 do { … … 69 95 $data .= '</myxml>'; 70 96 71 if ( ( $this->API_UseCaching_ ) == 0 && ( $this->iscronjob_ == false ) ) // Do not save the file97 if ( ( $this->API_UseCaching_ ) == 0 )//&& ( $this->iscronjob_ == false ) ) 72 98 { 73 $file = fopen('cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml', 'w+'); 74 fwrite($file, $data); 75 fclose($file); 99 // save the file if no errors have occurred 100 if ($this->errorcode_ == 0) 101 { 102 $file = fopen(getcwd().'/cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml', 'w+'); 103 fwrite($file, $data); 104 fclose($file); 105 //chmod the file so it can be altered by cronjobs in future 106 @chmod(getcwd().'/cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml',0666); 107 } 76 108 } 77 109 } else { 78 110 // re-use cached XML 79 $this->Output_ .= "<i>Using cached XML file</i><br><br>"; 80 if ($fp = @fopen('cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml', 'r')) { 81 $data = fread($fp, 1000000); 111 $this->Output_ .= "<i>Using cached XML file for " . config::get('API_Name_'.$keyindex) . "</i><br><br>"; 112 $logsource = "Cache"; 113 114 if ($fp = @fopen(getcwd().'/cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml', 'r')) { 115 $data = fread($fp, filesize(getcwd().'/cache/api/'.config::get('API_Name_'.$keyindex).'_KillLog.xml')); 82 116 fclose($fp); 83 117 } else { … … 99 133 xml_parser_free($xml_parser); 100 134 101 if ( $this->hasdownloaded_ == false && $this->errortext_ != "" ) 135 if ( ($this->hasdownloaded_ == false) && ($this->errortext_ != "") ) 136 { 102 137 $this->Output_ .= "<font color = \"#FF0000\">".$this->errortext_ . "</font><br>"; 138 $logsource = "Error"; 139 } 103 140 104 141 if ($this->mailcount_) 105 $this->Output_ .= "<div class=block-header2>".$this->mailcount_." kills added and ".$this->ignoredmails_." ignored from feed: api.eve-online.comwhich contained ".$this->totalmails_." mails.<br></div>";142 $this->Output_ .= "<div class=block-header2>".$this->mailcount_." kills, " . $this->malformedmails_ . " malformed, " . $this->ignoredmails_ . " ignored and " . $this->verified_ . " verified from feed: " . config::get('API_Name_'.$keyindex) . " which contained ".$this->totalmails_." mails.<br></div>"; 106 143 else 107 $this->Output_ .= "<div class=block-header2>No kills added from feed: api.eve-online.com which contained ".$this->totalmails_." mails.<br></div>"; 108 144 $this->Output_ .= "<div class=block-header2>No kills added, ". $this->malformedmails_ . " malformed, " . $this->ignoredmails_." ignored and " . $this->verified_ . " verified from feed: " . config::get('API_Name_'.$keyindex) . " which contained ".$this->totalmails_." mails.<br></div>"; 145 146 // Write to kb3_apilog 147 $qry = new DBQuery(); 148 if ($this->iscronjob_) 149 $logtype = "Cron Job"; 150 else 151 $logtype = "Manual"; 152 153 $qry->execute( "insert into kb3_apilog values( '" . KB_SITE . "', '" 154 . config::get('API_Name_'.$keyindex) . "'," 155 . $this->mailcount_ . "," 156 . $this->malformedmails_ . "," 157 . $this->ignoredmails_ . "," 158 . $this->verified_ . "," 159 . $this->totalmails_ . ",'" 160 . $logsource . "','" 161 . $logtype . "',now() )" ); 162 109 163 return $this->Output_; 110 164 … … 113 167 function startElement($parser, $name, $attribs) 114 168 { 115 if ($name == "ERROR") 116 $this->errorflag_ = true; 117 118 if ($name == "CACHEDUNTIL") 119 $this->cacheflag_ = true; 120 169 if($this->killmailExists_ && ($name != "ROW" || !is_numeric($attribs['KILLID']))) return; 170 else $this->killmailExists_ = false; 121 171 if ($name == "ROWSET") 122 172 { 123 if (($this->pname_ == "") && ($this->typid_ != "0")) 124 { // this is to catch containers that spawn a new rowset so are missed off loot 125 if ($this->qtydropped_ !=0) { 173 //echo $this->rowsetCounter_ . " "; 174 if (($this->pname_ == "") && ($this->typeid_ != "0")) 175 { 176 $this->isContainer = true; 177 // this is to catch containers that spawn a new rowset so are missed off loot 178 if ($this->qtydropped_ !=0) 179 { 126 180 // dropped items 127 181 $this->droppeditems_['typeid'][] = $this->typeid_; 128 182 $this->droppeditems_['qty'][] = $this->qtydropped_; 129 $this->droppeditems_['flag'][] = $this->itemFlag_; 183 //if ($this->isContainer) 184 //{ 185 // $this->droppeditems_['flag'][] = -1; 186 //} else { 187 $this->droppeditems_['flag'][] = $this->itemFlag_; 188 //} 130 189 } 131 if ($this->qtydestroyed_ != 0) { 190 if ($this->qtydestroyed_ != 0) 191 { 132 192 // destroyed items 133 193 $this->destroyeditems_['typeid'][] =$this->typeid_; 134 194 $this->destroyeditems_['qty'][] = $this->qtydestroyed_; 135 $this->destroyeditems_['flag'][] = $this->itemFlag_; 195 // if ($this->isContainer) 196 //{ 197 // $this->destroyeditems_['flag'][] = -1; 198 //} else { 199 $this->destroyeditems_['flag'][] = $this->itemFlag_; 200 //} 136 201 } 137 202 $this->typeid_ = 0; … … 140 205 $this->qtydestroyed_ = 0; 141 206 } 207 // goes after so container itself doesn't count as "(in countainer) 208 142 209 } 143 210 … … 152 219 break; 153 220 case "CHARACTERNAME": 154 $this->pname_ = $v; 221 $this->pname_ = $v; 222 223 // Error Correction is on (0 = on, 1 = off(I know, just don't ask)) 224 if ( $this->API_CCPErrorCorrecting == 0 ) 225 { 226 if ( ($this->charid_ != "0" ) && (strlen($this->pname_) == 0) ) 227 { 228 // name is blank but ID is valid - convert ID into name 229 $this->myIDName->clear(); 230 $this->myIDName->setIDs($this->charid_); 231 $this->Output_ .= $this->myIDName->fetchXML(); 232 $myNames = $this->myIDName->getIDData(); 233 $this->pname_ = $myNames[0]['name']; 234 } 235 } 155 236 break; 237 case "CORPORATIONID": 238 $this->corporationID_ = $v; 239 break; 156 240 case "CORPORATIONNAME": 157 $this->corporation_ = $v; 241 $this->corporation_ = $v; 242 243 // Error Correction is on (0 = on, 1 = off(I know, just don't ask)) 244 if ( $this->API_CCPErrorCorrecting == 0 ) 245 { 246 if ( ($this->corporationID_ != "0" ) && (strlen($this->corporation_) == 0) ) 247 { // name is blank but ID is valid - convert ID into name 248 $this->myIDName->clear(); 249 $this->myIDName->setIDs($this->corporationID_); 250 $this->Output_ .= $this->myIDName->fetchXML(); 251 $myNames = $this->myIDName->getIDData(); 252 $this->corporation_ = $myNames[0]['name']; 253 } 254 } 158 255 break; 159 256 case "ALLIANCEID": 160 if ($v != 0) 161 { 162 $this->alliance_ = $this->getAllianceName($v); 163 } else { 164 $this->alliance_ = "NONE"; // "None" in caps since EA 165 } 257 $this->allianceID_ = $v; 166 258 break; 167 //case "ALLIANCENAME": 168 // DISABLED - bugs early on (unsure if resolved yet, led to using the alliance ID and looking the name up instead 169 // $this->alliance_ = strip_tags($v); 170 // if (strlen($this->alliance_) == 0) 171 // $this->alliance_ = "None"; 172 // break; 259 case "ALLIANCENAME": 260 $this->alliance_ = $v; 261 262 // Error Correction is on (0 = on, 1 = off(I know, just don't ask)) 263 //if ( $this->API_CCPErrorCorrecting == 0 ) 264 // conditional branch removed - ALWAYS fix alliance name bugs 265 { 266 if ( ($this->allianceID_ != "0" ) && (strlen($this->alliance_) == 0) ) 267 { // name is blank but ID is valid - convert ID into name 268 $this->myIDName->clear(); 269 $this->myIDName->setIDs($this->allianceID_); 270 $this->Output_ .= $this->myIDName->fetchXML(); 271 $myNames = $this->myIDName->getIDData(); 272 $this->alliance_ = $myNames[0]['name']; 273 } 274 } 275 276 if (strlen($this->alliance_) == 0) 277 $this->alliance_ = "NONE"; 278 break; 173 279 case "DAMAGETAKEN": 174 280 $this->damagetaken_ = $v; … … 198 304 case "TYPEID": 199 305 $this->typeid_ = gettypeIDname($v); 306 307 // Missing Item correction 308 if ($this->typeid_ == "") 309 { 310 $this->myIDName->clear(); 311 $this->myIDName->setIDs($v); 312 $this->Output_ .= $this->myIDName->fetchXML(); 313 $myNames = $this->myIDName->getIDData(); 314 //$this->typeid_ = "Item missing from DB: " . $myNames[0]['name']; 315 $this->typeid_ = $myNames[0]['name']; 316 } 200 317 break; 201 318 case "FLAG": … … 217 334 $this->parseendofmail(); 218 335 } 219 $this->beforekillid_ = $v;220 336 $this->killid_ = $v; // added v2.6 for help tracing erroneous mails 221 337 $this->totalmails_++; // Count total number of mails in XML feed 338 if ($this->isKillIDVerified($v) != null) 339 { 340 $this->killmailExists_ = true; 341 unset($this->destroyeditems_ ); 342 unset($this->droppeditems_); 343 $this->beforekillid_ = 0; 344 return; 345 } else { 346 $this->killmailExists_ = false; 347 $this->beforekillid_ = $v; 348 } 222 349 break; 223 350 case "SOLARSYSTEMID": // convert to system name and fetch system security - DONE … … 237 364 case "MOONID": // only given with POS related stuff - unanchored mods however, do not have a moonid. 238 365 $this->moonid_ = $v; 239 $this->moonname_ = getMoonName($v); 366 367 $this->moonname_ = getMoonName($v); 368 // Missing Moon DB correction 369 if (($this->moonname_ == "") && ($this->moonid_ != 0)) 370 { 371 $this->myIDName->clear(); 372 $this->myIDName->setIDs($v); 373 $this->Output_ .= $this->myIDName->fetchXML(); 374 $myNames = $this->myIDName->getIDData(); 375 //$this->typeid_ = "Item missing from DB: " . $myNames[0]['name']; 376 $this->moonname_ = $myNames[0]['name']; 377 } 240 378 break; 241 379 case "KILLTIME": // Time Kill took place … … 252 390 } 253 391 break; 392 case "CODE": // error code 393 $this->errorcode_ .= $v; 394 break; 254 395 } 255 396 } … … 259 400 function endElement($parser, $name) 260 401 { 402 if($this->killmailExists_) return; 261 403 switch ($name) 262 404 { 405 case "ROWSET": 406 $this->isContainer = false; 407 break; 263 408 case "VICTIM": 264 409 $this->hasdownloaded_ = true; … … 269 414 //$this->shipname_ = "Unknown"; // this is done else mail will not parse 270 415 $this->isposkill_ = true; 271 } elseif ( $this->moonid_ == 0 && $this->pname_ == "") {416 } elseif (($this->moonid_ == 0) && ($this->pname_ == "") && ($this->charid_ != 0)) { 272 417 // catches unanchored POS modules - as moon is unknown, we will use system name instead 273 418 $this->pname_ = $this->systemname_; … … 292 437 293 438 if ( config::get('API_Update') == 0 ) 294 { // update Victim portrait while we're here 439 { 440 // update Victim portrait while we're here 295 441 $sql = 'select plts.plt_id, plts.plt_externalid from kb3_pilots plts where plts.plt_name = "' . $this->pname_ . '"'; 296 442 297 443 $qry = new DBQuery(); 298 444 $qry->execute($sql); 299 445 $row = $qry->getRow(); … … 304 450 305 451 if ( $pilot_external_id == 0 && $pilot_id != 0) 306 { // update DB with ID 452 { 453 // update DB with ID 307 454 $qry->execute("update kb3_pilots set plt_externalid = " . intval($this->charid_) . " 308 455 where plt_id = " . $pilot_id); … … 310 457 } 311 458 } 459 460 // update crp_external_id 461 Update_CorpID($this->corporation_, $this->corporationID_); 462 // update all_external_id 463 if ($this->allianceID_ != 0) 464 Update_AllianceID($this->alliance_, $this->allianceID_); 465 312 466 // set victim corp and alliance for FF check 313 467 $this->valliance_ = $this->alliance_; … … 327 481 $this->moonid_ = 0; 328 482 $this->mooname_ = 0; 483 $this->corporationID_ = 0; 484 $this->allianceID_ = 0; 329 485 break; 330 486 case "ROW": 331 if ( $this->typid_ != "0" ) 332 { // it's cargo 487 if ( $this->typeid_ != "0" ) 488 { 489 // it's cargo 333 490 if ($this->qtydropped_ !=0) 334 491 { … … 336 493 $this->droppeditems_['typeid'][] = $this->typeid_; 337 494 $this->droppeditems_['qty'][] = $this->qtydropped_; 338 $this->droppeditems_['flag'][] = $this->itemFlag_; 495 if ($this->isContainer) 496 { 497 $this->droppeditems_['flag'][] = -1; 498 } else { 499 $this->droppeditems_['flag'][] = $this->itemFlag_; 500 } 339 501 } 340 502 if ($this->qtydestroyed_ != 0) … … 343 505 $this->destroyeditems_['typeid'][] = $this->typeid_; 344 506 $this->destroyeditems_['qty'][] = $this->qtydestroyed_; 345 $this->destroyeditems_['flag'][] = $this->itemFlag_; 507 if ($this->isContainer) 508 { 509 $this->destroyeditems_['flag'][] = -1; 510 } else { 511 $this->destroyeditems_['flag'][] = $this->itemFlag_; 512 } 346 513 } 347 514 $this->typeid_ = 0; … … 350 517 $this->qtydestroyed_ = 0; 351 518 } 352 if ($this->corporation_ != "") // using corporation_ not pname_ as NPCs don't have a name 353 { // it's an attacker 519 // using corporation_ not pname_ as NPCs don't have a name *** CHANGED to corporationID 16/03/2009 to catch 'sleeper' NPCs 520 if ($this->corporationID_ != 0) 521 { 522 // it's an attacker 354 523 $this->attackerslist_['name'][] = $this->pname_; 355 524 $this->attackerslist_['finalblow'][] = $this->finalblow_; … … 363 532 364 533 if ( config::get('API_Update') == 0 ) 365 { // update Attacker portrait while we're here 534 { 535 // update Attacker portrait while we're here 366 536 $sql = 'select plts.plt_id, plts.plt_externalid from kb3_pilots plts where plts.plt_name = "' . $this->pname_ . '"'; 367 537 … … 375 545 376 546 if ( $pilot_external_id == 0 && $pilot_id != 0 ) 377 { // update DB with ID 547 { 548 // update DB with ID 378 549 $qry->execute("update kb3_pilots set plt_externalid = " . intval($this->charid_) . " 379 550 where plt_id = " . $pilot_id); … … 381 552 } 382 553 } 383 554 555 // update crp_external_id 556 Update_CorpID($this->corporation_, $this->corporationID_); 557 // update all_external_id 558 if ($this->allianceID_ != 0) 559 Update_AllianceID($this->alliance_, $this->allianceID_); 560 384 561 $this->pname_ = ""; 385 562 $this->finalblow_ = 0; … … 392 569 $this->damagedone_ = 0; 393 570 $this->charid_ = 0; 571 $this->corporationID_ = 0; 572 $this->allianceID_ = 0; 394 573 } 395 574 break; … … 399 578 400 579 // does last killmail 401 if ($this->hasdownloaded_) { // catch to prevent processing without any mails 580 if ($this->hasdownloaded_) 581 { 582 // catch to prevent processing without any mails 402 583 $this->parseendofmail(); 403 584 } … … 405 586 case "MYXML": 406 587 // end of data xml, process cachedtime here 407 //$ config->set('API_CachedUntil_' . $this->keyindex_, $this->cachetext_);588 //$ApiCache->set('API_CachedUntil_' . $this->keyindex_, $this->cachetext_); 408 589 break; 590 case "ERROR": // Error Message 591 if ($this->errortext_ == "") 592 { 593 $this->errortext_ .= $this->characterDataValue; 594 } 595 break; 596 case "CURRENTTIME": 597 $this->CurrentTime_ = $this->characterDataValue; 598 break; 599 case "CACHEDUNTIL": 600 // kill log can be several xml sheets stuck together, we only want the first CachedUntil_ 601 if ($this->CachedUntil_ == "") 602 { 603 // Do not save cache key if this is an error sheet 604 $this->CachedUntil_ = $this->characterDataValue; 605 ApiCache::set('API_CachedUntil_' . $this->keyindex_, $this->CachedUntil_); 606 } 607 break; 409 608 } 410 609 } … … 412 611 function characterData($parser, $data) 413 612 { 414 if ($this->errorflag_) 613 $this->characterDataValue = $data; 614 } 615 616 function parseendofmail() 617 { 618 // print attacks 619 $attackercounter = count($this->attackerslist_['name']); 620 // sort array into descending damage 621 if ($attackercounter != 0 ) 415 622 { 416 $this->errortext_ = $data; 417 $this->errorflag_ = false; 418 } 419 420 if ($this->cacheflag_) 421 { 422 $this->cachetext_ = $data; 423 $this->cacheflag_ = false; 424 } 425 } 426 427 function parseendofmail() 428 { 429 // print attacks 430 $attackercounter = count($this->attackerslist_['name']); 431 // sort array into descending damage 432 if ($attackercounter != 0 ) 433 { 434 array_multisort($this->attackerslist_['damagedone'], SORT_NUMERIC, SORT_DESC, 623 array_multisort($this->attackerslist_['damagedone'], SORT_NUMERIC, SORT_DESC, 435 624 $this->attackerslist_['name'], SORT_ASC, SORT_STRING, 436 625 $this->attackerslist_['finalblow'], SORT_NUMERIC, SORT_DESC, … … 448 637 $this->allianceFF_ = true; 449 638 $poswasfriendly = false; 450 639 451 640 // catch for victim being in no alliance 452 641 if ($this->valliance_ == "NONE") 453 642 $this->allianceFF_ = false; 454 643 455 644 for ($attackerx = 0; $attackerx < $attackercounter; $attackerx++) 456 645 { 457 // if NPC (name will be "") then set pname_ as corporation_ for mail parsing 458 if ($this->attackerslist_['name'][$attackerx] == "") 459 { 460 $this->killmail_ .= "Name: ".$this->attackerslist_['shiptypeid'][$attackerx] ." / ".$this->attackerslist_['corporation'][$attackerx]."\r\n"; 646 // if NPC (name will be "") then set pname_ as corporation_ for mail parsing 647 if ($this->attackerslist_['name'][$attackerx] == "") 648 { 649 // fix for Sleepers ("Unknown") 650 if ($this->attackerslist_['corporation'][$attackerx] == "") 651 { 652 $npccorpname = "Unknown"; 653 } else { 654 $npccorpname = $this->attackerslist_['corporation'][$attackerx]; 655 } 656 $this->killmail_ .= "Name: ".$this->attackerslist_['shiptypeid'][$attackerx] ." / ".$npccorpname."\r\n"; 461 657 $this->killmail_ .= "Damage Done: ".$this->attackerslist_['damagedone'][$attackerx]."\r\n"; 462 658 $this->corpFF_ = false; … … 481 677 // set Friendly Fire matches 482 678 if ($this->attackerslist_['alliance'][$attackerx] != $this->valliance_) 483 679 $this->allianceFF_ = false; 484 680 if ($this->attackerslist_['corporation'][$attackerx] != $this->vcorp_) 485 681 $this->corpFF_ = false; 486 682 } 487 683 $this->killmail_ .= "\r\n"; … … 499 695 { 500 696 if ($this->destroyeditems_['qty'][$x] > 1) 501 { // show quantity 502 $this->killmail_ .= $this->destroyeditems_['typeid'][$x].", Qty: ".$this->destroyeditems_['qty'][$x]; 503 } else { // just the one 504 $this->killmail_ .= $this->destroyeditems_['typeid'][$x]; 697 { 698 // show quantity 699 $this->killmail_ .= $this->destroyeditems_['typeid'][$x].", Qty: ".$this->destroyeditems_['qty'][$x]; 700 } else { 701 // just the one 702 $this->killmail_ .= $this->destroyeditems_['typeid'][$x]; 505 703 } 506 507 if ($this->destroyeditems_['flag'][$x] == 5) { 508 $this->killmail_ .= " (Cargo)"; 509 } elseif ($this->destroyeditems_['flag'][$x] == 87) { 510 $this->killmail_ .= " (Drone Bay)"; 511 } 704 705 if ($this->destroyeditems_['flag'][$x] == 5) { 706 $this->killmail_ .= " (Cargo)"; 707 } elseif ($this->destroyeditems_['flag'][$x] == 87) { 708 $this->killmail_ .= " (Drone Bay)"; 709 } elseif ($this->destroyeditems_['flag'][$x] == -1) 710 { 711 $this->killmail_ .= " (In Container)"; 712 } 512 713 $this->killmail_ .= "\r\n"; 513 714 } … … 521 722 for ($x = 0; $x < $counter; $x++) 522 723 { 523 if ($this->droppeditems_['qty'][$x] > 1) 524 { // show quantity 525 $this->killmail_ .= $this->droppeditems_['typeid'][$x].", Qty: ".$this->droppeditems_['qty'][$x]; 526 } else { // just the one 527 $this->killmail_ .= $this->droppeditems_['typeid'][$x]; 528 } 529 530 if ($this->droppeditems_['flag'][$x] == 5) 724 if ($this->droppeditems_['qty'][$x] > 1) 725 { 726 // show quantity 727 $this->killmail_ .= $this->droppeditems_['typeid'][$x].", Qty: ".$this->droppeditems_['qty'][$x]; 728 } else { 729 // just the one 730 $this->killmail_ .= $this->droppeditems_['typeid'][$x]; 731 } 732 733 if ($this->droppeditems_['flag'][$x] == 5) 734 { 735 $this->killmail_ .= " (Cargo)"; 736 } elseif ($this->droppeditems_['flag'][$x] == 87) 531 737 { 532 $this->killmail_ .= " (Cargo)";533 } elseif ($this->droppeditems_['flag'][$x] == 87)534 535 $this->killmail_ .= " (Drone Bay)";536 } 738 $this->killmail_ .= " (Drone Bay)"; 739 } elseif ($this->droppeditems_['flag'][$x] == -1) 740 { 741 $this->killmail_ .= " (In Container)"; 742 } 537 743 $this->killmail_ .= "\r\n"; 538 744 } … … 542 748 if ($this->isposkill_) { 543 749 // is board an alliance board? 544 if ( ALLIANCE_ID == 0) 545 { // no it's set as a corp 750 if ( ALLIANCE_ID == 0) 751 { 752 // no it's set as a corp 546 753 $thiscorp = new Corporation(CORP_ID); 547 754 if ( $this->vcorp_ == $thiscorp->getName() ) 548 $poswasfriendly = true; 549 } else { // yes it's an Alliance board 550 $thisalliance = new Alliance(ALLIANCE_ID); 755 $poswasfriendly = true; 756 } else { 757 // yes it's an Alliance board 758 $thisalliance = new Alliance(ALLIANCE_ID); 551 759 if ( $this->valliance_ == $thisalliance->getName() ) 552 760 $poswasfriendly = true; … … 556 764 if ( ( $this->API_IgnoreFriendPos_ == 0 ) && ( $poswasfriendly ) && ( $this->isposkill_ ) ) 557 765 { 558