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