} } $tpl->assign('nGMInitLon', $nGMInitLon); $tpl->assign('nGMInitLat', $nGMInitLat); $tpl->assign('nGMInitZoom', $nGMInitZoom); $tpl->assign('bGMInitCookiePos', $bGMInitCookiePos ? 1 : 0); $tpl->assign('sGMInitWaypoint', $sGMInitWaypoint); $tpl->assign('bFullscreen', $sMode == 'fullscreen' ? 1 : 0); $rsCacheType = sql("SELECT `cache_type`.`id`, IFNULL(`sys_trans_text`.`text`, `cache_type`.`name`) AS `text` FROM `cache_type` LEFT JOIN `sys_trans` ON `cache_type`.`trans_id`=`sys_trans`.`id` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' ORDER BY `cache_type`.`ordinal` ASC", $opt['template']['locale']); $tpl->assign_rs('aCacheType', $rsCacheType); sql_free_result($rsCacheType); $rsCacheSize = sql("SELECT `cache_size`.`id`, IFNULL(`sys_trans_text`.`text`, `cache_size`.`name`) AS `text` FROM `cache_size` LEFT JOIN `sys_trans` ON `cache_size`.`trans_id`=`sys_trans`.`id` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' ORDER BY `cache_size`.`ordinal` ASC", $opt['template']['locale']); $tpl->assign_rs('aCacheSize', $rsCacheSize); sql_free_result($rsCacheSize); /* assign attributes */ $tpl->assign('aAttributes', attribute::getAttrbutesListArray()); $aAttributesDisabled = array(); $rs = sql("SELECT `id` FROM `cache_attrib`"); while ($r = sql_fetch_assoc($rs)) { $aAttributesDisabled[] = $r['id']; } sql_free_result($rs); $tpl->assign('aAttributesDisabled', $aAttributesDisabled); $tpl->display(); function cache_locate($nLat, $nLon) { global $login; $nMaxDistance = 5; $rsCache = sql_slave("SELECT " . geomath::getSqlDistanceFormula($nLon, $nLat, $nMaxDistance) . " AS `distance`, \r\n\t `caches`.`wp_oc`\r\n\t FROM `caches` \r\n\t INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`\r\n\t WHERE `caches`.`latitude`>'&1' AND \r\n \t\t\t\t\t\t\t\t\t\t `caches`.`latitude`<'&2' AND \r\n\t\t\t\t\t\t\t\t\t\t `caches`.`longitude`>'&3' AND \r\n\t\t\t\t\t\t\t\t\t\t `caches`.`longitude`<'&4' AND\r\n\t\t\t\t\t\t\t\t\t\t (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1')\r\n\t\t\t\t\t ORDER BY `distance` ASC LIMIT 1", geomath::getMinLat($nLon, $nLat, $nMaxDistance), geomath::getMaxLat($nLon, $nLat, $nMaxDistance), geomath::getMinLon($nLon, $nLat, $nMaxDistance), geomath::getMaxLon($nLon, $nLat, $nMaxDistance), $login->userid); $rCache = sql_fetch_assoc($rsCache); sql_free_result($rsCache);