3 * @file mod/allfriends.php
6 use Friendica\Core\System;
7 use Friendica\Database\DBM;
8 use Friendica\Model\GlobalContact;
10 require_once 'include/Contact.php';
11 require_once 'include/contact_selectors.php';
12 require_once 'mod/contacts.php';
14 function allfriends_content(App $a) {
18 notice( t('Permission denied.') . EOL);
23 $cid = intval($a->argv[1]);
30 $uid = $a->user['uid'];
32 $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
37 if (! DBM::is_result($c)) {
41 $a->page['aside'] = "";
42 profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
44 $total = GlobalContact::countAllFriends(local_user(), $cid);
47 $a->set_pager_total($total);
49 $r = GlobalContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
51 if (! DBM::is_result($r)) {
52 $o .= t('No friends to display.');
60 //get further details of the contact
61 $contact_details = get_contact_details_by_url($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
69 $photo_menu = contact_photo_menu ($rr);
72 $connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
74 'profile' => array(t("View Profile"), zrl($rr['url'])),
75 'follow' => array(t("Connect/Follow"), $connlnk)
81 'itemurl' => (($contact_details['addr'] != "") ? $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' => account_type($contact_details),
89 'network' => network_to_name($contact_details['network'], $contact_details['url']),
90 'photo_menu' => $photo_menu,
91 'conntxt' => 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,array(
103 //'$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name'])),
104 '$tab_str' => $tab_str,
105 '$contacts' => $entries,
106 '$paginate' => paginate($a),