aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-03 16:35:55 -0700
committerfriendica <info@friendica.com>2013-08-03 16:35:55 -0700
commite6a8bb211c44550f2d235b6f795d67ef3d781111 (patch)
treeb6fc93af4f1643f990fd4f83043c2ee038f1b178 /mod
parent8a7fea45cc471b57cf0e44b03992d94b5a73bd0a (diff)
downloadvolse-hubzilla-e6a8bb211c44550f2d235b6f795d67ef3d781111.tar.gz
volse-hubzilla-e6a8bb211c44550f2d235b6f795d67ef3d781111.tar.bz2
volse-hubzilla-e6a8bb211c44550f2d235b6f795d67ef3d781111.zip
connect link in directory
Diffstat (limited to 'mod')
-rw-r--r--mod/directory.php26
-rw-r--r--mod/dirsearch.php2
2 files changed, 24 insertions, 4 deletions
diff --git a/mod/directory.php b/mod/directory.php
index 1e5d64a0f..1b7bc3e4f 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -53,6 +53,20 @@ 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)
@@ -88,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'];
@@ -142,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);
@@ -150,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,
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 993522549..6d6ef7434 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -134,6 +134,8 @@ function dirsearch_content(&$a) {
$entry = array();
$entry['name'] = $rr['xchan_name'];
+ $entry['hash'] = $rr['xchan_hash'];
+
$entry['updated'] = (($rr['ud_date']) ? $rr['ud_date'] : '0000-00-00 00:00:00');
$entry['url'] = $rr['xchan_url'];
$entry['photo'] = $rr['xchan_photo_m'];