intval($uid),
dbesc($name)
);
- if(count($r))
+ if (dbm::is_result($r))
$group_id = $r[0]['id'];
if(! $group_id)
return false;
$r = q("SELECT def_gid, allow_gid, deny_gid FROM user WHERE uid = %d LIMIT 1",
intval($uid)
);
- if($r) {
+ if ($r) {
$user_info = $r[0];
$change = false;
intval($uid),
dbesc($name)
);
- if(count($r))
+ if (dbm::is_result($r))
return $r[0]['id'];
return false;
}
intval($gid),
intval($member)
);
- if(count($r))
+ if (dbm::is_result($r))
return true; // You might question this, but
// we indicate success because the group member was in fact created
// -- It was just created at another time
- if(! count($r))
+ if (! dbm::is_result($r)) {
$r = q("INSERT INTO `group_member` (`uid`, `gid`, `contact-id`)
VALUES( %d, %d, %d ) ",
intval($uid),
intval($gid),
intval($member)
- );
+ );
+ }
return $r;
}
intval($gid),
intval(local_user())
);
- if(count($r))
+ if (dbm::is_result($r))
$ret = $r;
}
return $ret;
intval(local_user()),
dbesc(NETWORK_OSTATUS)
);
- if(count($r))
+ if (dbm::is_result($r))
$ret = count($r);
}
return $ret;
intval($uid)
);
$grps[] = array('name' => '', 'id' => '0', 'selected' => '');
- if(count($r)) {
- foreach($r as $rr) {
+ if (dbm::is_result($r)) {
+ foreach ($r as $rr) {
$grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : ''));
}
$o = '';
- if(! local_user())
+ if (! local_user())
return '';
$groups = array();
$member_of = groups_containing(local_user(),$cid);
}
- if(count($r)) {
- foreach($r as $rr) {
+ if (dbm::is_result($r)) {
+ foreach ($r as $rr) {
$selected = (($group_id == $rr['id']) ? ' group-selected' : '');
if ($editmode == "full") {
$ret = array();
- if(count($r))
+ if (dbm::is_result($r))
foreach($r as $rr)
$ret[] = $rr['contact-id'];
if($check_dead AND !$use_gcontact) {
);
$ret = array();
- if(count($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr)
$ret[] = $rr['gid'];
}
function groups_count_unseen() {
$r = q("SELECT `group`.`id`, `group`.`name`,
- (SELECT COUNT(*) FROM `item`
+ (SELECT COUNT(*) FROM `item` FORCE INDEX (`uid_unseen_contactid`)
WHERE `uid` = %d AND `unseen` AND
`contact-id` IN (SELECT `contact-id` FROM `group_member`
WHERE `group_member`.`gid` = `group`.`id` AND `group_member`.`uid` = %d)) AS `count`