Exemplo n.º 1
0
                                     `caches`.`difficulty` `difficulty`,
                                     `caches`.`terrain` `terrain`,
                                     `caches`.`founds` `founds`,
                                     `caches`.`status` `status`,
                                     `caches`.`user_id` `user_id`
                                 FROM `caches`
                                 WHERE `caches`.`cache_id` NOT IN (SELECT `cache_ignore`.`cache_id` FROM `cache_ignore` WHERE `cache_ignore`.`user_id`=\'' . $user_id . '\') AND caches.status<>4 AND caches.status<>5 AND caches.status <>6
                                     AND `longitude` > ' . ($lon - $max_lon_diff) . '
                                     AND `longitude` < ' . ($lon + $max_lon_diff) . '
                                     AND `latitude` > ' . ($lat - $max_lat_diff) . '
                                     AND `latitude` < ' . ($lat + $max_lat_diff) . '
                                 HAVING `distance` < ' . $distance);
 sql('ALTER TABLE local_caches ADD PRIMARY KEY ( `cache_id` ),
         ADD INDEX(`cache_id`), ADD INDEX (`wp_oc`), ADD INDEX(`type`), ADD INDEX(`name`), ADD INDEX(`user_id`), ADD INDEX(`date_hidden`), ADD INDEX(`date_created`)');
 // Read coordinates of the newest caches
 $markerpositions = get_marker_positions($latitude, $longitude, $radius, $user_id);
 // Generate include file for map with new caches
 tpl_set_var('local_cache_map', '<img src="' . create_map_url($markerpositions, -1, $latitude, $longitude) . '" basesrc="' . create_map_url($markerpositions, -1, $latitude, $longitude) . '" id="main-cachemap" name="main-cachemap" alt="mapa" />');
 //  $file_content = '<img src="' . create_map_url($markerpositions, -1,$latitude,$longitude) . '" basesrc="' . create_map_url($markerpositions, -1,$latitude,$longitude) . '" id="main-cachemap" name="main-cachemap" alt="mapa" />';
 //  $n_file = fopen($dynstylepath . "local_cachemap.inc.php", 'w');
 //  fwrite($n_file, $file_content);
 //  fclose($n_file);
 //start_newcaches.include
 $rs = sql("SELECT `user`.`user_id` `user_id`,\n                `user`.`username` `username`,\n                `caches`.`cache_id` `cache_id`,\n                `caches`.`name` `name`,\n                `caches`.`longitude` `longitude`,\n                `caches`.`latitude` `latitude`,\n                `caches`.`date_hidden` `date_hidden`,\n                `caches`.`date_created` `date_created`,\n                IF((`caches`.`date_hidden`>`caches`.`date_created`), `caches`.`date_hidden`, `caches`.`date_created`) AS `date`,\n                `caches`.`country` `country`,\n                `caches`.`difficulty` `difficulty`,\n                `caches`.`terrain` `terrain`,\n                `cache_type`.`icon_large` `icon_large`\n        FROM local_caches `caches` INNER JOIN `user` ON (`caches`.`user_id`=`user`.`user_id`), `cache_type`\n        WHERE         `caches`.`type`!=6\n              AND `caches`.`status`=1\n              AND `caches`.`type`=`cache_type`.`id`\n                AND `caches`.`date_created` <= NOW()\n                AND `caches`.`date_hidden` <= NOW()\n            ORDER BY `date` DESC, `caches`.`cache_id` DESC\n            LIMIT 0 , 10");
 $rsc = sql("SELECT `user`.`user_id` `user_id`,\n                `user`.`username` `username`,\n                `caches`.`cache_id` `cache_id`,\n                `caches`.`name` `name`,\n                `caches`.`longitude` `longitude`,\n                `caches`.`latitude` `latitude`,\n                `caches`.`date_hidden` `date_hidden`,\n                `caches`.`date_created` `date_created`,\n                IF((`caches`.`date_hidden`>`caches`.`date_created`), `caches`.`date_hidden`, `caches`.`date_created`) AS `date`,\n                `caches`.`country` `country`,\n                `caches`.`difficulty` `difficulty`,\n                `caches`.`terrain` `terrain`,\n                `cache_type`.`icon_large` `icon_large`\n            FROM local_caches `caches` INNER JOIN `user` ON (`caches`.`user_id`=`user`.`user_id`), `cache_type`\n            WHERE `caches`.`type`!=6\n                AND `caches`.`status`=1\n                AND `caches`.`type`=`cache_type`.`id`\n                AND `caches`.`date_created` <= NOW()\n                AND `caches`.`date_hidden` <= NOW()\n            ORDER BY `date` DESC, `caches`.`cache_id` DESC");
 if (mysql_num_rows($rsc) > 10) {
     tpl_set_var('more_caches', '<a class="links" href="myn_newcaches.php">[' . tr("show_more") . '...]</a>');
 }
 mysql_free_result($rsc);
 if (mysql_num_rows($rs) == 0) {
     $file_content = "<p>&nbsp;&nbsp;&nbsp;&nbsp;<b>" . tr('list_of_caches_is_empty') . "</b></p><br>";
Exemplo n.º 2
0
setlocale(LC_TIME, 'pl_PL.UTF-8');
global $lang, $rootpath;
if (!isset($rootpath)) {
    $rootpath = __DIR__ . '/../../../';
}
//include template handling
require_once $rootpath . 'lib/common.inc.php';
require_once $rootpath . 'lib/cache_icon.inc.php';
// Map parameters
$map_center_lat = $main_page_map_center_lat;
$map_center_lon = $main_page_map_center_lon;
$map_zoom = $main_page_map_zoom;
$map_width = $main_page_map_width;
$map_height = $main_page_map_height;
// Read coordinates of the newest caches
$markerpositions = get_marker_positions();
// Generate include file for map with new caches
$google_map = sprintf("//maps.google.com/maps/api/staticmap?center=%F,%F&zoom=%d&size=%dx%d&maptype=roadmap&key=%s&sensor=false", $map_center_lat, $map_center_lon, $map_zoom, $map_width, $map_height, $googlemap_key);
$file_content = '<img src="' . $google_map . '" id="main-cachemap" name="main-cachemap" alt="{{map}}" />';
// Calculate positions for small and large images highlighting recent caches and events
$markers = $markerpositions['markers'];
$small_markers = '';
$big_markers = '';
foreach ($markers as $i => $marker) {
    $markerposleft = lon_offset($marker['lon'], $map_center_lon, $map_width, $map_zoom);
    $markerpostop = lat_offset($marker['lat'], $map_center_lat, $map_height, $map_zoom);
    $type = strtoupper(typeToLetter($marker['type']));
    if (strcmp($type, 'E') == 0) {
        $small_marker = 'mark-small-orange.png';
        $big_marker = 'marker-orangeE.png';
    } else {