isArenaSearch()) { $_GET = StringMgr::removeJavascript($_GET); if ($_GET['hs'] && $_GET['q'] && !$_GET['atid']) { $activity_keywords = explode(' ', $_GET['q']); $keyword_columns = explode(',', "activity_name,arena_type,activity_verb"); $constraint_arr = array(); foreach ($activity_keywords as $v) { $constraint_arr2 = array(); foreach ($keyword_columns as $k) { $constraint_arr2[] = "`{$k}` LIKE '%" . $conn->sqlString($v) . "%'"; } if (strtolower($v) == 'mtb') { $constraint_arr2[] = "`activity_name` = 'mountain bike'"; } // Logging::comment($constraint_arr, 'constraint_arr'); // Logging::comment($constraint_arr2, 'constraint_arr2'); $constraint_arr[] = implode(" OR ", $constraint_arr2); } $constraints = "WHERE (" . implode(") AND (", $constraint_arr) . ")"; // $activity = $em->getActivity(" // WHERE activity_name LIKE '%" . $conn->sqlString($_GET['q']) . "%' // OR arena_type LIKE '%" . $conn->sqlString($_GET['q']) . "%' // OR activity_verb LIKE '%" . $conn->sqlString($_GET['q']) . "%' // "); $activity = array_shift($em->getActivities($constraints, "ORDER BY visits DESC")); if ($activity) { $_GET['atid'] = $activity['id']; unset($_GET['q']); if (!$_GET['z']) { $_GET['z'] = 'My Location'; } } // Logging::comment($activity, '$activity'); // Logging::comment($activity, '$activity'); // exit; } unset($_GET['hs']); include_once($VIEWS . "search-results.php"); } else { include_once($VIEWS . "home.php"); }