mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
profile/channel page view contacts
This commit is contained in:
parent
517c05700d
commit
593d361d2e
3 changed files with 19 additions and 22 deletions
21
boot.php
21
boot.php
|
@ -1280,6 +1280,8 @@ if(! function_exists('profile_sidebar')) {
|
|||
|
||||
$a = get_app();
|
||||
|
||||
$observer = $a->get_observer();
|
||||
|
||||
$o = '';
|
||||
$location = false;
|
||||
$address = false;
|
||||
|
@ -1315,7 +1317,7 @@ if(! function_exists('profile_sidebar')) {
|
|||
|
||||
|
||||
// show edit profile to yourself
|
||||
if ($profile['uid'] == local_user()) {
|
||||
if ($profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) {
|
||||
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
|
||||
|
||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
||||
|
@ -1373,23 +1375,16 @@ if(! function_exists('profile_sidebar')) {
|
|||
? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name']);
|
||||
$lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname))));
|
||||
|
||||
$diaspora = array(
|
||||
'podloc' => $a->get_baseurl(),
|
||||
'searchable' => (($profile['publish']) ? 'true' : 'false' ),
|
||||
'nickname' => $profile['nickname'],
|
||||
'fullname' => $profile['name'],
|
||||
'firstname' => $firstname,
|
||||
'lastname' => $lastname,
|
||||
'photo300' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg'),
|
||||
'photo100' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg'),
|
||||
'photo50' => $a->get_cached_avatar_image($a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg'),
|
||||
);
|
||||
logger('observer' . print_r($observer,true));
|
||||
logger('uid' . $profile['uid']);
|
||||
|
||||
if (!$block){
|
||||
if(is_array($observer)
|
||||
&& perm_is_allowed($profile['uid'],$observer['xchan_hash'],'view_contacts')) {
|
||||
$contact_block = contact_block();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$tpl = get_markup_template('profile_vcard.tpl');
|
||||
|
||||
$o .= replace_macros($tpl, array(
|
||||
|
|
|
@ -522,6 +522,7 @@ function contact_block() {
|
|||
$o = '';
|
||||
$a = get_app();
|
||||
|
||||
logger('contact block');
|
||||
$shown = get_pconfig($a->profile['uid'],'system','display_friend_count');
|
||||
if($shown === false)
|
||||
$shown = 24;
|
||||
|
@ -530,7 +531,7 @@ function contact_block() {
|
|||
|
||||
if((! is_array($a->profile)) || ($a->profile['hide_friends']))
|
||||
return $o;
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0",
|
||||
$r = q("SELECT COUNT(*) AS total FROM abook WHERE abook_channel = %d and abook_flags = 0",
|
||||
intval($a->profile['uid'])
|
||||
);
|
||||
if(count($r)) {
|
||||
|
@ -541,10 +542,12 @@ function contact_block() {
|
|||
$micropro = Null;
|
||||
|
||||
} else {
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY RAND() LIMIT %d",
|
||||
dbg(1);
|
||||
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d AND abook_flags = 0 ORDER BY RAND() LIMIT %d",
|
||||
intval($a->profile['uid']),
|
||||
intval($shown)
|
||||
);
|
||||
dbg(0);
|
||||
if(count($r)) {
|
||||
$contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
|
||||
$micropro = Array();
|
||||
|
@ -575,14 +578,14 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
|
|||
if($class)
|
||||
$class = ' ' . $class;
|
||||
|
||||
$url = $contact['url'];
|
||||
$url = $contact['xchan_url'];
|
||||
$sparkle = '';
|
||||
$redir = false;
|
||||
|
||||
if($redirect) {
|
||||
$a = get_app();
|
||||
$redirect_url = $a->get_baseurl() . '/redir/' . $contact['id'];
|
||||
if(local_user() && ($contact['uid'] == local_user()) && ($contact['network'] === 'dfrn')) {
|
||||
$redirect_url = $a->get_baseurl() . '/magic/' . $contact['abook_id'];
|
||||
if(local_user() && ($contact['abook_channel'] == local_user()) && ($contact['xchan_network'] === NETWORK_ZOT)) {
|
||||
$redir = true;
|
||||
$url = $redirect_url;
|
||||
$sparkle = ' sparkle';
|
||||
|
@ -598,15 +601,15 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
|
|||
. (($click) ? ' fakelink' : '') . '" '
|
||||
. (($redir) ? ' ' : '')
|
||||
. (($url) ? ' href="' . $url . '"' : '') . $click
|
||||
. '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
|
||||
. '" >'. $contact['name'] . '</a></div>' . "\r\n";
|
||||
. '" title="' . $contact['xchan_name'] . ' [' . $contact['xchan_url'] . ']" alt="' . $contact['xchan_name']
|
||||
. '" >'. $contact['xchan_name'] . '</a></div>' . "\r\n";
|
||||
}
|
||||
else {
|
||||
return '<div class="contact-block-div' . $class . '"><a class="contact-block-link' . $class . $sparkle
|
||||
. (($click) ? ' fakelink' : '') . '" '
|
||||
. (($redir) ? ' ' : '')
|
||||
. (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
|
||||
. $contact['micro'] . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
|
||||
. $contact['xchan_photo_s'] . '" title="' . $contact['xchan_name'] . ' [' . $contact['xchan_url'] . ']" alt="' . $contact['xchan_name']
|
||||
. '" /></a></div>' . "\r\n";
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
{{ if $gender }}<dl class="mf"><dt class="gender-label">$gender</dt> <dd class="x-gender">$profile.gender</dd></dl>{{ endif }}
|
||||
|
||||
{{ if $profile.pubkey }}<div class="key" style="display:none;">$profile.pubkey</div>{{ endif }}
|
||||
|
||||
{{ if $marital }}<dl class="marital"><dt class="marital-label"><span class="heart">♥</span>$marital</dt><dd class="marital-text">$profile.marital</dd></dl>{{ endif }}
|
||||
|
||||
|
|
Loading…
Reference in a new issue