$SITE['wsModules'][$pageName] = 'version: ' . $pageVersion; $pageFile = basename(__FILE__); // check to see this is the real script if ($pageFile != $pageName) { $SITE['wsModules'][$pageFile] = 'this file loaded instead of ' . $pageName; } ws_message('<!-- module ' . $pageFile . ' ==== ' . $SITE['wsModules'][$pageFile] . ' -->'); #------------------------------------------------------------------------------- # Display a list of forecast date from Yahoo #------------------------------------------------------------------------------- # First get the data from a weather class # if (!isset($yahooArray)) { ws_message('<!-- module yahooForecast2.php (' . __LINE__ . '): loading yahoo.weather2.php -->'); include_once 'yahoo.weather2.php'; $weather = new yahooWeather(); # $yahooArray = $weather->getWeatherData($SITE['yaPlaceID']); } else { ws_message('<!-- ' . $pageName . ' - yahoo data already loaded --> '); } if (isset($_REQUEST['city'])) { $yaPlaceID = $_REQUEST['city']; } else { $yaPlaceID = $SITE['yaPlaceID']; } $yahooArray = $weather->getWeatherData($yaPlaceID); #--------------------------------------------------------------------------- # define array and fill first row with headings #--------------------------------------------------------------------------- $forecast = array(); $forecast[0]['period'] = langtransstr('date');
// skip lines with invalid key values if (!is_numeric($hahooID)) { continue; } // skip lines with non-numeric yahoo id $key++; $my_yahoos[$hahooID] = array('key' => $key, 'name' => $area, 'lat' => $lat, 'lon' => $lon, 'hahooID' => $hahooID, 'found' => false); } # if (!isset($yahooArray)) { ws_message('<!-- moduledash_yahoo.php (' . __LINE__ . '): loading yahoo.weather2.php -->'); include_once $yahoo_folder . 'yahoo.weather2.php'; } else { ws_message('<!-- dash_yahoo.php (' . __LINE__ . '): yahoo data already loaded --> '); } $weather = new yahooWeather(); $testDash = false; $result_arr = array(); # #echo '<pre>'; print_r ($my_yahoos); exit; $count_yahoo = 0; $start_yahoo = microtime(true); foreach ($my_yahoos as $key => $arr) { $hahooID = $arr['hahooID']; $result = $weather->getWeatherData($hahooID); #echo '<pre>'; var_dump($result['ccn'][1]); exit; if (!$result) { unset($my_yahoos[$key]); continue; } # {echo '<br />false for : '.$key; continue;} else {echo '<br />true for : '.$key;}
$dayNight = 'daylight'; } else { $dayNight = 'nighttime'; } # ws_message("<!-- module wsDataGet.php (" . __LINE__ . "): time is {$nowInt} => {$now} | it is {$dayNight} | sunrise at {$sunriseInt} => {$sunrise} | sunset at {$sunsetInt} => {$sunset} -->"); ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): loading wsIconUrl.php -->'); include_once 'wsIconUrl.php'; #---------------------- and now get the current conditions from some source -------------- ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): $SITE["curCondFrom"] = ' . $SITE['curCondFrom'] . ' -->'); # switch ($SITE['curCondFrom']) { case 'yahoo': ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): loading yahoo.weather2.php -->'); include_once 'forecasts/yahoo.weather2.php'; $weather = new yahooWeather(); $yahooArray = $weather->getWeatherData($SITE['yaPlaceID']); $condDesc = cleanCurCond($yahooArray['ccn']['1']['text']); $ccnIconNr = $iconIn = $yahooArray['ccn']['1']['icon']; $ccnIconUrl = $urlIn = $yahooArray['ccn']['1']['iconUrl']; wsChangeIcon('yahoo', $iconIn, $ccnIconNr, $urlIn, $ccnIconUrl); $headerClass = wsHeaderLookup('yahoo', $iconIn); break; case 'wd': if (isset($ws['wdCurCond']) && isset($ws['wdCurIcon'])) { $condDesc = cleanCurCond($ws['wdCurCond']); $ccnIconNr = $ccnIconUrl = $urlIn = $notUsed = ''; wsChangeIcon('wd', $ws['wdCurIcon'], $ccnIconNr, $urlIn, $ccnIconUrl); $headerClass = wsHeaderLookup('wd', $ws['wdCurIcon']); break; }