getArena($_GET['aid']); } else if ($_GET['akey']) { $arena = $em->getArena("WHERE url_key = '{$_GET['akey']}'"); } if ($arena) { GeneralUse::redirect($ebm->getArenaUrl($arena), 301); } else { $_SESSION['failure'] .= "Sorry, we could not find that arena. "; GeneralUse::back(); } } // exit; // header("Content-type: text/plain"); // print_r($_SERVER); // print_r($_SESSION); // print_r($_REQUEST); // exit; $title = ""; $description = ""; $keywords = ""; if ($_REQUEST['action']) { switch (strtolower($_REQUEST['action'])) { case 'guest_review': $arena = $em->getArena($_POST['aid']); $_SESSION['guest']['name'] = $_POST['guest_name']; $_SESSION['guest']['email'] = $_POST['guest_email']; if ($arena) { if (!$_SESSION['guest']['is_human']) { $_SESSION['guest']['is_human'] = $ebm->isCaptchaSuccess($_POST); } if ($_SESSION['guest']['is_human']) { $review = array( 'review_type' => 'arena' ,'review_type_id' => $arena['id'] ,'rating' => $_POST['rating'] != '' ? $_POST['rating'] : null ,'review' => $_POST['guest_review'] ,'guest_name' => $_POST['guest_name'] ,'guest_email' => $_POST['guest_email'] ,'approved' => 0 ); if ($review['id'] = $conn->insertRow('review', $review)) { $_SESSION['success'] .= "Thank you for your comments. If they're approved, you should see them on the website soon. "; $arena_url = $ebm->getArenaUrl($arena); $email_params = array( 'table_name' => 'review' ,'table_id' => $review['id'] ,'save_message' => true ); // email Free Arenas $email_subject = 'New Guest Review'; $email_to = 'reviews@freearenas.com'; $email_from = $review['guest_email'] ? $review['guest_email'] : 'no-reply@freearenas.com'; $email_message = "
" . $review['review'] . "
"; if ($_POST['rating'] !== '') { $email_message .= "Rating: " . $review['rating'] . "
"; } if ($review['guest_name']) { // $from = "{$review['guest_name']} <{$review['guest_email']}>"; $from = "no-reply@freearenas.com"; $email_subject .= ' from ' . $review['guest_name']; $email_message .= "—
{$review['guest_name']}
{$review['guest_email']}
Arena:
" . $_SERVER['SITE_ROOT'] . $arena_url . "
Review:
" . $_SERVER['SITE_ROOT'] . "/admin/reviews/manage.php?id=" . $review['id'] . "
" . "Approve" . " | " . "Deny" . " | " . "Delete" . " | " . "Reply" . "
"; $emailer->send($email_to, $email_subject, $email_message, $email_from, $email_params); /* DON'T REPLY TO USER. THIS IS WHERE SPAM IS COMING FROM * // email reviewer $email_to = $review['guest_email']; $email_from = 'support@freearenas.com'; $email_subject = "Thank you for your review of {$arena['name']}"; $email_message = ""; if ($review['guest_name']) { list($guest_name) = explode(' ', $review['guest_name']); $email_message .= "{$guest_name},
"; } $email_message .= "Thank you for taking the time to write this review. If it's approved, you'll get another email telling you so.
"; $email_message .= ""; $email_message .= "“
{$review['review']}
— {$review['guest_name']}
To avoid this approval process in the future, just sign up for a free account at FreeArenas.com. In addition to simplifying your reviews, you'll also be able to put together collections of arenas, log your travels, create your own areans, add photos and videos. and earn reputation points.
"; $email_message .= "Please let us know what we can do to improve your experience on our website. You can use the \"Feedback\" tab at the bottom of the site or just send us an email at feedback@freearenas.com. We do what we can to make it easy for you to
"; $email_message .= "Find, Share, and GET OUT THERE!
"; $emailer->send($email_to, $email_subject, $email_message, $email_from, $email_params); */ GeneralUse::redirect($arena_url); } else { $failure .= "Sorry! Something went wrong and we were not able to save your comments. Please try again. If the problem continues, please leave feedback so we can get the problem fixed. Thank you. "; } } else { $failure .= "Sorry! We could not verify that you're a human. If you really are, please try again. "; } } else { $failure .= "Arena not found. "; GeneralUse::goBack(); } break; } } if ($_GET['akey']) { $arena = $ebm->getArenaByKey($_GET['akey'], true); } else if ($_REQUEST['aid']) { $arena = $em->getArena($_REQUEST['aid']); if ($arena) { GeneralUse::redirect($ebm->getArenaUrl($arena), 301); } else { $_SESSION['failure'] .= " We couldn't find that arena. "; GeneralUse::back('/'); } } if ($arena['id']) { if (!$arena['active']) { if ($ebm->isAdmin()) { $warning .= "This arena is currently marked inactive and is not viewable to the public. "; } else { $_SESSION['failure'] .= 'The listing for ' . $arena['name'] . ' is not available at this time. Check out one of these nearby locations. '; if ($arena['nearest_city']) { $redirect = $ebm->getCleanSearchUrl(['z'=>$arena['nearest_city']]); } else { $redirect = $ebm->getCleanSearchUrl(['z'=>'my location']); } GeneralUse::redirect($redirect); } } $arena_attributes = $ebm->getArenaAttributes($arena['id']); $ebm->fillArenaAttributes($arena); // $arena['routes'] = $em->getArenaRoutes("WHERE arena_id = {$arena['id']}"); // ksort($arena['routes']); $arena['routes'] = $ebm->getArenaRoutes($arena['id']); // Logging::comment($arena, 'arena'); $page_title = $arena['arena_name']; } else { // $err_msg = "That arena is no longer there."; $_SESSION['failure'] .= $err_msg; $redirect = "/"; // $err_msg .= "\n" . StringMgr::tab(print_r($_GET, true)); if ($_GET['akey']) { if (stristr($_GET['akey'], '-near-')) { list($arena_name, $nearest_city) = explode('-near-', $_GET['akey']); } else if (stristr($_GET['akey'], '-in-')) { list($arena_name, $nearest_city) = explode('-in-', $_GET['akey']); } if ($arena_name && $nearest_city) { $arena_name = strtolower(StringMgr::strAsTitle($arena_name)); $nearest_city = strtolower(StringMgr::strAsTitle($nearest_city)); $possible_matches = $em->getArenas("WHERE arena_name LIKE '" . $conn->sqlString($arena_name) . "'"); if (count($possible_matches) == 1) { $arena = array_shift($possible_matches); $_SESSION['failure'] .= " We couldn't find that arena. This is our best guess. "; $redirect = $ebm->getArenaUrl($arena); } else { $_SESSION['failure'] .= " We couldn't find that arena. Let's try searching. "; $redirect = "/?q={$arena_name}&z={$nearest_city}&s=1&rd=1"; // Logging::writeErrorLog($_SESSION['failure'] . " (Redirected to: {$redirect})"); } } } $page_error = array(); // $page_error['error_code'] = 404; $page_error['url'] = $_SERVER['REQUEST_URI']; $page_error['referer'] = $_SERVER['HTTP_REFERER']; $page_error['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $page_error['ip'] = $_SERVER['REMOTE_ADDR']; $page_error['redirect'] = $redirect; $page_error['notes'] = $_SESSION['failure']; $conn->insertRow('page_error', $page_error); GeneralUse::redirect($redirect); } if ($arena["activity_ids"]) { $activities = $em->getActivities("WHERE at.activity_id IN ({$arena["activity_ids"]})"); } // $reviews = $em->getReviews("WHERE review_type = 'arena' AND review_type_id = '{$arena['arena_id']}'"); Logging::commentOff(); // Logging::commentOn(); // $images = $ebm->getImages("arena", $arena['arena_id']); // Logging::comment($images, 'images'); $media_items = $ebm->getArenaMedia($arena); Logging::comment($media_items, "\$media_items"); Logging::commentRestore(); $videos = $em->getVideos("WHERE arena_id = '{$arena['id']}'", "ORDER BY sort_order"); $activities_list = $ebm->getActivitiesList($arena['activities']); $title = $page_title; if ($activities_list) { $title .= " - " . $activities_list; } if ($arena['nearest_city']) { $title .= " near " . $arena['nearest_city']; } else if ($arena['state']) { $title .= " in " . $arena['state']; } // Logging::comment($arena, 1, 'arena'); $description_location = ""; if ($arena['nearest_city']) { $description_location = " near " . $arena['nearest_city']; } else if ($arena['state']) { $description_location = " in " . $arena['state']; } // $description = $page_title // . " is a great place to " . $activities_list . $description_location . ". " // . strip_tags($arena['description']); $description = $activities_list . ' at ' . $arena['name'] . $description_location . ". Maps, directions, and reviews. "; if ($arena['description']) { $description .= $ebm->getArenaDescriptionText($arena['description']); $fb_og['description'] = StringMgr::singleLine($ebm->getArenaDescriptionText($arena['description'].$arena['description'].$arena['description'])); } // $description = str_replace('"', """, $description); Logging::comment($description, '$description'); Logging::comment($arena['description'], '$arena[description]'); if (is_array($media_items)) { foreach ($media_items as $media_item) { $fb_og['image'][] = $media_item['url']; } } $fb_og['type'] = 'place'; $fb_og['type'] = 'article'; $fb_og['title'] = $title; /** TESTING *** if (count($images) || count($videos)) { if (is_array($images) && count($images)) { $image = array_shift($images); $img_350 = $ebm->getSizedArenaImage($arena['id'], 350, $image); Logging::comment($img_350, 0, '$img_350'); } if (is_array($images) && count($images)) { foreach ($images as $i => $image) { $img_650 = $ebm->getSizedArenaImage($arena['id'], 600, $image); $img_150 = $ebm->getSizedArenaImage($arena['id'], 150, $image); Logging::comment($img_600, 0, '$img_600'); Logging::comment($img_150, 0, '$img_150'); } } } ** TESTING ***/ $nearby_order = "ORDER BY distance ASC LIMIT 20"; $nearby_camping = $ebm->getNearArenas($arena['gps'], array('activity_id' => 177, 'order' => $nearby_order)); if ($arena['activity_ids'] != '177') { // other arenas nearby (not solely campsites) Logging::comment($arena['activity_ids'], '$arena[activity_ids]'); $nearby_activity_ids = explode(",", $arena['activity_ids']); Logging::comment($nearby_activity_ids, 'nearby_activity_ids'); if (in_array('177', $nearby_activity_ids)) { unset($nearby_activity_ids[array_search('177', $nearby_activity_ids)]); } Logging::comment($nearby_activity_ids, 'nearby activity_ids'); $nearby_similar = $ebm->getNearArenas($arena['gps'], array('activity_ids' => implode(',', $nearby_activity_ids), 'order' => $nearby_order)); } else { $nearby_other = $ebm->getNearArenas($arena['gps'], array('order' => $nearby_order)); } if ($arena['show_google_directions']) { $google_directions_url = "https://maps.google.com/maps?daddr=" . $arena['gps']; $google_directions_mobile_url = $google_directions_url; if ($_SESSION['search']['address']) { $google_directions_url .= "&saddr=" . $_SESSION['search']['address']; } } $creator = $em->getUser($arena['created_by']); // $writer = ?; $show_map = !$arena['keep_out']; // arena references $constraint_arr = array(); $constraint_arr[] = "ar.arena_id = {$arena['id']}"; // if ($ebm->isSuperAdmin()) { $constraint_arr[] = "ar.status = '200' OR status = '' OR status IS NULL"; // } // else { // $constraint_arr[] = "ar.status = '200'"; // } if (!$ebm->isEditor()) { $constraint_arr[] = "ar.reference_url NOT LIKE '%backcountrysecrets.com%'"; $constraint_arr[] = "ar.reference_url NOT LIKE '%alltrails.com%'"; $constraint_arr[] = "ar.reference_url NOT LIKE '%theoutbound.com%'"; $constraint_arr[] = "ar.reference_url NOT LIKE '%outdoorproject.com%'"; } $constraints = "WHERE (" . implode(") AND (", $constraint_arr) . ")"; // Logging::commentOn(); $arena_references = $em->getArenaReferences($constraints, "ORDER BY status DESC, title, source_data, reference_url"); // shorg if ($ebm->isEditor()) { $is_shorg = false; foreach ($arena_references as $ref) { if (stristr($ref['reference_url'], 'swimmingholes.org')) { $is_shorg = true; break; } } if ($is_shorg) { $shorg = $conn->getRow('shorg', "WHERE arena_id = {$arena['id']}"); $arena['description'] .= "\n= $arena['keep_out'] ? 'Keep Out' : 'Closed' ?> = $arena['closed_to'] ? " until " . date("n/j/Y", strtotime($arena['closed_to'])) : "" ?>
= $arena['closure_note'] ?>
Address: | = $arena['address'] ?> |
GPS: |
= $geocoder->ddToDms($arena['gps']) ?>
Maps | Directions |
State: | = $arena['state'] ?> |
= $attribute['frontend_label'] ?>: | = $attr_text ?> |
Trails/Routes: |
= $attr ?> = $attr ?>
= $activities_list ?>
= $arena['keep_out'] ? 'Keep Out' : 'Closed' ?> = $arena['closed_to'] ? " until " . date("n/j/Y", strtotime($arena['closed_to'])) : "" ?>
= $arena['closure_note'] ?>
Do not follow Google Directions.= $arena['directions'] ? ' Try these instead:' : '' ?>
= $arena['directions'] ?>
Added by = $creator['username'] ?>
Elevation differences are scaled for emphasis. While the numbers are accurate, the cut-away shown here is not to scale.