X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FMail.php;h=e624a6f9758e120fb572f927f767134c49fc981a;hb=21f172c585aff8c606774a05fde1548ddff1667d;hp=afe3a3227ae620f1a80001cb8698f3191c98356a;hpb=d87963d8a187cdef420a8029ca4da7e56a38d94c;p=friendica.git diff --git a/src/Model/Mail.php b/src/Model/Mail.php index afe3a3227a..e624a6f975 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -1,6 +1,6 @@ t('[no subject]'); } - $me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]); + $me = DBA::selectFirst('contact', [], ['uid' => DI::userSession()->getLocalUserId(), 'self' => true]); if (!DBA::isResult($me)) { return -2; } - $contacts = ACL::getValidMessageRecipientsForUser(local_user()); + $contacts = ACL::getValidMessageRecipientsForUser(DI::userSession()->getLocalUserId()); $contactIndex = array_search($recipient, array_column($contacts, 'id')); if ($contactIndex === false) { @@ -151,7 +150,7 @@ class Mail $contact = $contacts[$contactIndex]; - Photo::setPermissionFromBody($body, local_user(), $me['id'], '<' . $contact['id'] . '>', '', '', ''); + Photo::setPermissionFromBody($body, DI::userSession()->getLocalUserId(), $me['id'], '<' . $contact['id'] . '>', '', '', ''); $guid = System::createUUID(); $uri = Item::newURI($guid); @@ -164,7 +163,7 @@ class Mail if (strlen($replyto)) { $reply = true; $condition = ["`uid` = ? AND (`uri` = ? OR `parent-uri` = ?)", - local_user(), $replyto, $replyto]; + DI::userSession()->getLocalUserId(), $replyto, $replyto]; $mail = DBA::selectFirst('mail', ['convid'], $condition); if (DBA::isResult($mail)) { $convid = $mail['convid']; @@ -177,7 +176,7 @@ class Mail $conv_guid = System::createUUID(); $convuri = $contact['addr'] . ':' . $conv_guid; - $fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $me['addr'], + $fields = ['uid' => DI::userSession()->getLocalUserId(), 'guid' => $conv_guid, 'creator' => $me['addr'], 'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(), 'subject' => $subject, 'recips' => $contact['addr'] . ';' . $me['addr']]; if (DBA::insert('conv', $fields)) { @@ -186,7 +185,7 @@ class Mail } if (!$convid) { - Logger::notice('send message: conversation not found.'); + Logger::warning('conversation not found.'); return -4; } @@ -196,7 +195,7 @@ class Mail $post_id = self::insert( [ - 'uid' => local_user(), + 'uid' => DI::userSession()->getLocalUserId(), 'guid' => $guid, 'convid' => $convid, 'from-name' => $me['name'], @@ -232,14 +231,14 @@ class Mail foreach ($images as $image) { $image_rid = Photo::ridFromURI($image); if (!empty($image_rid)) { - Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => local_user()]); + Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => DI::userSession()->getLocalUserId()]); } } } } if ($post_id) { - Worker::add(PRIORITY_HIGH, "Notifier", Delivery::MAIL, $post_id); + Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::MAIL, $post_id); return intval($post_id); } else { return -3; @@ -290,7 +289,7 @@ class Mail } if (!$convid) { - Logger::notice('send message: conversation not found.'); + Logger::warning('conversation not found.'); return -4; }