From ce637c58454e13704c4f8ea8dee4645cb463b8f2 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 15 Jul 2015 13:15:02 +0200 Subject: [PATCH] cleanup --- curweather/curweather.php | 12 +++++++++--- curweather/templates/settings.tpl | 4 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/curweather/curweather.php b/curweather/curweather.php index 93e9af9e..58daab0b 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -37,6 +37,11 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) $tunit = '°F'; $wunit = 'mph'; } + if ( trim((string)$res->weather['value']) == trim((string)$res->clouds['name']) ) { + $desc = (string)$res->clouds['name']; + } else { + $desc = (string)$res->weather['value'].', '.(string)$res->clouds['name']; + } $r = array( 'city'=> (string) $res->city['name'][0], 'country' => (string) $res->city->country[0], @@ -45,7 +50,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) 'temperature' => (string) $res->temperature['value'][0].$tunit, 'pressure' => (string) $res->pressure['value'].(string)$res->pressure['unit'], 'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'], - 'descripion' => (string)$res->weather['value'].', '.(string)$res->clouds['name'], + 'descripion' => $desc, 'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')', 'update' => (string)$res->lastupdate['value'] ); @@ -73,9 +78,10 @@ function curweather_network_mod_init(&$fk_app,&$b) { $fk_app->page['htmlhead'] .= '' . "\r\n"; - // the OpenWeatherMap-PHP-APIlib does all the work here - // the $rpt value is needed for location + // $rpt value is needed for location // $lang will be taken from the browser session to honour user settings + // TODO $lang does not work if the default settings are used + // and not all response strings are translated // $units can be set in the settings by the user // $appid is configured by the admin in the admin panel // those parameters will be used to get: cloud status, temperature, preassure diff --git a/curweather/templates/settings.tpl b/curweather/templates/settings.tpl index 1453b210..09f6f506 100644 --- a/curweather/templates/settings.tpl +++ b/curweather/templates/settings.tpl @@ -1,6 +1,4 @@ - +

{{$header}}