3 * @file mod/allfriends.php
7 use Friendica\Content\ContactSelector;
8 use Friendica\Content\Pager;
9 use Friendica\Core\L10n;
10 use Friendica\Core\System;
11 use Friendica\Database\DBA;
14 use Friendica\Util\Proxy as ProxyUtils;
17 require_once 'include/dba.php';
19 function allfriends_content(App $a)
23 notice(L10n::t('Permission denied.') . EOL);
29 $cid = intval($a->argv[1]);
36 $uid = $a->user['uid'];
38 $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['id' => $cid, 'uid' => local_user()]);
40 if (!DBA::isResult($contact)) {
44 $a->page['aside'] = "";
45 Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
47 $total = Model\GContact::countAllFriends(local_user(), $cid);
49 $pager = new Pager($a->query_string);
51 $r = Model\GContact::allFriends(local_user(), $cid, $pager->getStart(), $pager->getItemsPerPage());
52 if (!DBA::isResult($r)) {
53 $o .= L10n::t('No friends to display.');
61 //get further details of the contact
62 $contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid, $rr);
67 // $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
68 // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
70 $rr['id'] = $rr['cid'];
71 $photo_menu = Model\Contact::photoMenu($rr);
73 $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
75 'profile' => [L10n::t("View Profile"), Model\Contact::magicLink($rr['url'])],
76 'follow' => [L10n::t("Connect/Follow"), $connlnk]
82 'itemurl' => defaults($contact_details, 'addr', $rr['url']),
83 'name' => htmlentities($contact_details['name']),
84 'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
85 'img_hover' => htmlentities($contact_details['name']),
86 'details' => $contact_details['location'],
87 'tags' => $contact_details['keywords'],
88 'about' => $contact_details['about'],
89 'account_type' => Model\Contact::getAccountType($contact_details),
90 'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
91 'photo_menu' => $photo_menu,
92 'conntxt' => L10n::t('Connect'),
93 'connlnk' => $connlnk,
99 $tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
101 $tpl = get_markup_template('viewcontact_template.tpl');
103 $o .= replace_macros($tpl, [
104 //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
105 '$tab_str' => $tab_str,
106 '$contacts' => $entries,
107 '$paginate' => $pager->renderFull($total),