Incomplete PHP library to access static data from eve-online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

types.php 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?PHP
  2. require('inc/common.php');
  3. require('inc/database.php');
  4. header('Content-type: text/xml');
  5. echo "<?xml version='1.0' encoding='UTF-8'?>\n";
  6. echo "<eveapi version='2' etversion='1'>\n";
  7. echo " <currentTime>", date('Y-m-d H:i:s'), "</currentTime>\n";
  8. echo " <result>\n";
  9. if (isset($_GET['category']) && isset($_GET['groups'])) {
  10. $sql2 = 'SELECT groupID, groupName, graphicID, published FROM invGroups WHERE categoryID = ' . ((int) $_GET['category']);
  11. if (isset($_GET['published'])) { $sql2 .= ' AND published = 1'; }
  12. $res2 = mysql_query($sql2);
  13. echo ' <rowset name="groups" key="groupID" columns="groupID,groupName,graphicID', isset($_GET['published']) ? '' : ',published', '">', "\n";
  14. while ($row2 = mysql_fetch_assoc($res2)) {
  15. echo ' <row';
  16. if (isset($_GET['published'])) { unset($row2['published']); }
  17. foreach ($row2 as $key => $value) {
  18. echo ' ', $key, '="', htmlspecialchars($value), '"';
  19. }
  20. echo '>', "\n";
  21. $_GET['group'] = $row2['groupID'];
  22. doTypes();
  23. echo '</row>';
  24. }
  25. echo ' </rowset>', "\n";
  26. } else {
  27. doTypes();
  28. }
  29. function doTypes() {
  30. $sql = 'SELECT typeID, groupID, typeName, invTypes.graphicID, published, raceID FROM invTypes WHERE ';
  31. if (isset($_GET['group'])) { $sql .= 'groupID = ' . ((int) $_GET['group']); }
  32. else if (isset($_GET['type'])) { $sql .= 'typeID = ' . ((int) $_GET['type']); }
  33. else if (isset($_GET['category'])) { $sql .= 'groupID IN (SELECT groupID from invGroups WHERE categoryID = ' . ((int) $_GET['category']) . ')'; }
  34. if (isset($_GET['published'])) { $sql .= ' AND published = 1'; }
  35. $res = mysql_query($sql) or print(mysql_error());
  36. echo ' <rowset name="types" key="typeID" columns="typeID', isset($_GET['group']) ? '' : ',groupID', ',typeName,graphicID', isset($_GET['published']) ? '' : ',published', ',raceID">', "\n";
  37. while ($row = mysql_fetch_assoc($res)) {
  38. echo ' <row';
  39. if (isset($_GET['group'])) { unset($row['groupID']); }
  40. if (isset($_GET['published'])) { unset($row['published']); }
  41. foreach ($row as $key => $value) {
  42. echo ' ', $key, '="', htmlspecialchars($value), '"';
  43. }
  44. echo '>', "\n";
  45. $sql2 = 'SELECT attributeID, valueInt, valueFloat, attributeName, published, highIsGood FROM dgmTypeAttributes NATURAL JOIN dgmAttributeTypes WHERE typeID = ' . $row['typeID'];
  46. if (isset($_GET['attributes'])) { $sql2 .= ' AND attributeName LIKE \'' . mysql_real_escape_string($_GET['attributes']) . '\''; }
  47. $res2 = mysql_query($sql2);
  48. echo ' <rowset name="attributes" key="attributeID" columns="attributeID,value,attributeName,published,highIsGood">', "\n";
  49. while ($row2 = mysql_fetch_assoc($res2)) {
  50. $row2['value'] = $row2['valueInt'] . $row2['valueFloat'];
  51. unset($row2['valueInt'], $row2['valueFloat']);
  52. echo ' <row';
  53. foreach ($row2 as $key => $value) {
  54. echo ' ', $key, '="', htmlspecialchars($value), '"';
  55. }
  56. echo '/>', "\n";
  57. }
  58. echo " </rowset>\n";
  59. echo " </row>\n";
  60. }
  61. echo ' </rowset>', "\n";
  62. }
  63. echo " </result>\n";
  64. echo " <cachedUntil>", date('Y-m-d H:i:s', CACHEDUNTIL), "</cachedUntil>\n";
  65. echo "</eveapi>\n";
  66. ?>