2 require_once('include/Contact.php');
3 require_once('include/contact_selectors.php');
5 function viewcontacts_init(&$a) {
7 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
11 profile_load($a,$a->argv[1]);
15 function viewcontacts_content(&$a) {
16 require_once("mod/proxy.php");
18 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
19 notice( t('Public access denied.') . EOL);
23 if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
24 notice( t('Permission denied.') . EOL);
29 $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
30 intval($a->profile['uid'])
33 $a->set_pager_total($r[0]['total']);
35 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
36 intval($a->profile['uid']),
37 intval($a->pager['start']),
38 intval($a->pager['itemspage'])
41 info( t('No contacts.') . EOL );
53 // route DFRN profiles through the redirect
55 $is_owner = ((local_user() && ($a->profile['profile_uid'] == local_user())) ? true : false);
57 if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
58 $url = 'redir/' . $rr['id'];
62 $contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid']);
66 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
67 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
68 'name' => htmlentities(substr($rr['name'],0,20)),
69 'username' => htmlentities($rr['name']),
70 'details' => $contact_details['location'],
71 'tags' => $contact_details['keywords'],
72 'about' => $contact_details['about'],
75 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
76 'network' => network_to_name($rr['network'], $rr['url']),
81 $tpl = get_markup_template("viewcontact_template.tpl");
82 $o .= replace_macros($tpl, array(
83 '$title' => t('View Contacts'),
84 '$contacts' => $contacts,
85 '$paginate' => paginate($a),