]> git.mxchange.org Git - friendica.git/commitdiff
Changed parameter order for getByURL
authorMichael <heluecht@pirati.ca>
Wed, 15 Jul 2020 17:06:48 +0000 (17:06 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 15 Jul 2020 17:06:48 +0000 (17:06 +0000)
22 files changed:
mod/editpost.php
mod/follow.php
mod/match.php
mod/message.php
mod/ping.php
mod/unfollow.php
src/Content/Item.php
src/Content/Text/BBCode.php
src/Factory/Notification/Introduction.php
src/Model/Contact.php
src/Module/AllFriends.php
src/Module/Contact.php
src/Module/Contact/Advanced.php
src/Module/Contact/Hovercard.php
src/Module/Contact/Poke.php
src/Module/Search/Acl.php
src/Module/Search/Index.php
src/Object/Post.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php

index 8e7d3e7f53974d68741b2d17902b673495d78ba4..8bde0329331b1dd3f0e1f427a4b92b82c6561fc3 100644 (file)
@@ -145,7 +145,7 @@ function undo_post_tagging($s) {
        if ($cnt) {
                foreach ($matches as $mtch) {
                        if (in_array($mtch[1], ['!', '@'])) {
-                               $contact = Contact::getByURL($mtch[2], 0, ['addr'], false);
+                               $contact = Contact::getByURL($mtch[2], false, ['addr']);
                                $mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
                        }
                        $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
index 97bf9fcf9a50f89752e5b35d6e1c33e4c33449dc..141fa9fdba2c392ab6748c7d5c2b41cc4399f6ab 100644 (file)
@@ -107,7 +107,7 @@ function follow_content(App $a)
                }
        }
 
-       $contact = Contact::getByURL($url, 0, [], true);
+       $contact = Contact::getByURL($url, true);
        if (empty($contact)) {
                // Possibly it is a remote item and not an account
                follow_remote_item($url);
index f6dbe6aba7eef873c32b97b65fcc7d00d6b3fc74..b54be01347bb03a4302708b1dbcfde0a707f5cd2 100644 (file)
@@ -102,7 +102,7 @@ function match_content(App $a)
                                'follow' => [DI::l10n()->t("Connect/Follow"), $connlnk]
                        ];
 
-                       $contact_details = Contact::getByURL($profile->url, 0, [], false);
+                       $contact_details = Contact::getByURL($profile->url, false);
 
                        $entry = [
                                'url'          => Contact::magicLink($profile->url),
index 1a0fa1a482c3c06b7dd12c3a8b39d29e4237e15d..438f96030b529808bbbf4889a281c539b8f6ef2c 100644 (file)
@@ -396,7 +396,7 @@ function message_content(App $a)
                        $body_e = BBCode::convert($message['body']);
                        $to_name_e = $message['name'];
 
-                       $contact = Contact::getByURL($message['from-url'], 0, ['thumb', 'addr'], false);
+                       $contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr']);
                        if (isset($contact["thumb"])) {
                                $from_photo = $contact["thumb"];
                        } else {
@@ -528,7 +528,7 @@ function render_messages(array $msg, $t)
                $body_e = $rr['body'];
                $to_name_e = $rr['name'];
 
-               $contact = Contact::getByURL($rr['url'], 0, ['thumb', 'addr'], false);
+               $contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr']);
                if (isset($contact["thumb"])) {
                        $from_photo = $contact["thumb"];
                } else {
index c64b045411d01c2ab69ca8b6d4c704159d6fcedb..d1983e8036cb73f6bca5474c5c118ad891b90bc5 100644 (file)
@@ -331,7 +331,7 @@ function ping_init(App $a)
 
                if (DBA::isResult($notifs)) {
                        foreach ($notifs as $notif) {
-                               $contact = Contact::getByURL($notif['url'], 0, ['micro'], false);
+                               $contact = Contact::getByURL($notif['url'], false, ['micro']);
                                if (isset($contact['micro'])) {
                                        $notif['photo'] = ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO);
                                } else {
index 370f13d876b223d21a8d25a686e0b3ebde4e1967..09466ba8027dc91b1d68d21cf036fa42e9315144 100644 (file)
@@ -146,7 +146,7 @@ function unfollow_content(App $a)
        ]);
 
        DI::page()['aside'] = '';
-       Profile::load($a, '', Contact::getByURL($contact['url'], 0, [], false));
+       Profile::load($a, '', Contact::getByURL($contact['url'], false));
 
        $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')]);
 
index 052670bc7f4c66866628d26fcd850729c3c7f1b1..d93b0c1b6d4b4a917de6f2611c2d78be48c1592c 100644 (file)
@@ -130,7 +130,7 @@ class Item
                                // Checking for the alias that is used for OStatus
                                $pattern = '/[@!]\[url\=(.*?)\](.*?)\[\/url\]/ism';
                                if (preg_match($pattern, $tag, $matches)) {
-                                       $data = Contact::getByURL($matches[1], 0, ['alias', 'nick'], false);
+                                       $data = Contact::getByURL($matches[1], false, ['alias', 'nick']);
 
                                        if ($data['alias'] != '') {
                                                $newtag = '@[url=' . $data['alias'] . ']' . $data['nick'] . '[/url]';
index d460fefd28cd1ff37b4f375c5f1ca5cddca7bc44..ce34d58ac506a2bb79885e2457081d7ff588c69a 100644 (file)
@@ -983,7 +983,7 @@ class BBCode
                                        $attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8');
                                }
 
-                               $author_contact = Contact::getByURL($attributes['profile'], 0, ['url', 'addr', 'name', 'micro'], false);
+                               $author_contact = Contact::getByURL($attributes['profile'], false, ['url', 'addr', 'name', 'micro']);
                                $author_contact['url'] = ($author_contact['url'] ?? $attributes['profile']);
                                $author_contact['addr'] = ($author_contact['addr'] ?? '') ?: Protocol::getAddrFromProfileUrl($attributes['profile']);
 
@@ -1061,7 +1061,7 @@ class BBCode
                        default:
                                $text = ($is_quote_share? "\n" : '');
 
-                               $contact = Contact::getByURL($attributes['profile'], 0, ['network'], false);
+                               $contact = Contact::getByURL($attributes['profile'], false, ['network']);
                                $network = $contact['network'] ?? Protocol::PHANTOM;
 
                                $tpl = Renderer::getMarkupTemplate('shared_content.tpl');
@@ -1975,7 +1975,7 @@ class BBCode
         */
        private static function bbCodeMention2DiasporaCallback($match)
        {
-               $contact = Contact::getByURL($match[3], 0, ['addr']);
+               $contact = Contact::getByURL($match[3], null, ['addr']);
 
                if (empty($contact['addr'])) {
                        return $match[0];
index 8e97498b3d7705b92df7dd824935af64ff057917..21aef9297a776537096d9e29587790560efe7434 100644 (file)
@@ -213,7 +213,7 @@ class Introduction extends BaseFactory
                // If the network and addr is still not available
                // get the missing data data from other sources
                if (empty($intro['gnetwork']) || empty($intro['gaddr'])) {
-                       $ret = Contact::getByURL($intro['url'], 0, ['network', 'addr'], false);
+                       $ret = Contact::getByURL($intro['url'], false, ['network', 'addr']);
 
                        if (empty($intro['gnetwork']) && !empty($ret['network'])) {
                                $intro['gnetwork'] = $ret['network'];
index 3b6e0ac6583f503d7512b596a62df566330963a8..7c8dec3895b10a609924a38b0b07c1c21922df06 100644 (file)
@@ -199,7 +199,7 @@ class Contact
         * @param boolean $update true = always update, false = never update, null = update when not found or outdated
         * @return array contact array
         */
-       public static function getByURL(string $url, int $uid = 0, array $fields = [], $update = null)
+       public static function getByURL(string $url, $update = null, array $fields = [], int $uid = 0)
        {
                if ($update || is_null($update)) {
                        $cid = self::getIdForURL($url, $uid, !($update ?? false));
@@ -241,7 +241,7 @@ class Contact
        public static function getByURLForUser(string $url, int $uid = 0, array $fields = [], $update = null)
        {
                if ($uid != 0) {
-                       $contact = self::getByURL($url, $uid, $fields, $update);
+                       $contact = self::getByURL($url, $update, $fields, $uid);
                        if (!empty($contact)) {
                                if (!empty($contact['id'])) {
                                        $contact['cid'] = $contact['id'];
@@ -251,7 +251,7 @@ class Contact
                        }
                }
 
-               $contact = self::getByURL($url, 0, $fields, $update);
+               $contact = self::getByURL($url, $update, $fields);
                if (!empty($contact['id'])) {           
                        $contact['cid'] = 0;
                        $contact['zid'] = $contact['id'];
@@ -1318,7 +1318,7 @@ class Contact
                        return 0;
                }
 
-               $contact = self::getByURL($url, $uid, ['id', 'avatar', 'updated', 'network'], false);
+               $contact = self::getByURL($url, false, ['id', 'avatar', 'updated', 'network'], $uid);
 
                if (!empty($contact)) {
                        $contact_id = $contact["id"];
index 5bade0c57925bfe21007b6037ca8ce1cd40471af..3f5cf7c8391a966b2e504aa0bbdfbe48985f78c1 100644 (file)
@@ -63,7 +63,7 @@ class AllFriends extends BaseModule
                }
 
                DI::page()['aside'] = "";
-               Model\Profile::load($app, "", Model\Contact::getByURL($contact["url"], 0, [], false));
+               Model\Profile::load($app, "", Model\Contact::getByURL($contact["url"], false));
 
                $total = Model\GContact::countAllFriends(local_user(), $cid);
 
index fc54f1ea2af97ab28874174d8f6ce9bfbc2460cf..f63d42c0ea58ae9a4252ad143b7775681ac0e065 100644 (file)
@@ -971,7 +971,7 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        DI::page()['aside'] = '';
 
-                       $profiledata = Model\Contact::getByURL($contact['url'], 0, [], false);
+                       $profiledata = Model\Contact::getByURL($contact['url'], false);
 
                        Model\Profile::load($a, '', $profiledata, true);
 
@@ -994,7 +994,7 @@ class Contact extends BaseModule
                if (DBA::isResult($contact)) {
                        DI::page()['aside'] = '';
 
-                       $profiledata = Model\Contact::getByURL($contact['url'], 0, [], false);
+                       $profiledata = Model\Contact::getByURL($contact['url'], false);
 
                        if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
                                $profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
index 4ec122ce87949c756e84d956f3a5530c40225e09..d29d0609a930e4d7719cdc3f829291cdb57d0fe1 100644 (file)
@@ -108,7 +108,7 @@ class Advanced extends BaseModule
                        throw new BadRequestException(DI::l10n()->t('Contact not found.'));
                }
 
-               Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], 0, [], false));
+               Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], false));
 
                $warning = DI::l10n()->t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
                $info    = DI::l10n()->t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');
index f0111b14d025c274c947282e489f078447e5aace..655fc9e2d50dd03aa89bed911b1113af61efec49 100644 (file)
@@ -67,7 +67,7 @@ class Hovercard extends BaseModule
                if (Session::isAuthenticated()) {
                        $contact = Contact::getByURLForUser($contact_url, local_user(), [], false);
                } else {
-                       $contact = Contact::getByURL($contact_url, 0, [], false);
+                       $contact = Contact::getByURL($contact_url, false);
                }
 
                if (!count($contact)) {
index 0f289b529105211d631c2b9e1fbcafdbc30c75d8..b4adff46d3d624abd8d1c6f3d7ba09455ccadbc9 100644 (file)
@@ -138,7 +138,7 @@ class Poke extends BaseModule
                        throw new HTTPException\NotFoundException();
                }
 
-               Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], 0, [], false));
+               Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], false));
 
                $verbs = [];
                foreach (DI::l10n()->getPokeVerbs() as $verb => $translations) {
index e684d25e9b2cb2d12172a0f1a974c101d8df3a67..8a5c9faf589177c51d45cd825f383bd66dfb7ea1 100644 (file)
@@ -350,7 +350,7 @@ class Acl extends BaseModule
                                        continue;
                                }
 
-                               $contact = Contact::getByURL($author, 0, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum'], false);
+                               $contact = Contact::getByURL($author, false, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum']);
 
                                if (count($contact) > 0) {
                                        $unknown_contacts[] = [
index 1be3e3a796fe702f672d317126a14cab84655da3..34085e339e0a4f52fff5c23f384d1c8c1b49a155 100644 (file)
@@ -239,7 +239,7 @@ class Index extends BaseSearch
                        if ($isAddr) {
                                $contact = Contact::selectFirst(['id'], ['addr' => $search, 'uid' => 0]);
                        } else {
-                               $contact = array_merge(['id' => 0], Contact::getByURL($search, 0, ['id']));
+                               $contact = array_merge(['id' => 0], Contact::getByURL($search, null, ['id']));
                        }
 
                        if (DBA::isResult($contact)) {
index ba949dace39e5fcb7faa703097bd79190bcdcb18..ee886c1576a2a2342387d12dbe80642341d52959 100644 (file)
@@ -877,7 +877,7 @@ class Post
 
                $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
                foreach ($terms as $term) {
-                       $profile = Contact::getByURL($term['url'], 0, ['addr', 'contact-type'], false);
+                       $profile = Contact::getByURL($term['url'], false, ['addr', 'contact-type']);
                        if (!empty($profile['addr']) && ((($profile['contact-type'] ?? '') ?: Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
                                ($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
                                $text .= '@' . $profile['addr'] . ' ';
index 6b7b7a383562fe05aea1fdc26c547a49dbf09f94..0e4aca4a5a4868e0eb931e72c5a7f038fd0eb710 100644 (file)
@@ -987,7 +987,7 @@ class Processor
        {
                $parent_terms = Tag::getByURIId($parent['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
 
-               $parent_author = Contact::getByURL($parent['author-link'], 0, ['url', 'nurl', 'alias'], false);
+               $parent_author = Contact::getByURL($parent['author-link'], false, ['url', 'nurl', 'alias']);
 
                $implicit_mentions = [];
                if (empty($parent_author['url'])) {
@@ -1003,7 +1003,7 @@ class Processor
                }
 
                foreach ($parent_terms as $term) {
-                       $contact = Contact::getByURL($term['url'], 0, ['url', 'nurl', 'alias'], false);
+                       $contact = Contact::getByURL($term['url'], false, ['url', 'nurl', 'alias']);
                        if (!empty($contact['url'])) {
                                $implicit_mentions[] = $contact['url'];
                                $implicit_mentions[] = $contact['nurl'];
index 5e60a2131e2dc59994f6a031b47919df79ced0d4..bd6f67128f3924182bb0a457c594b4b09c1533e6 100644 (file)
@@ -1008,7 +1008,7 @@ class Transmitter
                                $url = DI::baseUrl() . '/search?tag=' . urlencode($term['name']);
                                $tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['name']];
                        } else {
-                               $contact = Contact::getByURL($term['url'], 0, ['addr'], false);
+                               $contact = Contact::getByURL($term['url'], false, ['addr']);
                                if (!empty($contact['addr'])) {
                                        $mention = '@' . $contact['addr'];
                                } else {
@@ -1141,7 +1141,7 @@ class Transmitter
                        return '';
                }
 
-               $data = Contact::getByURL($match[1], 0, ['url', 'nick'], false);
+               $data = Contact::getByURL($match[1], false, ['url', 'nick']);
                if (empty($data['nick'])) {
                        return $match[0];
                }
@@ -1861,7 +1861,7 @@ class Transmitter
                $mentions = [];
 
                foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
-                       $profile = Contact::getByURL($tag['url'], 0, ['addr', 'contact-type', 'nick'], false);
+                       $profile = Contact::getByURL($tag['url'], false, ['addr', 'contact-type', 'nick']);
                        if (!empty($profile['addr'])
                                && $profile['contact-type'] != Contact::TYPE_COMMUNITY
                                && !strstr($body, $profile['addr'])
index ae2c0e23eb11c47a4f46f6867ff567fd62452ee4..c9da351f75f7745153da69650856dc1ee30b17cb 100644 (file)
@@ -3729,7 +3729,7 @@ class Diaspora
 
        private static function prependParentAuthorMention($body, $profile_url)
        {
-               $profile = Contact::getByURL($profile_url, 0, ['addr', 'name', 'contact-type'], false);
+               $profile = Contact::getByURL($profile_url, false, ['addr', 'name', 'contact-type']);
                if (!empty($profile['addr'])
                        && $profile['contact-type'] != Contact::TYPE_COMMUNITY
                        && !strstr($body, $profile['addr'])
index ef2515c1f501da286641052b67644f40346506eb..0b39c3deee62c5c182c919fc905a6e2fe32c5668 100644 (file)
@@ -2105,7 +2105,7 @@ class OStatus
                        $mentioned = $newmentions;
 
                        foreach ($mentioned as $mention) {
-                               $contact = Contact::getByURL($mention, 0, ['contact-type']);
+                               $contact = Contact::getByURL($mention, ['contact-type']);
                                if (!empty($contact) && ($contact['contact-type'] == Contact::TYPE_COMMUNITY)) {
                                        XML::addElement($doc, $entry, "link", "",
                                                [