'; if (SITETITLE) { printf (' %s', SITETITLE); } foreach ($features as $feature) { $title = htmlspecialchars ($feature->title, ENT_QUOTES); $description = htmlspecialchars ($feature->description, ENT_QUOTES); if (strpos ($feature->imgurl, "http://") === 0) { $imgurl = "http://" . rawurlencode (substr($feature->imgurl, 7)); } else if (strpos ($feature->imgurl, "https://") === 0) { $imgurl = "https://" . rawurlencode (substr ($feature->imgurl, 8)); } else { $imgurl = rawurlencode ($feature->imgurl); } $imgurl = str_replace ('%2F', '/', $imgurl); $lon = $feature->lon; $lat = $feature->lat; $alt = (strlen ($title) > 60) ? (substr ($title, 0, 57) . '...') : $title; printf (' %s %s

%s ]]>
%s,%s
', $title, $description, $alt, $imgurl, $lon, $lat); } echo'
'; } try { $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX); $features = $connection->listfeatures (); } catch (Exception $e) { server_error (); } header ("Content-type: application/vnd.google-earth.kml+xml"); main ($features); ?>