date); $matches = array(); if (preg_match ('/^([\-+])(\d{2})(\d{2})$/', date ('O', $feature->date), $matches)) { $date .= $matches [1] . $matches [2] . ':' . $matches [3]; } else { $date .= 'Z'; } return $date; } // method from http://diveintomark.org/archives/2004/05/28/howto-atom-id#other function unique_id_from_feature ($feature) { $date = date('Y-m-d', $feature->date); $res = sprintf("tag:%s,%s:%d", gethost(), $date, $feature->id); return $res; } function unique_id_from_site () { $id = md5 (full_url_from_path ("")); $res = sprintf("tag:%s,1970-01-01:%d", gethost, $id); return $res; } function main ($features) { printf (" \n"); printf(" \n", full_url_from_path ("")); printf(" \n", full_url_from_path (basename ($_SERVER ["PHP_SELF"]))); printf(" %s\n", unique_id_from_site()); if (count ($features) > 0) { printf(" %s\n", date3339 ($features[0])); } if (SITETITLE) { printf (" %s\n", SITETITLE); } if (WEBMASTERMAIL) { printf (" \n"); printf (" %s\n", WEBMASTERMAIL); printf(" \n"); } printf ("\n"); foreach ($features as $feature) { printf (" \n"); if ($feature->title) { $title = htmlspecialchars ($feature->title, ENT_QUOTES); } else { $title = $feature->id; } printf (" %s\n", $title); $rel_url = sprintf ("index.php?lat=%.18F&lon=%.18F&zoom=12", $feature->lat, $feature->lon); $link = htmlspecialchars (full_url_from_path ($rel_url), ENT_QUOTES); printf (" \n", $link); printf (" %s\n", unique_id_from_feature ($feature)); printf (" %s\n", date3339 ($feature)); if ($feature->description) { $contentHTML = sprintf ("

%s

", htmlspecialchars ($feature->description, ENT_QUOTES)); } else { $contentHTML = sprintf ("

%s

", htmlspecialchars ($feature->title, ENT_QUOTES)); } if (strlen ($contentHTML) != 0) { printf (" %s \n", htmlspecialchars ($contentHTML)); } printf(" %.18F %.18F\n", $feature->lat, $feature->lon); printf("
\n\n"); } printf ("
"); } try { $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX); $features = $connection->mostrecentfeatures (10); } catch (Exception $e) { exit ("server error"); } main ($features); ?>