]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_request.php
Fixed class name
[friendica.git] / mod / dfrn_request.php
index eb323c24821ac41af751d57cdd29075a94ab4a17..bd72813b8ae71b2bab1c3e158dd596cb015d9cce 100644 (file)
@@ -29,13 +29,13 @@ use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Core\Search;
-use Friendica\Core\System;
 use Friendica\Core\Session;
+use Friendica\Core\System;
 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\Profile;
 use Friendica\Model\User;
 use Friendica\Module\Security\Login;
@@ -189,7 +189,7 @@ function dfrn_request_post(App $a)
                                        Group::addMember(User::getDefaultGroup(local_user(), $r[0]["network"]), $r[0]['id']);
 
                                        if (isset($photo)) {
-                                               Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
+                                               Contact::updateAvatar($r[0]["id"], $photo, true);
                                        }
 
                                        $forward_path = "contact/" . $r[0]['id'];
@@ -203,7 +203,7 @@ function dfrn_request_post(App $a)
                                }
 
                                if (!empty($dfrn_request) && strlen($confirm_key)) {
-                                       Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
+                                       DI::httpRequest()->fetch($dfrn_request . '?confirm_key=' . $confirm_key);
                                }
 
                                // (ignore reply, nothing we can do it failed)
@@ -298,7 +298,7 @@ function dfrn_request_post(App $a)
                $network = $data["network"];
 
                // Canonicalize email-style profile locator
-               $url = Probe::webfingerDfrn($data['url'], $hcard);
+               $url = Probe::webfingerDfrn($data['url'] ?? $url, $hcard);
 
                if (substr($url, 0, 5) === 'stat:') {
                        // Every time we detect the remote subscription we define this as OStatus.
@@ -420,7 +420,7 @@ function dfrn_request_post(App $a)
                                        );
                                        if (DBA::isResult($r)) {
                                                $contact_record = $r[0];
-                                               Contact::updateAvatar($photo, $uid, $contact_record["id"], true);
+                                               Contact::updateAvatar($contact_record["id"], $photo, true);
                                        }
                                }
                        }
@@ -559,18 +559,12 @@ function dfrn_request_content(App $a)
 
                                if (!$auto_confirm) {
                                        notification([
-                                               'type'         => Type::INTRO,
-                                               'notify_flags' => $r[0]['notify-flags'],
-                                               'language'     => $r[0]['language'],
-                                               'to_name'      => $r[0]['username'],
-                                               'to_email'     => $r[0]['email'],
-                                               'uid'          => $r[0]['uid'],
-                                               'link'         => DI::baseUrl() . '/notifications/intros',
-                                               'source_name'  => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : DI::l10n()->t('[Name Withheld]')),
-                                               'source_link'  => $r[0]['url'],
-                                               'source_photo' => $r[0]['photo'],
-                                               'verb'         => Activity::REQ_FRIEND,
-                                               'otype'        => 'intro'
+                                               'type'  => Notification\Type::INTRO,
+                                               'otype' => Notification\ObjectType::INTRO,
+                                               'verb'  => Activity::REQ_FRIEND,
+                                               'uid'   => $r[0]['uid'],
+                                               'cid'   => $r[0]['id'],
+                                               'link'  => DI::baseUrl() . '/notifications/intros',
                                        ]);
                                }