mirror of
https://github.com/friendica/friendica
synced 2024-12-23 02:40:17 +00:00
Rename selectOne to selectFirst
This commit is contained in:
parent
c7a7658316
commit
ae66bcaff3
51 changed files with 821 additions and 821 deletions
|
@ -222,7 +222,7 @@ function api_login(App $a)
|
||||||
} else {
|
} else {
|
||||||
$user_id = User::authenticate(trim($user), trim($password));
|
$user_id = User::authenticate(trim($user), trim($password));
|
||||||
if ($user_id) {
|
if ($user_id) {
|
||||||
$record = dba::selectOne('user', [], ['uid' => $user_id]);
|
$record = dba::selectFirst('user', [], ['uid' => $user_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ function api_rss_extra(App $a, $arr, $user_info)
|
||||||
*/
|
*/
|
||||||
function api_unique_id_to_nurl($id)
|
function api_unique_id_to_nurl($id)
|
||||||
{
|
{
|
||||||
$r = dba::selectOne('contact', array('nurl'), array('uid' => 0, 'id' => $id));
|
$r = dba::selectFirst('contact', array('nurl'), array('uid' => 0, 'id' => $id));
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
return $r["nurl"];
|
return $r["nurl"];
|
||||||
|
@ -792,7 +792,7 @@ function api_get_user(App $a, $contact_id = null)
|
||||||
|
|
||||||
// If this is a local user and it uses Frio, we can get its color preferences.
|
// If this is a local user and it uses Frio, we can get its color preferences.
|
||||||
if ($ret['self']) {
|
if ($ret['self']) {
|
||||||
$theme_info = dba::selectOne('user', ['theme'], ['uid' => $ret['uid']]);
|
$theme_info = dba::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
|
||||||
if ($theme_info['theme'] === 'frio') {
|
if ($theme_info['theme'] === 'frio') {
|
||||||
$schema = PConfig::get($ret['uid'], 'frio', 'schema');
|
$schema = PConfig::get($ret['uid'], 'frio', 'schema');
|
||||||
if ($schema && ($schema != '---')) {
|
if ($schema && ($schema != '---')) {
|
||||||
|
@ -4870,7 +4870,7 @@ function api_friendica_remoteauth()
|
||||||
|
|
||||||
// traditional DFRN
|
// traditional DFRN
|
||||||
|
|
||||||
$r = dba::selectOne('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
|
$r = dba::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]);
|
||||||
|
|
||||||
if (!DBM::is_result($r) || ($r['network'] !== NETWORK_DFRN)) {
|
if (!DBM::is_result($r) || ($r['network'] !== NETWORK_DFRN)) {
|
||||||
throw new BadRequestException("Unknown contact");
|
throw new BadRequestException("Unknown contact");
|
||||||
|
|
|
@ -224,12 +224,12 @@ function common_friends_visitor_widget($profile_uid)
|
||||||
|
|
||||||
if (!$cid) {
|
if (!$cid) {
|
||||||
if (get_my_url()) {
|
if (get_my_url()) {
|
||||||
$r = dba::selectOne('contact', ['id'],
|
$r = dba::selectFirst('contact', ['id'],
|
||||||
['nurl' => normalise_link(get_my_url()), 'uid' => $profile_uid]);
|
['nurl' => normalise_link(get_my_url()), 'uid' => $profile_uid]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$cid = $r['id'];
|
$cid = $r['id'];
|
||||||
} else {
|
} else {
|
||||||
$r = dba::selectOne('gcontact', ['id'], ['nurl' => normalise_link(get_my_url())]);
|
$r = dba::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(get_my_url())]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$zcid = $r['id'];
|
$zcid = $r['id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -968,7 +968,7 @@ function best_link_url($item, &$sparkle, $url = '') {
|
||||||
$clean_url = normalise_link($item['author-link']);
|
$clean_url = normalise_link($item['author-link']);
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
$r = dba::selectOne('contact', ['id'],
|
$r = dba::selectFirst('contact', ['id'],
|
||||||
['network' => NETWORK_DFRN, 'uid' => local_user(), 'nurl' => normalise_link($clean_url), 'pending' => false]);
|
['network' => NETWORK_DFRN, 'uid' => local_user(), 'nurl' => normalise_link($clean_url), 'pending' => false]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$best_url = 'redir/' . $r['id'];
|
$best_url = 'redir/' . $r['id'];
|
||||||
|
@ -1019,7 +1019,7 @@ function item_photo_menu($item) {
|
||||||
$cid = 0;
|
$cid = 0;
|
||||||
$network = '';
|
$network = '';
|
||||||
$rel = 0;
|
$rel = 0;
|
||||||
$r = dba::selectOne('contact', array('id', 'network', 'rel'), array('uid' => local_user(), 'nurl' => normalise_link($item['author-link'])));
|
$r = dba::selectFirst('contact', array('id', 'network', 'rel'), array('uid' => local_user(), 'nurl' => normalise_link($item['author-link'])));
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$cid = $r['id'];
|
$cid = $r['id'];
|
||||||
$network = $r['network'];
|
$network = $r['network'];
|
||||||
|
|
|
@ -1047,7 +1047,7 @@ class dba {
|
||||||
if (is_bool($old_fields)) {
|
if (is_bool($old_fields)) {
|
||||||
$do_insert = $old_fields;
|
$do_insert = $old_fields;
|
||||||
|
|
||||||
$old_fields = self::selectOne($table, [], $condition);
|
$old_fields = self::selectFirst($table, [], $condition);
|
||||||
|
|
||||||
if (is_bool($old_fields)) {
|
if (is_bool($old_fields)) {
|
||||||
if ($do_insert) {
|
if ($do_insert) {
|
||||||
|
@ -1095,7 +1095,7 @@ class dba {
|
||||||
* @return bool|array
|
* @return bool|array
|
||||||
* @see dba::select
|
* @see dba::select
|
||||||
*/
|
*/
|
||||||
public static function selectOne($table, array $fields = [], array $condition = [], $params = [])
|
public static function selectFirst($table, array $fields = [], array $condition = [], $params = [])
|
||||||
{
|
{
|
||||||
$params['limit'] = 1;
|
$params['limit'] = 1;
|
||||||
$result = self::select($table, $fields, $condition, $params);
|
$result = self::select($table, $fields, $condition, $params);
|
||||||
|
|
|
@ -106,7 +106,7 @@ function notification($params)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($params['type'] == NOTIFY_COMMENT) {
|
if ($params['type'] == NOTIFY_COMMENT) {
|
||||||
$p = dba::selectOne('thread', ['ignored'], ['iid' => $parent_id]);
|
$p = dba::selectFirst('thread', ['ignored'], ['iid' => $parent_id]);
|
||||||
if (DBM::is_result($p) && $p["ignored"]) {
|
if (DBM::is_result($p) && $p["ignored"]) {
|
||||||
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
|
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
|
@ -131,7 +131,7 @@ function notification($params)
|
||||||
$p = null;
|
$p = null;
|
||||||
|
|
||||||
if ($params['otype'] === 'item' && $parent_id) {
|
if ($params['otype'] === 'item' && $parent_id) {
|
||||||
$p = dba::selectOne('item', [], ['id' => $parent_id]);
|
$p = dba::selectFirst('item', [], ['id' => $parent_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_post_type = item_post_type($p);
|
$item_post_type = item_post_type($p);
|
||||||
|
@ -672,12 +672,12 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
$profiles = $notification_data["profiles"];
|
$profiles = $notification_data["profiles"];
|
||||||
|
|
||||||
$fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
|
$fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
|
||||||
$user = dba::selectOne('user', $fields, ['uid' => $uid]);
|
$user = dba::selectFirst('user', $fields, ['uid' => $uid]);
|
||||||
if (!DBM::is_result($user)) {
|
if (!DBM::is_result($user)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner = dba::selectOne('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
$owner = dba::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
||||||
if (!DBM::is_result($owner)) {
|
if (!DBM::is_result($owner)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0)
|
||||||
if (remote_user() && count($_SESSION['remote'])) {
|
if (remote_user() && count($_SESSION['remote'])) {
|
||||||
foreach ($_SESSION['remote'] as $visitor) {
|
foreach ($_SESSION['remote'] as $visitor) {
|
||||||
if ($visitor['uid'] == $uid) {
|
if ($visitor['uid'] == $uid) {
|
||||||
$r = dba::selectOne('contact', ['profile-id'], ['id' => $visitor['cid']]);
|
$r = dba::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$profile = $r['profile-id'];
|
$profile = $r['profile-id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -562,7 +562,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
// check for create date and expire time
|
// check for create date and expire time
|
||||||
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
|
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
|
||||||
|
|
||||||
$user = dba::selectOne('user', ['expire'], ['uid' => $uid]);
|
$user = dba::selectFirst('user', ['expire'], ['uid' => $uid]);
|
||||||
if (DBM::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
|
if (DBM::is_result($user) && ($user['expire'] > 0) && (($user['expire'] < $expire_interval) || ($expire_interval == 0))) {
|
||||||
$expire_interval = $user['expire'];
|
$expire_interval = $user['expire'];
|
||||||
}
|
}
|
||||||
|
@ -1149,14 +1149,14 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
*/
|
*/
|
||||||
function item_set_last_item($arr) {
|
function item_set_last_item($arr) {
|
||||||
// Unarchive the author
|
// Unarchive the author
|
||||||
$contact = dba::selectOne('contact', [], ['id' => $arr["author-link"]]);
|
$contact = dba::selectFirst('contact', [], ['id' => $arr["author-link"]]);
|
||||||
if ($contact['term-date'] > NULL_DATE) {
|
if ($contact['term-date'] > NULL_DATE) {
|
||||||
Contact::unmarkForArchival($contact);
|
Contact::unmarkForArchival($contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unarchive the contact if it is a toplevel posting
|
// Unarchive the contact if it is a toplevel posting
|
||||||
if ($arr["parent-uri"] === $arr["uri"]) {
|
if ($arr["parent-uri"] === $arr["uri"]) {
|
||||||
$contact = dba::selectOne('contact', [], ['id' => $arr["contact-id"]]);
|
$contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"]]);
|
||||||
if ($contact['term-date'] > NULL_DATE) {
|
if ($contact['term-date'] > NULL_DATE) {
|
||||||
Contact::unmarkForArchival($contact);
|
Contact::unmarkForArchival($contact);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ function send_message($recipient = 0, $body = '', $subject = '', $replyto = '')
|
||||||
'subject' => $subject, 'recips' => $handles);
|
'subject' => $subject, 'recips' => $handles);
|
||||||
dba::insert('conv', $fields);
|
dba::insert('conv', $fields);
|
||||||
|
|
||||||
$r = dba::selectOne('conv', ['id'], ['guid' => $conv_guid, 'uid' => local_user()]);
|
$r = dba::selectFirst('conv', ['id'], ['guid' => $conv_guid, 'uid' => local_user()]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$convid = $r['id'];
|
$convid = $r['id'];
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ function send_wallmessage($recipient = '', $body = '', $subject = '', $replyto =
|
||||||
'subject' => $subject, 'recips' => $handles);
|
'subject' => $subject, 'recips' => $handles);
|
||||||
dba::insert('conv', $fields);
|
dba::insert('conv', $fields);
|
||||||
|
|
||||||
$r = dba::selectOne('conv', ['id'], ['guid' => $conv_guid, 'uid' => $recipient['uid']]);
|
$r = dba::selectFirst('conv', ['id'], ['guid' => $conv_guid, 'uid' => $recipient['uid']]);
|
||||||
if (!DBM::is_result($r)) {
|
if (!DBM::is_result($r)) {
|
||||||
logger('send message: conversation not found.');
|
logger('send message: conversation not found.');
|
||||||
return -4;
|
return -4;
|
||||||
|
|
|
@ -94,7 +94,7 @@ function nav_info(App $a)
|
||||||
$nav['usermenu'][] = array('notes/', t('Personal notes'), '', t('Your personal notes'));
|
$nav['usermenu'][] = array('notes/', t('Personal notes'), '', t('Your personal notes'));
|
||||||
|
|
||||||
// user info
|
// user info
|
||||||
$r = dba::selectOne('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
|
$r = dba::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
|
||||||
$userinfo = array(
|
$userinfo = array(
|
||||||
'icon' => (DBM::is_result($r) ? $a->remove_baseurl($r['micro']) : 'images/person-48.jpg'),
|
'icon' => (DBM::is_result($r) ? $a->remove_baseurl($r['micro']) : 'images/person-48.jpg'),
|
||||||
'name' => $a->user['username'],
|
'name' => $a->user['username'],
|
||||||
|
|
|
@ -33,7 +33,7 @@ function ref_session_read($id)
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = dba::selectOne('session', ['data'], ['sid' => $id]);
|
$r = dba::selectFirst('session', ['data'], ['sid' => $id]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$session_exists = true;
|
$session_exists = true;
|
||||||
return $r['data'];
|
return $r['data'];
|
||||||
|
|
|
@ -226,7 +226,7 @@ function wtagblock($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA
|
||||||
$o = '';
|
$o = '';
|
||||||
$r = tagadelic($uid, $count, $owner_id, $flags, $type);
|
$r = tagadelic($uid, $count, $owner_id, $flags, $type);
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
$contact = dba::selectOne('contact', ['url'], ['id' => $uid]);
|
$contact = dba::selectFirst('contact', ['url'], ['id' => $uid]);
|
||||||
$url = System::removedBaseUrl($contact['url']);
|
$url = System::removedBaseUrl($contact['url']);
|
||||||
|
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ if (!$a->is_backend()) {
|
||||||
*/
|
*/
|
||||||
if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
|
if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
|
||||||
// we didn't loaded user data yet, but we need user language
|
// we didn't loaded user data yet, but we need user language
|
||||||
$r = dba::selectOne('user', ['language'], ['uid' => $_SESSION['uid']]);
|
$r = dba::selectFirst('user', ['language'], ['uid' => $_SESSION['uid']]);
|
||||||
$_SESSION['language'] = $lang;
|
$_SESSION['language'] = $lang;
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$_SESSION['language'] = $r['language'];
|
$_SESSION['language'] = $r['language'];
|
||||||
|
|
|
@ -1551,7 +1551,7 @@ function admin_page_users(App $a)
|
||||||
{
|
{
|
||||||
if ($a->argc > 2) {
|
if ($a->argc > 2) {
|
||||||
$uid = $a->argv[3];
|
$uid = $a->argv[3];
|
||||||
$user = dba::selectOne('user', ['username', 'blocked'], ['uid' => $uid]);
|
$user = dba::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
|
||||||
if (DBM::is_result($user)) {
|
if (DBM::is_result($user)) {
|
||||||
notice('User not found' . EOL);
|
notice('User not found' . EOL);
|
||||||
goaway('admin/users');
|
goaway('admin/users');
|
||||||
|
|
|
@ -32,7 +32,7 @@ function cal_init(App $a)
|
||||||
|
|
||||||
if ($a->argc > 1) {
|
if ($a->argc > 1) {
|
||||||
$nick = $a->argv[1];
|
$nick = $a->argv[1];
|
||||||
$user = dba::selectOne('user', [], ['nickname' => $nick, 'blocked' => false]);
|
$user = dba::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
|
||||||
if (!DBM::is_result($user)) {
|
if (!DBM::is_result($user)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,11 +63,11 @@ function common_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cid && get_my_url()) {
|
if (!$cid && get_my_url()) {
|
||||||
$contact = dba::selectOne('contact', ['id'], ['nurl' => normalise_link(get_my_url()), 'uid' => $uid]);
|
$contact = dba::selectFirst('contact', ['id'], ['nurl' => normalise_link(get_my_url()), 'uid' => $uid]);
|
||||||
if (DBM::is_result($contact)) {
|
if (DBM::is_result($contact)) {
|
||||||
$cid = $contact['id'];
|
$cid = $contact['id'];
|
||||||
} else {
|
} else {
|
||||||
$gcontact = dba::selectOne('gcontact', ['id'], ['nurl' => normalise_link(get_my_url())]);
|
$gcontact = dba::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(get_my_url())]);
|
||||||
if (DBM::is_result($gcontact)) {
|
if (DBM::is_result($gcontact)) {
|
||||||
$zcid = $gcontact['id'];
|
$zcid = $gcontact['id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ function contacts_init(App $a)
|
||||||
$contact = [];
|
$contact = [];
|
||||||
if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
|
if ((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
|
||||||
$contact_id = intval($a->argv[1]);
|
$contact_id = intval($a->argv[1]);
|
||||||
$contact = dba::selectOne('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBM::is_result($contact)) {
|
if (DBM::is_result($contact)) {
|
||||||
|
@ -222,7 +222,7 @@ function contacts_post(App $a)
|
||||||
notice(t('Failed to update contact record.') . EOL);
|
notice(t('Failed to update contact record.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = dba::selectOne('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
||||||
if (DBM::is_result($contact)) {
|
if (DBM::is_result($contact)) {
|
||||||
$a->data['contact'] = $contact;
|
$a->data['contact'] = $contact;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ function contacts_post(App $a)
|
||||||
|
|
||||||
function _contact_update($contact_id)
|
function _contact_update($contact_id)
|
||||||
{
|
{
|
||||||
$contact = dba::selectOne('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ function _contact_update($contact_id)
|
||||||
|
|
||||||
function _contact_update_profile($contact_id)
|
function _contact_update_profile($contact_id)
|
||||||
{
|
{
|
||||||
$contact = dba::selectOne('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = dba::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ function contacts_content(App $a)
|
||||||
|
|
||||||
$cmd = $a->argv[2];
|
$cmd = $a->argv[2];
|
||||||
|
|
||||||
$orig_record = dba::selectOne('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
|
$orig_record = dba::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'self' => false]);
|
||||||
if (!DBM::is_result($orig_record)) {
|
if (!DBM::is_result($orig_record)) {
|
||||||
notice(t('Could not access contact record.') . EOL);
|
notice(t('Could not access contact record.') . EOL);
|
||||||
goaway('contacts');
|
goaway('contacts');
|
||||||
|
@ -904,7 +904,7 @@ function contact_posts($a, $contact_id)
|
||||||
{
|
{
|
||||||
$o = contacts_tab($a, $contact_id, 1);
|
$o = contacts_tab($a, $contact_id, 1);
|
||||||
|
|
||||||
$contact = dba::selectOne('contact', ['url'], ['id' => $contact_id]);
|
$contact = dba::selectFirst('contact', ['url'], ['id' => $contact_id]);
|
||||||
if (DBM::is_result($contact)) {
|
if (DBM::is_result($contact)) {
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = "";
|
||||||
profile_load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
profile_load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
||||||
|
|
|
@ -202,7 +202,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$item_id = $_REQUEST['item_id'];
|
$item_id = $_REQUEST['item_id'];
|
||||||
$item = dba::selectOne('item', ['uid', 'parent'], ['id' => $item_id]);
|
$item = dba::selectFirst('item', ['uid', 'parent'], ['id' => $item_id]);
|
||||||
$a->profile = array('uid' => intval($item['uid']), 'profile_uid' => intval($item['uid']));
|
$a->profile = array('uid' => intval($item['uid']), 'profile_uid' => intval($item['uid']));
|
||||||
$item_parent = $item['parent'];
|
$item_parent = $item['parent'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -345,7 +345,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
$s = dba::inArray($r);
|
$s = dba::inArray($r);
|
||||||
|
|
||||||
if (local_user() && (local_user() == $a->profile['uid'])) {
|
if (local_user() && (local_user() == $a->profile['uid'])) {
|
||||||
$unseen = dba::selectOne('item', ['id'], ['parent' => $s[0]['parent'], 'unseen' => true]);
|
$unseen = dba::selectFirst('item', ['id'], ['parent' => $s[0]['parent'], 'unseen' => true]);
|
||||||
if (DBM::is_result($unseen)) {
|
if (DBM::is_result($unseen)) {
|
||||||
dba::update('item', array('unseen' => false), array('parent' => $s[0]['parent'], 'unseen' => true));
|
dba::update('item', array('unseen' => false), array('parent' => $s[0]['parent'], 'unseen' => true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ function hovercard_content()
|
||||||
$cid = 0;
|
$cid = 0;
|
||||||
if (local_user() && strpos($profileurl, 'redir/') === 0) {
|
if (local_user() && strpos($profileurl, 'redir/') === 0) {
|
||||||
$cid = intval(substr($profileurl, 6));
|
$cid = intval(substr($profileurl, 6));
|
||||||
$r = dba::selectOne('contact', ['nurl'], ['id' => $cid]);
|
$r = dba::selectFirst('contact', ['nurl'], ['id' => $cid]);
|
||||||
$profileurl = defaults($r, 'nurl', '');
|
$profileurl = defaults($r, 'nurl', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -581,7 +581,7 @@ function networkThreadedView(App $a, $update = 0) {
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
// If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
|
// If $cid belongs to a communitity forum or a privat goup,.add a mention to the status editor
|
||||||
$condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
|
$condition = ["`id` = ? AND (`forum` OR `prv`)", $cid];
|
||||||
$contact = dba::selectOne('contact', ['addr', 'nick'], $condition);
|
$contact = dba::selectFirst('contact', ['addr', 'nick'], $condition);
|
||||||
if (DBM::is_result($contact)) {
|
if (DBM::is_result($contact)) {
|
||||||
if ($contact["addr"] != '') {
|
if ($contact["addr"] != '') {
|
||||||
$content = "!".$contact["addr"];
|
$content = "!".$contact["addr"];
|
||||||
|
@ -632,7 +632,7 @@ function networkThreadedView(App $a, $update = 0) {
|
||||||
$sql_nets = (($nets) ? sprintf(" and $sql_table.`network` = '%s' ", dbesc($nets)) : '');
|
$sql_nets = (($nets) ? sprintf(" and $sql_table.`network` = '%s' ", dbesc($nets)) : '');
|
||||||
|
|
||||||
if ($group) {
|
if ($group) {
|
||||||
$r = dba::selectOne('group', ['name'], ['id' => $group, 'uid' => $_SESSION['uid']]);
|
$r = dba::selectFirst('group', ['name'], ['id' => $group, 'uid' => $_SESSION['uid']]);
|
||||||
if (!DBM::is_result($r)) {
|
if (!DBM::is_result($r)) {
|
||||||
if ($update)
|
if ($update)
|
||||||
killme();
|
killme();
|
||||||
|
@ -647,7 +647,7 @@ function networkThreadedView(App $a, $update = 0) {
|
||||||
$contact_str_self = "";
|
$contact_str_self = "";
|
||||||
|
|
||||||
$contact_str = implode(',',$contacts);
|
$contact_str = implode(',',$contacts);
|
||||||
$self = dba::selectOne('contact', ['id'], ['uid' => $_SESSION['uid'], 'self' => true]);
|
$self = dba::selectFirst('contact', ['id'], ['uid' => $_SESSION['uid'], 'self' => true]);
|
||||||
if (DBM::is_result($self)) {
|
if (DBM::is_result($self)) {
|
||||||
$contact_str_self = $self["id"];
|
$contact_str_self = $self["id"];
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ function networkThreadedView(App $a, $update = 0) {
|
||||||
$fields = ['id', 'name', 'network', 'writable', 'nurl',
|
$fields = ['id', 'name', 'network', 'writable', 'nurl',
|
||||||
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
|
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
|
||||||
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
|
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
|
||||||
$r = dba::selectOne('contact', $fields, $condition);
|
$r = dba::selectFirst('contact', $fields, $condition);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
|
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
|
||||||
|
|
||||||
|
|
|
@ -68,13 +68,13 @@ function noscrape_init(App $a) {
|
||||||
// We display the last activity (post or login), reduced to year and week number
|
// We display the last activity (post or login), reduced to year and week number
|
||||||
$last_active = 0;
|
$last_active = 0;
|
||||||
$condition = ['uid' => $a->profile['uid'], 'self' => true];
|
$condition = ['uid' => $a->profile['uid'], 'self' => true];
|
||||||
$contact = dba::selectOne('contact', ['last-item'], $condition);
|
$contact = dba::selectFirst('contact', ['last-item'], $condition);
|
||||||
if (DBM::is_result($contact)) {
|
if (DBM::is_result($contact)) {
|
||||||
$last_active = strtotime($contact['last-item']);
|
$last_active = strtotime($contact['last-item']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = ['uid' => $a->profile['uid']];
|
$condition = ['uid' => $a->profile['uid']];
|
||||||
$user = dba::selectOne('user', ['login_date'], $condition);
|
$user = dba::selectFirst('user', ['login_date'], $condition);
|
||||||
if (DBM::is_result($user)) {
|
if (DBM::is_result($user)) {
|
||||||
if ($last_active < strtotime($user['login_date'])) {
|
if ($last_active < strtotime($user['login_date'])) {
|
||||||
$last_active = strtotime($user['login_date']);
|
$last_active = strtotime($user['login_date']);
|
||||||
|
|
|
@ -148,7 +148,7 @@ function proxy_init(App $a) {
|
||||||
$r = array();
|
$r = array();
|
||||||
|
|
||||||
if (!$direct_cache && ($cachefile == '')) {
|
if (!$direct_cache && ($cachefile == '')) {
|
||||||
$r = dba::selectOne('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
|
$r = dba::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$img_str = $r['data'];
|
$img_str = $r['data'];
|
||||||
$mime = $r['desc'];
|
$mime = $r['desc'];
|
||||||
|
|
|
@ -32,7 +32,7 @@ function receive_post(App $a)
|
||||||
}
|
}
|
||||||
$guid = $a->argv[2];
|
$guid = $a->argv[2];
|
||||||
|
|
||||||
$importer = dba::selectOne('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
|
$importer = dba::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
|
||||||
if (!DBM::is_result($importer)) {
|
if (!DBM::is_result($importer)) {
|
||||||
http_status_exit(500);
|
http_status_exit(500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -997,7 +997,7 @@ function settings_content(App $a)
|
||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
$profile = dba::selectOne('profile', [], ['is-default' => true, 'uid' => local_user()]);
|
$profile = dba::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]);
|
||||||
if (!DBM::is_result($profile)) {
|
if (!DBM::is_result($profile)) {
|
||||||
notice(t('Unable to find your profile. Please contact your admin.') . EOL);
|
notice(t('Unable to find your profile. Please contact your admin.') . EOL);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,7 +26,7 @@ function unfollow_post(App $a) {
|
||||||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||||
$uid, CONTACT_IS_FRIEND, normalise_link($url),
|
$uid, CONTACT_IS_FRIEND, normalise_link($url),
|
||||||
normalise_link($url), $url, NETWORK_STATUSNET];
|
normalise_link($url), $url, NETWORK_STATUSNET];
|
||||||
$contact = dba::selectOne('contact', [], $condition);
|
$contact = dba::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
notice(t("Contact wasn't found or can't be unfollowed."));
|
notice(t("Contact wasn't found or can't be unfollowed."));
|
||||||
|
@ -65,7 +65,7 @@ function unfollow_content(App $a) {
|
||||||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||||
local_user(), CONTACT_IS_FRIEND, normalise_link($url),
|
local_user(), CONTACT_IS_FRIEND, normalise_link($url),
|
||||||
normalise_link($url), $url, NETWORK_STATUSNET];
|
normalise_link($url), $url, NETWORK_STATUSNET];
|
||||||
$contact = dba::selectOne('contact', ['url', 'network', 'addr', 'name'], $condition);
|
$contact = dba::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
||||||
|
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
notice(t("You aren't a friend of this contact.").EOL);
|
notice(t("You aren't a friend of this contact.").EOL);
|
||||||
|
|
|
@ -36,7 +36,7 @@ function xrd_init(App $a)
|
||||||
$name = substr($local, 0, strpos($local, '@'));
|
$name = substr($local, 0, strpos($local, '@'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = dba::selectOne('user', [], ['nickname' => $name]);
|
$r = dba::selectFirst('user', [], ['nickname' => $name]);
|
||||||
if (!DBM::is_result($r)) {
|
if (!DBM::is_result($r)) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class OEmbed
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
$condition = ['url' => normalise_link($embedurl)];
|
$condition = ['url' => normalise_link($embedurl)];
|
||||||
$r = dba::selectOne('oembed', ['content'], $condition);
|
$r = dba::selectFirst('oembed', ['content'], $condition);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$txt = $r["content"];
|
$txt = $r["content"];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Cache
|
||||||
// Frequently clear cache
|
// Frequently clear cache
|
||||||
self::clear();
|
self::clear();
|
||||||
|
|
||||||
$r = dba::selectOne('cache', ['v'], ['k' => $key]);
|
$r = dba::selectFirst('cache', ['v'], ['k' => $key]);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$cached = $r['v'];
|
$cached = $r['v'];
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = dba::selectOne('config', ['v'], ['cat' => $family, 'k' => $key]);
|
$ret = dba::selectFirst('config', ['v'], ['cat' => $family, 'k' => $key]);
|
||||||
if (DBM::is_result($ret)) {
|
if (DBM::is_result($ret)) {
|
||||||
// manage array value
|
// manage array value
|
||||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
|
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
|
||||||
|
|
|
@ -90,7 +90,7 @@ class PConfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = dba::selectOne('pconfig', ['v'], ['uid' => $uid, 'cat' => $family, 'k' => $key]);
|
$ret = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $family, 'k' => $key]);
|
||||||
if (DBM::is_result($ret)) {
|
if (DBM::is_result($ret)) {
|
||||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
|
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
|
||||||
$a->config[$uid][$family][$key] = $val;
|
$a->config[$uid][$family][$key] = $val;
|
||||||
|
|
|
@ -165,7 +165,7 @@ class Worker
|
||||||
private static function highestPriority()
|
private static function highestPriority()
|
||||||
{
|
{
|
||||||
$condition = array("`executed` <= ? AND NOT `done`", NULL_DATE);
|
$condition = array("`executed` <= ? AND NOT `done`", NULL_DATE);
|
||||||
$s = dba::selectOne('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
|
$s = dba::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
|
||||||
if (DBM::is_result($s)) {
|
if (DBM::is_result($s)) {
|
||||||
return $s["priority"];
|
return $s["priority"];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Contact extends BaseObject
|
||||||
return true;
|
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)) {
|
if (!DBM::is_result($user)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class Contact extends BaseObject
|
||||||
public static function remove($id)
|
public static function remove($id)
|
||||||
{
|
{
|
||||||
// We want just to make sure that we don't delete our "self" contact
|
// 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'])) {
|
if (!DBM::is_result($r) || !intval($r['uid'])) {
|
||||||
return;
|
return;
|
||||||
|
@ -490,7 +490,7 @@ class Contact extends BaseObject
|
||||||
return $menu;
|
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) {
|
if ($r) {
|
||||||
return self::photoMenu($r, $uid);
|
return self::photoMenu($r, $uid);
|
||||||
} else {
|
} else {
|
||||||
|
@ -653,18 +653,18 @@ class Contact extends BaseObject
|
||||||
|
|
||||||
/// @todo Verify if we can't use Contact::getDetailsByUrl instead of the following
|
/// @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
|
// 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)
|
// Then the addr (nick@server.tld)
|
||||||
if (!DBM::is_result($contact)) {
|
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)
|
// Then the alias (which could be anything)
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
// The link could be provided as http although we stored it as https
|
// The link could be provided as http although we stored it as https
|
||||||
$ssl_url = str_replace('http://', 'https://', $url);
|
$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);
|
$contact = dba::fetch($r);
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
}
|
}
|
||||||
|
@ -697,7 +697,7 @@ class Contact extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get data from the gcontact table
|
// 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)) {
|
if (!DBM::is_result($gcontacts)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -735,7 +735,7 @@ class Contact extends BaseObject
|
||||||
$contact_id = $contacts[0]["id"];
|
$contact_id = $contacts[0]["id"];
|
||||||
|
|
||||||
// Update the newly created contact from data in the gcontact table
|
// 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)) {
|
if (DBM::is_result($gcontact)) {
|
||||||
// Only use the information when the probing hadn't fetched these values
|
// Only use the information when the probing hadn't fetched these values
|
||||||
if ($data['keywords'] != '') {
|
if ($data['keywords'] != '') {
|
||||||
|
@ -759,7 +759,7 @@ class Contact extends BaseObject
|
||||||
self::updateAvatar($data["photo"], $uid, $contact_id);
|
self::updateAvatar($data["photo"], $uid, $contact_id);
|
||||||
|
|
||||||
$fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'pubkey'];
|
$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
|
// This condition should always be true
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
|
@ -817,7 +817,7 @@ class Contact extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$blocked = dba::selectOne('contact', ['blocked'], ['id' => $cid]);
|
$blocked = dba::selectFirst('contact', ['blocked'], ['id' => $cid]);
|
||||||
if (!DBM::is_result($blocked)) {
|
if (!DBM::is_result($blocked)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -837,7 +837,7 @@ class Contact extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hidden = dba::selectOne('contact', ['hidden'], ['id' => $cid]);
|
$hidden = dba::selectFirst('contact', ['hidden'], ['id' => $cid]);
|
||||||
if (!DBM::is_result($hidden)) {
|
if (!DBM::is_result($hidden)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -980,7 +980,7 @@ class Contact extends BaseObject
|
||||||
public static function updateAvatar($avatar, $uid, $cid, $force = false)
|
public static function updateAvatar($avatar, $uid, $cid, $force = false)
|
||||||
{
|
{
|
||||||
// Limit = 1 returns the row so no need for dba:inArray()
|
// 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)) {
|
if (!DBM::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -999,7 +999,7 @@ class Contact extends BaseObject
|
||||||
|
|
||||||
// Update the public contact (contact id = 0)
|
// Update the public contact (contact id = 0)
|
||||||
if ($uid != 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)) {
|
if (DBM::is_result($pcontact)) {
|
||||||
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
|
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,7 @@ class Contact extends BaseObject
|
||||||
This will reliably kill your communication with Friendica contacts.
|
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)) {
|
if (!DBM::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1246,7 +1246,7 @@ class Contact extends BaseObject
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$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)) {
|
if (!DBM::is_result($r)) {
|
||||||
$result['message'] .= t('Unable to retrieve contact information.') . EOL;
|
$result['message'] .= t('Unable to retrieve contact information.') . EOL;
|
||||||
|
|
|
@ -888,7 +888,7 @@ class GContact
|
||||||
'network', 'bd', 'gender',
|
'network', 'bd', 'gender',
|
||||||
'keywords', 'alias', 'contact-type',
|
'keywords', 'alias', 'contact-type',
|
||||||
'url', 'location', 'about');
|
'url', 'location', 'about');
|
||||||
$old_contact = dba::selectOne('contact', $fields, ['id' => $r[0]["id"]]);
|
$old_contact = dba::selectFirst('contact', $fields, ['id' => $r[0]["id"]]);
|
||||||
|
|
||||||
// Update it with the current values
|
// Update it with the current values
|
||||||
$fields = array('name' => $contact['name'], 'nick' => $contact['nick'],
|
$fields = array('name' => $contact['name'], 'nick' => $contact['nick'],
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Group extends BaseObject
|
||||||
// all the old members are gone, but the group remains so we don't break any security
|
// all the old members are gone, but the group remains so we don't break any security
|
||||||
// access lists. What we're doing here is reviving the dead group, but old content which
|
// access lists. What we're doing here is reviving the dead group, but old content which
|
||||||
// was restricted to this group may now be seen by the new group members.
|
// was restricted to this group may now be seen by the new group members.
|
||||||
$group = dba::selectOne('group', ['deleted'], ['id' => $gid]);
|
$group = dba::selectFirst('group', ['deleted'], ['id' => $gid]);
|
||||||
if (DBM::is_result($group) && $group['deleted']) {
|
if (DBM::is_result($group) && $group['deleted']) {
|
||||||
dba::update('group', ['deleted' => 0], ['gid' => $gid]);
|
dba::update('group', ['deleted' => 0], ['gid' => $gid]);
|
||||||
notice(t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
|
notice(t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
|
||||||
|
@ -120,7 +120,7 @@ class Group extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = dba::selectOne('group', ['id'], ['uid' => $uid, 'name' => $name]);
|
$group = dba::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
|
||||||
if (DBM::is_result($group)) {
|
if (DBM::is_result($group)) {
|
||||||
return $group['id'];
|
return $group['id'];
|
||||||
}
|
}
|
||||||
|
@ -139,13 +139,13 @@ class Group extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = dba::selectOne('group', ['uid'], ['gid' => $gid]);
|
$group = dba::selectFirst('group', ['uid'], ['gid' => $gid]);
|
||||||
if (!DBM::is_result($group)) {
|
if (!DBM::is_result($group)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove group from default posting lists
|
// remove group from default posting lists
|
||||||
$user = dba::selectOne('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
|
$user = dba::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
|
||||||
if (DBM::is_result($user)) {
|
if (DBM::is_result($user)) {
|
||||||
$change = false;
|
$change = false;
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,14 @@ class Photo
|
||||||
*/
|
*/
|
||||||
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
|
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
|
||||||
{
|
{
|
||||||
$r = dba::selectOne('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
|
$r = dba::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$guid = $r['guid'];
|
$guid = $r['guid'];
|
||||||
} else {
|
} else {
|
||||||
$guid = get_guid();
|
$guid = get_guid();
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = dba::selectOne('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
|
$x = dba::selectFirst('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
|
||||||
|
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
|
@ -88,7 +88,7 @@ class Photo
|
||||||
*/
|
*/
|
||||||
public static function importProfilePhoto($photo, $uid, $cid, $quit_on_error = false)
|
public static function importProfilePhoto($photo, $uid, $cid, $quit_on_error = false)
|
||||||
{
|
{
|
||||||
$r = dba::selectOne(
|
$r = dba::selectFirst(
|
||||||
'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos']
|
'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class User
|
||||||
return $default_group;
|
return $default_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = dba::selectOne('user', ['def_gid'], ['uid' => $uid]);
|
$user = dba::selectFirst('user', ['def_gid'], ['uid' => $uid]);
|
||||||
|
|
||||||
if (DBM::is_result($user)) {
|
if (DBM::is_result($user)) {
|
||||||
$default_group = $user["def_gid"];
|
$default_group = $user["def_gid"];
|
||||||
|
@ -112,7 +112,7 @@ class User
|
||||||
if (is_object($user_info)) {
|
if (is_object($user_info)) {
|
||||||
$user = (array) $user_info;
|
$user = (array) $user_info;
|
||||||
} elseif (is_int($user_info)) {
|
} elseif (is_int($user_info)) {
|
||||||
$user = dba::selectOne('user', ['uid', 'password'],
|
$user = dba::selectFirst('user', ['uid', 'password'],
|
||||||
[
|
[
|
||||||
'uid' => $user_info,
|
'uid' => $user_info,
|
||||||
'blocked' => 0,
|
'blocked' => 0,
|
||||||
|
@ -328,7 +328,7 @@ class User
|
||||||
|
|
||||||
if ($insert_result) {
|
if ($insert_result) {
|
||||||
$uid = dba::lastInsertId();
|
$uid = dba::lastInsertId();
|
||||||
$user = dba::selectOne('user', [], ['uid' => $uid]);
|
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(t('An error occurred during registration. Please try again.'));
|
throw new Exception(t('An error occurred during registration. Please try again.'));
|
||||||
}
|
}
|
||||||
|
@ -530,7 +530,7 @@ class User
|
||||||
|
|
||||||
logger('Removing user: ' . $uid);
|
logger('Removing user: ' . $uid);
|
||||||
|
|
||||||
$user = dba::selectOne('user', [], ['uid' => $uid]);
|
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||||
|
|
||||||
call_hooks('remove_user', $user);
|
call_hooks('remove_user', $user);
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ class Login extends BaseModule
|
||||||
} else {
|
} else {
|
||||||
$user_id = User::authenticate(trim($_POST['username']), trim($_POST['password']));
|
$user_id = User::authenticate(trim($_POST['username']), trim($_POST['password']));
|
||||||
if ($user_id) {
|
if ($user_id) {
|
||||||
$record = dba::selectOne('user', [], ['uid' => $user_id]);
|
$record = dba::selectFirst('user', [], ['uid' => $user_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class Login extends BaseModule
|
||||||
$data = json_decode($_COOKIE["Friendica"]);
|
$data = json_decode($_COOKIE["Friendica"]);
|
||||||
if (isset($data->uid)) {
|
if (isset($data->uid)) {
|
||||||
|
|
||||||
$user = dba::selectOne('user', [],
|
$user = dba::selectFirst('user', [],
|
||||||
[
|
[
|
||||||
'uid' => $data->uid,
|
'uid' => $data->uid,
|
||||||
'blocked' => false,
|
'blocked' => false,
|
||||||
|
@ -196,7 +196,7 @@ class Login extends BaseModule
|
||||||
goaway(self::getApp()->get_baseurl());
|
goaway(self::getApp()->get_baseurl());
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = dba::selectOne('user', [],
|
$user = dba::selectFirst('user', [],
|
||||||
[
|
[
|
||||||
'uid' => $_SESSION['uid'],
|
'uid' => $_SESSION['uid'],
|
||||||
'blocked' => false,
|
'blocked' => false,
|
||||||
|
|
|
@ -40,7 +40,7 @@ class FKOAuth1 extends OAuthServer
|
||||||
{
|
{
|
||||||
logger("FKOAuth1::loginUser $uid");
|
logger("FKOAuth1::loginUser $uid");
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$record = dba::selectOne('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
|
$record = dba::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
|
||||||
|
|
||||||
if (!DBM::is_result($record)) {
|
if (!DBM::is_result($record)) {
|
||||||
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
||||||
|
@ -63,7 +63,7 @@ class FKOAuth1 extends OAuthServer
|
||||||
$a->timezone = $a->user['timezone'];
|
$a->timezone = $a->user['timezone'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = dba::selectOne('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
|
$r = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$a->contact = $r;
|
$a->contact = $r;
|
||||||
|
|
|
@ -88,7 +88,7 @@ class FKOAuthDataStore extends OAuthDataStore
|
||||||
*/
|
*/
|
||||||
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
|
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
|
||||||
{
|
{
|
||||||
$r = dba::selectOne('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
|
$r = dba::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
return new \OAuthToken($r['id'], $r['secret']);
|
return new \OAuthToken($r['id'], $r['secret']);
|
||||||
|
|
|
@ -406,7 +406,7 @@ class Probe
|
||||||
|
|
||||||
$condition = array('nurl' => normalise_link($data["url"]));
|
$condition = array('nurl' => normalise_link($data["url"]));
|
||||||
|
|
||||||
$old_fields = dba::selectOne('gcontact', $fieldnames, $condition);
|
$old_fields = dba::selectFirst('gcontact', $fieldnames, $condition);
|
||||||
|
|
||||||
dba::update('gcontact', $fields, $condition, $old_fields);
|
dba::update('gcontact', $fields, $condition, $old_fields);
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ class Probe
|
||||||
|
|
||||||
$condition = array('nurl' => normalise_link($data["url"]), 'self' => false, 'uid' => 0);
|
$condition = array('nurl' => normalise_link($data["url"]), 'self' => false, 'uid' => 0);
|
||||||
|
|
||||||
$old_fields = dba::selectOne('contact', $fieldnames, $condition);
|
$old_fields = dba::selectFirst('contact', $fieldnames, $condition);
|
||||||
|
|
||||||
dba::update('contact', $fields, $condition, $old_fields);
|
dba::update('contact', $fields, $condition, $old_fields);
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ class Post extends BaseObject
|
||||||
'classundo' => $item['starred'] ? "" : "hidden",
|
'classundo' => $item['starred'] ? "" : "hidden",
|
||||||
'starred' => t('starred'),
|
'starred' => t('starred'),
|
||||||
);
|
);
|
||||||
$r = dba::selectOne('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
|
$r = dba::selectFirst('thread', ['ignored'], ['uid' => $item['uid'], 'iid' => $item['id']]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$ignore = array(
|
$ignore = array(
|
||||||
'do' => t("ignore thread"),
|
'do' => t("ignore thread"),
|
||||||
|
|
|
@ -2015,7 +2015,7 @@ class Diaspora
|
||||||
|
|
||||||
// like on comments have the comment as parent. So we need to fetch the toplevel parent
|
// like on comments have the comment as parent. So we need to fetch the toplevel parent
|
||||||
if ($parent_item["id"] != $parent_item["parent"]) {
|
if ($parent_item["id"] != $parent_item["parent"]) {
|
||||||
$toplevel = dba::selectOne('item', ['origin'], ['id' => $parent_item["parent"]]);
|
$toplevel = dba::selectFirst('item', ['origin'], ['id' => $parent_item["parent"]]);
|
||||||
$origin = $toplevel["origin"];
|
$origin = $toplevel["origin"];
|
||||||
} else {
|
} else {
|
||||||
$origin = $parent_item["origin"];
|
$origin = $parent_item["origin"];
|
||||||
|
@ -2317,7 +2317,7 @@ class Diaspora
|
||||||
|
|
||||||
$arr["last-child"] = 1;
|
$arr["last-child"] = 1;
|
||||||
|
|
||||||
$user = dba::selectOne('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]);
|
$user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]);
|
||||||
|
|
||||||
$arr["allow_cid"] = $user["allow_cid"];
|
$arr["allow_cid"] = $user["allow_cid"];
|
||||||
$arr["allow_gid"] = $user["allow_gid"];
|
$arr["allow_gid"] = $user["allow_gid"];
|
||||||
|
@ -2741,7 +2741,7 @@ class Diaspora
|
||||||
|
|
||||||
while ($item = dba::fetch($r)) {
|
while ($item = dba::fetch($r)) {
|
||||||
// Fetch the parent item
|
// Fetch the parent item
|
||||||
$parent = dba::selectOne('item', ['author-link', 'origin'], ['id' => $item["parent"]]);
|
$parent = dba::selectFirst('item', ['author-link', 'origin'], ['id' => $item["parent"]]);
|
||||||
|
|
||||||
// Only delete it if the parent author really fits
|
// Only delete it if the parent author really fits
|
||||||
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
|
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
|
||||||
|
@ -3255,7 +3255,7 @@ class Diaspora
|
||||||
// If the item belongs to a user, we take this user id.
|
// If the item belongs to a user, we take this user id.
|
||||||
if ($item['uid'] == 0) {
|
if ($item['uid'] == 0) {
|
||||||
$condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
|
$condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
|
||||||
$first_user = dba::selectOne('user', ['uid'], $condition);
|
$first_user = dba::selectFirst('user', ['uid'], $condition);
|
||||||
$owner = User::getOwnerDataById($first_user['uid']);
|
$owner = User::getOwnerDataById($first_user['uid']);
|
||||||
} else {
|
} else {
|
||||||
$owner = User::getOwnerDataById($item['uid']);
|
$owner = User::getOwnerDataById($item['uid']);
|
||||||
|
|
|
@ -254,7 +254,7 @@ class Feed {
|
||||||
if (!$simulate) {
|
if (!$simulate) {
|
||||||
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
|
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
|
||||||
$importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
|
$importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
|
||||||
$previous = dba::selectOne('item', ['id'], $condition);
|
$previous = dba::selectFirst('item', ['id'], $condition);
|
||||||
if (DBM::is_result($previous)) {
|
if (DBM::is_result($previous)) {
|
||||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
|
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -72,7 +72,7 @@ class OStatus
|
||||||
if ($aliaslink != '') {
|
if ($aliaslink != '') {
|
||||||
$condition = ["`uid` = ? AND `alias` = ? AND `network` != ?",
|
$condition = ["`uid` = ? AND `alias` = ? AND `network` != ?",
|
||||||
$importer["uid"], $aliaslink, NETWORK_STATUSNET];
|
$importer["uid"], $aliaslink, NETWORK_STATUSNET];
|
||||||
$r = dba::selectOne('contact', [], $condition);
|
$r = dba::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
@ -91,7 +91,7 @@ class OStatus
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `nurl` IN (?, ?) AND `network` != ?", $importer["uid"],
|
$condition = ["`uid` = ? AND `nurl` IN (?, ?) AND `network` != ?", $importer["uid"],
|
||||||
normalise_link($author["author-link"]), normalise_link($aliaslink), NETWORK_STATUSNET];
|
normalise_link($author["author-link"]), normalise_link($aliaslink), NETWORK_STATUSNET];
|
||||||
$r = dba::selectOne('contact', [], $condition);
|
$r = dba::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
@ -106,7 +106,7 @@ class OStatus
|
||||||
if (!$found && ($addr != "")) {
|
if (!$found && ($addr != "")) {
|
||||||
$condition = ["`uid` = ? AND `addr` = ? AND `network` != ?",
|
$condition = ["`uid` = ? AND `addr` = ? AND `network` != ?",
|
||||||
$importer["uid"], $addr, NETWORK_STATUSNET];
|
$importer["uid"], $addr, NETWORK_STATUSNET];
|
||||||
$r = dba::selectOne('contact', [], $condition);
|
$r = dba::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
@ -208,7 +208,7 @@ class OStatus
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
|
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
|
||||||
$old_contact = dba::selectOne('contact', $fields, ['id' => $cid]);
|
$old_contact = dba::selectFirst('contact', $fields, ['id' => $cid]);
|
||||||
|
|
||||||
// Update it with the current values
|
// Update it with the current values
|
||||||
$fields = array('url' => $author["author-link"], 'name' => $contact["name"],
|
$fields = array('url' => $author["author-link"], 'name' => $contact["name"],
|
||||||
|
@ -542,7 +542,7 @@ class OStatus
|
||||||
private static function deleteNotice($item)
|
private static function deleteNotice($item)
|
||||||
{
|
{
|
||||||
$condition = ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'uri' => $item['uri']];
|
$condition = ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'uri' => $item['uri']];
|
||||||
$deleted = dba::selectOne('item', ['id', 'parent-uri'], $condition);
|
$deleted = dba::selectFirst('item', ['id', 'parent-uri'], $condition);
|
||||||
if (!DBM::is_result($deleted)) {
|
if (!DBM::is_result($deleted)) {
|
||||||
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it. ");
|
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it. ");
|
||||||
return;
|
return;
|
||||||
|
@ -896,7 +896,7 @@ class OStatus
|
||||||
private static function fetchRelated($related, $related_uri, $importer)
|
private static function fetchRelated($related, $related_uri, $importer)
|
||||||
{
|
{
|
||||||
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
|
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $related_uri, PROTOCOL_DFRN, PROTOCOL_OSTATUS_SALMON];
|
||||||
$conversation = dba::selectOne('conversation', ['source', 'protocol'], $condition);
|
$conversation = dba::selectFirst('conversation', ['source', 'protocol'], $condition);
|
||||||
if (DBM::is_result($conversation)) {
|
if (DBM::is_result($conversation)) {
|
||||||
$stored = true;
|
$stored = true;
|
||||||
$xml = $conversation['source'];
|
$xml = $conversation['source'];
|
||||||
|
@ -976,7 +976,7 @@ class OStatus
|
||||||
// Finally we take the data that we fetched from "ostatus:conversation"
|
// Finally we take the data that we fetched from "ostatus:conversation"
|
||||||
if ($xml == '') {
|
if ($xml == '') {
|
||||||
$condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
|
$condition = ['item-uri' => $related_uri, 'protocol' => PROTOCOL_SPLITTED_CONV];
|
||||||
$conversation = dba::selectOne('conversation', ['source'], $condition);
|
$conversation = dba::selectFirst('conversation', ['source'], $condition);
|
||||||
if (DBM::is_result($conversation)) {
|
if (DBM::is_result($conversation)) {
|
||||||
$stored = true;
|
$stored = true;
|
||||||
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
|
logger('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
|
||||||
|
|
|
@ -66,7 +66,7 @@ class PortableContact
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
if (!$url || !$uid) {
|
if (!$url || !$uid) {
|
||||||
$r = dba::selectOne('contact', ['poco', 'uid'], ['id' => $cid]);
|
$r = dba::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$url = $r['poco'];
|
$url = $r['poco'];
|
||||||
$uid = $r['uid'];
|
$uid = $r['uid'];
|
||||||
|
@ -813,7 +813,7 @@ class PortableContact
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$servers = dba::selectOne('gserver', [], ['nurl' => normalise_link($server_url)]);
|
$servers = dba::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||||
if (DBM::is_result($servers)) {
|
if (DBM::is_result($servers)) {
|
||||||
if ($servers["created"] <= NULL_DATE) {
|
if ($servers["created"] <= NULL_DATE) {
|
||||||
$fields = ['created' => datetime_convert()];
|
$fields = ['created' => datetime_convert()];
|
||||||
|
|
|
@ -226,7 +226,7 @@ class ExAuth
|
||||||
if ($a->get_hostname() == $aCommand[2]) {
|
if ($a->get_hostname() == $aCommand[2]) {
|
||||||
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
|
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
|
||||||
|
|
||||||
$aUser = dba::selectOne('user', ['uid', 'password'], ['nickname' => $sUser]);
|
$aUser = dba::selectFirst('user', ['uid', 'password'], ['nickname' => $sUser]);
|
||||||
if (DBM::is_result($aUser)) {
|
if (DBM::is_result($aUser)) {
|
||||||
$uid = $aUser['uid'];
|
$uid = $aUser['uid'];
|
||||||
$success = User::authenticate($aUser, $aCommand[3]);
|
$success = User::authenticate($aUser, $aCommand[3]);
|
||||||
|
|
|
@ -126,7 +126,7 @@ class Lock
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dba::lock('locks');
|
dba::lock('locks');
|
||||||
$lock = dba::selectOne('locks', ['locked', 'pid'], ['name' => $fn_name]);
|
$lock = dba::selectFirst('locks', ['locked', 'pid'], ['name' => $fn_name]);
|
||||||
|
|
||||||
if (DBM::is_result($lock)) {
|
if (DBM::is_result($lock)) {
|
||||||
if ($lock['locked']) {
|
if ($lock['locked']) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Expire {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} elseif (intval($param) > 0) {
|
} elseif (intval($param) > 0) {
|
||||||
$user = dba::selectOne('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
$user = dba::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
|
||||||
if (DBM::is_result($user)) {
|
if (DBM::is_result($user)) {
|
||||||
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
|
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
|
||||||
item_expire($user['uid'], $user['expire']);
|
item_expire($user['uid'], $user['expire']);
|
||||||
|
|
|
@ -267,7 +267,7 @@ class Notifier {
|
||||||
|
|
||||||
$fields = ['forum', 'prv'];
|
$fields = ['forum', 'prv'];
|
||||||
$condition = ['id' => $target_item['contact-id']];
|
$condition = ['id' => $target_item['contact-id']];
|
||||||
$contact = dba::selectOne('contact', $fields, $condition);
|
$contact = dba::selectFirst('contact', $fields, $condition);
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
// Should never happen
|
// Should never happen
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -42,7 +42,7 @@ Class OnePoll
|
||||||
|
|
||||||
$d = datetime_convert();
|
$d = datetime_convert();
|
||||||
|
|
||||||
$contact = dba::selectOne('contact', [], ['id' => $contact_id]);
|
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
logger('Contact not found or cannot be used.');
|
logger('Contact not found or cannot be used.');
|
||||||
return;
|
return;
|
||||||
|
@ -339,10 +339,10 @@ Class OnePoll
|
||||||
logger("Mail: Enabled", LOGGER_DEBUG);
|
logger("Mail: Enabled", LOGGER_DEBUG);
|
||||||
|
|
||||||
$mbox = null;
|
$mbox = null;
|
||||||
$user = dba::selectOne('user', ['prvkey'], ['uid' => $importer_uid]);
|
$user = dba::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
|
||||||
|
|
||||||
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
|
$condition = ["`server` != '' AND `uid` = ?", $importer_uid];
|
||||||
$mailconf = dba::selectOne('mailacct', [], $condition);
|
$mailconf = dba::selectFirst('mailacct', [], $condition);
|
||||||
if (DBM::is_result($user) && DBM::is_result($mailconf)) {
|
if (DBM::is_result($user) && DBM::is_result($mailconf)) {
|
||||||
$mailbox = Email::constructMailboxName($mailconf);
|
$mailbox = Email::constructMailboxName($mailconf);
|
||||||
$password = '';
|
$password = '';
|
||||||
|
@ -384,7 +384,7 @@ Class OnePoll
|
||||||
// Have we seen it before?
|
// Have we seen it before?
|
||||||
$fields = ['deleted', 'id'];
|
$fields = ['deleted', 'id'];
|
||||||
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
|
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
|
||||||
$r = dba::selectOne('item', $fields, $condition);
|
$r = dba::selectFirst('item', $fields, $condition);
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
|
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Queue
|
||||||
|
|
||||||
$q_item = $r[0];
|
$q_item = $r[0];
|
||||||
|
|
||||||
$contact = dba::selectOne('contact', [], ['id' => $q_item['cid']]);
|
$contact = dba::selectFirst('contact', [], ['id' => $q_item['cid']]);
|
||||||
if (!DBM::is_result($contact)) {
|
if (!DBM::is_result($contact)) {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
return;
|
return;
|
||||||
|
@ -113,7 +113,7 @@ class Queue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = dba::selectOne('user', [], ['uid' => $contact['uid']]);
|
$user = dba::selectFirst('user', [], ['uid' => $contact['uid']]);
|
||||||
if (!DBM::is_result($user)) {
|
if (!DBM::is_result($user)) {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -57,7 +57,7 @@ if (in_array($net['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$nurl = normalise_link($net['url']);
|
$nurl = normalise_link($net['url']);
|
||||||
$r = dba::selectOne("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
$r = dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
dba::update("contact", array("hidden" => true), array("id" => $r["id"]));
|
dba::update("contact", array("hidden" => true), array("id" => $r["id"]));
|
||||||
echo "NOTICE: The account should be silenced from the global community page\r\n";
|
echo "NOTICE: The account should be silenced from the global community page\r\n";
|
||||||
|
|
Loading…
Reference in a new issue