require_once ("./inc/utils.php");
require_once ("./inc/db/mysql.php");
-function main ($features) {
+function headers_callback ($output) {
+ $etag = md5 ($output);
+ if ((isset ($_SERVER ["HTTP_IF_NONE_MATCH"])) &&
+ ($_SERVER ["HTTP_IF_NONE_MATCH"] == $etag)) {
+ header ("HTTP/1.1 304 Not Modified");
+ exit ();
+ }
+
+ header ("Content-type: application/vnd.google-earth.kml+xml");
+ header ("Cache-control: must-revalidate");
+ header (sprintf ("ETag: %s", $etag));
+
+ return $output;
+}
- header("Cache-control: no-cache");
+function main ($features) {
echo '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
$title = htmlspecialchars ($feature->title, ENT_QUOTES);
$description = htmlspecialchars ($feature->description, ENT_QUOTES);
$imgurl = ($feature->imgpath ?
- full_url_from_imgpath ($feature->imgpath)
+ image_url_from_imgpath ($feature->imgpath)
+ : "");
+ $thumburl = ($feature->imgpath ?
+ thumb_url_from_imgpath ($feature->imgpath)
: "");
$lon = $feature->lon;
$lat = $feature->lat;
$title;
if ($imgurl) {
- $imgurlHTML = sprintf ('<img alt="%s" src="%s">', $alt, $imgurl);
+ $imgurlHTML = sprintf ('<a href="%s"><img alt="%s" src="%s"></a>', $imgurl, $alt, $thumburl);
} else {
$imgurlHTML = "";
}
} catch (Exception $e) {
exit ("server error");
}
-header ("Content-type: application/vnd.google-earth.kml+xml");
+
+ob_start ("headers_callback");
main ($features);
+ob_end_flush ()
?>