diff options
Diffstat (limited to 'mod/directory.php')
-rw-r--r-- | mod/directory.php | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/mod/directory.php b/mod/directory.php index 21fb14bfc..b7cdaffe7 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -4,7 +4,7 @@ require_once('include/dir_fns.php'); function directory_init(&$a) { - $a->set_pager_itemspage(60); + $a->set_pager_itemspage(80); } @@ -45,7 +45,7 @@ function directory_content(&$a) { $directory = find_upstream_directory($dirmode); if($directory) { - $url = $directory['url']; + $url = $directory['url'] . '/dirsearch'; } else { $url = DIRECTORY_FALLBACK_MASTER . '/dirsearch'; @@ -53,12 +53,30 @@ function directory_content(&$a) { } logger('mod_directory: URL = ' . $url, LOGGER_DEBUG); + $contacts = array(); + + if(local_user()) { + $x = q("select abook_xchan from abook where abook_channel = %d", + intval(local_user()) + ); + if($x) { + foreach($x as $xx) + $contacts[] = $xx['abook_xchan']; + } + } + + + if($url) { $query = $url . '?f=' ; if($search) $query .= '&name=' . urlencode($search); if(strpos($search,'@')) $query .= '&address=' . urlencode($search); + + $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : ''); + if($sort_order) + $query .= '&order=' . urlencode($sort_order); if($a->pager['page'] != 1) $query .= '&p=' . $a->pager['page']; @@ -66,7 +84,7 @@ function directory_content(&$a) { logger('mod_directory: query: ' . $query); $x = z_fetch_url($query); - logger('directory: return from upstream: ' . print_r($x,true)); + logger('directory: return from upstream: ' . print_r($x,true), LOGGER_DATA); if($x['success']) { $t = 0; @@ -84,7 +102,11 @@ function directory_content(&$a) { $profile_link = chanlink_url($rr['url']); $pdesc = (($rr['description']) ? $rr['description'] . '<br />' : ''); - + $connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : ''); + + if(in_array($rr['hash'],$contacts)) + $connect_link = ''; + $details = ''; if(strlen($rr['locale'])) $details .= $rr['locale']; @@ -138,7 +160,8 @@ function directory_content(&$a) { 'marital' => $marital, 'homepage' => $homepage, 'about' => $about, - + 'conn_label' => t('Connect'), + 'connect' => $connect_link, ); $arr = array('contact' => $rr, 'entry' => $entry); @@ -146,14 +169,13 @@ function directory_content(&$a) { call_hooks('directory_item', $arr); $entries[] = $entry; - unset($profile); unset($location); } - logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); +// logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); $o .= replace_macros($tpl, array( '$search' => $search, @@ -166,7 +188,7 @@ function directory_content(&$a) { )); - $o .= alt_pager($a,$j['records'], t('more'), t('back')); + $o .= alt_pager($a,$j['records'], t('next page'), t('previous page')); } else { |