return true;
}
- $user = dba::selectOne('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
+ $user = dba::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
if (!DBM::is_result($user)) {
return false;
}
public static function remove($id)
{
// We want just to make sure that we don't delete our "self" contact
- $r = dba::selectOne('contact', ['uid'], ['id' => $id, 'self' => false]);
+ $r = dba::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
if (!DBM::is_result($r) || !intval($r['uid'])) {
return;
return $menu;
}
- $r = dba::selectOne('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
+ $r = dba::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
if ($r) {
return self::photoMenu($r, $uid);
} else {
/// @todo Verify if we can't use Contact::getDetailsByUrl instead of the following
// We first try the nurl (http://server.tld/nick), most common case
- $contact = dba::selectOne('contact', ['id', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
+ $contact = dba::selectFirst('contact', ['id', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
// Then the addr (nick@server.tld)
if (!DBM::is_result($contact)) {
- $contact = dba::selectOne('contact', ['id', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
+ $contact = dba::selectFirst('contact', ['id', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
}
// Then the alias (which could be anything)
if (!DBM::is_result($contact)) {
// The link could be provided as http although we stored it as https
$ssl_url = str_replace('http://', 'https://', $url);
- $r = dba::selectOne('contact', ['id', 'avatar', 'avatar-date'], ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid]);
+ $r = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid]);
$contact = dba::fetch($r);
dba::close($r);
}
}
// Get data from the gcontact table
- $gcontacts = dba::selectOne('gcontact', ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'], ['nurl' => normalise_link($url)]);
+ $gcontacts = dba::selectFirst('gcontact', ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'], ['nurl' => normalise_link($url)]);
if (!DBM::is_result($gcontacts)) {
return 0;
}
$contact_id = $contacts[0]["id"];
// Update the newly created contact from data in the gcontact table
- $gcontact = dba::selectOne('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
+ $gcontact = dba::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
if (DBM::is_result($gcontact)) {
// Only use the information when the probing hadn't fetched these values
if ($data['keywords'] != '') {
self::updateAvatar($data["photo"], $uid, $contact_id);
$fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'pubkey'];
- $contact = dba::selectOne('contact', $fields, ['id' => $contact_id]);
+ $contact = dba::selectFirst('contact', $fields, ['id' => $contact_id]);
// This condition should always be true
if (!DBM::is_result($contact)) {
return false;
}
- $blocked = dba::selectOne('contact', ['blocked'], ['id' => $cid]);
+ $blocked = dba::selectFirst('contact', ['blocked'], ['id' => $cid]);
if (!DBM::is_result($blocked)) {
return false;
}
return false;
}
- $hidden = dba::selectOne('contact', ['hidden'], ['id' => $cid]);
+ $hidden = dba::selectFirst('contact', ['hidden'], ['id' => $cid]);
if (!DBM::is_result($hidden)) {
return false;
}
public static function updateAvatar($avatar, $uid, $cid, $force = false)
{
// Limit = 1 returns the row so no need for dba:inArray()
- $r = dba::selectOne('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
+ $r = dba::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
if (!DBM::is_result($r)) {
return false;
} else {
// Update the public contact (contact id = 0)
if ($uid != 0) {
- $pcontact = dba::selectOne('contact', ['id'], ['nurl' => $r[0]['nurl']]);
+ $pcontact = dba::selectFirst('contact', ['id'], ['nurl' => $r[0]['nurl']]);
if (DBM::is_result($pcontact)) {
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
}
This will reliably kill your communication with Friendica contacts.
*/
- $r = dba::selectOne('contact', ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'], ['id' => $id]);
+ $r = dba::selectFirst('contact', ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'], ['id' => $id]);
if (!DBM::is_result($r)) {
return false;
}
);
}
- $r = dba::selectOne('contact', ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
+ $r = dba::selectFirst('contact', ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
if (!DBM::is_result($r)) {
$result['message'] .= t('Unable to retrieve contact information.') . EOL;