2 require_once('include/contact_selectors.php');
4 function viewcontacts_init(&$a) {
6 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
10 profile_load($a,$a->argv[1]);
14 function viewcontacts_content(&$a) {
16 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
17 notice( t('Public access denied.') . EOL);
21 if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
22 notice( t('Permission denied.') . EOL);
27 $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
28 intval($a->profile['uid'])
31 $a->set_pager_total($r[0]['total']);
33 $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 ",
34 intval($a->profile['uid']),
35 intval($a->pager['start']),
36 intval($a->pager['itemspage'])
39 info( t('No contacts.') . EOL );
51 // route DFRN profiles through the redirect
53 $is_owner = ((local_user() && ($a->profile['profile_uid'] == local_user())) ? true : false);
55 if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
56 $url = 'redir/' . $rr['id'];
62 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
63 'thumb' => $rr['thumb'],
64 'name' => substr($rr['name'],0,20),
65 'username' => $rr['name'],
68 'itemurl' => $rr['url'],
69 'network' => network_to_name($rr['network']),
74 $tpl = get_markup_template("viewcontact_template.tpl");
75 $o .= replace_macros($tpl, array(
76 '$title' => t('View Contacts'),
77 '$contacts' => $contacts,
78 '$paginate' => paginate($a),