3 * @file mod/allfriends.php
7 use Friendica\Content\ContactSelector;
8 use Friendica\Content\Pager;
9 use Friendica\Core\L10n;
10 use Friendica\Core\Renderer;
11 use Friendica\Core\System;
12 use Friendica\Database\DBA;
15 use Friendica\Util\Proxy as ProxyUtils;
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', 'uid', 'id'], ['id' => $cid, 'uid' => local_user()]);
39 if (!DBA::isResult($contact)) {
43 $a->page['aside'] = "";
44 Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
46 $total = Model\GContact::countAllFriends(local_user(), $cid);
48 $pager = new Pager($a->query_string);
50 $r = Model\GContact::allFriends(local_user(), $cid, $pager->getStart(), $pager->getItemsPerPage());
51 if (!DBA::isResult($r)) {
52 $o .= L10n::t('No friends to display.');
60 //get further details of the contact
61 $contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid, $rr);
64 // $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
65 // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
67 $rr['id'] = $rr['cid'];
68 $photo_menu = Model\Contact::photoMenu($rr);
70 $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
72 'profile' => [L10n::t("View Profile"), Model\Contact::magicLink($rr['url'])],
73 'follow' => [L10n::t("Connect/Follow"), $connlnk]
78 'url' => Model\Contact::magicLink($rr['url']),
79 'itemurl' => defaults($contact_details, 'addr', $rr['url']),
80 'name' => $contact_details['name'],
81 'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
82 'img_hover' => $contact_details['name'],
83 'details' => $contact_details['location'],
84 'tags' => $contact_details['keywords'],
85 'about' => $contact_details['about'],
86 'account_type' => Model\Contact::getAccountType($contact_details),
87 'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
88 'photo_menu' => $photo_menu,
89 'conntxt' => L10n::t('Connect'),
90 'connlnk' => $connlnk,
96 $tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
98 $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
99 $o .= Renderer::replaceMacros($tpl, [
100 '$tab_str' => $tab_str,
101 '$contacts' => $entries,
102 '$paginate' => $pager->renderFull($total),