don't do an empty query

This commit is contained in:
Friendika 2011-04-30 17:28:57 -07:00
parent e00068334f
commit 0db25abcef

View file

@ -379,18 +379,23 @@ function facebook_post_hook(&$a,&$b) {
$deny = array_unique(array_merge($deny_people,$deny_groups)); $deny = array_unique(array_merge($deny_people,$deny_groups));
$allow_str = dbesc(implode(', ',$recipients)); $allow_str = dbesc(implode(', ',$recipients));
$r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'"); if($allow_str) {
$allow_arr = array(); $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'");
if(count($r)) $allow_arr = array();
foreach($r as $rr) if(count($r))
$allow_arr[] = $rr['notify']; foreach($r as $rr)
$allow_arr[] = $rr['notify'];
}
$deny_str = dbesc(implode(', ',$deny)); $deny_str = dbesc(implode(', ',$deny));
$r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'"); if($deny_str) {
$deny_arr = array(); $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'");
if(count($r)) $deny_arr = array();
foreach($r as $rr) if(count($r))
$deny_arr[] = $rr['notify']; foreach($r as $rr)
$deny_arr[] = $rr['notify'];
}
if(count($deny_arr) && (! count($allow_arr))) { if(count($deny_arr) && (! count($allow_arr))) {
// One or more FB folks were denied access but nobody on FB was specifically allowed access. // One or more FB folks were denied access but nobody on FB was specifically allowed access.