aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-11-01 19:16:33 -0700
committerFriendika <info@friendika.com>2011-11-01 19:16:33 -0700
commit3d9a9614e232a3ff207803be1092b1d42bcadde6 (patch)
treeaf9ba51b8cefc4246a2627ec2e94b940c6531aa4 /mod
parent0975ea86101281befec9258d58e28c88d7b8ae4d (diff)
downloadvolse-hubzilla-3d9a9614e232a3ff207803be1092b1d42bcadde6.tar.gz
volse-hubzilla-3d9a9614e232a3ff207803be1092b1d42bcadde6.tar.bz2
volse-hubzilla-3d9a9614e232a3ff207803be1092b1d42bcadde6.zip
common friends
Diffstat (limited to 'mod')
-rw-r--r--mod/common.php61
-rw-r--r--mod/contacts.php5
2 files changed, 66 insertions, 0 deletions
diff --git a/mod/common.php b/mod/common.php
new file mode 100644
index 000000000..852388c14
--- /dev/null
+++ b/mod/common.php
@@ -0,0 +1,61 @@
+<?php
+
+require_once('include/socgraph.php');
+
+function common_content(&$a) {
+
+ $o = '';
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ if($a->argc > 1)
+ $cid = intval($a->argv[1]);
+ if(! $cid)
+ return;
+
+ $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
+ intval($cid),
+ intval(local_user())
+ );
+
+ $a->page['aside'] .= '<div class="vcard">'
+ . '<div class="fn label">' . $c[0]['name'] . '</div>'
+ . '<div id="profile-photo-wrapper">'
+ . '<a href="/contacts/' . $cid . '"><img class="photo" width="175" height="175"
+ src="' . $c[0]['photo'] . '" alt="' . $c[0]['name'] . '" /></div>'
+ . '</div>';
+
+
+ if(! count($c))
+ return;
+
+ $o .= '<h2>' . t('Common Friends') . '</h2>';
+
+// $o .= '<h3>' . sprintf( t('You and %s'),$c[0]['name']) . '</h3>';
+
+
+ $r = common_friends(local_user(),$cid);
+
+ if(! count($r)) {
+ $o .= t('No friends in common.');
+ return $o;
+ }
+
+ $tpl = get_markup_template('common_friends.tpl');
+
+ foreach($r as $rr) {
+
+ $o .= replace_macros($tpl,array(
+ '$url' => $rr['url'],
+ '$name' => $rr['name'],
+ '$photo' => $rr['photo'],
+ '$tags' => ''
+ ));
+ }
+
+ $o .= cleardiv();
+// $o .= paginate($a);
+ return $o;
+}
diff --git a/mod/contacts.php b/mod/contacts.php
index 9bbcea07d..ecfbe6c2c 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -1,6 +1,7 @@
<?php
require_once('include/Contact.php');
+require_once('include/socgraph.php');
function contacts_init(&$a) {
if(! local_user())
@@ -265,6 +266,8 @@ function contacts_content(&$a) {
$nettype = '<div id="contact-edit-nettype">' . sprintf( t('Network type: %s'),network_to_name($r[0]['network'])) . '</div>';
+ $common = count_common_friends(local_user(),$r[0]['id']);
+ $common_text = (($common) ? sprintf( tt('%d friends in common','%d friends in common', $common),$common) : '');
$o .= replace_macros($tpl,array(
'$header' => t('Contact Editor'),
'$submit' => t('Submit'),
@@ -275,6 +278,8 @@ function contacts_content(&$a) {
'$lbl_rep2' => t('Occasionally your friends may wish to inquire about this person\'s online legitimacy.'),
'$lbl_rep3' => t('You may help them choose whether or not to interact with this person by providing a <em>reputation</em> to guide them.'),
'$lbl_rep4' => t('Please take a moment to elaborate on this selection if you feel it could be helpful to others.'),
+ '$common_text' => $common_text,
+ '$common_link' => $a->get_baseurl() . '/common/' . $r[0]['id'],
'$visit' => sprintf( t('Visit %s\'s profile [%s]'),$r[0]['name'],$r[0]['url']),
'$blockunblock' => t('Block/Unblock contact'),
'$ignorecont' => t('Ignore contact'),