X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FMail.php;h=b2e9e1a48734770b4b2ec5a0b9fcf05287eb0eda;hb=dad58e0f6fdff5e1ff8a002bb31119a38f08268b;hp=d5105ac21ce118a05bdb752dcf14b686020172f1;hpb=753996c86f0ddc3aa54c3fbd52a66626d89933aa;p=friendica.git diff --git a/src/Model/Mail.php b/src/Model/Mail.php index d5105ac21c..b2e9e1a487 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -1,17 +1,19 @@ local_user(), 'self' => true]); @@ -67,10 +69,10 @@ class Mail if (!$convid) { // create a new conversation - $recip_host = substr($contact[0]['url'], strpos($contact[0]['url'], '://') + 3); + $recip_host = substr($contact['url'], strpos($contact['url'], '://') + 3); $recip_host = substr($recip_host, 0, strpos($recip_host, '/')); - $recip_handle = (($contact[0]['addr']) ? $contact[0]['addr'] : $contact[0]['nick'] . '@' . $recip_host); + $recip_handle = (($contact['addr']) ? $contact['addr'] : $contact['nick'] . '@' . $recip_host); $sender_handle = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $conv_guid = get_guid(32); @@ -79,7 +81,7 @@ class Mail $handles = $recip_handle . ';' . $sender_handle; $fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $sender_handle, - 'created' => datetime_convert(), 'updated' => datetime_convert(), + 'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(), 'subject' => $subject, 'recips' => $handles]; if (dba::insert('conv', $fields)) { $convid = dba::lastInsertId(); @@ -102,18 +104,18 @@ class Mail 'uid' => local_user(), 'guid' => $guid, 'convid' => $convid, - 'from-name' => $me[0]['name'], - 'from-photo' => $me[0]['thumb'], - 'from-url' => $me[0]['url'], + 'from-name' => $me['name'], + 'from-photo' => $me['thumb'], + 'from-url' => $me['url'], 'contact-id' => $recipient, 'title' => $subject, 'body' => $body, - 'seen' => true, + 'seen' => 1, 'reply' => $reply, - 'replied' => false, + 'replied' => 0, 'uri' => $uri, 'parent-uri' => $replyto, - 'created' => datetime_convert() + 'created' => DateTimeFormat::utcNow() ] ); @@ -168,7 +170,7 @@ class Mail } if (!strlen($subject)) { - $subject = t('[no subject]'); + $subject = L10n::t('[no subject]'); } $guid = get_guid(32); @@ -193,12 +195,12 @@ class Mail $convid = null; $fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle, - 'created' => datetime_convert(), 'updated' => datetime_convert(), + 'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(), 'subject' => $subject, 'recips' => $handles]; if (dba::insert('conv', $fields)) { $convid = dba::lastInsertId(); } - + if (!$convid) { logger('send message: conversation not found.'); return -4; @@ -216,13 +218,13 @@ class Mail 'contact-id' => 0, 'title' => $subject, 'body' => $body, - 'seen' => false, - 'reply' => false, - 'replied' => false, + 'seen' => 0, + 'reply' => 0, + 'replied' => 0, 'uri' => $uri, 'parent-uri' => $replyto, - 'created' => datetime_convert(), - 'unknown' => true + 'created' => DateTimeFormat::utcNow(), + 'unknown' => 1 ] );