From 1793513f463973587caa517db77a3ab83f3b9cde Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 25 Jul 2021 07:04:48 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- mod/display.php | 19 ++++++++++--------- mod/photos.php | 2 +- src/Module/Delegation.php | 2 +- src/Module/Magic.php | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mod/display.php b/mod/display.php index 6b30391d65..c0e72837af 100644 --- a/mod/display.php +++ b/mod/display.php @@ -122,15 +122,16 @@ function display_fetchauthor($item) // Check for a repeated message $shared = Item::getShareArray($item); if (!empty($shared) && empty($shared['comment'])) { - $profiledata = []; - $profiledata['uid'] = -1; - $profiledata['id'] = -1; - $profiledata['nickname'] = ''; - $profiledata['name'] = ''; - $profiledata['picdate'] = ''; - $profiledata['photo'] = ''; - $profiledata['url'] = ''; - $profiledata['network'] = ''; + $profiledata = [ + 'uid' => -1, + 'id' => -1, + 'nickname' => '', + 'name' => '', + 'picdate' => '', + 'photo' => '', + 'url' => '', + 'network' => '', + ]; if (!empty($shared['author'])) { $profiledata['name'] = $shared['author']; diff --git a/mod/photos.php b/mod/photos.php index e4b0dcf4ed..d55541680a 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1624,7 +1624,7 @@ function photos_content(App $a) $o .= Renderer::replaceMacros($tpl, [ '$title' => DI::l10n()->t('Recent Photos'), '$can_post' => $can_post, - '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/'.$user['nickname'].'/upload'], + '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $user['nickname'] . '/upload'], '$photos' => $photos, '$paginate' => $pager->renderFull($total), ]); diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index 201f38990c..e50fb7d5f3 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -118,7 +118,7 @@ class Delegation extends BaseModule throw new ForbiddenException(DI::l10n()->t('Permission denied.')); } - $identities = User::identities(DI::session()->get('submanage') ?: local_user()); + $identities = User::identities(DI::session()->get('submanage', local_user())); //getting additinal information for each identity foreach ($identities as $key => $identity) { diff --git a/src/Module/Magic.php b/src/Module/Magic.php index 5b4676dd56..cbd629fd3c 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -65,7 +65,7 @@ class Magic extends BaseModule $contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]); // Redirect if the contact is already authenticated on this site. - if (!empty($a->getContactId()) && strpos($contact['nurl'], Strings::normaliseLink(DI::baseUrl()->get())) !== false) { + if ($a->getContactId() && strpos($contact['nurl'], Strings::normaliseLink(DI::baseUrl()->get())) !== false) { if ($test) { $ret['success'] = true; $ret['message'] .= 'Local site - you are already authenticated.' . EOL;