foreach ($params as $k => $v) { if (isset($_REQUEST[$k])) { $params[$k] = strtolower(safeString($_REQUEST[$k])); } } $action = $params['action']; $type = $params['type']; $query = $params['query']; $page = $params['page']; $limit = $params['limit']; $sort = $params['sort']; if ($action == "search") { $data = searchExperiments($query, $page, $limit, $sort); } else { if ($sort == "default" || $sort == "recent") { $data = browseExperimentsByRecent($page, $limit, true); } else { if ($sort == "popularity") { $data = browseExperimentsByPopular($page, $limit, true); } else { if ($sort == "activity") { $data = browseExperimentsByActivity($page, $limit, true); } else { if ($sort == "rating") { $data = browseExperimentsByRating($page, $limit, true); } } } } } if (count($data) > 0) {
if ($action == "browse") { if ($type == "visualizations") { $results = browseVisualizationsByTimeCreated($page, $limit); $count = browseVisualizationsByTimeCreated(-1, $limit); } else { if ($type == "people") { $results = browsePeople($page, $limit); $count = browsePeople(-1, $limit); } else { if ($type == "activities") { $results = browseActivities($page, $limit); $count = browseActivities(-1, $limit); } else { if ($sort == "default" || $sort == "recent") { $results = browseExperimentsByRecent($page, $limit); $count = browseExperimentsByRecent(-1, $limit); } else { if ($sort == "popularity") { $results = browseExperimentsByPopular($page, $limit); $count = browseExperimentsByPopular(-1, $limit); } else { if ($sort == "activity") { $results = browseExperimentsByActivity($page, $limit); $count = browseExperimentsByActivity(-1, $limit); } else { if ($sort == "rating") { $results = browseExperimentsByRating($page, $limit); $count = browseExperimentsByRating(-1, $limit); } } }