]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_confirm.php
Merge pull request #10300 from annando/issue-10264
[friendica.git] / mod / dfrn_confirm.php
index e909428d1e862e738d3cfd8ed1146b7887ed3d72..47cc09326f7101ecedccf675ab4aa23d2f0bd299 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -40,7 +40,7 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
-use Friendica\Model\Notify\Type;
+use Friendica\Model\Notification;
 use Friendica\Model\User;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
@@ -181,7 +181,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                 * random key which is encrypted with their site public key.
                 */
 
-               $src_aes_key = openssl_random_pseudo_bytes(64);
+               $src_aes_key = random_bytes(64);
 
                $result = '';
                openssl_private_encrypt($dfrn_id, $result, $user['prvkey']);
@@ -539,21 +539,15 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                if (DBA::isResult($r)) {
                        $combined = $r[0];
 
-                       if ($combined['notify-flags'] & Type::CONFIRM) {
+                       if ($combined['notify-flags'] & Notification\Type::CONFIRM) {
                                $mutual = ($new_relation == Contact::FRIEND);
                                notification([
-                                       'type'         => Type::CONFIRM,
-                                       'notify_flags' => $combined['notify-flags'],
-                                       'language'     => $combined['language'],
-                                       'to_name'      => $combined['username'],
-                                       'to_email'     => $combined['email'],
-                                       'uid'          => $combined['uid'],
-                                       'link'         => DI::baseUrl() . '/contact/' . $dfrn_record,
-                                       'source_name'  => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : DI::l10n()->t('[Name Withheld]')),
-                                       'source_link'  => $combined['url'],
-                                       'source_photo' => $combined['photo'],
-                                       'verb'         => ($mutual ? Activity::FRIEND : Activity::FOLLOW),
-                                       'otype'        => 'intro'
+                                       'type'  => Notification\Type::CONFIRM,
+                                       'otype' => Notification\ObjectType::INTRO,
+                                       'verb'  => ($mutual ? Activity::FRIEND : Activity::FOLLOW),
+                                       'uid'   => $combined['uid'],
+                                       'cid'   => $combined['id'],
+                                       'link'  => DI::baseUrl() . '/contact/' . $dfrn_record,
                                ]);
                        }
                }