2015-08-23 22:38:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once('include/socgraph.php');
|
|
|
|
|
|
|
|
function common_init(&$a) {
|
|
|
|
|
|
|
|
if(argc() > 1 && intval(argv(1)))
|
|
|
|
$channel_id = intval(argv(1));
|
|
|
|
else {
|
|
|
|
notice( t('No channel.') . EOL );
|
2016-04-17 16:29:18 +02:00
|
|
|
App::$error = 404;
|
2015-08-23 22:38:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$x = q("select channel_address from channel where channel_id = %d limit 1",
|
|
|
|
intval($channel_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
if($x)
|
|
|
|
profile_load($a,$x[0]['channel_address'],0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function common_content(&$a) {
|
|
|
|
|
|
|
|
$o = '';
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
if(! App::$profile['profile_uid'])
|
2015-08-23 22:38:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
$observer_hash = get_observer_hash();
|
|
|
|
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
if(! perm_is_allowed(App::$profile['profile_uid'],$observer_hash,'view_contacts')) {
|
2015-08-23 22:38:18 +02:00
|
|
|
notice( t('Permission denied.') . EOL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$o .= '<h2>' . t('Common connections') . '</h2>';
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
$t = count_common_friends(App::$profile['profile_uid'],$observer_hash);
|
2015-08-23 22:38:18 +02:00
|
|
|
|
|
|
|
if(! $t) {
|
|
|
|
notice( t('No connections in common.') . EOL);
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
$r = common_friends(App::$profile['profile_uid'],$observer_hash);
|
2015-08-23 22:38:18 +02:00
|
|
|
|
|
|
|
if($r) {
|
|
|
|
|
|
|
|
$tpl = get_markup_template('common_friends.tpl');
|
|
|
|
|
|
|
|
foreach($r as $rr) {
|
|
|
|
$o .= replace_macros($tpl,array(
|
|
|
|
'$url' => $rr['xchan_url'],
|
|
|
|
'$name' => $rr['xchan_name'],
|
|
|
|
'$photo' => $rr['xchan_photo_m'],
|
|
|
|
'$tags' => ''
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
$o .= cleardiv();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|