4 function search_post(&$a) {
6 $a->data['search'] = $_POST['search'];
10 function search_content(&$a) {
12 require_once("include/bbcode.php");
13 require_once('include/security.php');
14 require_once('include/conversation.php');
16 if(x($_SESSION,'theme'))
17 unset($_SESSION['theme']);
19 $o = '<div id="live-search"></div>' . "\r\n";
21 $o .= '<h3>' . t('Search') . '</h3>';
23 if(x($a->data,'search'))
24 $search = notags(trim($a->data['search']));
26 $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
28 $o .= search($search);
35 AND `item`.`allow_cid` = ''
36 AND `item`.`allow_gid` = ''
37 AND `item`.`deny_cid` = ''
38 AND `item`.`deny_gid` = ''
41 $s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )";
42 $s_regx = "AND `item`.`body` REGEXP '%s' ";
44 if(mb_strlen($search) >= 3)
45 $search_alg = $s_bool;
47 $search_alg = $s_regx;
49 $r = q("SELECT COUNT(*) AS `total`
50 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
51 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
52 AND ( `wall` = 1 OR `contact`.`uid` = %d )
53 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
61 $a->set_pager_total($r[0]['total']);
63 if(! $r[0]['total']) {
64 notice( t('No results.') . EOL);
68 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
69 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
70 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
71 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
73 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
74 LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
75 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
76 AND ( `wall` = 1 OR `contact`.`uid` = %d )
77 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
80 ORDER BY `parent` DESC ",
87 $o .= conversation($a,$r,'search',false);