X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FProfile.php;h=bd455bc6ba4ca4898bf736b85c245d31d6fe5b05;hb=94eca7704130822bf83bb5fee6930dee6bae81dd;hp=a73c8410b31ba12a114b85cf8e31fee9d2c93c8b;hpb=924869ab5b75fd496014a1b7ca1240a6df939fc6;p=friendica.git diff --git a/src/Model/Profile.php b/src/Model/Profile.php index a73c8410b3..bd455bc6ba 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -28,8 +28,6 @@ use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Strings; use Friendica\Util\Temporal; -require_once 'include/dba.php'; - class Profile { /** @@ -99,7 +97,7 @@ class Profile * load a lot of theme-specific content * * @brief Loads a profile into the page sidebar. - * @param object $a App + * @param App $a * @param string $nickname string * @param int $profile int * @param array $profiledata array @@ -297,9 +295,9 @@ class Profile $profile['picdate'] = urlencode(defaults($profile, 'picdate', '')); if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) { - $profile['network_name'] = Strings::formatNetworkName($profile['network'], $profile['url']); + $profile['network_link'] = Strings::formatNetworkName($profile['network'], $profile['url']); } else { - $profile['network_name'] = ''; + $profile['network_link'] = ''; } Addon::callHooks('profile_sidebar_enter', $profile); @@ -337,6 +335,11 @@ class Profile } } + // Is the remote user already connected to that user? + if ($connect && Contact::isFollower(remote_user(), $profile['uid'])) { + $connect = false; + } + if ($connect && ($profile['network'] != Protocol::DFRN) && !isset($profile['remoteconnect'])) { $connect = false; } @@ -507,10 +510,8 @@ class Profile $p['about'] = BBCode::convert($p['about']); } - if (isset($p['address'])) { - $p['address'] = BBCode::convert($p['address']); - } elseif (isset($p['location'])) { - $p['address'] = BBCode::convert($p['location']); + if (empty($p['address']) && !empty($p['location'])) { + $p['address'] = $p['location']; } if (isset($p['photo'])) { @@ -1118,6 +1119,17 @@ class Profile $_SESSION['visitor_home'] = $visitor['url']; $_SESSION['my_url'] = $visitor['url']; + /// @todo replace this and the query for this variable with some cleaner functionality + $_SESSION['remote'] = []; + + $remote_contacts = DBA::select('contact', ['id', 'uid'], ['nurl' => $visitor['nurl'], 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]); + while ($contact = DBA::fetch($remote_contacts)) { + if (($contact['uid'] == 0) || Contact::isBlockedByUser($visitor['id'], $contact['uid'])) { + continue; + } + + $_SESSION['remote'][] = ['cid' => $contact['id'], 'uid' => $contact['uid'], 'url' => $visitor['url']]; + } $arr = [ 'visitor' => $visitor, 'url' => $a->query_string