# # Copyright: (c) 2008-2016 Copyright nordicweather.net. # ############################################################################ # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ############################################################################ # # This work is licensed under the # Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. # To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc-nd/3.0/. # ############################################################################ date_default_timezone_set("UTC"); $tkey=hash('sha256', 'euweather'.date("dmYH")); date_default_timezone_set($tzabb); $tzdiff = date("Z")*1000; $frcdata[frc]=15; $times = frccurl("https://a.maps.nordicweather.net/maptime_e.php?tz=".$tzabb."&tk=".$tkey."&du=".time()); $query=$_SERVER["QUERY_STRING"]; $q=explode("|",$query); if(preg_match("|\||",$query)){ $lang=$q[0]; $geoid=$q[1]; $args='?lang='.$lang.'&geoid='.$geoid; }else{ if(isset($_GET[lang])){$lang = $_GET[lang];} if(isset($_GET[p])){$p = '&p='.$_GET[p];} // Leuven fix $args='?lang='.$lang; $argb='&geoid='; $baseurl='https://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"].$args.$p.$argb; if($_COOKIE[ewndef]){ $dcookie=json_decode($_COOKIE[ewndef],true); if(!isset($_GET[geoid])&&!isset($_GET[lat])&&$dcookie[co]){ $geoid=$dcookie[id]; } } if($_GET[lat] && is_numeric($_GET[lat])){$centerlat=$_GET[lat];} if($_GET[lon] && is_numeric($_GET[lon])){$centerlon=$_GET[lon];} if($_GET[geoid]){$geoid=$_GET[geoid];} } if($geoid){$args.='&geoid='.$geoid.$p;} else{$args.='&lat='.$centerlat.'&lon='.$centerlon.$p;} $ewnargs = '&wsp='.$wunit.'&datestyle='.$datestyle.'&v='.$ewnversion.'&tk='.$tkey.'&all=1'; $frcdata = frccurl("https://euweather.eu/backend/frc/data_ew_front3.php".$args.$ewnargs); $frcdata = json_decode($frcdata,true); foreach ($days as $key => $value) { $da[]=utf8_encode(html2utf8($value)); } $day_array = json_encode($da); foreach ($months as $key => $value) { $mo[]=utf8_encode($value); } $mo_array = json_encode($mo); ########################################################### $ewnhead=' '; ########################################################### if($jqueryload ){ $ewnfooter.=' '; } $ewnfooter.=' '; if($bootstrapload ){ $ewnfooter.=' '; } $ewnfooter.=' '; ########################################################### $flagbox="
".SELECTCOUNTRY."
".get_flags(); $settingsbox = " "; $frcfront=' '.$settingsbox.'
'.FORECAST.'
'.utf8_decode($frcdata[frc6h]).'
'.DAY.' 1 - 3
'.DAY.' 4 - 6
'.DAY.' 7 - 9
'.$adtorni.'
'.$stuff.'
'.CLOSEOBS.'
'.LOCATIONINFO.'
'.AREA.': '.$frcdata[area].'
'; if(strlen($frcdata[postcode])>2){ $frcfront.=POSTCODE.': '.$frcdata[postcode].'
'; } $frcfront.=LATI.': '.sprintf("%01.3f",$frcdata[lat]).'°N
'.LONGI.': '.sprintf("%01.3f",$frcdata[lon]).'°E
'; if($frcdata[alt]<>0){ $frcfront.=ALTITUDE.': '.$frcdata[alt].' m
'; } $frcfront.='
'; $legendbox="
".LEVEL." 3
".LEVEL." 2
".LEVEL." 1
".THUNDER."
".WIND." > ".fixwsp(17,true,true)."
".SNOW."
"; ########################################################### # PUT TOGETHER BODY $nfrcbody = '

'.FORECASTFOR.' '.$frcdata[name].'

'.TEMP.'/'.PRECIP.'/'.BARO.' '.THUNDER.'/'.DEWP.''; if($frcdata[snowind]==1){ $nfrcbody.=''.SNOWDEPTH.''; } $nfrcbody.='
'.$frcfront.'
'.$adblock.'

'.WARNANDSEVERE.'

'; if(strlen($frcdata[warn])>150){ $nfrcbody.='
'.utf8_decode($frcdata[warn]).'
Warnings by MeteoAlarm.
'; }else{ $nfrcbody.='
'.NOWARNS.'
'; } $nfrcbody.='
'.RADARSTRIKES.'
'.SEVEREFRCTODAY.'
'.LOCATIONS.'
'; if(strlen($frcmapurl)>4){ $nfrcbody.=''; } $nfrcbody.=FRCSTMAPS.'
'; ########################################################### function html2utf8($name) { if(mb_detect_encoding($name, 'UTF-8', true)){$name=utf8_decode($name);} $n=str_replace("ä","ä",$name); $n=str_replace("å","å",$n); $n=str_replace("æ","æ",$n); $n=str_replace("ö","ö",$n); $n=str_replace("ø","ø",$n); return $n; } function fixwsp($num,$ext,$round){ global $wunit; if($wunit=="kmh"){$num = sprintf("%01.1f",$num*3.6);$wu="km/h";} elseif($wunit=="mph"){$num = sprintf("%01.1f",$num*2.23693629);$wu="mph";} elseif($wunit=="kts"){$num = sprintf("%01.1f",$num*1.94384449);$wu="kts";} else{$wu="m/s";} if($round){$num=round($num);} if($ext){return $num.' '.$wu;} else{return $num;} } function get_flags(){ $countrys = array( "AL" => defcountries("Albania"), "AD" => defcountries("Andorra"), "AT" => defcountries("Austria"), "AX" => defcountries("Åland"), "BY" => defcountries("Belarus"), "BE" => defcountries("Belgium"), "BA" => defcountries("Bosnia"), "BG" => defcountries("Bulgaria"), "HR" => defcountries("Croatia"), "CY" => defcountries("Cyprus"), "CZ" => defcountries("Czech"), "DK" => defcountries("Denmark"), "EE" => defcountries("Estonia"), "FO" => defcountries("Faroe"), "FI" => defcountries("Finland"), "FR" => defcountries("France"), "DE" => defcountries("Germany"), "GI" => defcountries("Gibraltar"), "GR" => defcountries("Greece"), "GL" => defcountries("Greenland"), "HU" => defcountries("Hungary"), "IS" => defcountries("Iceland"), "IE" => defcountries("Ireland"), "IT" => defcountries("Italy"), "RS" => defcountries("Kosovo"), "LV" => defcountries("Latvia"), "LI" => defcountries("Liechtenstein"), "LT" => defcountries("Lithuania"), "LU" => defcountries("Luxembourg"), "MK" => defcountries("Macedonia"), "MT" => defcountries("Malta"), "MD" => defcountries("Moldova"), "MC" => defcountries("Monaco"), "ME" => defcountries("Montenegro"), "NL" => defcountries("Netherlands"), "NO" => defcountries("Norway"), "PL" => defcountries("Poland"), "PT" => defcountries("Portugal"), "RO" => defcountries("Romania"), "RU" => defcountries("Russia"), "SM" => defcountries("San Marino"), "RS" => defcountries("Serbia"), "SK" => defcountries("Slovakia"), "SI" => defcountries("Slovenia"), "ES" => defcountries("Spain"), "SE" => defcountries("Sweden"), "CH" => defcountries("Switzerland"), "TR" => defcountries("Turkey"), "UA" => defcountries("Ukraine"), "GB" => defcountries("UK"), "VA" => defcountries("Vatican") ); $flags='
'; foreach ($countrys as $key => $value) { $flags.='
'.$value.'
'; $i++; if($i==17||$i==34){$flags.='
';} } $flags.='
'; return $flags; } ?>