3 * @file mod/allfriends.php
7 use Friendica\Content\ContactSelector;
8 use Friendica\Core\L10n;
9 use Friendica\Core\System;
10 use Friendica\Database\DBA;
11 use Friendica\Model\Contact;
12 use Friendica\Model\GContact;
13 use Friendica\Model\Profile;
15 require_once 'include/dba.php';
16 require_once 'mod/contacts.php';
18 function allfriends_content(App $a)
22 notice(L10n::t('Permission denied.') . EOL);
28 $cid = intval($a->argv[1]);
35 $uid = $a->user['uid'];
37 $contact = DBA::selectFirst('contact', ['name', 'url', 'photo'], ['id' => $cid, 'uid' => local_user()]);
39 if (!DBA::isResult($contact)) {
43 $a->page['aside'] = "";
44 Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
46 $total = GContact::countAllFriends(local_user(), $cid);
48 $a->set_pager_total($total);
50 $r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
51 if (!DBA::isResult($r)) {
52 $o .= L10n::t('No friends to display.');
60 //get further details of the contact
61 $contact_details = Contact::getDetailsByURL($rr['url'], $uid, $rr);
66 // $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
67 // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
69 $rr['id'] = $rr['cid'];
70 $photo_menu = Contact::photoMenu($rr);
72 $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
74 'profile' => [L10n::t("View Profile"), Contact::magicLink($rr['url'])],
75 'follow' => [L10n::t("Connect/Follow"), $connlnk]
81 'itemurl' => defaults($contact_details, 'addr', $rr['url']),
82 'name' => htmlentities($contact_details['name']),
83 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
84 'img_hover' => htmlentities($contact_details['name']),
85 'details' => $contact_details['location'],
86 'tags' => $contact_details['keywords'],
87 'about' => $contact_details['about'],
88 'account_type' => Contact::getAccountType($contact_details),
89 'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
90 'photo_menu' => $photo_menu,
91 'conntxt' => L10n::t('Connect'),
92 'connlnk' => $connlnk,
98 $tab_str = contacts_tab($a, $cid, 3);
100 $tpl = get_markup_template('viewcontact_template.tpl');
102 $o .= replace_macros($tpl, [
103 //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
104 '$tab_str' => $tab_str,
105 '$contacts' => $entries,
106 '$paginate' => paginate($a),