3 function viewcontacts_init(&$a) {
5 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
9 profile_load($a,$a->argv[1]);
13 function viewcontacts_content(&$a) {
15 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
16 notice( t('Public access denied.') . EOL);
20 if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
21 notice( t('Permission denied.') . EOL);
25 $o .= '<h3>' . t('View Contacts') . '</h3>';
28 $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0",
29 intval($a->profile['uid'])
32 $a->set_pager_total($r[0]['total']);
34 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
35 intval($a->profile['uid']),
36 intval($a->pager['start']),
37 intval($a->pager['itemspage'])
40 info( t('No contacts.') . EOL );
44 $tpl = get_markup_template("viewcontact_template.tpl");
52 // route DFRN profiles through the redirect
54 $is_owner = ((local_user() && ($a->profile['profile_uid'] == local_user())) ? true : false);
56 if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
57 $url = 'redir/' . $rr['id'];
59 $o .= replace_macros($tpl, array(
61 '$alt_text' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
62 '$thumb' => $rr['thumb'],
63 '$name' => substr($rr['name'],0,20),
64 '$username' => $rr['name'],
69 $o .= '<div id="view-contact-end"></div>';