\n"; global $ModName; // solo settato, se ci troviamo in PostNuke/Gnred if( !empty($ModName) ) { if($DEBUG) echo "inside GNred
\n"; // considera eventuali parametri passato nell'URL: $frominput_eventfrom = pnVarCleanFromInput('eventfrom'); $frominput_eventtill = pnVarCleanFromInput('eventtill'); $frominput_eventcity = pnVarCleanFromInput('eventcity'); $frominput_eventranc = pnVarCleanFromInput('eventranc'); $frominput_eventlimit = pnVarCleanFromInput('eventlimit'); $frominput_eventid = pnVarCleanFromInput('eventid'); if(!empty($frominput_eventfrom)) $eventfrom = $frominput_eventfrom; if(!empty($frominput_eventtill)) $eventtill = $frominput_eventtill; if(!empty($frominput_eventcity)) $eventcity = $frominput_eventcity; if(!empty($frominput_eventranc)) $eventranc = $frominput_eventranc; if(!empty($frominput_eventlimit)) $eventlimit = $frominput_eventlimit; if(!empty($frominput_eventid)) $eventid = $frominput_eventid; } else { if($DEBUG) echo "outside GNred
\n"; // variabili se chiamato all'esterno di GNred $default_language = "it"; } $today = date("Y-m-d"); $nextyear = date("Y")+1; if( empty($la) ) $la = $default_language; // specificato in default.conf if( strtolower($la)=="nl" ) $la = "en"; // invece di olandese presentiamo gli events in inglese if( empty($eventfrom) || ($eventfrom<$today) ) $eventfrom = $today; // default: la data di oggi if( empty($eventtill) ) $eventtill = $nextyear."-12-31"; // praticamente tutti if( empty($eventcity) ) $eventcity = "0"; // basta specificare parte del nome (tedesco), es "Wolken", "stina" if( empty($eventranc) ) $eventranc = "5"; // TopEvents hanno ranc=1 if( empty($eventlimit) ) $eventlimit = 100000; // praticamente tutti if($DEBUG) echo "Parameters: la:$la, eventfrom:$eventfrom, eventtill:$eventtill, eventcity:$eventcity, eventranc:$eventranc, eventlimit:$eventlimit
\n"; /********** Funktionen zum parsen der XML-Datei eines einzelnen Events ********/ function xml_get_children($vals, &$i) { $children = array(); if (isset($vals[$i]['value'])) $children[] = $vals[$i]['value']; while (++$i < count($vals)) { switch ($vals[$i]['type']) { case 'cdata': $children[] = $vals[$i]['value']; break; case 'complete': $children[] = array( 'tag' => $vals[$i]['tag'], 'attributes' => isset($vals[$i]['attributes'])? $vals[$i]['attributes'] : null, 'value' => $vals[$i]['value'] ); break; case 'open': $children[] = array( 'tag' => $vals[$i]['tag'], 'attributes' => isset($vals[$i]['attributes'])? $vals[$i]['attributes'] : null, 'children' => xml_get_children($vals, $i) ); break; case 'close': return $children; } } } function xml_get_tree($file) { $data = join('', file($file)); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $data, $vals, $index); xml_parser_free($parser); return array( 'tag' => $vals[0]['tag'], 'attributes' => isset($vals[0]['attributes'])? $vals[0]['attributes'] : null, 'children' => xml_get_children($vals, $i = 0) ); } /********** Anzeigen eines Events *********************************************/ if( !empty($eventid) ) { // mostrare un evento specifico if($DEBUG) echo "EVENT-Details fir eventid: $eventid
\n"; // $XMLSERVER = "http://data.tourist.info"; $XMLSERVER = "http://tourist.bz.it"; $URLXDATEN = $XMLSERVER."/data/CDBData.asmx/SendDataXmlOut?sInput="; $URLXTICKET = $XMLSERVER."/data/CDBData.asmx/GetTicket?sInput="; // zuert die SessionID ermitteln: $XMLSTRING = "%3CSendData%20Function='GetTicket'%20User='info@valgardena.it'%20Pwd='AB54DD9B9E'%20Version='1.0'%20PrefUserID='64E09593F49E486DA8339D4B34BE7461'%20/%3E"; $FILEURL = "$URLXTICKET$XMLSTRING"; $xmlticket = file_get_contents($FILEURL); $xmlpart = strtok($xmlticket, " \n\t"); while ($xmlpart !== false) { $sess = strstr( $xmlpart, "SessionID=" ); // ritorna la parte dopo sessionid= if( $sess ) $sessionid = str_replace("'","",strstr($sess, "'")); $xmlpart = strtok(" \n\t"); } $FILEURL = $URLXDATEN."%3CSendData%20UserID='64E09593F49E486DA8339D4B34BE7461'%20SessionID='".$sessionid."'%20Function='GetEventData'%20Version='1.0'%20EvRID='".$eventid."'%20/%3E"; $tree = xml_get_tree($FILEURL); $ticks = $tree["attributes"]["Ticks"]; $subtree = $tree["children"][0]; foreach($subtree["children"] as $stc) { $tag = $stc["tag"]; switch( $tag ) { case "EventDefinition": $zip = $stc["attributes"]["Zip"]; foreach($stc["children"] as $sstc) { if( strcasecmp($sstc["attributes"]["LngID"],$la)==0 ) { $eventtitle = htmlentities($sstc["attributes"]["Title"],ENT_QUOTES,"utf-8"); $eventlocation = $sstc["attributes"]["Location"]; $eventcity = htmlentities($sstc["attributes"]["City"],ENT_QUOTES,"utf-8"); } } break; case "EventDate": $zip = $stc["attributes"]["Zip"]; foreach($stc["children"] as $sstc) { $eventdates[] = substr($sstc["attributes"]["Date"],0,10); } break; case "EventPublicity": if( strcasecmp($stc["attributes"]["LngID"],$la)==0 ) { $eventdesc = htmlentities($stc["attributes"]["Desc"],ENT_QUOTES,"utf-8"); // OK // $eventdesc = htmlentities(html_entity_decode($stc["attributes"]["Desc"],ENT_COMPAT,"iso-8859-15"),ENT_COMPAT,"utf-8"); // OK } break; case "EventTime": $eventtime = substr($stc["attributes"]["Start"],0,5); break; case "EventFoto": $eventpicture = $stc["attributes"]["Picture"]; break; } } $estart = min($eventdates); $eend = max($eventdates); $eventstart = substr($estart,8,2).".".substr($estart,5,2).".".substr($estart,2,2); $eventend = substr($eend,8,2).".".substr($eend,5,2).".".substr($eend,2,2); $eventdate = ($eventstart != $eventend) ? "$eventstart - $eventend" : "$eventstart"; $etime = ($eventtime != "00:00") ? ", ".$eventtime : ""; echo "
\n"; echo "
$eventtitle
\n"; if( !empty($eventpicture) && strlen($eventpicture)>3 ) echo "\n"; echo "
$eventdate$etime
\n"; echo "
$ecityname
\n"; echo "
$eventcity
$eventlocation
\n"; echo "
$eventdesc
\n"; echo "
\n"; echo "".$str_allevents[$lang]."\n"; } else { /********** Anzeigen einer Liste von Events ***********************************/ if($DEBUG) echo "showing EVENT-List...
\n"; // Sprachabhaengig: $filename = str_replace("XX",strtolower($la),$event_filename); // neue Events-API verwednet it,de,... statt IT,DE,... if($DEBUG) echo "including file:$filename
\n"; include $filename; if($DEBUG) echo "filename:$filename
la:$la, eventfrom:$eventfrom, eventtill:$eventtill eventlimit:$eventlimit\n"; echo "\n"; echo "".$str_allevents[$lang]."\n"; } ?>