From: Michael <heluecht@pirati.ca>
Date: Wed, 15 Jul 2020 17:06:48 +0000 (+0000)
Subject: Changed parameter order for getByURL
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fc0312451d3b8f8d10fc01701216fdd3a5139102;p=friendica.git

Changed parameter order for getByURL
---

diff --git a/mod/editpost.php b/mod/editpost.php
index 8e7d3e7f53..8bde032933 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -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);
diff --git a/mod/follow.php b/mod/follow.php
index 97bf9fcf9a..141fa9fdba 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -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);
diff --git a/mod/match.php b/mod/match.php
index f6dbe6aba7..b54be01347 100644
--- a/mod/match.php
+++ b/mod/match.php
@@ -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),
diff --git a/mod/message.php b/mod/message.php
index 1a0fa1a482..438f96030b 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -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 {
diff --git a/mod/ping.php b/mod/ping.php
index c64b045411..d1983e8036 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -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 {
diff --git a/mod/unfollow.php b/mod/unfollow.php
index 370f13d876..09466ba802 100644
--- a/mod/unfollow.php
+++ b/mod/unfollow.php
@@ -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')]);
 
diff --git a/src/Content/Item.php b/src/Content/Item.php
index 052670bc7f..d93b0c1b6d 100644
--- a/src/Content/Item.php
+++ b/src/Content/Item.php
@@ -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]';
diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index d460fefd28..ce34d58ac5 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -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];
diff --git a/src/Factory/Notification/Introduction.php b/src/Factory/Notification/Introduction.php
index 8e97498b3d..21aef9297a 100644
--- a/src/Factory/Notification/Introduction.php
+++ b/src/Factory/Notification/Introduction.php
@@ -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'];
diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index 3b6e0ac658..7c8dec3895 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -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"];
diff --git a/src/Module/AllFriends.php b/src/Module/AllFriends.php
index 5bade0c579..3f5cf7c839 100644
--- a/src/Module/AllFriends.php
+++ b/src/Module/AllFriends.php
@@ -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);
 
diff --git a/src/Module/Contact.php b/src/Module/Contact.php
index fc54f1ea2a..f63d42c0ea 100644
--- a/src/Module/Contact.php
+++ b/src/Module/Contact.php
@@ -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']);
diff --git a/src/Module/Contact/Advanced.php b/src/Module/Contact/Advanced.php
index 4ec122ce87..d29d0609a9 100644
--- a/src/Module/Contact/Advanced.php
+++ b/src/Module/Contact/Advanced.php
@@ -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.');
diff --git a/src/Module/Contact/Hovercard.php b/src/Module/Contact/Hovercard.php
index f0111b14d0..655fc9e2d5 100644
--- a/src/Module/Contact/Hovercard.php
+++ b/src/Module/Contact/Hovercard.php
@@ -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)) {
diff --git a/src/Module/Contact/Poke.php b/src/Module/Contact/Poke.php
index 0f289b5291..b4adff46d3 100644
--- a/src/Module/Contact/Poke.php
+++ b/src/Module/Contact/Poke.php
@@ -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) {
diff --git a/src/Module/Search/Acl.php b/src/Module/Search/Acl.php
index e684d25e9b..8a5c9faf58 100644
--- a/src/Module/Search/Acl.php
+++ b/src/Module/Search/Acl.php
@@ -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[] = [
diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php
index 1be3e3a796..34085e339e 100644
--- a/src/Module/Search/Index.php
+++ b/src/Module/Search/Index.php
@@ -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)) {
diff --git a/src/Object/Post.php b/src/Object/Post.php
index ba949dace3..ee886c1576 100644
--- a/src/Object/Post.php
+++ b/src/Object/Post.php
@@ -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'] . ' ';
diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php
index 6b7b7a3835..0e4aca4a5a 100644
--- a/src/Protocol/ActivityPub/Processor.php
+++ b/src/Protocol/ActivityPub/Processor.php
@@ -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'];
diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php
index 5e60a2131e..bd6f67128f 100644
--- a/src/Protocol/ActivityPub/Transmitter.php
+++ b/src/Protocol/ActivityPub/Transmitter.php
@@ -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'])
diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php
index ae2c0e23eb..c9da351f75 100644
--- a/src/Protocol/Diaspora.php
+++ b/src/Protocol/Diaspora.php
@@ -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'])
diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php
index ef2515c1f5..0b39c3deee 100644
--- a/src/Protocol/OStatus.php
+++ b/src/Protocol/OStatus.php
@@ -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", "",
 						[