X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FPortableContact.php;h=70acf5064c0e643dee8596190eff748678702d68;hb=79eeb409695716fae8a501a02ef57ed855acb3a8;hp=ceafffa832a65cdaac0933a645b87c6ebb0a03d2;hpb=0a4119adaf6294bf43d135a0f435c1dd677c50e0;p=friendica.git diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index ceafffa832..70acf5064c 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -1,34 +1,45 @@ . * - * @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username - * @todo Fetch profile data from profile page for Redmatrix users - * @todo Detect if it is a forum */ namespace Friendica\Protocol; -use DOMDocument; -use DOMXPath; use Exception; use Friendica\Content\Text\HTML; -use Friendica\Core\Config; use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Model\Contact; +use Friendica\DI; use Friendica\Model\GContact; use Friendica\Model\GServer; -use Friendica\Model\Profile; -use Friendica\Module\Register; -use Friendica\Network\Probe; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\Strings; -use Friendica\Util\XML; +/** + * + * @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username + * @todo Fetch profile data from profile page for Redmatrix users + * @todo Detect if it is a forum + */ class PortableContact { const DISABLED = 0; @@ -88,7 +99,7 @@ class PortableContact return; } - $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation'); + $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation'); Logger::log('load: ' . $url, Logger::DEBUG); @@ -123,7 +134,6 @@ class PortableContact $location = ''; $about = ''; $keywords = ''; - $gender = ''; $contact_type = -1; $generation = 0; @@ -168,10 +178,6 @@ class PortableContact $about = HTML::toBBCode($entry['aboutMe']); } - if (isset($entry['gender'])) { - $gender = $entry['gender']; - } - if (isset($entry['generation']) && ($entry['generation'] > 0)) { $generation = ++$entry['generation']; } @@ -192,7 +198,6 @@ class PortableContact "photo" => $profile_photo, "about" => $about, "location" => $location, - "gender" => $gender, "keywords" => $keywords, "connect" => $connect_url, "updated" => $updated, @@ -282,7 +287,7 @@ class PortableContact self::fetchServerlist($server["poco"]); // Fetch all users from the other server - $url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; + $url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation"; Logger::info("Fetch all users from the server " . $server["url"]); @@ -295,8 +300,8 @@ class PortableContact self::discoverServer($data, 2); } - if (Config::get('system', 'poco_discovery') >= self::USERS_GCONTACTS) { - $timeframe = Config::get('system', 'poco_discovery_since'); + if (DI::config()->get('system', 'poco_discovery') >= self::USERS_GCONTACTS) { + $timeframe = DI::config()->get('system', 'poco_discovery_since'); if ($timeframe == 0) { $timeframe = 30; @@ -305,7 +310,7 @@ class PortableContact $updatedSince = date(DateTimeFormat::MYSQL, time() - $timeframe * 86400); // Fetch all global contacts from the other server (Not working with Redmatrix and Friendica versions before 3.3) - $url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; + $url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation"; $success = false; @@ -320,7 +325,7 @@ class PortableContact } } - if (!$success && !empty($data) && Config::get('system', 'poco_discovery') >= self::USERS_GCONTACTS_FALLBACK) { + if (!$success && !empty($data) && DI::config()->get('system', 'poco_discovery') >= self::USERS_GCONTACTS_FALLBACK) { Logger::info("Fetch contacts from users of the server " . $server["nurl"]); self::discoverServerUsers($data, $server); } @@ -365,7 +370,7 @@ class PortableContact Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], Logger::DEBUG); // Fetch all contacts from a given user from the other server - $url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation'; + $url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation'; $curlResult = Network::curl($url); @@ -398,7 +403,6 @@ class PortableContact $location = ''; $about = ''; $keywords = ''; - $gender = ''; $contact_type = -1; $generation = $default_generation; @@ -444,10 +448,6 @@ class PortableContact $about = HTML::toBBCode($entry['aboutMe']); } - if (isset($entry['gender'])) { - $gender = $entry['gender']; - } - if (isset($entry['generation']) && ($entry['generation'] > 0)) { $generation = ++$entry['generation']; } @@ -473,7 +473,6 @@ class PortableContact "photo" => $profile_photo, "about" => $about, "location" => $location, - "gender" => $gender, "keywords" => $keywords, "connect" => $connect_url, "updated" => $updated,