Only show contacts from open networks
This commit is contained in:
parent
011f5b9cae
commit
16e4e61cc5
1 changed files with 27 additions and 15 deletions
40
mod/poco.php
40
mod/poco.php
|
@ -12,7 +12,7 @@ function poco_init(&$a) {
|
||||||
$user = notags(trim($a->argv[1]));
|
$user = notags(trim($a->argv[1]));
|
||||||
}
|
}
|
||||||
if(! x($user)) {
|
if(! x($user)) {
|
||||||
$c = q("select * from pconfig where cat = 'system' and k = 'suggestme' and v = 1");
|
$c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
|
||||||
if(! count($c))
|
if(! count($c))
|
||||||
http_status_exit(401);
|
http_status_exit(401);
|
||||||
$system_mode = true;
|
$system_mode = true;
|
||||||
|
@ -44,21 +44,28 @@ function poco_init(&$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($justme)
|
if($justme)
|
||||||
$sql_extra = " and `contact`.`self` = 1 ";
|
$sql_extra = " AND `contact`.`self` = 1 ";
|
||||||
else
|
else
|
||||||
$sql_extra = " and `contact`.`self` = 0 ";
|
$sql_extra = " AND `contact`.`self` = 0 ";
|
||||||
|
|
||||||
if($cid)
|
if($cid)
|
||||||
$sql_extra = sprintf(" and `contact`.`id` = %d ",intval($cid));
|
$sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));
|
||||||
|
|
||||||
if($system_mode) {
|
if($system_mode) {
|
||||||
$r = q("SELECT count(*) as `total` from `contact` where self = 1
|
$r = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '')
|
||||||
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) ");
|
AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) ",
|
||||||
|
dbesc(NETWORK_DFRN),
|
||||||
|
dbesc(NETWORK_DIASPORA),
|
||||||
|
dbesc(NETWORK_OSTATUS)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$r = q("SELECT count(*) as `total` from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0 and archive = 0
|
$r = q("SELECT count(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
||||||
$sql_extra ",
|
AND `network` IN ('%s', '%s', '%s', '') $sql_extra",
|
||||||
intval($user['uid'])
|
intval($user['uid']),
|
||||||
|
dbesc(NETWORK_DFRN),
|
||||||
|
dbesc(NETWORK_DIASPORA),
|
||||||
|
dbesc(NETWORK_OSTATUS)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(count($r))
|
if(count($r))
|
||||||
|
@ -73,17 +80,22 @@ function poco_init(&$a) {
|
||||||
|
|
||||||
|
|
||||||
if($system_mode) {
|
if($system_mode) {
|
||||||
$r = q("SELECT * from contact where self = 1
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `network` IN ('%s', '%s', '%s', '')
|
||||||
and uid in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = 1) limit %d, %d ",
|
AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d",
|
||||||
|
dbesc(NETWORK_DFRN),
|
||||||
|
dbesc(NETWORK_DIASPORA),
|
||||||
|
dbesc(NETWORK_OSTATUS),
|
||||||
intval($startIndex),
|
intval($startIndex),
|
||||||
intval($itemsPerPage)
|
intval($itemsPerPage)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
|
||||||
$r = q("SELECT * from `contact` where `uid` = %d and blocked = 0 and pending = 0 and hidden = 0 and archive = 0
|
AND `network` IN ('%s', '%s', '%s', '') $sql_extra LIMIT %d, %d",
|
||||||
$sql_extra LIMIT %d, %d",
|
|
||||||
intval($user['uid']),
|
intval($user['uid']),
|
||||||
|
dbesc(NETWORK_DFRN),
|
||||||
|
dbesc(NETWORK_DIASPORA),
|
||||||
|
dbesc(NETWORK_OSTATUS),
|
||||||
intval($startIndex),
|
intval($startIndex),
|
||||||
intval($itemsPerPage)
|
intval($itemsPerPage)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue