4 function search_post(&$a) {
6 $a->data['search'] = $_POST['search'];
10 function search_content(&$a) {
12 if(x($_SESSION,'theme'))
13 unset($_SESSION['theme']);
15 $o = '<div id="live-search"></div>' . "\r\n";
17 $o .= '<h3>' . t('Search') . '</h3>';
19 if(x($a->data,'search'))
20 $search = notags(trim($a->data['search']));
22 $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
24 $o .= search($search);
29 require_once("include/bbcode.php");
30 require_once('include/security.php');
33 AND `item`.`allow_cid` = ''
34 AND `item`.`allow_gid` = ''
35 AND `item`.`deny_cid` = ''
36 AND `item`.`deny_gid` = ''
39 $s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )";
40 $s_regx = "AND `item`.`body` REGEXP '%s' ";
42 if(mb_strlen($search) >= 3)
43 $search_alg = $s_bool;
45 $search_alg = $s_regx;
47 $r = q("SELECT COUNT(*) AS `total`
48 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
49 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
50 AND ( `wall` = 1 OR `contact`.`uid` = %d )
51 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
59 $a->set_pager_total($r[0]['total']);
61 if(! $r[0]['total']) {
62 notice( t('No results.') . EOL);
66 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
67 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
68 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
69 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
71 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
72 LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
73 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
74 AND ( `wall` = 1 OR `contact`.`uid` = %d )
75 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
78 ORDER BY `parent` DESC ",
84 require_once('include/conversation.php');
86 $o .= conversation($a,$r,'search',false);