mirror of
https://github.com/friendica/friendica
synced 2025-04-27 10:30:10 +00:00
Improve dba::selectFirst calls
- Fix remaining $r[0] references - Rename $r to meaningful names
This commit is contained in:
parent
465e1d6a5c
commit
5fc4927764
29 changed files with 228 additions and 250 deletions
|
@ -968,10 +968,15 @@ function best_link_url($item, &$sparkle, $url = '') {
|
|||
$clean_url = normalise_link($item['author-link']);
|
||||
|
||||
if (local_user()) {
|
||||
$r = dba::selectFirst('contact', ['id'],
|
||||
['network' => NETWORK_DFRN, 'uid' => local_user(), 'nurl' => normalise_link($clean_url), 'pending' => false]);
|
||||
if (DBM::is_result($r)) {
|
||||
$best_url = 'redir/' . $r['id'];
|
||||
$condition = [
|
||||
'network' => NETWORK_DFRN,
|
||||
'uid' => local_user(),
|
||||
'nurl' => normalise_link($clean_url),
|
||||
'pending' => false
|
||||
];
|
||||
$contact = dba::selectFirst('contact', ['id'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
$best_url = 'redir/' . $contact['id'];
|
||||
$sparkle = true;
|
||||
if ($url != '') {
|
||||
$hostname = get_app()->get_hostname();
|
||||
|
@ -1019,11 +1024,12 @@ function item_photo_menu($item) {
|
|||
$cid = 0;
|
||||
$network = '';
|
||||
$rel = 0;
|
||||
$r = dba::selectFirst('contact', array('id', 'network', 'rel'), array('uid' => local_user(), 'nurl' => normalise_link($item['author-link'])));
|
||||
if (DBM::is_result($r)) {
|
||||
$cid = $r['id'];
|
||||
$network = $r['network'];
|
||||
$rel = $r['rel'];
|
||||
$condition = ['uid' => local_user(), 'nurl' => normalise_link($item['author-link'])];
|
||||
$contact = dba::selectFirst('contact', ['id', 'network', 'rel'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
$cid = $contact['id'];
|
||||
$network = $contact['network'];
|
||||
$rel = $contact['rel'];
|
||||
}
|
||||
|
||||
if ($sparkle) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue