if(! $search)
return $o;
-
- $sql_extra = "
- AND `item`.`allow_cid` = ''
- AND `item`.`allow_gid` = ''
- AND `item`.`deny_cid` = ''
- AND `item`.`deny_gid` = ''
- ";
+ // Here is the way permissions work in the search module...
+ // Only public wall posts can be shown
+ // OR your own posts if you are a logged in member
$s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )";
$s_regx = "AND `item`.`body` REGEXP '%s' ";
$search_alg = $s_regx;
$r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND ( `wall` = 1 OR `contact`.`uid` = %d )
+ AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0)
+ OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $search_alg
- $sql_extra ",
+ $search_alg ",
intval(local_user()),
dbesc($search)
);
$a->set_pager_total($r[0]['total']);
if(! $r[0]['total']) {
- notice( t('No results.') . EOL);
+ info( t('No results.') . EOL);
return $o;
}
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
`user`.`nickname`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
+ LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND ( `wall` = 1 OR `contact`.`uid` = %d )
+ AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0 )
+ OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$search_alg
- $sql_extra
- ORDER BY `parent` DESC ",
+ ORDER BY `received` DESC LIMIT %d , %d ",
intval(local_user()),
- dbesc($search)
+ dbesc($search),
+ intval($a->pager['start']),
+ intval($a->pager['itemspage'])
+
);
$o .= conversation($a,$r,'search',false);
$o .= paginate($a);
+ $o .= cc_license();
return $o;
}