All pastes #738096 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-10-16 00:22 UTC
rendered paste body
<?$partner_ID = "1027070437"; // weahter channel partner ID$license_key = "cdb13fca44c105ef"; // weahter channel license key$units = "m"; // m for metric (C)  // s for standard (F)$lenght="10"; // the amount of days for forecast (max. 10)$image_size = "64x64"; // the size of the forecast images (32x32 or 64x64 or 128x128)$loc_id="ITXX0038";$length = $_REQUEST['length']; //$patt_meteo[10] = "/Light/";$patt_meteo[33]  = "/Fog/";$patt_meteo[32]  = "/Showers/";$patt_meteo[31]  = "/Wind/";$patt_meteo[30]  = "/Light Rain/";$patt_meteo[29]  = "/with Thunder/";$patt_meteo[28]  = "/T-Storm/";$patt_meteo[27]  = "/Rain/";$patt_meteo[26]  = "/Cloudy/";$patt_meteo[25]  = "/Sunny/";$patt_meteo[24]  = "/AM Showers/";$patt_meteo[23]  = "/Fair/";$patt_meteo[22]  = "/Rain \/ Thunder/";     //$patt_meteo[21]  = "/Rain \/ Wind/";     //$patt_meteo[20]  = "/Showers \/ Wind/";$patt_meteo[19]  = "/PM T-Storms/";$patt_meteo[18]  = "/PM Showers/";$patt_meteo[17]  = "/Light Drizzle/";$patt_meteo[16]  = "/Partly Cloudy/";$patt_meteo[15]  = "/Mostly Cloudy/";$patt_meteo[14]  = "/Few Showers/";$patt_meteo[13]  = "/Scattered Showers/";$patt_meteo[12]  = "/Scattered T-Storms/";$patt_meteo[11]  = "/Mostly Sunny/";$patt_meteo[10]  = "/Isolated T-Storms/";$patt_meteo[9]   = "/Light Rain/";$patt_meteo[8]   = "/T-Storm and Windy/";$patt_meteo[7]   = "/Mostly Cloudy and Windy/";$patt_meteo[6]   = "/Partly Cloudy and Windy/";$patt_meteo[5]   = "/AM Light Rain/";$patt_meteo[5]   = "/AM Light Rain/";$patt_meteo[4]   = "/AM Showers \/ Wind/";  //$patt_meteo[3]   = "/Light Rain \/ Wind/";$patt_meteo[2]   = "/Thunder in the Vicinity/";$patt_meteo[1]   = "/AM Clouds \/ PM Sun/";$patt_meteo[0]   = "/Light Rain with Thunder/";$repl_meteo[33]  = "Nebbia";$repl_meteo[32]  = "Acquazzoni";$repl_meteo[31]  = "Vento";$repl_meteo[30]  = "Pioggerella";$repl_meteo[29]  = "con Tuoni";$repl_meteo[28]  = "Temporali";$repl_meteo[27]  = "Pioggia";$repl_meteo[26]  = "Nuvoloso";$repl_meteo[25]  = "Soleggiato";$repl_meteo[24]  = "Acquazzoni mattutini";$repl_meteo[23]  = "Sereno";$repl_meteo[22]  = "Pioggia / Temporali";    //$repl_meteo[21]  = "Pioggia / Vento";    //$repl_meteo[20]  = "Acquazzoni / Vento";$repl_meteo[19]  = "Temporali pomeridiani";$repl_meteo[18]  = "Acquazzoni pomeridiani";$repl_meteo[17]  = "Leggera pioggerella";$repl_meteo[16]  = "Parzialmente nuvoloso";$repl_meteo[15]  = "Molto nuvoloso";$repl_meteo[14]  = "Piogge sparse";$repl_meteo[13]  = "Acquazzoni isolati";$repl_meteo[12]  = "Temporali sparsi";$repl_meteo[11]  = "Leggermente velato";$repl_meteo[10]  = "Temporali isolati";$repl_meteo[9]   = "Deboli piogge";$repl_meteo[8]   = "Temporali e Vento";$repl_meteo[7]   = "Molto nuvoloso e Vento";$repl_meteo[6]   = "Parzialmente nuvoloso e Vento";$repl_meteo[5]   = "Debole pioggia mattutina";$repl_meteo[4]   = "Acquazzoni mattutini / Vento";$repl_meteo[3]   = "Deboli piogge mattutine / Vento";$repl_meteo[2]   = "Tuoni in avvicinamento";$repl_meteo[1]   = "Mattina nuvolovoso / Pomeriggio soleggiato";$repl_meteo[0]   = "Pioggerella con tuoni"; ksort($patt_meteo);ksort($repl_meteo); $patt_press[6]  = "/Moderate/";$patt_press[5]  = "/CALM/";$patt_press[4]  = "/rising/";$patt_press[3]  = "/calm/";$patt_press[2]  = "/falling/";$patt_press[1]  = "/steady/";$repl_press[6]  = "Moderato";$repl_press[5]  = "CALMO";$repl_press[4]  = "in aumento";$repl_press[3]  = "calmo";$repl_press[2]  = "in diminuzione";$repl_press[1]  = "stabile";ksort($patt_press);ksort($repl_press); $patt_UV[3]  = "/Moderate/";$patt_UV[2]  = "/High/";$patt_UV[1]  = "/Low/";$patt_UV[0]  = "/Very High/";$repl_UV[3]  = "Moderato";$repl_UV[2]  = "Alta";$repl_UV[1]  = "Basso";$repl_UV[0]  = "Molto Alta";ksort($patt_UV);ksort($repl_UV); $patt_wind[4]  = "/W/";$patt_wind[3]  = "/WNW/";$patt_wind[2]  = "/WSW/";$patt_wind[1]  = "/NNW/";  $repl_wind[4]  = "O";$repl_wind[3]  = "ONO";$repl_wind[2]  = "OSO";$repl_wind[1]  = "NNO";ksort($patt_wind);ksort($repl_wind); $repl_day[14] = "Dic";$repl_day[13] = "Ott";$repl_day[12] = "Set";$repl_day[11] = "Ago";$repl_day[10] = "Lug";$repl_day[9] = "Giu";$repl_day[8] = "Mag";$repl_day[7] = "Gen";$repl_day[6] = "Sabato";$repl_day[5] = "Venerd&igrave;";$repl_day[4] = "Gioved&igrave;";$repl_day[3] = "Mercoled&igrave;";$repl_day[2] = "Marted&igrave;";$repl_day[1] = "Luned&igrave;";$repl_day[0] = "Domenica";$patt_day[14] = "/Dec/";$patt_day[13] = "/Oct/";$patt_day[12] = "/Sep/";$patt_day[11] = "/Aug/";$patt_day[10] = "/Jul/";$patt_day[9] = "/Jun/";$patt_day[8] = "/May/";$patt_day[7] = "/Jan/";$patt_day[6] = "/Saturday/";$patt_day[5] = "/Friday/";$patt_day[4] = "/Thursday/";$patt_day[3] = "/Wednesday/";$patt_day[2] = "/Tuesday/";$patt_day[1] = "/Monday/";$patt_day[0] = "/Sunday/";ksort($patt_day);ksort($repl_day); if (!($length >= 1 And $length <= 10)) $length = 10;$forecast_url = "http://xoap.weather.com/weather/local/$loc_id?cc=*&dayf=$length&prod=xoap&par=$partner_ID&key=$license_key&unit=$units";$checkurl = $forecast_url;$xml_url = md5($checkurl);$ttl = 60*60; $cachefilename = "./elements/weather/weather/cache/$xml_url";	if (file_exists($cachefilename) && (time() - $ttl < filemtime($cachefilename))) {	$url = $cachefilename;        $xml = file_get_contents($url");	}else{	$url = $forecast_url;        $xml = file_get_contents($url");	}			$parser = xml_parser_create(  ); 	xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);	xml_parse_into_struct($parser,$xml,$values,$index); 	xml_parser_free($parser);	$city = htmlspecialchars($values[$index[dnam][0]][value]);	$unit_temp = $values[$index[ut][0]][value];	$unit_speed = $values[$index[us][0]][value];	$unit_pressure = $values[$index[up][0]][value];	$unit_precip = $values[$index[ur][0]][value];	$unit_visib = $values[$index[ud][0]][value];	$sunrise = $values[$index[sunr][0]][value];	$sunset = $values[$index[suns][0]][value];	$hmid = $values[$index[hmid][0]][value];	$lat = $values[$index[lat][0]][value];	$lon = $values[$index[lon][0]][value];	$press = $values[$index[r][0]][value];	$press_desc = $values[$index[d][0]][value];	$vis = $values[$index[vis][0]][value];	$speed_wind = $values[$index[s][0]][value];	$speed_deg = $values[$index[d][1]][value];	$speed_ang = $values[$index[t][1]][value];	$uv_ind = $values[$index[i][0]][value];	$uv_desc = $values[$index[t][2]][value];	$timezone = $values[$index[tzone][0]][value];	$last_update = $values[$index[lsup][0]][value];	$curr_temp = $values[$index[tmp][0]][value];	$curr_flik = $values[$index[flik][0]][value];	$curr_text = $values[$index[t][0]][value];	$curr_icon = $values[$index[icon][0]][value];	$counter = 0;	$row_counter = 2;	$xml="";function convert_to_24_hr($time, $ampm){	/* Make sure it's lower case */	$ampm=strtolower($ampm);			/* Split the time */	list($hour, $min)=split(":", $time);		switch($ampm){				case "am":            if ($hour == 12) {                $hour = 0;			    $hour = fill_time($hour);            } else {			    $hour = fill_time($hour);            }//			$hour = fill_time($hour);		break;				case "pm":            if ($hour == 12) {                $hour = 12;            } else {			    $hour = $hour + 12;            }		break;			}		$min = fill_time($min);		return $hour . ":" . $min;}function fill_time($string){	if(strlen($string)==1){			$string="0" . $string;	}	return $string;}function ita_date($string){    list($month, $mday, $year)=split("/", $string);    return fill_time($mday)."/".$month."/".$year; }?>