aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-07-03 05:00:11 -0700
committerFriendika <info@friendika.com>2011-07-03 05:00:11 -0700
commit3538dc15cc98cc8bba378357e6802ef48b378e0e (patch)
tree4e7311a9d7ff2496d7c796b4b996f25e73bf1da4
parent34df1538f33c2d7b4e1e24e47735c7168c586b97 (diff)
downloadvolse-hubzilla-3538dc15cc98cc8bba378357e6802ef48b378e0e.tar.gz
volse-hubzilla-3538dc15cc98cc8bba378357e6802ef48b378e0e.tar.bz2
volse-hubzilla-3538dc15cc98cc8bba378357e6802ef48b378e0e.zip
improved search - ensure you can see all your own content (logged in members). Visitors can only see public wall posts.
-rw-r--r--mod/search.php20
1 files changed, 8 insertions, 12 deletions
diff --git a/mod/search.php b/mod/search.php
index 9c82b38e8..bb33fb11d 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -35,13 +35,9 @@ function search_content(&$a) {
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' ";
@@ -54,10 +50,10 @@ function search_content(&$a) {
$r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
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` = '' )
+ OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $search_alg
- $sql_extra ",
+ $search_alg ",
intval(local_user()),
dbesc($search)
);
@@ -78,10 +74,10 @@ function search_content(&$a) {
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` = '' )
+ OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$search_alg
- $sql_extra
ORDER BY `parent` DESC ",
intval(local_user()),
dbesc($search)