Automatically exported from code.google.com/p/planningalerts
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 17 Jahren
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. require_once ("include/config.php");
  3. require_once ("phpcoord.php");
  4. $api = new api;
  5. class api {
  6. //Properties
  7. var $warnings = "";
  8. var $easting = 0;
  9. var $northing = 0;
  10. var $area_size = 0;
  11. var $applications;
  12. //Constructor
  13. function api() {
  14. $this->setup();
  15. $this->bind();
  16. }
  17. //setup
  18. function setup (){
  19. //Grab the postcode and area size from the get string
  20. if (!isset($_GET['area_size'])){ //check is_numeric and isn't too big
  21. $this->warnings .= "No area size specified ";
  22. }
  23. if (!(isset($_GET['lat']) && isset($_GET['lng']))
  24. || !(isset($_GET['postcode'])) ) {
  25. $this->warmings .= "No location specified ";
  26. }
  27. if ($this->warnings == ""){
  28. //Get OS ref from postcode
  29. if (isset($_GET['postcode'])) {
  30. $xy = postcode_to_location($_GET['postcode']);
  31. } else {
  32. $latlng = new LatLng($_GET['lat'], $_GET['lng']);
  33. $xy = $latlng->toOSRef();
  34. }
  35. $this->easting = $xy->easting;
  36. $this->northing = $xy->northing;
  37. $this->area_size = $_GET['area_size'];
  38. $this->applications = Applications::query($this->easting, $this->northing, alert_size_to_meters($this->area_size));
  39. }
  40. }
  41. //Bind
  42. function bind () {
  43. //page vars
  44. $form_action = $_SERVER['PHP_SELF'];
  45. header("Content-Type: text/xml");
  46. //smarty
  47. $smarty = new Smarty;
  48. $smarty->force_compile = true;
  49. $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
  50. $smarty->assign("warnings", $this->warnings);
  51. $smarty->assign("applications", $this->applications);
  52. //Render
  53. $smarty->display('rss.tpl');
  54. }
  55. }
  56. ?>