-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
59 lines (48 loc) · 1.32 KB
/
search.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* search
*
* @package Delus
* @author Dmitry
*/
// fetch bootloader
require('bootloader.php');
// user access
if (!$system['system_public']) {
user_access();
}
// valid inputs
$_GET['tab'] = ($_GET['tab'] == "") ? "posts" : $_GET['tab'];
if (!in_array($_GET['tab'], ["posts", "blogs", "users", "pages", "groups", "events"])) {
_error(404);
}
try {
// search
if (isset($_GET['query'])) {
/* get results */
$results = $user->search($_GET['query'], $_GET['tab']);
/* assign variables */
$smarty->assign('query', htmlentities($_GET['query'], ENT_QUOTES, 'utf-8'));
$smarty->assign('hashtag', (isset($_GET['hashtag']) && $_GET['hashtag'] == '1') ? true : false);
$smarty->assign('results', $results);
}
$smarty->assign('tab', $_GET['tab']);
// get ads campaigns
$ads_campaigns = $user->ads_campaigns();
/* assign variables */
$smarty->assign('ads_campaigns', $ads_campaigns);
// get ads
$ads = $user->ads('search');
/* assign variables */
$smarty->assign('ads', $ads);
// get widgets
$widgets = $user->widgets('search');
/* assign variables */
$smarty->assign('widgets', $widgets);
} catch (Exception $e) {
_error(__("Error"), $e->getMessage());
}
// page header
page_header(__("Search") . ' | ' . __($system['system_title']));
// page footer
page_footer('search');