Merge pull request #9721 from annando/notices

Fix several notices
This commit is contained in:
Hypolite Petovan 2020-12-30 09:20:59 -05:00 committed by GitHub
commit 934f69a426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View file

@ -24,7 +24,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Widget; use Friendica\Content\Widget;
@ -69,7 +68,6 @@ function cal_init(App $a)
} }
$a->profile = Profile::getByNickname($nick, $a->profile_uid); $a->profile = Profile::getByNickname($nick, $a->profile_uid);
if (empty($a->profile)) { if (empty($a->profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -131,6 +129,9 @@ function cal_content(App $a)
// Setup permissions structures // Setup permissions structures
$owner_uid = intval($a->data['user']['uid']); $owner_uid = intval($a->data['user']['uid']);
$nick = $a->data['user']['nickname']; $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']); $contact_id = Session::getRemoteContactID($a->profile['uid']);

View file

@ -30,6 +30,7 @@ use Friendica\Core\Theme;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Event; use Friendica\Model\Event;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\User; use Friendica\Model\User;
@ -129,7 +130,7 @@ function events_post(App $a)
]; ];
$action = ($event_id == '') ? 'new' : 'event/' . $event_id; $action = ($event_id == '') ? 'new' : 'event/' . $event_id;
$onerror_path = 'events/' . $action . '?' . http_build_query($params, null, null, PHP_QUERY_RFC3986); $onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
if (strcmp($finish, $start) < 0 && !$nofinish) { if (strcmp($finish, $start) < 0 && !$nofinish) {
notice(DI::l10n()->t('Event can not end before it has started.')); notice(DI::l10n()->t('Event can not end before it has started.'));

View file

@ -332,7 +332,7 @@ function message_content(App $a)
'id' => $message['id'], 'id' => $message['id'],
'from_name' => $from_name_e, 'from_name' => $from_name_e,
'from_url' => $from_url, 'from_url' => $from_url,
'from_addr' => $contact['addr'], 'from_addr' => $contact['addr'] ?? $from_url,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'from_photo' => $from_photo, 'from_photo' => $from_photo,
'subject' => $subject_e, 'subject' => $subject_e,

View file

@ -291,6 +291,9 @@ class Event
} }
$contact = DBA::selectFirst('contact', [], $conditions); $contact = DBA::selectFirst('contact', [], $conditions);
if (!DBA::isResult($contact)) {
Logger::warning('Contact not found', ['condition' => $conditions, 'callstack' => System::callstack(20)]);
}
// Existing event being modified. // Existing event being modified.
if ($event['id']) { if ($event['id']) {