3 * @file mod/allfriends.php
6 use Friendica\Content\ContactSelector;
7 use Friendica\Core\L10n;
8 use Friendica\Core\System;
9 use Friendica\Database\DBM;
10 use Friendica\Model\Contact;
11 use Friendica\Model\GContact;
12 use Friendica\Model\Profile;
14 require_once 'include/dba.php';
15 require_once 'mod/contacts.php';
17 function allfriends_content(App $a)
21 notice(L10n::t('Permission denied.') . EOL);
27 $cid = intval($a->argv[1]);
34 $uid = $a->user['uid'];
36 $contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
38 if (!DBM::is_result($contact)) {
42 $a->page['aside'] = "";
43 Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
45 $total = GContact::countAllFriends(local_user(), $cid);
47 $a->set_pager_total($total);
49 $r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
50 if (!DBM::is_result($r)) {
51 $o .= L10n::t('No friends to display.');
59 //get further details of the contact
60 $contact_details = Contact::getDetailsByURL($rr['url'], $uid, $rr);
65 // $rr[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photo_menu
66 // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
68 $rr['id'] = $rr['cid'];
69 $photo_menu = Contact::photoMenu($rr);
71 $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
73 'profile' => [L10n::t("View Profile"), Contact::magicLink($rr['url'])],
74 'follow' => [L10n::t("Connect/Follow"), $connlnk]
80 'itemurl' => defaults($contact_details, 'addr', $rr['url']),
81 'name' => htmlentities($contact_details['name']),
82 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
83 'img_hover' => htmlentities($contact_details['name']),
84 'details' => $contact_details['location'],
85 'tags' => $contact_details['keywords'],
86 'about' => $contact_details['about'],
87 'account_type' => Contact::getAccountType($contact_details),
88 'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
89 'photo_menu' => $photo_menu,
90 'conntxt' => L10n::t('Connect'),
91 'connlnk' => $connlnk,
97 $tab_str = contacts_tab($a, $cid, 3);
99 $tpl = get_markup_template('viewcontact_template.tpl');
101 $o .= replace_macros($tpl, [
102 //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
103 '$tab_str' => $tab_str,
104 '$contacts' => $entries,
105 '$paginate' => paginate($a),