function geocacheStatusCheck($cacheId) { $geocache = new GeoCache(array('cacheId' => $cacheId)); $forbidenCacheStatuses = array(GeoCache::STATUS_BLOCKED, GeoCache::STATUS_ARCHIVED, GeoCache::STATUS_WAITAPPROVERS); if (in_array($geocache->getStatus(), $forbidenCacheStatuses)) { print 'geocache of this status cannot be added'; return false; } return true; }
// add cache to print (do not duplicate items) if (count($_SESSION['print_list']) == 0) { $_SESSION['print_list'] = array(); } if (onTheList($_SESSION['print_list'], $cache_id) == -1) { array_push($_SESSION['print_list'], $cache_id); } } if (isset($_REQUEST['print_list']) && $_REQUEST['print_list'] == 'n') { // remove cache from print list while (onTheList($_SESSION['print_list'], $cache_id) != -1) { unset($_SESSION['print_list'][onTheList($_SESSION['print_list'], $cache_id)]); } $_SESSION['print_list'] = array_values($_SESSION['print_list']); } if ($cache_id != 0 && ($geocache->getStatus() != 4 && $geocache->getStatus() != 5 && $geocache->getStatus() != 6 || $usr['userid'] == $geocache->getOwner()->getUserId() || $usr['admin'] || $cache_record['status'] == 4 && $applicationContainer->getLoggedUser()->getIsGuide())) { //ok, cache is here, let's process $owner_id = $geocache->getOwner()->getUserId(); tpl_set_var('owner_id', $owner_id); // check XY home if OK redirect to myn if ($usr == true) { $ulat = $applicationContainer->getLoggedUser()->getHomeCoordinates()->getLatitude(); $ulon = $applicationContainer->getLoggedUser()->getHomeCoordinates()->getLongitude(); if ($ulon != NULL && $ulat != NULL || $ulon != 0 && $ulat != 0) { $distancecache = sprintf("%.2f", calcDistance($ulat, $ulon, $geocache->getCoordinates()->getLatitude(), $geocache->getCoordinates()->getLongitude())); tpl_set_var('distance_cache', '<img src="tpl/stdstyle/images/free_icons/car.png" class="icon16" alt="distance" title="" align="middle" /> ' . tr('distance_to_cache') . ': <b>' . $distancecache . ' km</b><br />'); } else { tpl_set_var('distance_cache', ''); } } else { tpl_set_var('distance_cache', '');