From 806853493b50b3d9cf22dee378a769d3694975c5 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Thu, 05 Sep 2013 21:45:10 +0000
Subject: [PATCH] Drobna poprawka związana z kompatybilnością automatycznego ładowania klas z PHPUnit.

---
 modules/30_pogoda/api_geonames.php |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/30_pogoda/api_geonames.php b/modules/30_pogoda/api_geonames.php
index 5463ea8..39c488e 100644
--- a/modules/30_pogoda/api_geonames.php
+++ b/modules/30_pogoda/api_geonames.php
@@ -15,7 +15,7 @@
 			}
 			
 			libxml_use_internal_errors();
-			$data = simplexml_load_string();
+			$data = simplexml_load_string($data);
 			libxml_clear_errors();
 			
 			if(!$data) {
@@ -23,10 +23,10 @@
 				return FALSE;
 			}
 			
-			// Trzymaj w cache przez około 278 dni
-			$download->cacheFor(1000000);
+			// Trzymaj w cache przez około 116 dni
+			$download->cacheFor(10000000);
 			
-			if($data->geoname[0]->getName() != 'geoname'
+			if((int)$data->totalResultsCount == 0 || $data->geoname->getName() != 'geoname' || $data->geoname[0]->getName() != 'geoname'
 				|| $data->geoname[0]->name->getName() != 'name'
 				|| $data->geoname[0]->countryName->getName() != 'countryName'
 				|| $data->geoname[0]->lat->getName() != 'lat'
@@ -34,7 +34,7 @@
 				return NULL;
 			}
 			
-			$data = (array)$this->geoname[0];
+			$data = (array)$data->geoname[0];
 			foreach($data as &$value) {
 				$value = trim($value);
 			}

--
Gitblit v1.9.1