$r = q("select uid from contact where id = %d limit 1",
intval($id)
);
- if((! count($r)) || (! intval($r[0]['uid'])))
+ if((! dbm::is_result($r)) || (! intval($r[0]['uid'])))
return;
$archive = get_pconfig($r[0]['uid'], 'system','archive_removed_contacts');
FROM `gcontact` WHERE `nurl` = '%s'",
dbesc(normalise_link($url)));
- if ($r) {
+ if (dbm::is_result($r)) {
// If there is more than one entry we filter out the connector networks
if (count($r) > 1) {
foreach ($r AS $id => $result) {
ORDER BY rand() LIMIT 1",
dbesc(NETWORK_DFRN));
- if(count($r))
+ if(dbm::is_result($r))
return dirname($r[0]['url']);
return '';
}
$a = get_app();
$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
- if (count($r)) {
+ if (dbm::is_result($r)) {
foreach ($r as $rr) {
$k = $rr['k'];
if ($family === 'config') {
dbesc($family),
intval($uid)
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
foreach ($r as $rr) {
$k = $rr['k'];
$a->config[$uid][$family][$k] = $rr['v'];
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
- if(count($x) && count($r)) {
+ if(dbm::is_result($x) && dbm::is_result($r)) {
$mailbox = construct_mailbox_name($r[0]);
$password = '';
openssl_private_decrypt(hex2bin($r[0]['pass']), $password,$x[0]['prvkey']);
call_hooks($a->module . '_pre_' . $selname, $arr);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" ";
call_hooks($a->module . '_pre_' . $selname, $arr);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" ";
$receiverlist = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" ";
$r = q("SELECT `pubmail` FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$mail_enabled = true;
if(intval($r[0]['pubmail']))
$pubmail_enabled = true;
$r = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $g){
$contacts[] = array(
"type" => "c",
dbesc($search),
implode("','", $known_contacts)
);
- if (is_array($r) && count($r)){
+ if (dbm::is_result($r)){
foreach($r as $row) {
// nickname..
$up = parse_url($row['author-link']);
dbesc(trim($user)),
dbesc($encrypted)
);
- if(count($r))
+ if(dbm::is_result($r))
$record = $r[0];
}
if (isset($_GET["q"])) {
$r = q("SELECT id FROM `contact` WHERE `uid` = 0 AND `name` = '%s'", dbesc($_GET["q"]));
- if (!count($r))
+ if (!dbm::is_result($r))
$r = q("SELECT `id` FROM `contact` WHERE `uid` = 0 AND `nick` = '%s'", dbesc($_GET["q"]));
- if (count($r)) {
+ if (dbm::is_result($r)) {
$k = 0;
foreach ($r AS $user) {
$user_info = api_get_user($a, $user["id"], "json");
intval(api_user())
);
- if ((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ if ((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
throw new BadRequestException("Unknown contact");
$cid = $r[0]['id'];
intval($uid),
intval($gid));
// error message if specified gid is not in database
- if (count($r) == 0)
+ if (!dbm::is_result($r))
throw new BadRequestException("gid not available");
}
else
intval($uid),
intval($gid));
// error message if specified gid is not in database
- if (count($r) == 0)
+ if (!dbm::is_result($r))
throw new BadRequestException('gid not available');
// get data of the specified group id and group name
$profile_url = $user_info["url"];
// message if nothing was found
- if (count($r) == 0)
+ if (!dbm::is_result($r))
+ $success = array('success' => false, 'search_results' => 'problem with query');
+ else if (count($r) == 0)
$success = array('success' => false, 'search_results' => 'nothing found');
else {
$ret = Array();
intval(api_user()),
intval($profileid));
// error message if specified gid is not in database
- if (count($r) == 0)
+ if (!dbm::is_result($r))
throw new BadRequestException("profile_id not available");
}
else
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($_SESSION['visitor_id'])
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
$a->contact = $r[0];
}
}
intval($_SESSION['uid'])
);
- if (!count($r)) {
+ if (!dbm::is_result($r)) {
nuke_session();
goaway(z_root());
}
dbesc(trim($_POST['username'])),
dbesc($encrypted)
);
- if (count($r))
+ if (dbm::is_result($r))
$record = $r[0];
}
$r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d",
intval($_SESSION['uid']));
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$selected = (($rr['id'] == $current) ? " selected=\"selected\" " : "");
$o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
);
$nets = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
require_once('include/contact_selectors.php');
foreach($r as $rr) {
if($rr['network'])
dbesc(normalise_link(get_my_url())),
intval($profile_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$cid = $r[0]['id'];
else {
$r = q("select id from gcontact where nurl = '%s' limit 1",
dbesc(normalise_link(get_my_url()))
);
- if(count($r))
+ if(dbm::is_result($r))
$zcid = $r[0]['id'];
}
}
$r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
dbesc($item['parent-uri']));
- if(count($r)==0) return;
+ if(!dbm::is_result($r)) return;
$obj=$r[0];
$author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
dbesc($item['parent-uri']));
- if(count($r)==0) return;
+ if(!dbm::is_result($r)) return;
$obj=$r[0];
$author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
dbesc($obj->id),
intval($item['uid'])
);
- if(count($r) && $r[0]['plink']) {
+ if(dbm::is_result($r) && $r[0]['plink']) {
$target = $r[0];
$Bname = $target['author-name'];
$Blink = $target['author-link'];
// In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']);
dbesc($item_id),
dbesc($contact_id)
);
- if (!count($r)) {
+ if (!dbm::is_result($r)) {
continue;
}
intval($item_id)
);
- if ((!count($r)) || (!intval($r[0]['parent']))) {
+ if ((!dbm::is_result($r)) || (!intval($r[0]['parent']))) {
continue;
}
intval($uid)
);
- if (!count($r))
+ if (!dbm::is_result($r))
continue;
$owner = $r[0];
intval($contact_id)
);
- if (count($r))
+ if (dbm::is_result($r))
$contact = $r[0];
if ($contact['self'])
intval($argv[2]),
intval($uid)
);
- if (count($r))
+ if (dbm::is_result($r))
$it = $r[0];
}
if (!$it)
dbesc($it['parent-uri']),
intval($uid));
- if (count($r) AND ($r[0]['title'] != ''))
+ if (dbm::is_result($r) AND ($r[0]['title'] != ''))
$subject = $r[0]['title'];
else {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($it['parent-uri']),
intval($uid));
- if (count($r) AND ($r[0]['title'] != ''))
+ if (dbm::is_result($r) AND ($r[0]['title'] != ''))
$subject = $r[0]['title'];
}
}
dbesc($owner_nick)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$owner = $r[0];
intval($owner_id)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$contact = $r[0];
dbesc(normalise_link($suggest["url"])),
intval($suggest["uid"])
);
- if(count($r))
+ if(dbm::is_result($r))
return false;
// Do we already have an fcontact record for this person?
dbesc($suggest["name"]),
dbesc($suggest["request"])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$fid = $r[0]["id"];
// OK, we do. Do we already have an introduction for this person ?
intval($suggest["uid"]),
intval($fid)
);
- if(count($r))
+ if(dbm::is_result($r))
return false;
}
if(!$fid)
dbesc($suggest["name"]),
dbesc($suggest["request"])
);
- if(count($r))
+ if(dbm::is_result($r))
$fid = $r[0]["id"];
else
// database record did not get created. Quietly give up.
LIMIT 1",
dbesc($item["parent-uri"])
);
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
$r = q("SELECT `item`.`forum_mode`, `item`.`wall` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' OR `item`.`thr-parent` = '%s')
dbesc($r[0]["parent-uri"]),
intval($importer["importer_uid"])
);
- if($r && count($r))
+ if(dbm::is_result($r))
$is_a_remote_action = true;
}
dbesc($item["verb"]),
dbesc($item["parent-uri"])
);
- if($r && count($r))
+ if(dbm::is_result($r))
return false;
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1",
dbesc($item["verb"]),
dbesc($item["parent-uri"])
);
- if($r && count($r))
+ if(dbm::is_result($r))
return false;
} else
$is_like = false;
intval($importer["importer_uid"])
);
- if(!count($r))
+ if(!dbm::is_result($r))
return false;
// extract tag, if not duplicate, add to parent item
dbesc($item["uri"]),
intval($importer["uid"])
);
- if(count($r))
+ if(dbm::is_result($r))
$ev["id"] = $r[0]["id"];
$event_id = event_store($ev);
}
// Update content if 'updated' changes
- if(count($r)) {
+ if(dbm::is_result($r)) {
if (self::update_content($r[0], $item, $importer, $entrytype))
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
else
intval($posted_id),
intval($importer["importer_uid"])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$parent = $r[0]["parent"];
$parent_uri = $r[0]["parent-uri"];
}
intval($importer["uid"]),
intval($importer["id"])
);
- if(!count($r)) {
+ if(!dbm::is_result($r)) {
logger("Item with uri ".$uri." from contact ".$importer["id"]." for user ".$importer["uid"]." wasn't found.", LOGGER_DEBUG);
return;
} else {
dbesc($item["parent-uri"]),
intval($importer["uid"])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]["id"])
);
$hash = random_string();
$r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash));
- if (count($r))
+ if (dbm::is_result($r))
$dups = true;
} while($dups == true);
intval($item[0]['contact-id']),
intval($uid)
);
- $send_notification = count($r);
+ $send_notification = dbm::is_result($r);
if (!$send_notification) {
$tags = q("SELECT `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` = %d AND `uid` = %d",
foreach ($tags AS $tag) {
$r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `notify_new_posts`",
normalise_link($tag["url"]), intval($uid));
- if (count($r))
+ if (dbm::is_result($r))
$send_notification = true;
}
}
intval($arr['id']),
intval($arr['uid'])
);
- if((! count($r)) || ($r[0]['edited'] === $arr['edited'])) {
+ if((! dbm::is_result($r)) || ($r[0]['edited'] === $arr['edited'])) {
// Nothing has changed. Grab the item id to return.
intval($arr['id']),
intval($arr['uid'])
);
- return((count($r)) ? $r[0]['id'] : 0);
+ return((dbm::is_result($r)) ? $r[0]['id'] : 0);
}
// The event changed. Update it.
intval($arr['id']),
intval($arr['uid'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
$object .= '</object>' . "\n";
dbesc($arr['uri']),
intval($arr['uid'])
);
- if(count($r))
+ if(dbm::is_result($r))
$event = $r[0];
$item_arr = array();
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($arr['uid'])
);
- //if(count($r))
+ //if(dbm::is_result($r))
// $plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id;
intval($event_params["event_id"])
);
- if(count($r))
+ if(dbm::is_result($r))
return $r;
}
dbesc($event_params["adjust_finish"])
);
- if(count($r))
+ if(dbm::is_result($r))
return $r;
}
);
}
- if(count($r))
+ if(dbm::is_result($r))
return $r;
}
// we are allowed to show events
// get the timezone the user is in
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
- if (count($r))
+ if (dbm::is_result($r))
$timezone = $r[0]['timezone'];
// get all events which are owned by a uid (respects permissions);
logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
item_expire($rr['uid'],$rr['expire']);
dbesc($nurl)
);
- if(count($r))
+ if(dbm::is_result($r))
return $r[0]['id'];
$r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
dbesc($photo)
);
- if($r) {
+ if(dbm::is_result($r)) {
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
dbesc($nurl)
);
- if(count($r))
+ if(dbm::is_result($r))
return $r[0]['id'];
}
dbesc($ret['network'])
);
- if(!count($r))
+ if(!dbm::is_result($r))
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` = '%s' LIMIT 1",
intval($uid), dbesc(normalise_link($url)), dbesc($ret['network'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
// update contact
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
intval($uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$total_contacts = $r[0]['total'];
if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
intval($uid),
dbesc($network)
);
- if(count($r))
+ if(dbm::is_result($r))
$total_network = $r[0]['total'];
if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
intval($uid)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$result['message'] .= t('Unable to retrieve contact information.') . EOL;
return $result;
}
intval($uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
if(($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
require_once('include/salmon.php');
slapper($r[0],$contact['notify'],$slap);
intval($uid),
dbesc($name)
);
- if(count($r))
+ if(dbm::is_result($r))
$group_id = $r[0]['id'];
if(! $group_id)
return 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(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)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : ''));
}
$member_of = groups_containing(local_user(),$cid);
}
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$selected = (($group_id == $rr['id']) ? ' group-selected' : '');
$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'];
}
$r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($visitor['cid'])
);
- if(count($r))
+ if(dbm::is_result($r))
$profile = $r[0]['profile-id'];
break;
}
intval($profile_int)
);
}
- if((!$r) && (!count($r))) {
+ if(!dbm::is_result($r)) {
$r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*,
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
FROM `profile`
$r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'",
local_user(), $profile_url);
- if (count($r))
+ if (dbm::is_result($r))
$connect = false;
}
'entries' => array(),
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$profile['menu']['entries'][] = array(
if(is_array($a->profile) AND !$a->profile['hide-friends']) {
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
intval($a->profile['uid']));
- if(count($r))
+ if(dbm::is_result($r))
$updated = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `hidden` AND NOT `archive`
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
- if(count($r))
+ if(dbm::is_result($r))
$contacts = intval($r[0]['total']);
}
}
dbesc(datetime_convert('UTC','UTC','now'))
);
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
$total = 0;
$now = strtotime('now');
$cids = array();
dbesc(datetime_convert('UTC','UTC','now - 1 days'))
);
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
$now = strtotime('now');
$istoday = false;
foreach($r as $rr) {
/* check for create date and expire time */
$uid = intval($arr['uid']);
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
- if (count($r)) {
+ if (dbm::is_result($r)) {
$expire_interval = $r[0]['expire'];
if ($expire_interval>0) {
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
intval($arr['uid'])
);
- if (!count($r))
+ if (!dbm::is_result($r))
$r = q("SELECT `network` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND `nurl` = '%s' LIMIT 1",
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS),
dbesc(normalise_link($arr['author-link']))
);
- if (!count($r))
+ if (!dbm::is_result($r))
$r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($arr['contact-id']),
intval($arr['uid'])
);
- if (count($r))
+ if (dbm::is_result($r))
$arr['network'] = $r[0]["network"];
// Fallback to friendica (why is it empty in some cases?)
$r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1",
dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid']));
- if (count($r)) {
+ if (dbm::is_result($r)) {
logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG);
return 0;
}
intval($arr['uid'])
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
// is the new message multi-level threaded?
// even though we don't support it now, preserve the info
function get_item_guid($id) {
$r = q("SELECT `guid` FROM `item` WHERE `id` = %d LIMIT 1", intval($id));
- if (count($r))
+ if (dbm::is_result($r))
return($r[0]["guid"]);
else
return("");
$r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `item`.`guid` = '%s' AND `item`.`uid` = %d", dbesc($guid), intval($uid));
- if (count($r)) {
+ if (dbm::is_result($r)) {
$id = $r[0]["id"];
$nick = $r[0]["nickname"];
}
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
AND `item`.`private` = 0 AND `item`.`wall` = 1
AND `item`.`guid` = '%s'", dbesc($guid));
- if (count($r)) {
+ if (dbm::is_result($r)) {
$id = $r[0]["id"];
$nick = $r[0]["nickname"];
}
if ($contact['remote_self'] == 2) {
$r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`",
intval($contact['uid']));
- if (count($r)) {
+ if (dbm::is_result($r)) {
$datarray['contact-id'] = $r[0]["id"];
$datarray['owner-name'] = $r[0]["name"];
intval($importer['uid']),
dbesc($url)
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
$contact_record = $r[0];
update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
}
intval($importer['uid'])
);
$a = get_app();
- if (count($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
+ if (dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
// create notification
$hash = random_string();
));
}
- } elseif (count($r) AND in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
+ } elseif (dbm::is_result($r) AND in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
$r = q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
intval($importer['uid']),
dbesc($url)
// through the direct Diaspora protocol. If we try and use
// the feed, we'll get duplicates. So don't.
- if ((! count($r)) || $contact['network'] === NETWORK_DIASPORA)
+ if ((! dbm::is_result($r)) || $contact['network'] === NETWORK_DIASPORA)
return;
$push_url = get_config('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
intval($days)
);
- if (! count($r))
+ if (! dbm::is_result($r))
return;
$expire_items = get_pconfig($uid, 'expire','items');
intval($id)
);
- if (! count($r)) {
+ if (! dbm::is_result($r)) {
if (! $interactive)
return 0;
notice( t('Item not found.') . EOL);
dbesc($item['parent-uri']),
intval($item['uid'])
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]['id'])
);
intval($uid),
intval($wall ? 1 : 0)
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
// logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA);
return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10);
}
dbesc($item_id)
);
- if(! $item_id || (! count($r))) {
+ if(! $item_id || (! dbm::is_result($r))) {
logger('like: no item ' . $item_id);
return false;
}
intval($item['contact-id']),
intval($item['uid'])
);
- if(! count($r))
+ if(! dbm::is_result($r))
return false;
if(! $r[0]['self'])
$remote_owner = $r[0];
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
intval($owner_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$owner = $r[0];
if(! $owner) {
intval($_SESSION['visitor_id']),
intval($owner_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$contact = $r[0];
}
if(! $contact) {
dbesc($item_id), dbesc($item_id), dbesc($item['uri'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$like_item = $r[0];
// Already voted, undo it
dbesc($fn_name)
);
- if((count($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
+ if((dbm::is_result($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'",
dbesc(datetime_convert()),
dbesc($fn_name)
);
$got_lock = true;
}
- elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
+ elseif(! dbm::is_result($r)) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
dbesc($fn_name),
dbesc(datetime_convert())
dbesc($fn_name)
);
- if(count($r) && $r[0]['locked'])
+ if(dbm::is_result($r) && $r[0]['locked'])
sleep($wait_sec);
- } while(count($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
+ } while(dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
return;
}}
dbesc($replyto),
dbesc($replyto)
);
- if(count($r))
+ if(dbm::is_result($r))
$convid = $r[0]['convid'];
}
dbesc($conv_guid),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$convid = $r[0]['id'];
}
dbesc($uri),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$post_id = $r[0]['id'];
/**
dbesc($conv_guid),
intval($recipient['uid'])
);
- if(count($r))
+ if(dbm::is_result($r))
$convid = $r[0]['id'];
if(! $convid) {
// user info
$r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
$userinfo = array(
- 'icon' => (count($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'),
+ 'icon' => (dbm::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg'),
'name' => $a->user['username'],
);
} else {
intval($item_id)
);
- if((! count($r)) || (! intval($r[0]['parent']))) {
+ if((! dbm::is_result($r)) || (! intval($r[0]['parent']))) {
return;
}
intval($uid)
);
- if(! count($r))
+ if(! dbm::is_result($r))
return;
$owner = $r[0];
intval($uid),
dbesc(NETWORK_DFRN)
);
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$recipients_followup[] = $rr['id'];
}
$r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra);
- if(count($r))
+ if(dbm::is_result($r))
$contacts = $r;
} else
intval($uid),
dbesc(NETWORK_MAIL)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
$recipients[] = $rr['id'];
}
// delivery loop
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $contact) {
if(!$contact['self']) {
$r = array_merge($r2,$r1,$r0);
- if(count($r)) {
+ if(dbm::is_result($r)) {
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
// throw everything into the queue in case we get killed
$r = q("SELECT client_id, pw, redirect_uri FROM clients WHERE client_id='%s'",
dbesc($consumer_key)
);
- if (count($r))
+ if (dbm::is_result($r))
return new OAuthConsumer($r[0]['client_id'],$r[0]['pw'],$r[0]['redirect_uri']);
return null;
}
dbesc($token_type),
dbesc($token)
);
- if (count($r)){
+ if (dbm::is_result($r)){
$ot=new OAuthToken($r[0]['id'],$r[0]['secret']);
$ot->scope=$r[0]['scope'];
$ot->expires = $r[0]['expires'];
dbesc($nonce),
intval($timestamp)
);
- if (count($r))
+ if (dbm::is_result($r))
return new OAuthToken($r[0]['id'],$r[0]['secret']);
return null;
}
$r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
intval($uid)
);
- if(count($r)){
+ if(dbm::is_result($r)){
$record = $r[0];
} else {
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
$r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
intval($_SESSION['uid']));
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->contact = $r[0];
$a->cid = $r[0]['id'];
$_SESSION['cid'] = $a->cid;
$r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'",
dbesc($oauth_token));
- if (count($r))
+ if (dbm::is_result($r))
return $r[0];
return null;
}
$r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
- if (count($r))
+ if (dbm::is_result($r))
return $r[0];
return null;
}
where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['id'])
);
- if (count($r))
+ if (dbm::is_result($r))
if (!$r[0]['total'])
poco_load($contact['id'],$importer_uid,0,$contact['poco']);
}
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($importer_uid)
);
- if(! count($r))
+ if(! dbm::is_result($r))
return;
$importer = $r[0];
dbesc($datarray['uri'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
// Only delete when mails aren't automatically moved or deleted
$r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1",
intval($importer_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
// $datarray['parent-uri'] = $r[0]['uri'];
}
dbesc(protect_sprintf($datarray['title'])),
intval($importer_uid),
dbesc(NETWORK_MAIL));
- if(count($r))
+ if(dbm::is_result($r))
$datarray['parent-uri'] = $r[0]['parent-uri'];
}
if(strlen($plugins)) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
- if(count($r))
+ if(dbm::is_result($r))
$installed = $r;
else
$installed = array();
dbesc($file),
dbesc($function)
);
- if(count($r))
+ if(dbm::is_result($r))
return true;
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
$a = get_app();
$a->hooks = array();
$r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks))
$a->hooks[$rr['hook']] = array();
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if($r !== false and count($r)) {
+ if(dbm::is_result($r)) {
$service_class = $r[0]['service_class'];
}
}
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if($r !== false and count($r)) {
+ if(dbm::is_result($r)) {
$service_class = $r[0]['service_class'];
}
}
WHERE `queue`.`cid` = %d AND `contact`.`self` = 0 ",
intval($cid)
);
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
if($batch && ($r[0]['total'] > $batch_queue)) {
logger('add_to_queue: too many queued items for batch server ' . $cid . ' - discarding message');
return;
dbesc($nurl)
);
- if((!$r) || (! count($r)) || $r[0]['id'] == remote_user())
+ if((! dbm::is_result($r)) || $r[0]['id'] == remote_user())
return;
dbesc($baseurl)
);
- if(! ($r && count($r)))
+ if(! dbm::is_result($r))
return;
$cid = $r[0]['id'];
$r = q("select * from user where uid = %d limit 1",
intval($_SESSION['submanage'])
);
- if(count($r))
+ if(dbm::is_result($r))
$master_record = $r[0];
}
dbesc($master_record['password']),
dbesc($master_record['email'])
);
- if($r && count($r))
+ if(dbm::is_result($r))
$a->identities = $r;
else
$a->identities = array();
and `manage`.`uid` = %d",
intval($master_record['uid'])
);
- if($r && count($r))
+ if(dbm::is_result($r))
$a->identities = array_merge($a->identities,$r);
if($login_initial)
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($_SESSION['uid']));
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->contact = $r[0];
$a->cid = $r[0]['id'];
$_SESSION['cid'] = $a->cid;
intval(PAGE_COMMUNITY)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$verified = 2;
return true;
}
intval($remote_user),
intval($owner_id)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$remote_verified = true;
$groups = init_groups_visitor($remote_user);
}
intval($remote_user),
intval($owner_id)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$remote_verified = true;
$groups = init_groups_visitor($remote_user);
}
WHERE `contact-id` = %d ",
intval($contact_id)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
$groups[] = $rr['gid'];
}
$r = q("select `poco`, `uid` from `contact` where `id` = %d limit 1",
intval($cid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$url = $r[0]['poco'];
$uid = $r[0]['uid'];
}
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
);
- if(count($r))
+ if(dbm::is_result($r))
$network = $r[0]["network"];
if (($network == "") OR ($network == NETWORK_OSTATUS)) {
$r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc($profile_url), dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$network = $r[0]["network"];
//$profile_url = $r[0]["url"];
}
intval($gcid),
intval($zcid)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
q("INSERT INTO `glink` (`cid`,`uid`,`gcid`,`zcid`, `updated`) VALUES (%d,%d,%d,%d, '%s') ",
intval($cid),
intval($uid),
);
// logger("count_common_friends: $uid $cid {$r[0]['total']}");
- if(count($r))
+ if(dbm::is_result($r))
return $r[0]['total'];
return 0;
intval($uid)
);
- if(count($r))
+ if(dbm::is_result($r))
return $r[0]['total'];
return 0;
intval($uid)
);
- if(count($r))
+ if(dbm::is_result($r))
return $r[0]['total'];
return 0;
intval($limit)
);
- if (count($r) && count($r) >= ($limit -1)) {
+ if (dbm::is_result($r) && count($r) >= ($limit -1)) {
// Uncommented because the result of the queries are to big to store it in the cache.
// We need to decide if we want to change the db column type or if we want to delete it.
// Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $r, CACHE_FIVE_MINUTES);
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done))
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($uri));
- if(count($r))
+ if(dbm::is_result($r))
$dups = true;
} while($dups == true);
return $uri;
$r = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1",
dbesc($resource)
);
- if(count($r))
+ if(dbm::is_result($r))
$found = true;
} while($found == true);
return $resource;
dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_DIASPORA)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$total = intval($r[0]['total']);
}
if(! $total) {
$r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)",
dbesc(implode(",", $contacts)));
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
$micropro = Array();
foreach($r as $rr) {
// intval($uid)
//);
- if(count($r)) {
+ if(dbm::is_result($r)) {
unset($deleted_tags[$key]);
}
else {
intval($item),
intval($uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
q("UPDATE `item` SET `file` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),
intval($item),
intval($uid)
);
- if(! count($r))
+ if(! dbm::is_result($r))
return false;
q("UPDATE `item` SET `file` = '%s' WHERE `id` = %d AND `uid` = %d",
//$r = q("select file from item where uid = %d and deleted = 0 " . file_tag_file_query('item',$file,(($cat) ? 'category' : 'file')),
//);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$saved = get_pconfig($uid,'system','filetags');
set_pconfig($uid,'system','filetags',str_replace($pattern,'',$saved));
// Is there a shadow parent?
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item['parent-uri']));
- if (!count($r))
+ if (!dbm::is_result($r))
return;
// Is there already a shadow entry?
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item['uri']));
- if (count($r))
+ if (dbm::is_result($r))
return;
// Preparing public shadow (removing user specific data)
dbesc($itemuri),
intval($item["uid"])
);
- if (!count($r)) {
+ if (!dbm::is_result($r)) {
$r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0",
dbesc($itemuri)
);
notice(t('Error! Cannot check nickname'));\r
return;\r
}\r
- if (count($r) > 0) {\r
+ if (dbm::is_result($r) > 0) {\r
notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));\r
return;\r
}\r
notice(t('Error! Cannot check nickname'));\r
return;\r
}\r
- if (count($r) > 0) {\r
+ if (dbm::is_result($r) > 0) {\r
notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));\r
return;\r
}\r
$r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
dbesc($email)
);
- if(count($r))
+ if(dbm::is_result($r))
$result['message'] .= t('Cannot use that email.') . EOL;
}
WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname)
);
- if(count($r))
+ if(dbm::is_result($r))
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
// Check deleted accounts that had this nickname. Doesn't matter to us,
WHERE `username` = '%s' LIMIT 1",
dbesc($nickname)
);
- if(count($r))
+ if(dbm::is_result($r))
$result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
if(strlen($result['message'])) {
dbesc($username),
dbesc($new_password_encoded)
);
- if($r !== false && count($r)) {
+ if(dbm::is_result($r)) {
$u = $r[0];
$newuid = intval($r[0]['uid']);
}
intval($newuid),
dbesc(t('Friends'))
);
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
$def_gid = $r[0]['id'];
q("UPDATE `user` SET `def_gid` = %d WHERE `uid` = %d",
$failed = array();
$r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' ");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$upd = intval(substr($rr['k'],7));
if($upd < 1139 || $rr['v'] === 'success')
$r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$o .= t('No friends to display.');
return $o;
}
AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'",
dbesc($token));
- if (!count($r))
+ if (!dbm::is_result($r))
return null;
return $r[0];
$r = q("SELECT * FROM `attach` WHERE `id` = %d LIMIT 1",
intval($item_id)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Item was not found.'). EOL);
return;
}
dbesc($item_id)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Permission denied.') . EOL);
return;
}
intval($contact_id),
intval($a->profile['profile_uid'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contact = $r[0];
$remote_contact = true;
}
$links = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
$r = sort_by_date($r);
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
$events=array();
// transform the event in a usable array
- if(count($r))
+ if(dbm::is_result($r))
$r = sort_by_date($r);
$events = process_events($r);
dbesc(normalise_link(get_my_url())),
intval($profile_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$cid = $r[0]['id'];
else {
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link(get_my_url()))
);
- if(count($r))
+ if(dbm::is_result($r))
$zcid = $r[0]['id'];
}
}
$r = common_friends_zcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
return $o;
}
AND `item`.`private` = 0 AND `item`.`wall` = 1"
);
- if(count($r))
+ if(dbm::is_result($r))
$a->set_pager_total($r[0]['total']);
if(! $r[0]['total']) {
$r = community_getitems($a->pager['start'], $a->pager['itemspage']);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
info( t('No results.') . EOL);
return $o;
}
intval($a->argv[2]),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$change = intval($a->argv[2]);
}
intval($a->argv[1]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
killme();
}
intval(local_user()),
intval($contact_id)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$contact_id = 0;
}
}
intval($profile_id),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Could not locate selected profile.') . EOL);
return;
}
intval($contact_id),
intval(local_user())
);
- if($r && count($r))
+ if($r && dbm::is_result($r))
$a->data['contact'] = $r[0];
return;
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid']));
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
$contacts = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$contacts[] = _contact_detail_for_template($rr);
}
);
$str = '';
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$str .= '<' . $rr['id'] . '>';
if(strlen($str))
intval($group),
intval($_SESSION['uid'])
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
if($update)
killme();
notice( t('No such group') . EOL );
AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
intval($cid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) ";
}
$parents_arr = array();
$parents_str = '';
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr))
$parents_arr[] = $rr['item_id'];
intval($item['uid']),
intval($item['id'])
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
$ignore = array(
'do' => t("ignore thread"),
'undo' => t("unignore thread"),
intval(local_user()),
intval($contact_id)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$contact_id = 0;
}
}
);
}
- if(! count($r))
+ if(! dbm::is_result($r))
return;
$contact = $r[0];
);
}
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Contact not found.') . EOL);
return;
}
$r = q("select `nickname` from user where uid = %d limit 1",
intval($id)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
intval(local_user()),
dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname']))
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
q("insert into manage ( uid, mid ) values ( %d , %d ) ",
intval($a->argv[2]),
intval(local_user())
dbesc($a->user['email']),
dbesc($a->user['password'])
);
- if(count($r))
+ if(dbm::is_result($r))
$full_managers = $r;
$delegates = array();
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$delegates = $r;
$uids = array();
dbesc(NETWORK_DFRN)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('No potential page delegates located.') . EOL);
return;
}
$nicknames = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
}
$r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )");
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
if(! in_array($rr['uid'],$uids))
$potentials[] = $rr;
intval($uid)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('Contact not found in DB.');
notice( t('Contact not found.') . EOL );
notice( t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL );
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id)
);
- if(count($r))
+ if(dbm::is_result($r))
$contact = $r[0];
else
$contact = null;
intval($uid)
);
- if((count($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
+ if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
require_once('include/items.php');
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($node));
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$message = sprintf(t('No user record found for \'%s\' '), $node);
xml_status(3,$message); // failure
// NOTREACHED
$r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1",
dbesc($decrypted_dfrn_id)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
xml_status(1,$message); // Birthday paradox - duplicate dfrn-id
// NOTREACHED
dbesc($dfrn_pubkey),
intval($dfrn_record)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$message = t('Unable to set your contact credentials on our system.');
xml_status(3,$message);
}
$r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($dfrn_record));
- if(count($r))
+ if(dbm::is_result($r))
$photo = $r[0]['photo'];
else
$photo = $a->get_baseurl() . '/images/person-175.jpg';
intval($dfrn_record)
);
- if(count($r))
+ if(dbm::is_result($r))
$combined = $r[0];
- if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
+ if((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
$mutual = ($new_relation == CONTACT_IS_FRIEND);
notification(array(
'type' => NOTIFY_CONFIRM,
intval($local_uid)
);
- if((count($r)) && ($r[0]['hide-friends'] == 0)) {
+ if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
require_once('include/items.php');
dbesc($dfrn_id),
dbesc($challenge)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
xml_status(3);
}
dbesc($a->argv[1])
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('dfrn_notify: contact not found for dfrn_id ' . $dfrn_id);
xml_status(3);
//NOTREACHED
dbesc($a->argv[1])
);
- if(! count($r))
+ if(! dbm::is_result($r))
$status = 1;
logger("Remote rino version: ".$rino_remote." for ".$r[0]["url"], LOGGER_DEBUG);
dbesc($a->argv[1])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
xml_status(3, 'No ticket');
// NOTREACHED
}
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
dbesc($dfrn_id));
- if(count($r)) {
+ if(dbm::is_result($r)) {
xml_status(1);
return; // NOTREACHED
}
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
xml_status(3, 'No ticket');
// NOTREACHED
}
dbesc($challenge)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$type = $r[0]['type'];
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1");
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$contact = $r[0];
$reputation = 0;
$text = '';
- if(count($r)) {
+ if(dbm::is_result($r)) {
$reputation = $r[0]['rating'];
$text = $r[0]['reason'];
dbesc($nickname)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$challenge = '';
$encrypted_id = '';
));
}
- $profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
+ $profile = ((dbm::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
switch($destination_url) {
case 'profile':
dbesc(normalise_link($dfrn_url))
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
if(strlen($r[0]['dfrn-id'])) {
/*
dbesc($dfrn_url),
$parms['key'] // this was already escaped
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$def_gid = get_default_group(local_user(), $r[0]["network"]);
if(intval($def_gid))
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
intval($uid)
);
- if(count($r) > $maxreq) {
+ if(dbm::is_result($r) > $maxreq) {
notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL);
notice( t('Spam protection measures have been invoked.') . EOL);
notice( t('Friends are advised to please try again in 24 hours.') . EOL);
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
dbesc(NETWORK_MAIL2)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d",
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
dbesc(NETWORK_MAIL2)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d",
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('This account has not been configured for email. Request failed.') . EOL);
return;
dbesc($poll),
intval($uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contact_id = $r[0]['id'];
$def_gid = get_default_group($uid, $r[0]["network"]);
$parms['url'],
$parms['issued-id']
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contact_record = $r[0];
update_contact_avatar($photo, $uid, $contact_record["id"], true);
}
$auto_confirm = false;
- if(count($r)) {
+ if(dbm::is_result($r)) {
if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
$auto_confirm = true;
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid'])
);
- if(! count($r))
+ if(! dbm::is_result($r))
$mail_disabled = 1;
}
$r = $db->q("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
- if(count($r))
+ if(dbm::is_result($r))
$a->set_pager_total($r[0]['total']);
$order = " ORDER BY `name` ASC ";
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit);
- if(count($r)) {
+ if(dbm::is_result($r)) {
if(in_array('small', $a->argv))
$photo = 'thumb';
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$mail_enabled = true;
if(intval($r[0]['pubmail']))
$pubmail_enabled = true;
$links = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
$r = sort_by_date($r);
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
$events=array();
// transform the event in a usable array
- if(count($r))
+ if(dbm::is_result($r))
$r = sort_by_date($r);
$events = process_events($r);
intval($event_id),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$orig_event = $r[0];
}
$visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0");
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$visible_plugins[] = $rr['name'];
}
$visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0");
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$visible_plugins[] = $rr['name'];
}
intval($contact_id),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Contact not found.') . EOL);
return;
}
intval($new_contact),
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
dbesc($hash),
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$fsuggest_id = $r[0]['id'];
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($note),
intval($contact_id),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Contact not found.') . EOL);
return;
}
intval($a->argv[1]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Group not found.') . EOL );
goaway($a->get_baseurl() . '/contacts');
return; // NOTREACHED
intval($a->argv[2]),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$result = group_rmv(local_user(),$r[0]['name']);
if($result)
info( t('Group removed.') . EOL);
intval($a->argv[2]),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$change = intval($a->argv[2]);
}
intval($a->argv[1]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Group not found.') . EOL );
goaway($a->get_baseurl() . '/contacts');
}
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
if(! in_array($member['id'],$preselected)) {
intval(local_user()),
intval($message_id)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
if(! intval($r[0]['ignored']))
if($db && $db->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`");
- if($r && count($r) && $r[0]['total']) {
+ if(dbm::is_result($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
return replace_macros($tpl, array(
'$title' => $install_title,
}
// if this isn't the real parent of the conversation, find it
- if($r !== false && count($r)) {
+ if(dbm::is_result($r)) {
$parid = $r[0]['parent'];
$parent_uri = $r[0]['uri'];
if($r[0]['id'] != $r[0]['parent']) {
}
}
- if(($r === false) || (! count($r))) {
+ if(! dbm::is_result($r)) {
notice( t('Unable to locate original post.') . EOL);
if(x($_REQUEST,'return'))
goaway($return_path);
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($thrparent[0]["author-link"])));
- if (count($r)) {
+ if (dbm::is_result($r)) {
$parent_contact = $r[0];
$parent_contact["thumb"] = $parent_contact["photo"];
$parent_contact["micro"] = $parent_contact["photo"];
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
- if(count($r) && intval($r[0]['pubmail']))
+ if(dbm::is_result($r) && intval($r[0]['pubmail']))
$pubmail_enabled = true;
}
}
intval($profile_uid)
);
- if(! count($r))
+ if(! dbm::is_result($r))
continue;
$r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
dbesc($type),
intval($item_id)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$item = $r[0];
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $allowed_groups))
);
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$l[] = '<b>' . $rr['name'] . '</b>';
}
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$allowed_users))
);
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$l[] = $rr['name'];
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $deny_groups))
);
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
}
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$deny_users))
);
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$l[] = '<strike>' . $rr['name'] . '</strike>';
dbesc($loginame)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('No valid account found.') . EOL);
goaway(z_root());
}
$r = q("SELECT * FROM `user` WHERE `pwdreset` = '%s' LIMIT 1",
dbesc($hash)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$o = t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.");
return $o;
}
$r = q("select * from user where uid = %d limit 1",
intval($_SESSION['submanage'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$uid = intval($r[0]['uid']);
$orig_record = $r[0];
}
);
}
- if(! count($r))
+ if(! dbm::is_result($r))
return;
unset($_SESSION['authenticated']);
$r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
);
- if(! count($r))
+ if(! dbm::is_result($r))
return;
if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
intval($a->argv[2]),
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$parent = $r[0]['parent-uri'];
$convid = $r[0]['convid'];
dbesc(base64_decode($a->argv[2]))
);
}
- if(count($r)) {
+ if(dbm::is_result($r)) {
$prename = $r[0]['name'];
$preurl = $r[0]['url'];
$preid = $r[0]['id'];
intval(local_user()),
intval($a->argv[1])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contact_id = $r[0]['contact-id'];
$convid = $r[0]['convid'];
dbesc($nick)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$lines = explode("\n",$r[0]['spubkey']);
intval($parent),
intval($uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$parent_uri = $r[0]['uri'];
$private = $r[0]['private'];
$allow_cid = $r[0]['allow_cid'];
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
dbesc($search)
);
- if(count($r))
+ if(dbm::is_result($r))
$total = $r[0]['total'];
$r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
);
$results = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
$results[] = array(
'name' => $rr['name'],
intval(local_user()),
dbesc($search)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
q("INSERT INTO `search` ( `uid`,`term` ) VALUES ( %d, '%s') ",
intval(local_user()),
dbesc($search)
$saved = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$saved[] = array(
'id' => $rr['id'],
);
$str = '';
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $rr)
$str .= '<' . $rr['id'] . '>';
if(strlen($str))
intval($group),
intval($_SESSION['uid'])
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
if($update)
killme();
notice( t('No such group') . EOL );
AND (NOT `blocked` OR `pending`) LIMIT 1",
intval($cid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
$entries[0] = array(
intval($_SESSION['uid'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
}
}
require_once('include/Contact.php');
$r = contacts_not_grouped(local_user());
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
}
$r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$contact_details = get_contact_details_by_url($rr['url'], local_user(), $rr);
if(is_array($a->profile) AND !$a->profile['hide-friends']) {
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
intval($a->profile['uid']));
- if(count($r))
+ if(dbm::is_result($r))
$json_info["updated"] = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
- if(count($r))
+ if(dbm::is_result($r))
$json_info["contacts"] = intval($r[0]['total']);
}
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(40);
}
$parents_arr = array();
$parents_str = '';
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
$parents_arr[] = $rr['item_id'];
$parents_str = implode(', ', $parents_arr);
dbesc($parents_str)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$items = conv_sort($r,"`commented`");
$o .= conversation($a,$items,'notes',$update);
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id)
);
- if (count($r)){
+ if (dbm::is_result($r)){
$nick = $r[0]['nickname'];
$url = $a->get_baseurl()."/display/$nick/$id";
goaway($url);
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$intro_id = $r[0]['id'];
$contact_id = $r[0]['contact-id'];
}
require_once('include/bbcode.php');
$r = $nm->getAll(array('seen'=>0));
- if ($r!==false && count($r) > 0) {
+ if (dbm::is_result($r) > 0) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
dbesc($authid), dbesc(normalise_openid($authid))
);
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
// successful OpenID login
intval($resolution),
intval($uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$data = $r[0]['data'];
$mimetype = $r[0]['type'];
}
dbesc($photo),
intval($resolution)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$sql_extra = permissions_sql($r[0]['uid']);
$public = ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
- if(count($r)) {
+ if(dbm::is_result($r)) {
$resolution = $r[0]['scale'];
$data = $r[0]['data'];
$mimetype = $r[0]['type'];
intval($page_owner_uid)
);
- if (! count($r)) {
+ if (! dbm::is_result($r)) {
notice( t('Contact information unavailable') . EOL);
logger('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
killme();
dbesc($album),
intval($page_owner_uid)
);
- if (! count($r)) {
+ if (! dbm::is_result($r)) {
notice( t('Album not found.') . EOL);
goaway($_SESSION['photo_return']);
return; // NOTREACHED
dbesc($album),
intval($page_owner_uid)
);
- if ((! count($r)) || ($album == t('Profile Photos')))
+ if ((! dbm::is_result($r)) || ($album == t('Profile Photos')))
$visible = 1;
else
$visible = 0;
}
$comments = '';
- if (! count($r)) {
+ if (! dbm::is_result($r)) {
if ($can_post || can_write_wall($a,$owner_uid)) {
if ($link_item['last-child']) {
$comments .= replace_macros($cmnt_tpl,array(
where `user`.`nickname` = '%s' and `profile`.`is-default` = 1 limit 1",
dbesc($user)
);
- if(! count($r) || $r[0]['hidewall'] || $r[0]['hide-friends'])
+ if(! dbm::is_result($r) || $r[0]['hidewall'] || $r[0]['hide-friends'])
http_status_exit(404);
$user = $r[0];
dbesc(NETWORK_STATUSNET)
);
}
- if(count($r))
+ if(dbm::is_result($r))
$totalResults = intval($r[0]['total']);
else
$totalResults = 0;
}
if(is_array($r)) {
- if(count($r)) {
+ if(count($r) > 0) {
foreach($r as $rr) {
if (!isset($rr['generation'])) {
if ($global)
intval($uid)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('poke: no contact ' . $contact_id);
return;
}
intval($parent),
intval($uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$parent_uri = $r[0]['uri'];
$private = $r[0]['private'];
$allow_cid = $r[0]['allow_cid'];
intval($_GET['c']),
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$name = $r[0]['name'];
$id = $r[0]['id'];
}
AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nickname)
);
- if(! count($r))
+ if(! dbm::is_result($r))
http_status_exit(500);
$importer = $r[0];
$which = htmlspecialchars($a->argv[1]);
else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1");
- if(count($r)) {
+ if(dbm::is_result($r)) {
goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
}
else {
intval($contact_id),
intval($a->profile['profile_uid'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contact = $r[0];
$remote_contact = true;
}
intval($a->profile['profile_uid'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
}
}
intval($_REQUEST['profile']),
intval(local_user())
);
- if(count($r) && (! intval($r[0]['is-default'])))
+ if(dbm::is_result($r) && (! intval($r[0]['is-default'])))
$is_default_profile = 0;
}
dbesc(local_user()),
intval($scale));
- if(count($r)) {
+ if(dbm::is_result($r)) {
$base_image = $r[0];
intval(local_user()),
dbesc($resource_id)
);
- if (!count($r)){
+ if (!dbm::is_result($r)){
notice( t('Permission denied.') . EOL );
return;
}
intval($a->argv[2]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Profile not found.') . EOL);
goaway('profiles');
return; // NOTREACHED
intval($a->argv[1]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Profile not found.') . EOL);
killme();
return;
intval(local_user())
);
}
- if(count($r)) {
+ if(dbm::is_result($r)) {
$prf = $r[0]['url'];
$newname = $r[0]['name'];
}
intval($a->argv[1]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Profile not found.') . EOL);
return;
}
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user()
);
- if(count($r)){
+ if(dbm::is_result($r)){
//Go to the default profile.
goaway('profiles/'.$r[0]['id']);
}
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user());
- if(count($r)) {
+ if(dbm::is_result($r)) {
$tpl = get_markup_template('profile_entry.tpl');
foreach($r as $rr) {
intval($a->argv[2]),
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$change = intval($a->argv[2]);
}
intval($a->argv[1]),
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('Invalid profile identifier.') . EOL );
return;
}
);
$ingroup = array();
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $member)
$ingroup[] = $member['id'];
$members = $r;
$ingroup = array();
- if(count($r))
+ if(dbm::is_result($r))
foreach($r as $member)
$ingroup[] = $member['id'];
}
dbesc(NETWORK_DFRN)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
if(! in_array($member['id'],$ingroup)) {
if (!$direct_cache AND ($cachefile == "")) {
$r = qu("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash);
- if (count($r)) {
+ if (dbm::is_result($r)) {
$img_str = $r[0]['data'];
$mime = $r[0]["desc"];
if ($mime == "") $mime = "image/jpeg";
} else
$r = array();
- if (!count($r)) {
+ if (!dbm::is_result($r)) {
// It shouldn't happen but it does - spaces in URL
$_REQUEST['url'] = str_replace(" ", "+", $_REQUEST['url']);
$redirects = 0;
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('pubsub: local account not found: ' . $nick);
hub_return(false, '');
}
intval($contact_id),
intval($owner['uid'])
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('pubsub: contact '.$contact_id.' not found.');
hub_return(false, '');
}
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick)
);
- if(! count($r))
+ if(! dbm::is_result($r))
hub_post_return();
$importer = $r[0];
dbesc(NETWORK_FEED)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('pubsub: no contact record for "'.$nick.' ('.$contact_id.')" - ignored. '.$xml);
hub_post_return();
}
" AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick));
- if(!count($r)) {
+ if(!dbm::is_result($r)) {
logger('pubsubhubbub: local account not found: ' . $nick);
http_status_exit(404);
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked`".
" AND NOT `pending` AND `self` LIMIT 1",
intval($owner['uid']));
- if(!count($r)) {
+ if(!dbm::is_result($r)) {
logger('pubsubhubbub: contact not found.');
http_status_exit(404);
}
// if we are just updating an old subscription, keep the
// old values for push and last_update
- if (count($r)) {
+ if (dbm::is_result($r)) {
$last_update = $r[0]['last_update'];
$push_flag = $r[0]['push'];
}
intval($limit)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
$results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
$results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
$r = q("SELECT * FROM `user` WHERE `guid` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($guid)
);
- if(! count($r))
+ if(! dbm::is_result($r))
http_status_exit(500);
$importer = $r[0];
intval(local_user())
);
- if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ if((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
goaway(z_root());
$cid = $r[0]['id'];
intval(local_user())
);
- if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ if((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
goaway(z_root());
}
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
intval($user[0]['uid'])
);
- if(count($r) && $r[0]['net-publish']) {
+ if(dbm::is_result($r) && $r[0]['net-publish']) {
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
if($url && strlen(get_config('system','directory')))
proc_run(PRIORITY_LOW, "include/directory.php", $url);
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick)
);
- if(! count($r))
+ if(! dbm::is_result($r))
http_status_exit(500);
$importer = $r[0];
dbesc(normalise_link($author_link)),
intval($importer['uid'])
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('mod-salmon: Author unknown to us.');
if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
$result = new_contact($importer['uid'],$author_link);
// Have we ignored the person?
// If so we can not accept this post.
- //if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
- if(count($r) && $r[0]['blocked']) {
+ //if((dbm::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
+ if(dbm::is_result($r) && $r[0]['blocked']) {
logger('mod-salmon: Ignoring this author.');
http_status_exit(202);
// NOTREACHED
// Placeholder for hub discovery.
$hub = '';
- $contact_rec = ((count($r)) ? $r[0] : null);
+ $contact_rec = ((dbm::is_result($r)) ? $r[0] : null);
ostatus::import($data,$importer,$contact_rec, $hub);
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$saved = array();
foreach($r as $rr) {
$saved[] = array(
intval(local_user()),
dbesc($search)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
q("INSERT INTO `search` (`uid`,`term`) VALUES ( %d, '%s')",
intval(local_user()),
dbesc($search)
intval($a->pager['start']), intval($a->pager['itemspage']));
}
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
info( t('No results.') . EOL);
return $o;
}
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
intval(local_user())
);
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$eacct = $r[0];
require_once('include/email.php');
$mb = construct_mailbox_name($eacct);
dbesc($a->argv[3]),
local_user());
- if (!count($r)){
+ if (!dbm::is_result($r)){
notice(t("You can't edit this application."));
return;
}
$settings_addons = "";
$r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
- if(! count($r))
+ if(! dbm::is_result($r))
$settings_addons = t('No Plugin settings configured');
call_hooks('plugin_settings', $settings_addons);
$r = null;
}
- $mail_server = ((count($r)) ? $r[0]['server'] : '');
- $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
- $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
- $mail_user = ((count($r)) ? $r[0]['user'] : '');
- $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
- $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
- $mail_action = ((count($r)) ? $r[0]['action'] : 0);
- $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : '');
- $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
+ $mail_server = ((dbm::is_result($r)) ? $r[0]['server'] : '');
+ $mail_port = ((dbm::is_result($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
+ $mail_ssl = ((dbm::is_result($r)) ? $r[0]['ssltype'] : '');
+ $mail_user = ((dbm::is_result($r)) ? $r[0]['user'] : '');
+ $mail_replyto = ((dbm::is_result($r)) ? $r[0]['reply_to'] : '');
+ $mail_pubmail = ((dbm::is_result($r)) ? $r[0]['pubmail'] : 0);
+ $mail_action = ((dbm::is_result($r)) ? $r[0]['action'] : 0);
+ $mail_movetofolder = ((dbm::is_result($r)) ? $r[0]['movetofolder'] : '');
+ $mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
$tpl = get_markup_template("settings_connectors.tpl");
intval($post_id),
intval(local_user())
);
- if(! count($r) || ($r[0]['private'] == 1))
+ if(! dbm::is_result($r) || ($r[0]['private'] == 1))
killme();
if (!intval(get_config('system','old_share'))) {
intval(local_user()),
intval($message_id)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
if(! intval($r[0]['starred']))
dbesc($item_id)
);
- if(! $item_id || (! count($r))) {
+ if(! $item_id || (! dbm::is_result($r))) {
logger('subthread: no item ' . $item_id);
return;
}
intval($item['contact-id']),
intval($item['uid'])
);
- if(! count($r))
+ if(! dbm::is_result($r))
return;
if(! $r[0]['self'])
$remote_owner = $r[0];
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
intval($owner_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$owner = $r[0];
if(! $owner) {
intval($_SESSION['visitor_id']),
intval($owner_uid)
);
- if(count($r))
+ if(dbm::is_result($r))
$contact = $r[0];
}
if(! $contact) {
$r = suggestion_query(local_user());
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
return $o;
}
dbesc($item_id)
);
- if(! $item_id || (! count($r))) {
+ if(! $item_id || (! dbm::is_result($r))) {
logger('tagger: no item ' . $item_id);
return;
}
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
intval($owner_uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$owner_nick = $r[0]['nickname'];
$blocktags = $r[0]['blocktags'];
}
$r = q("select * from contact where self = 1 and uid = %d limit 1",
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$contact = $r[0];
else {
logger('tagger: no contact_id');
$r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1",
dbesc($item['uri'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
intval($r[0]['uid'])
);
intval(local_user())
);
- if(! count($r))
+ if(! dbm::is_result($r))
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
$arr = explode(',', $r[0]['tag']);
intval(local_user())
);
- if(! count($r))
+ if(! dbm::is_result($r))
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
$arr = explode(',', $r[0]['tag']);
function _uexport_multirow($query) {
$result = array();
$r = q($query);
-// if(count($r)) {
+// if(dbm::is_result($r)) {
if ($r){
foreach($r as $rr){
$p = array();
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
intval(local_user())
);
- if(count($r))
+ if(dbm::is_result($r))
$total = $r[0]['total'];
// chunk the output to avoid exhausting memory
intval($x),
intval(500)
);
- /*if(count($r)) {
+ /*if(dbm::is_result($r)) {
foreach($r as $rr)
foreach($rr as $k => $v)
$item[][$k] = $v;
dbesc($video_id)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
intval(local_user()),
dbesc($video_id)
intval($contact_id),
intval($owner_uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$can_post = true;
$contact = $r[0];
$remote_contact = true;
intval($contact_id),
intval($owner_uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$contact = $r[0];
$remote_contact = true;
}
$sql_extra GROUP BY hash",
intval($a->data['user']['uid'])
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
}
$videos = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if($a->theme['template_engine'] === 'internal') {
$alt_e = template_escape($rr['filename']);
dbesc($nick)
);
- if(! count($r))
+ if(! dbm::is_result($r))
return;
$a->data['user'] = $r[0];
dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS)
);
- if(count($r))
+ if(dbm::is_result($r))
$a->set_pager_total($r[0]['total']);
$r = q("SELECT * FROM `contact`
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
- if(!count($r)) {
+ if(!dbm::is_result($r)) {
info(t('No contacts.').EOL);
return $o;
}
dbesc($item_id)
);
- if(count($r))
+ if(dbm::is_result($r))
if(is_ajax()) {
echo str_replace("\n",'<br />',$r[0]['body']);
killme();
$r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
dbesc($nick)
);
- if(! count($r)){
+ if(! dbm::is_result($r)){
if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.')));
killme();
intval($contact_id),
intval($page_owner_uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$can_post = true;
$visitor = $contact_id;
}
dbesc($hash)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
$msg = t('File upload failed.');
if ($r_json) {
echo json_encode(array('error'=>$msg));
dbesc($nick)
);
- if(! count($r)){
+ if(! dbm::is_result($r)){
if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.')));
killme();
intval($contact_id),
intval($page_owner_uid)
);
- if(count($r)) {
+ if(dbm::is_result($r)) {
$can_post = true;
$visitor = $contact_id;
}
dbesc($recipient)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
logger('wallmessage: no recipient');
return;
}
dbesc($recipient)
);
- if(! count($r)) {
+ if(! dbm::is_result($r)) {
notice( t('No recipient.') . EOL);
logger('wallmessage: no recipient');
return;
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($name)
);
- if(! count($r))
+ if(! dbm::is_result($r))
killme();
$salmon_key = salmon_key($r[0]['spubkey']);
intval($item['uid']),
intval($item['id'])
);
- if (count($r)) {
+ if (dbm::is_result($r)) {
$ignore = array(
'do' => t("ignore thread"),
'undo' => t("unignore thread"),
// create 's' keys for everybody that does not have one
$r = q("SELECT * FROM `user` WHERE `spubkey` = '' ");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$sres=openssl_pkey_new(array('encrypt_key' => false ));
$sprvkey = '';
function update_1011() {
q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
$r = q("SELECT * FROM `contact` WHERE 1");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d",
dbesc(basename($rr['url'])),
require_once('include/Photo.php');
q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
$r = q("SELECT * FROM `photo` WHERE `scale` = 4");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$ph = new Photo($rr['data']);
if($ph->is_valid()) {
}
}
$r = q("SELECT * FROM `contact` WHERE 1");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
if(stristr($rr['thumb'],'avatar'))
q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
function update_1031() {
// Repair any bad links that slipped into the item table
$r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' ");
- if($r && count($r)) {
+ if($r && dbm::is_result($r)) {
foreach($r as $rr) {
if(strstr($rr['object'],'type="http')) {
q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d",
function update_1036() {
$r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' ");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('include/photo','photo',$rr['photo'])),
function update_1074() {
q("ALTER TABLE `user` ADD `hidewall` TINYINT( 1) NOT NULL DEFAULT '0' AFTER `blockwall` ");
$r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d",
intval($rr['uid'])
function update_1075() {
q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` ");
$r = q("SELECT `uid` FROM `user` WHERE 1");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$found = true;
do {
ADD INDEX ( `guid` ) ");
// make certain the following code is only executed once
$r = q("select `id` from `photo` where `guid` != '' limit 1");
- if($r && count($r))
+ if(dbm::is_result($r))
return;
$r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$guid = get_guid();
q("update `photo` set `guid` = '%s' where `resource-id` = '%s'",
q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
$r = q("SELECT `id` FROM `item` WHERE `parent` = `id` ");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1",
intval($rr['id'])
require_once('include/text.php');
$r = q("select id, url from contact where url != '' and nurl = '' ");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
q("update contact set nurl = '%s' where id = %d",
dbesc(normalise_link($rr['url'])),
// might be missing on new installs. We'll check.
$r = q("describe item");
- if($r && count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr)
if($rr['Field'] == 'spam')
return;
// order in reverse so that we save the newest entry
$r = q("select * from config where 1 order by id desc");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$found = false;
foreach($arr as $x) {
$arr = array();
$r = q("select * from pconfig where 1 order by id desc");
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$found = false;
foreach($arr as $x) {
);
// convert old forumlist addon entries in new config entries
- if (count($r)) {
+ if (dbm::is_result($r)) {
foreach ($r as $rr) {
$uid = $rr['uid'];
$family = $rr['cat'];
// user info
$r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
- $r[0]['photo'] = (count($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg");
+ $r[0]['photo'] = (dbm::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg");
$r[0]['name'] = $a->user['username'];
} elseif(!local_user() && remote_user()) {
$nav['remote'] = t("Visitor");
}
- if(count($r)){
+ if(dbm::is_result($r)){
$nav['userinfo'] = array(
- 'icon' => (count($r) ? $r[0]['photo'] : "images/person-48.jpg"),
+ 'icon' => (dbm::is_result($r) ? $r[0]['photo'] : "images/person-48.jpg"),
'name' => $r[0]['name'],
);
}
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid']));
- if(count($r)) {
+ if(dbm::is_result($r)) {
$total = $r[0]["total"];
}
$contacts = array();
- if(count($r)) {
+ if(dbm::is_result($r)) {
foreach($r as $rr) {
$contacts[] = _contact_detail_for_template($rr);
}
$r = suggestion_query(local_user(), 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
- if(count($r)) {
+ if(dbm::is_result($r)) {
$aside['$comunity_profiles_title'] = t('Community Profiles');
$aside['$comunity_profiles_items'] = array();
0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
- if(count($r)) {
+ if(dbm::is_result($r)) {
$aside['$lastusers_title'] = t('Last users');
$aside['$lastusers_items'] = array();