diff --git a/mod/ping.php b/mod/ping.php index 1634ed725d..df6793f3c6 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -342,7 +342,7 @@ function ping_init(App $a) array_walk($notifications, function (&$notification) { if (empty($notification['photo'])) { $contact = Contact::getByURL($notification['url'], false, ['micro', 'id', 'avatar']); - $notification['photo'] = Contact::getMicro($contact, $notif['photo']); + $notification['photo'] = Contact::getMicro($contact, $notification['photo']); } $notification['timestamp'] = DateTimeFormat::local($notification['date']); diff --git a/src/Model/Profile.php b/src/Model/Profile.php index b56df5bc5f..c5652c6f7a 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -166,7 +166,7 @@ class Profile } } - $profile = User::getOwnerDataById($user['uid'], false); + $profile = !empty($user['uid']) ? User::getOwnerDataById($user['uid'], false) : []; if (empty($profile) && empty($profiledata)) { Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); diff --git a/src/Model/User.php b/src/Model/User.php index 2b70189505..76408df812 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -264,7 +264,7 @@ class User */ public static function getById($uid, array $fields = []) { - return DBA::selectFirst('user', $fields, ['uid' => $uid]); + return !empty($uid) ? DBA::selectFirst('user', $fields, ['uid' => $uid]) : []; } /** diff --git a/src/Security/FKOAuth1.php b/src/Security/FKOAuth1.php index df6b38a171..d7549a1e7c 100644 --- a/src/Security/FKOAuth1.php +++ b/src/Security/FKOAuth1.php @@ -55,7 +55,7 @@ class FKOAuth1 extends OAuthServer $a = DI::app(); $record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]); - if (!DBA::isResult($record)) { + if (!DBA::isResult($record) || empty($uid)) { Logger::info('FKOAuth1::loginUser failure', ['server' => $_SERVER]); header('HTTP/1.0 401 Unauthorized'); die('This api requires login');