diff options
-rw-r--r-- | include/text.php | 4 | ||||
-rw-r--r-- | install/update.php | 2 | ||||
-rw-r--r-- | mod/viewcontacts.php | 49 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/tpl/contact_template.tpl | 2 | ||||
-rw-r--r-- | view/tpl/smarty3/contact_template.tpl | 2 |
6 files changed, 29 insertions, 32 deletions
diff --git a/include/text.php b/include/text.php index d0b2733c0..3b5b6824a 100644 --- a/include/text.php +++ b/include/text.php @@ -598,7 +598,7 @@ function contact_block() { if((! is_array($a->profile)) || ($a->profile['hide_friends'])) return $o; - $r = q("SELECT COUNT(*) AS total FROM abook WHERE abook_channel = %d and abook_flags = 0", + $r = q("SELECT COUNT(abook_id) AS total FROM abook WHERE abook_channel = %d and abook_flags = 0", intval($a->profile['uid']) ); if(count($r)) { @@ -627,7 +627,7 @@ function contact_block() { $tpl = get_markup_template('contact_block.tpl'); $o = replace_macros($tpl, array( '$contacts' => $contacts, - '$nickname' => $a->profile['nickname'], + '$nickname' => $a->profile['channel_address'], '$viewcontacts' => t('View Connections'), '$micropro' => $micropro, )); diff --git a/install/update.php b/install/update.php index 26cd7a173..c40dd1982 100644 --- a/install/update.php +++ b/install/update.php @@ -378,7 +378,7 @@ function update_r1030() { KEY `issue_created` (`issue_created`), KEY `issue_updated` (`issue_updated`), KEY `issue_assigned` (`issue_assigned`), -KEY `issue_priority` ('issue_priority`), +KEY `issue_priority` (`issue_priority`), KEY `issue_status` (`issue_status`), KEY `issue_component` (`issue_component`) ) ENGINE = MYISAM "); diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 3f69e4a09..e3c0c490a 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -1,13 +1,14 @@ <?php require_once('include/contact_selectors.php'); +require_once('include/Contact.php'); function viewcontacts_init(&$a) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { return; } - - profile_load($a,$a->argv[1]); + if(argc() > 1) + profile_load($a,argv(1)); } @@ -33,57 +34,53 @@ function viewcontacts_content(&$a) { return; } + if(! perm_is_allowed($a->profile['uid'], get_observer_hash(),'view_contacts')) { + notice( t('Permission denied.') . EOL); + return; + } + - $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", + + $r = q("SELECT COUNT(abook_id) as total FROM abook WHERE abook_channel = %d AND abook_flags = 0 ", intval($a->profile['uid']) ); - if(count($r)) + if($r) $a->set_pager_total($r[0]['total']); - $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 ", + $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_flags = 0 order by xchan_name LIMIT %d , %d ", intval($a->profile['uid']), intval($a->pager['start']), intval($a->pager['itemspage']) ); - if(! count($r)) { - info( t('No contacts.') . EOL ); + + if(! $r) { + info( t('No connections.') . EOL ); return $o; } $contacts = array(); foreach($r as $rr) { - if($rr['self']) - continue; - - $url = $rr['url']; - - // route DFRN profiles through the redirect - - $is_owner = ((local_user() && ($a->profile['profile_uid'] == local_user())) ? true : false); - if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) - $url = 'redir/' . $rr['id']; - else - $url = zid($url); + $url = zid($rr['xchan_url']); $contacts[] = array( - 'id' => $rr['id'], - 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), - 'thumb' => $rr['thumb'], - 'name' => substr($rr['name'],0,20), - 'username' => $rr['name'], + 'id' => $rr['abook_id'], + 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['xchan_name'], $rr['xchan_url']), + 'thumb' => $rr['xchan_photo_m'], + 'name' => substr($rr['xchan_name'],0,20), + 'username' => $rr['xchan_addr'], 'url' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], - 'network' => network_to_name($rr['network']), + 'network' => '', ); } $tpl = get_markup_template("viewcontact_template.tpl"); $o .= replace_macros($tpl, array( - '$title' => t('View Contacts'), + '$title' => t('View Connnections'), '$contacts' => $contacts, '$paginate' => paginate($a), )); diff --git a/version.inc b/version.inc index 7e1699df2..c07f843b6 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-02-18.228 +2013-02-19.229 diff --git a/view/tpl/contact_template.tpl b/view/tpl/contact_template.tpl index 0accd5e02..7bdcd6b93 100644 --- a/view/tpl/contact_template.tpl +++ b/view/tpl/contact_template.tpl @@ -1,7 +1,7 @@ <div class="contact-entry-wrapper" id="contact-entry-wrapper-$contact.id" > <div class="contact-entry-photo-wrapper" > - <a href="$contact.edit" title="$contact.img_hover" /><img src="$contact.thumb" alt="$contact.name" /></a> + <a href="$contact.url" title="$contact.img_hover" /><img src="$contact.thumb" alt="$contact.name" /></a> </div> <div class="contact-entry-photo-end" ></div> <div class="contact-entry-name" id="contact-entry-name-$contact.id" >$contact.name</div> diff --git a/view/tpl/smarty3/contact_template.tpl b/view/tpl/smarty3/contact_template.tpl index a426508eb..496fb90ba 100644 --- a/view/tpl/smarty3/contact_template.tpl +++ b/view/tpl/smarty3/contact_template.tpl @@ -6,7 +6,7 @@ <div class="contact-entry-wrapper" id="contact-entry-wrapper-{{$contact.id}}" > <div class="contact-entry-photo-wrapper" > - <a href="{{$contact.edit}}" title="{{$contact.img_hover}}" /><img src="{{$contact.thumb}}" alt="{{$contact.name}}" /></a> + <a href="{{$contact.url}}" title="{{$contact.img_hover}}" /><img src="{{$contact.thumb}}" alt="{{$contact.name}}" /></a> </div> <div class="contact-entry-photo-end" ></div> <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div> |