init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
27
scripts/ajax/ue_wetter.php
Normal file
27
scripts/ajax/ue_wetter.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<?php
|
||||
$data = json_decode(file_get_contents('http://api.openweathermap.org/data/2.5/weather?q=Leipzig,DE&units=metric&lang=de&APPID=e1fbd5096c088db7a388f3a582c99b02'));
|
||||
|
||||
$night=0;
|
||||
$icon=$data->weather[0]->icon;
|
||||
$wetter['icon']="http://openweathermap.org/img/w/".$icon."@2x.png";
|
||||
$wetter['w_id']=$data->weather[0]->id;
|
||||
$wetter['cist']=round($data->main->temp);
|
||||
$wetter['cmin']=round($data->main->temp_min);
|
||||
$wetter['cmax']=round($data->main->temp_max);
|
||||
$wetter['text']=$data->weather[0]->description;
|
||||
|
||||
$sunset = $data->sys->sunset;
|
||||
$sunrise= $data->sys->sunrise;
|
||||
|
||||
if ($sunrise>time()) { $night=1; }
|
||||
if ($sunrise<time() && $sunset>time()) { $night=0; }
|
||||
if ($sunrise<time() && $sunset<time()) { $night=1; }
|
||||
|
||||
$template->assign('night', $night);
|
||||
$template->assign('wetter', $wetter);
|
||||
$template->assign('content', 'tpl/ajax/ue_wetter.tpl');
|
||||
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue