aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/socgraph.php20
-rw-r--r--mod/directory.php5
-rwxr-xr-xview/tpl/direntry.tpl3
3 files changed, 28 insertions, 0 deletions
diff --git a/include/socgraph.php b/include/socgraph.php
index 7f03f8696..acebec419 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -180,6 +180,26 @@ function poco_load($xchan = '', $url = null) {
}
$total ++;
+
+
+ $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 0 limit 1",
+ dbesc($xchan),
+ dbesc($hash)
+ );
+
+ if(! $r) {
+ q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated, xlink_static ) values ( '%s', '%s', '%s', 0 ) ",
+ dbesc($xchan),
+ dbesc($hash),
+ dbesc(datetime_convert())
+ );
+ }
+ else {
+ q("update xlink set xlink_updated = '%s' where xlink_id = %d",
+ dbesc(datetime_convert()),
+ intval($r[0]['xlink_id'])
+ );
+ }
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
diff --git a/mod/directory.php b/mod/directory.php
index 87dadc58f..2a4672039 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -82,12 +82,15 @@ function directory_content(&$a) {
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
if($suggest) {
+
$r = suggestion_query(local_channel(),get_observer_hash());
// Remember in which order the suggestions were
$addresses = array();
+ $common = array();
$index = 0;
foreach($r as $rr) {
+// $common[$rr['xchan_addr']] = $rr['total'];
$addresses[$rr['xchan_addr']] = $index++;
}
@@ -300,6 +303,8 @@ function directory_content(&$a) {
'keywords' => $out,
'ignlink' => $suggest ? $a->get_baseurl() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => "Don't suggest",
+ 'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''),
+ 'common_txt' => sprintf( t('Common connections: %s'), intval($common[$rr['address']]) ),
'safe' => $safe_mode
);
diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl
index db098baa1..0608bca0a 100755
--- a/view/tpl/direntry.tpl
+++ b/view/tpl/direntry.tpl
@@ -20,6 +20,9 @@
{{if $entry.canrate}}<button class="btn btn-default" onclick="doRatings('{{$entry.hash}}'); return false;" ><i class="icon-pencil"></i></button><span class="required" id="edited-{{$entry.hash}}" style="display: none;" >*</span>{{/if}}
</div>
{{/if}}
+{{if $entry.common_friends}}
+<div id="dir-common">{{$entry.common_txt}}</div>
+{{/if}}
{{if $entry.public_forum}}
<div class="contact-forum">
{{$entry.forum_label}} @{{$entry.nickname}}+