Fix several notices
authorMichael <heluecht@pirati.ca>
Tue, 29 Dec 2020 21:38:23 +0000 (21:38 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 29 Dec 2020 21:38:23 +0000 (21:38 +0000)
mod/cal.php
mod/message.php
src/Model/Event.php

index 1ac11dc..2992f29 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 use Friendica\App;
-use Friendica\Content\Feature;
 use Friendica\Content\Nav;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Widget;
@@ -69,7 +68,6 @@ function cal_init(App $a)
        }
 
        $a->profile = Profile::getByNickname($nick, $a->profile_uid);
-
        if (empty($a->profile)) {
                throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
        }
@@ -131,6 +129,9 @@ function cal_content(App $a)
        // Setup permissions structures
        $owner_uid = intval($a->data['user']['uid']);
        $nick = $a->data['user']['nickname'];
+       if (empty($a->profile)) {
+               throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+       }
 
        $contact_id = Session::getRemoteContactID($a->profile['uid']);
 
index 7a8b133..f12f540 100644 (file)
@@ -332,7 +332,7 @@ function message_content(App $a)
                                'id' => $message['id'],
                                'from_name' => $from_name_e,
                                'from_url' => $from_url,
-                               'from_addr' => $contact['addr'],
+                               'from_addr' => $contact['addr'] ?? $from_url,
                                'sparkle' => $sparkle,
                                'from_photo' => $from_photo,
                                'subject' => $subject_e,
index 5139abc..2b4932b 100644 (file)
@@ -291,6 +291,9 @@ class Event
                }
 
                $contact = DBA::selectFirst('contact', [], $conditions);
+               if (!DBA::isResult($contact)) {
+                       Logger::warning('Contact not found', ['condition' => $conditions]);
+               }
 
                // Existing event being modified.
                if ($event['id']) {