// Y $only_active .= " AND caches.status = 2"; } } } $result = XDb::xSql("SELECT caches.cache_id, caches.name, user.username, caches.wp_oc as wp, caches.votes, caches.score,\n caches.topratings, caches.latitude, caches.longitude, caches.type, caches.status as status,\n datediff(now(), caches.date_hidden) as old, caches.user_id,\n IF(cache_id IN\n (\n SELECT cache_id\n FROM cache_logs\n WHERE deleted=0 AND user_id= ?\n AND (type=1 OR type=8)\n ), 1, 0\n ) as found\n FROM user, caches\n WHERE (caches.user_id = user.user_id)\n AND caches.latitude > ? AND caches.latitude < ?\n AND caches.longitude > ? AND caches.longitude < ?\n " . XDb::xEscape($only_active) . " " . $filter_by_type_string . "\n ORDER BY " . XDb::xEscape($ORDERBY) . "\n LIMIT " . XDb::xEscape($page) . ", " . XDb::xEscape($PER_PAGE), $user_id, $latSW, $latNE, $lonSW, $lonNE); echo "<?xml version=\"1.0\" encoding=\"" . $ENCODING . "\"?>\n"; echo "<markers>\n"; while ($res = XDb::xFetchArray($result)) { if (!isset($_REQUEST['print_list']) || onTheList($_SESSION['print_list'], $res['cache_id']) == -1) { $druk = "druk=\"y\""; } else { $druk = "druk=\"n\""; } $founds = XDb::xMultiVariableQueryValue("SELECT count(*) FROM cache_logs\n WHERE deleted=0 AND cache_id = :1\n AND (type=1 OR type=8)", 0, $res['cache_id']); $notfounds = XDb::xMultiVariableQueryValue("SELECT count(*) FROM cache_logs\n WHERE deleted=0 AND cache_id = :1 AND type=2", 0, $res['cache_id']); if ($res['votes'] > 2) { $score = $res['score']; } else { $score = ""; } echo "<marker id=\"" . htmlspecialchars($res['cache_id']) . "\" name=\"" . htmlspecialchars($res['name']) . "\" lat=\"" . htmlspecialchars($res['latitude']) . "\" lng=\"" . htmlspecialchars($res['longitude']) . "\" owner=\"" . htmlspecialchars($res['username']) . "\" owner_id=\"" . htmlspecialchars($res['user_id']) . "\" type=\"" . htmlspecialchars(typeLetter($res['type'])) . "\" found=\"" . $res['found'] . "\" old=\"" . htmlspecialchars($res['old']) . "\" score=\"" . htmlspecialchars($score) . "\" topratings=\"" . htmlspecialchars($res['topratings']) . "\" notfounds=\"" . htmlspecialchars($notfounds) . "\" votes=\"" . htmlspecialchars($res['votes']) . "\" founds=\"" . htmlspecialchars($founds) . "\" status=\"" . htmlspecialchars($res['status']) . "\" wp=\"" . htmlspecialchars($res['wp']) . "\" " . $druk . "/>\n"; } $res2['num'] = XDb::xMultiVariableQueryValue("SELECT count(cache_id) as num FROM caches\n WHERE caches.status = 1\n AND caches.latitude > :1\n AND caches.latitude < :2\n AND caches.longitude > :3\n AND caches.longitude < :4 ", 0, $latSW, $latNE, $lonSW, $lonNE); $pages = ''; for ($i = 0; $i < $res2['num'] / $PER_PAGE; $i++) { $pages .= "<a href=\"javascript:load_data(" . $i . ");\">" . ($i + 1) . "</a> "; } $pages = htmlspecialchars($pages); echo "<data count=\"" . $res2['num'] . "\" pager=\"" . $pages . "\" />\n"; echo "</markers>";
$value = array($pt["x"] - max(2 * $zoom - 10, 5) / 2, $pt["y"] - $pointer, $pt["x"], $pt["y"], $pt["x"] + max(2 * $zoom - 10, 5) / 2, $pt["y"] - $pointer); imagefilledpolygon($im, $value, 3, $color[$typeColor]); imageline($im, $pt["x"] - max(2 * $zoom - 10, 5) / 2, $pt["y"] - $pointer, $pt["x"], $pt["y"], $black); imageline($im, $pt["x"] + max(2 * $zoom - 10, 5) / 2, $pt["y"] - $pointer, $pt["x"], $pt["y"], $black); //imageellipse($im, $pt["x"], $pt["y"]+1.5*$zoom, $radius, $radius, $black); if ($_GET['signes'] == "true") { $fontSize = 1.3 * $zoom - 11; $box = imagettfbbox($fontSize, 0, '../util.sec/bt.ttf', $cache['wp']); imagettftext($im, $fontSize, 0, $pt["x"] - (int) abs($box[2] / 2), $pt["y"] + (int) abs($box[7] / 2) - $pointer + max(2 * $zoom + 28, 5) / 2, $black, $rootpath . 'util.sec/bt.ttf', $cache['wp']); } } if ($zoom > 10) { //echo "aaa"; $fontSize = 1.55 * $zoom - 11; $box = imagettfbbox($fontSize, 0, '../util.sec/bt.ttf', typeLetter($cache['type'])); imagettftext($im, $fontSize, 0, $pt["x"] - (int) abs($box[2] / 2), $pt["y"] + (int) abs($box[7] / 2) - $pointer, $black, $rootpath . 'util.sec/bt.ttf', typeLetter($cache['type'])); } } // end markers } unset($icons); header("Content-Type: image/gif"); imagegif($im, '', 9); imagedestroy($im); // utility class to hold the rectangle position and size. class Rectangle { var $x, $y; var $width, $height; } /** returns the Google zoom level for the keyhole string. */
return "C"; break; //math //math case 9: return "O"; break; //mOving //mOving case 10: return "D"; break; //Drive-in //Drive-in default: return ""; } } db_connect(); $language = "pl"; $encoding = "UTF-8"; $user_id = mysql_escape_string($_GET['uid']); mysql_query("SET NAMES 'utf8'"); $result = mysql_query("SELECT `cache_logs`.`cache_id` `cache_id` , `caches`.`latitude`, `caches`.`longitude`, `caches`.`type` `type` , `cache_logs`.`date` `date` , `caches`.`name` `name` , `log_types`.`icon_small` , `log_types_text`.`text_combo` FROM `cache_logs` , `caches` , `log_types` , `log_types_text` WHERE `cache_logs`.`deleted`=0 AND `cache_logs`.`user_id` = '" . $user_id . "' AND `cache_logs`.`cache_id` = `caches`.`cache_id` AND `cache_logs`.`type` = 1 AND `log_types`.`id` = `cache_logs`.`type` AND `log_types_text`.`log_types_id` = `log_types`.`id` AND `log_types_text`.`lang` = '" . $language . "' ORDER BY `cache_logs`.`date` DESC , `cache_logs`.`date_created` DESC"); echo "<?xml version=\"1.0\" encoding=\"" . $encoding . "\"?>\n"; echo "<markers>\n"; while ($res = mysql_fetch_array($result)) { echo "<marker id=\"" . htmlspecialchars($res['cache_id']) . "\" name=\"" . htmlspecialchars($res['name']) . "\" lat=\"" . htmlspecialchars($res['latitude']) . "\" lng=\"" . htmlspecialchars($res['longitude']) . "\" type=\"" . htmlspecialchars(typeLetter($res['type'])) . "\" date=\"" . htmlspecialchars(typeLetter($res['date'])) . "\" />\n"; } echo "</markers>"; db_disconnect();