4 function search_post(&$a) {
6 $a->data['search'] = $_POST['search'];
10 function search_content(&$a) {
12 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
13 notice( t('Public access denied.') . EOL);
17 require_once("include/bbcode.php");
18 require_once('include/security.php');
19 require_once('include/conversation.php');
21 if(x($_SESSION,'theme'))
22 unset($_SESSION['theme']);
24 $o = '<div id="live-search"></div>' . "\r\n";
26 $o .= '<h3>' . t('Search') . '</h3>';
28 if(x($a->data,'search'))
29 $search = notags(trim($a->data['search']));
31 $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
33 $o .= search($search);
40 AND `item`.`allow_cid` = ''
41 AND `item`.`allow_gid` = ''
42 AND `item`.`deny_cid` = ''
43 AND `item`.`deny_gid` = ''
46 $s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )";
47 $s_regx = "AND `item`.`body` REGEXP '%s' ";
49 if(mb_strlen($search) >= 3)
50 $search_alg = $s_bool;
52 $search_alg = $s_regx;
54 $r = q("SELECT COUNT(*) AS `total`
55 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
56 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
57 AND ( `wall` = 1 OR `contact`.`uid` = %d )
58 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
66 $a->set_pager_total($r[0]['total']);
68 if(! $r[0]['total']) {
69 notice( t('No results.') . EOL);
73 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
74 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
75 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
76 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
78 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
79 LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
80 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
81 AND ( `wall` = 1 OR `contact`.`uid` = %d )
82 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
85 ORDER BY `parent` DESC ",
92 $o .= conversation($a,$r,'search',false);