]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact.php
Meaningful notification message
[friendica.git] / src / Module / Contact.php
index 6aa602af2f0d65ced426e109a81f5469c2af648b..ae7c77d9927b0b23dc6a692529592dbacc3db774 100644 (file)
@@ -27,7 +27,6 @@ use Friendica\Content\Nav;
 use Friendica\Content\Pager;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Widget;
-use Friendica\Core\ACL;
 use Friendica\Core\Hook;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
@@ -106,13 +105,13 @@ class Contact extends BaseModule
                }
 
                // @TODO: Replace with parameter from router
-               if ($a->argv[1] === 'batch') {
+               if (DI::args()->getArgv()[1] === 'batch') {
                        self::batchActions();
                        return;
                }
 
                // @TODO: Replace with parameter from router
-               $contact_id = intval($a->argv[1]);
+               $contact_id = intval(DI::args()->getArgv()[1]);
                if (!$contact_id) {
                        return;
                }
@@ -169,8 +168,7 @@ class Contact extends BaseModule
                }
 
                if ($contact['network'] == Protocol::OSTATUS) {
-                       $user = Model\User::getById($contact['uid']);
-                       $result = Model\Contact::createFromProbe($user, $contact['url'], false, $contact['network']);
+                       $result = Model\Contact::createFromProbeForUser($contact['uid'], $contact['url'], $contact['network']);
 
                        if ($result['success']) {
                                DBA::update('contact', ['subhub' => 1], ['id' => $contact_id]);
@@ -271,10 +269,10 @@ class Contact extends BaseModule
 
                $contact = null;
                // @TODO: Replace with parameter from router
-               if ($a->argc == 2 && intval($a->argv[1])
-                       || $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
+               if (DI::args()->getArgc() == 2 && intval(DI::args()->getArgv()[1])
+                       || DI::args()->getArgc() == 3 && intval(DI::args()->getArgv()[1]) && in_array(DI::args()->getArgv()[2], ['posts', 'conversations'])
                ) {
-                       $contact_id = intval($a->argv[1]);
+                       $contact_id = intval(DI::args()->getArgv()[1]);
 
                        // Ensure to use the user contact when the public contact was provided
                        $data = Model\Contact::getPublicAndUserContactID($contact_id, local_user());
@@ -293,7 +291,7 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        if ($contact['self']) {
                                // @TODO: Replace with parameter from router
-                               if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
+                               if ((DI::args()->getArgc() == 3) && intval(DI::args()->getArgv()[1]) && in_array(DI::args()->getArgv()[2], ['posts', 'conversations'])) {
                                        DI::baseUrl()->redirect('profile/' . $contact['nick']);
                                } else {
                                        DI::baseUrl()->redirect('profile/' . $contact['nick'] . '/profile');
@@ -343,14 +341,14 @@ class Contact extends BaseModule
                        return Login::form();
                }
 
-               if ($a->argc == 3) {
-                       $contact_id = intval($a->argv[1]);
+               if (DI::args()->getArgc() == 3) {
+                       $contact_id = intval(DI::args()->getArgv()[1]);
                        if (!$contact_id) {
                                throw new BadRequestException();
                        }
 
                        // @TODO: Replace with parameter from router
-                       $cmd = $a->argv[2];
+                       $cmd = DI::args()->getArgv()[2];
 
                        $orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false, 'deleted' => false]);
                        if (!DBA::isResult($orig_record)) {
@@ -609,6 +607,8 @@ class Contact extends BaseModule
                                '$location_label' => DI::l10n()->t('Location:'),
                                '$xmpp'           => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['xmpp']),
                                '$xmpp_label'     => DI::l10n()->t('XMPP:'),
+                               '$matrix'         => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['matrix']),
+                               '$matrix_label'   => DI::l10n()->t('Matrix:'),
                                '$about'          => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'], BBCode::EXTERNAL),
                                '$about_label'    => DI::l10n()->t('About:'),
                                '$keywords'       => $contact['keywords'],
@@ -637,7 +637,7 @@ class Contact extends BaseModule
                $sql_values = [local_user()];
 
                // @TODO: Replace with parameter from router
-               $type = $a->argv[1] ?? '';
+               $type = DI::args()->getArgv()[1] ?? '';
 
                switch ($type) {
                        case 'blocked':
@@ -935,18 +935,7 @@ class Contact extends BaseModule
                if (!$update) {
                        // We need the editor here to be able to reshare an item.
                        if (local_user()) {
-                               $x = [
-                                       'is_owner' => true,
-                                       'allow_location' => $a->user['allow_location'],
-                                       'default_location' => $a->user['default-location'],
-                                       'nickname' => $a->user['nickname'],
-                                       'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
-                                       'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true),
-                                       'bang' => '',
-                                       'visitor' => 'block',
-                                       'profile_uid' => local_user(),
-                               ];
-                               $o = status_editor($a, $x, 0, true);
+                               $o = status_editor($a, [], 0, true);
                        }
                }