|
@@ -18,7 +18,7 @@ discard block |
|
|
block discarded – undo |
|
18
|
18
|
$api = $this->di->get("ipstack"); |
|
19
|
19
|
$ipstack = $api["config"]; |
|
20
|
20
|
$getipInfo = new Models\Curl; |
|
21
|
|
- $userIp = $getipInfo->cUrl($ipstack["url"]. "check". '?access_key='. $ipstack["key"]. "&fields=ip"); |
|
|
21
|
+ $userIp = $getipInfo->cUrl($ipstack["url"]."check".'?access_key='.$ipstack["key"]."&fields=ip"); |
|
22
|
22
|
$apiResult = json_decode($userIp, true); |
|
23
|
23
|
|
|
24
|
24
|
$session->set("userIp", $apiResult["ip"]); |
|
@@ -51,12 +51,12 @@ discard block |
|
|
block discarded – undo |
|
51
|
51
|
$ipNumber = $request->getGet("ip"); |
|
52
|
52
|
$location = $locationHandler->getLocation($ipNumber, $ipstack, $mapquest); |
|
53
|
53
|
$mapDiv = $map->getMap($location["latitude"], $location["longitude"]); |
|
54
|
|
- $weatherJson = $getJson->cUrl($darksky["url"]. $darksky["key"]. "/". $location["latitude"]. ",". $location["longitude"]. "?lang=sv&units=auto"); |
|
|
54
|
+ $weatherJson = $getJson->cUrl($darksky["url"].$darksky["key"]."/".$location["latitude"].",".$location["longitude"]."?lang=sv&units=auto"); |
|
55
|
55
|
|
|
56
|
56
|
$weather = json_decode($weatherJson, true); |
|
57
|
57
|
$page->add("weather/weather", ["location" => $location, "mapDiv" => $mapDiv, "weather" => $weather]); |
|
58
|
58
|
|
|
59
|
|
- return $page->render(["title" => $title,]); |
|
|
59
|
+ return $page->render(["title" => $title, ]); |
|
60
|
60
|
} |
|
61
|
61
|
|
|
62
|
62
|
public function weatherOldActionGet() |
|
@@ -80,20 +80,20 @@ discard block |
|
|
block discarded – undo |
|
80
|
80
|
|
|
81
|
81
|
$url = []; |
|
82
|
82
|
$time = time() - (30 * 24 * 60 * 60); |
|
83
|
|
- for ($i=0; $i < 31; $i++) { |
|
84
|
|
- $time = time() - ($i * 24 * 60 * 60); |
|
85
|
|
- array_push($url, $darksky["url"]. $darksky["key"]. "/". $location["latitude"]. ",". $location["longitude"]. ",". $time. "?lang=sv&units=auto"); |
|
|
83
|
+ for ($i = 0; $i < 31; $i++) { |
|
|
84
|
+ $time = time() - ($i * 24 * 60 * 60); |
|
|
85
|
+ array_push($url, $darksky["url"].$darksky["key"]."/".$location["latitude"].",".$location["longitude"].",".$time."?lang=sv&units=auto"); |
|
86
|
86
|
} |
|
87
|
87
|
|
|
88
|
88
|
$mapDiv = $map->getMap($location["latitude"], $location["longitude"]); |
|
89
|
89
|
$weatherJson = $getJson->cUrlMulti($url); |
|
90
|
90
|
$weather = []; |
|
91
|
|
- for ($i=0; $i < count($weatherJson); $i++) { |
|
|
91
|
+ for ($i = 0; $i < count($weatherJson); $i++) { |
|
92
|
92
|
array_push($weather, json_decode($weatherJson[$i], true)); |
|
93
|
93
|
} |
|
94
|
94
|
|
|
95
|
95
|
$page->add("weather/weatherOld", ["location" => $location, "mapDiv" => $mapDiv, "weather" => $weather]); |
|
96
|
96
|
|
|
97
|
|
- return $page->render(["title" => $title,]); |
|
|
97
|
+ return $page->render(["title" => $title, ]); |
|
98
|
98
|
} |
|
99
|
99
|
} |