use Friendica\Util\Strings;
use Friendica\Util\Temporal;
-require_once 'include/dba.php';
-
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
$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);
}
}
+ // 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;
}
$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'])) {
$_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