-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashtag.php
40 lines (35 loc) · 1.33 KB
/
hashtag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
require_once(__DIR__ . '/conf/init_http.php');
require_once(__DIR__ . '/lib/class/Forum/Forum.php');
require_once(__DIR__ . '/lib/class/User/Profile.php');
require_once(__DIR__ . '/lib/class/File/UserFile.php');
$response = (object) array(
'success' => false,
'message' => '',
'results' => null
);
if ($_POST) {
switch ($_POST['command']) {
case "go":
$forumResults = Forum::search($_POST['tag']);
$profileResults = Profile::search($_POST['tag']);
$blogResults = Blog::search($_POST['tag']);
$fileResults = UserFile::search($_POST['tag']);
$response->success = true;
$response->results = (object) array(
'hashtag' => $_POST['tag'],
'forum' => $forumResults,
'profiles' => array_values($profileResults),
'blogs' => $blogResults,
'files' => $fileResults
);
break;
default:
$response->message = "Unsupported command: \"" . $_POST['command'] . "\".";
break;
}
}
header('Content-Type: application/json');
echo json_encode($response);
exit(0);
?>