Commit ff0b20ff authored by Nigel McNie's avatar Nigel McNie
Browse files

Cleaned up this file quite a bit, given there's no special case code needed to format results.

I was actually looking to fix a bug about it displaying the currently logged in user in search results, but there's a change on the forums branch that will allow this, and I don't want conflicts.
parent 77db60b4
......@@ -32,9 +32,6 @@ define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require('searchlib.php');
safe_require('search', 'internal');
json_headers();
$type = param_variable('type');
$query = param_variable('query', '');
......@@ -43,10 +40,10 @@ $offset = param_integer('offset', 0);
switch ($type) {
case 'user':
$data = get_user_results($query, $limit, $offset);
$data = search_user($query, $limit, $offset);
break;
case 'group':
$data = get_group_results($query, $limit, $offset);
$data = search_group($query, $limit, $offset);
break;
}
......@@ -55,20 +52,4 @@ $data['error'] = false;
$data['message'] = '';
echo json_encode($data);
function get_user_results($query, $limit, $offset) {
$data = search_user($query, $limit, $offset);
return $data;
}
function get_group_results($query, $limit, $offset) {
$data = search_group($query, $limit, $offset);
if ($data['data']) {
foreach ($data['data'] as &$result) {
}
}
return $data;
}
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment