$width, "height" => $height, "border" => $border, "lat" => $lat, "lon" => $lon, "zoom" => $zoom, "layer" => $layer);
$up = clipZoom(1, $zoom - 1, 16);
$down = clipZoom(1, $zoom + 1, 16);
// 2 x border for scrolling. image split into 3x3
$w = $width- 2*$border;
$h = $height- 2*$border;
// how wide and high is a tile in degres
$dlon = 360/pow(2, $zoom);
$dlat = 360 * cos($lat * pi() / 180)/pow(2, $zoom);
if($x > 0 && $y > 0 && $comment != "") {
$buglat = $lat - ($y - $h/2) * $dlat / 256;
$buglon = $lon + ($x - $w/2) * $dlon / 256;
$ch = curl_init("http://openstreetbugs.appspot.com/addPOIexec");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "lon=$buglon&lat=$buglat&text=".urlencode("$comment [$nickname]"));
$result = curl_exec($ch);
curl_close($ch);
if(substr($result, 0, 2) == "ok") {
echo "report filed
\n";
} else {
echo "Something went wrong.
\n";
}
echo "Back to the map\n";
} else if($x > 0 && $y > 0) {
echo "\n";
} else {
echo "Pick spot
\n";
echo "\n";
}
?>