diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-11-30 13:30:51 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-11-30 13:30:51 +0100 |
commit | 7077eba3c3bf4ff2f641b5873e414ad9c3c541ba (patch) | |
tree | 39d7c10226f65df47d9c4ae179bdd4c9d93753fa /widgets/weather/update_weather.php | |
parent | 0e077a1ed82ca9bfb8e6f234f53bbb44400df86a (diff) | |
download | skin-flatplus-7077eba3c3bf4ff2f641b5873e414ad9c3c541ba.tar.gz skin-flatplus-7077eba3c3bf4ff2f641b5873e414ad9c3c541ba.tar.bz2 |
update widgets folders
Diffstat (limited to 'widgets/weather/update_weather.php')
-rw-r--r-- | widgets/weather/update_weather.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/widgets/weather/update_weather.php b/widgets/weather/update_weather.php index 4b4dbb86..a2294906 100644 --- a/widgets/weather/update_weather.php +++ b/widgets/weather/update_weather.php @@ -11,16 +11,20 @@ $lang = $ini_array['Lang']; $convertPoint = $ini_array['ConvertPoint2Comma']; $api_key = $ini_array['ApiKey']; +$OUTPUTFLDRTEMP = "/tmp/skinflatplus/widgets/weather"; +if( !file_exists($OUTPUTFLDRTEMP) ) + mkdir($OUTPUTFLDRTEMP, 0775, true); + include('lib/forecast.io.php'); // delete old files -array_map('unlink', glob("weather.*")); +array_map('unlink', glob($OUTPUTFLDRTEMP."/weather.*")); // forecast query $forecast = new ForecastIO($api_key); $condition = $forecast->getCurrentConditions($latitude, $longitude, $units, $lang); -if( !$handle = fopen("weather.0.temp", "w") ) { +if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.0.temp", "w") ) { print "can't create file!\n"; continue; } @@ -35,7 +39,7 @@ fclose($handle); // get daily conditions for next 7 days $conditions_week = $forecast->getForecastWeek($latitude, $longitude, $units, $lang); -if( !$handle = fopen("weather.location", "w") ) { +if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.location", "w") ) { print "can't create file!\n"; } else { fwrite($handle, $locationSkin); @@ -47,14 +51,14 @@ $index = -1; foreach($conditions_week as $conditions) { $index++; - if( !$handle = fopen("weather.".$index.".summary", "w") ) { + if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".summary", "w") ) { print "can't create file!\n"; continue; } fwrite($handle, $conditions->getSummary()); fclose($handle); - if( !$handle = fopen("weather.".$index.".tempMin", "w") ) { + if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".tempMin", "w") ) { print "can't create file!\n"; continue; } @@ -66,7 +70,7 @@ foreach($conditions_week as $conditions) { fwrite($handle, $degree_sign); fclose($handle); - if( !$handle = fopen("weather.".$index.".tempMax", "w") ) { + if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".tempMax", "w") ) { print "can't create file!\n"; continue; } @@ -79,14 +83,14 @@ foreach($conditions_week as $conditions) { fclose($handle); - if( !$handle = fopen("weather.".$index.".precipitation", "w") ) { + if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".precipitation", "w") ) { print "can't create file!\n"; continue; } fwrite($handle, $conditions->getPrecipitationProbability()); fclose($handle); - if( !$handle = fopen("weather.".$index.".precipitationType", "w") ) { + if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".precipitationType", "w") ) { print "can't create file!\n"; continue; } @@ -96,7 +100,7 @@ foreach($conditions_week as $conditions) { fwrite($handle, "none"); fclose($handle); - if( !$handle = fopen("weather.".$index.".icon", "w") ) { + if( !$handle = fopen($OUTPUTFLDRTEMP."/weather.".$index.".icon", "w") ) { print "can't create file!\n"; continue; } |