Home
News
Contattaci
Storia Fossili Turismo Fossili Cultura Itinerari Eventi
NEWS


","",str_replace("0) if ($width==999999) return str_replace("width="55"","",$tmp); else return str_replace("width="55"","width="".$width.""",$tmp); else return $tmp; } function extractImageLarge($content, $width, $border) { //se width != "" o <1 allora cambio larghezza, se 999999 allora tolgo $tmp=extractImage($content, $width, $border); return str_replace("medium", "large", $tmp); } function extractImageSmall($content, $width, $border) { //se width != "" o <1 allora cambio larghezza, se 999999 allora tolgo $tmp=extractImage($content, $width, $border); return str_replace("medium", "small", $tmp); } function startElementHandler( $parser, $element_name, $element_attribs ){ global $item_counter; global $item_data; global $xml_current_tag_state; $xml_current_tag_state = $element_name; } function endElementHandler( $parser, $element_name ){ global $item_counter; global $item_data; global $xml_current_tag_state; $xml_current_tag_state = ''; if( $element_name == "ITEM" ) { //echo $item_counter . " " . $item_data[$item_counter]["title"] . "
"; $item_counter++; $item_data[$item_counter]["guid"] = ""; $item_data[$item_counter]["title"] = ""; $item_data[$item_counter]["link"] = ""; $item_data[$item_counter]["pubdate"] = ""; $item_data[$item_counter]["description"] = ""; $item_data[$item_counter]["content"] = ""; $item_data[$item_counter]["filename"] = ""; } } function characterDataHandler( $parser , $data ){ global $item_counter; global $item_data; global $xml_current_tag_state; global $valid_guid; global $directory_pdf; //echo $data . " - "; $data = htmlentities($data, ENT_QUOTES, 'UTF-8'); //echo $xml_current_tag_state . "-->" . $data . "
"; if( $xml_current_tag_state == '' ) { return; } if( $xml_current_tag_state == "GUID" ) { $valid_guid++; $item_data[$item_counter]["guid"] .= $data; $end=strrpos($item_data[$item_counter]["guid"],"/"); $length=strlen($item_data[$item_counter]["guid"]); $start=strrpos($item_data[$item_counter]["guid"],"/",$end-$length-1) + 1; $filename=substr($item_data[$item_counter]["guid"],$start,$end-$start); //echo $item_data[$item_counter]["guid"] . " " . $start . " " . $end . " " . $length . " " . $filename."
"; if (!file_exists($directory_pdf . $filename . ".pdf")) { if (!file_exists($directory_pdf . "escursione_" . str_replace("escursione","",$filename) . ".pdf")) { if (file_exists($directory_pdf . $filename)) { $fh = fopen($directory_pdf . $filename, 'r'); $theData = fread($fh, 100); fclose($fh); if (strlen(trim($theData))>1 && file_exists($directory_pdf . trim($theData))) { $item_data[$item_counter]["filename"] = trim($theData); } //else //echo "file " . $filename . " con contenuto non valido
"; } //else //echo "file " . $filename . ".pdf" . " non trovato
"; } else { $item_data[$item_counter]["filename"]="escursione_" . str_replace("escursione","",$filename) . ".pdf"; } } else { $item_data[$item_counter]["filename"] = $filename . ".pdf"; } } else if( $xml_current_tag_state == "TITLE" ) { if ($valid_guid>0) $item_data[$item_counter]["title"] .= $data; } else if( $xml_current_tag_state == "LINK" ) { if ($valid_guid>0) $item_data[$item_counter]["link"] .= $data; } else if( $xml_current_tag_state == "PUBDATE" ) { if ($valid_guid>0) $item_data[$item_counter]["pubdate"] .= $data; } else if( $xml_current_tag_state == "DESCRIPTION" ) { if ($valid_guid>0) $item_data[$item_counter]["description"] .= $data; } else if( $xml_current_tag_state == "CONTENT:ENCODED" ) { if ($valid_guid>0) $item_data[$item_counter]["content"] .= $data; } }*/ if( !($xml_parser = xml_parser_create()) ){ die("Impossibile creare l' XML parser!"); } xml_set_element_handler($xml_parser, "startElementHandler", "endElementHandler"); xml_set_character_data_handler($xml_parser, "characterDataHandler"); $data = stream_get_contents($fp); if( !xml_parse($xml_parser, $data, feof($fp)) ){ break; // esce dal loop quando finisce } xml_parser_free($xml_parser); /*function date_diff($start, $end="NOW") { $sdate = strtotime($start); $edate = strtotime($end); $time = $edate - $sdate; if($time>=86400) { // Days + Hours + Minutes $pday = ($edate - $sdate) / 86400; $preday = explode('.',$pday); $timeshift = $preday[0];//.' days '.$prehour[0].' hrs '.$min[0].' min '.round($sec,0).' sec '; } return $timeshift; } function confronta_data($data) { $arr = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec'); $start=stripos($data, ',')+1; $mese=0; for ($i=1; $i<13; $i++) { $end=stripos($data, $arr[$i], $start); if ($end>$start) { $mese=$i; break; } } //strtotime(trim(substr ($data, $end+3, 6))+""+$mese+"-"+trim(substr ($data, $start, $end-$start))) //strtotime(date("Y")+"-"+date("m")+"-"+date("d")) $start_date = (trim(substr ($data, $end+3, 6))."-".$mese."-".trim(substr ($data, $start, $end-$start))); $end_date = (date("Y")."-".date("m")."-".date("d")); return date_diff($start_date, $end_date); } */ $from=$_GET["from"]; $to=$_GET["to"]; //echo "prima controllo from=" . $from . " to=" . $to . "
" ; if (trim($from)=="" || $from<0) $from=0; if (trim($to)=="" || $to<=0) $to=$from+$num_news_page-1; if ($from>=$item_counter) $from=$item_counter-$num_news_page; if ($to>=$item_counter) $to=$item_counter-1; if ($to-$from>$num_news_page) $to=$from+$num_news_page-1; //echo "dopo controllo from=" . $from . " to=" . $to . "
" ; echo "

"; for( $i=0 ; $i < $item_counter ; ++$i ){ if ($i<=$to && $i>=$from) { echo "
"; echo ""; echo html_entity_decode(extractImage($item_data[$i]["content"],75,1), ENT_QUOTES, 'ISO-8859-1'); echo " "; echo ""; echo $item_data[$i]["title"]."

"; if ($item_data[$i]["filename"]!="") echo "
Formato pdf
\n"; echo "

"; } } echo "\n\n\n\n\n\n
\n"; if ($from>0){ $tmp = $from - $num_news_page; if ($tmp<0) $tmp=0; echo "< news precedenti\t "; } echo "\n"; echo "\n"; if ($to<$item_counter-1){ $tmp = $to + $num_news_page; if ($tmp>=$item_counter) $tmp=$item_counter-1; echo "news successive >"; } echo "
\n"; fclose($fp); ?>

Storia | Fossili | Turismo | Cultura | Itinerari | Eventi | Contattaci   Copyright © Proloco di Bolca