-function curweather_network_mod_init(&$fk_app,&$b) {
-
- if(! intval(get_pconfig(local_user(),'curweather','curweather_enable')))
- return;
-
- $fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
-
- // the OpenWeatherMap-PHP-APIlib does all the work here
- // the $rpt value is needed for location
- // $lang will be taken from the browser session to honour user settings
- // $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
- // and relative humidity for display, also the relevent area of the map is
- // linked from lat/log of the reply of OWMp
- $rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc');
-
-
- // set the language to the browsers language and use metric units
- $lang = $_SESSION['language'];
- $units = get_pconfig( local_user(), 'curweather', 'curweather_units');
- $appid = get_config('curweather','appid');
- $cachetime = intval(get_config('curweather','cachetime'));
- if ($units==="")
- $units = 'metric';
- // Get OpenWeatherMap object. Don't use caching (take a look into
- // Example_Cache.php to see how it works).
- //$owm = new OpenWeatherMap();
- $owm = new OpenWeatherMap(null, new CWCache(), $cachetime);
-
- try {
- $weather = $owm->getWeather($rpt, $units, $lang, $appid);
- $temp = $weather->temperature->getValue();
- if ( $units === 'metric') {
- $temp .= '°C';