From 593d361d2e9dd177d4125a8751540f0afa4b2323 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 9 Nov 2012 00:02:46 -0800 Subject: profile/channel page view contacts --- boot.php | 21 ++++++++------------- include/text.php | 19 +++++++++++-------- view/tpl/profile_vcard.tpl | 1 - 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/boot.php b/boot.php index 8e8b92593..707545155 100644 --- a/boot.php +++ b/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( diff --git a/include/text.php b/include/text.php index dcd3ad07f..6c1a102c0 100644 --- a/include/text.php +++ b/include/text.php @@ -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'] . '' . "\r\n"; + . '" title="' . $contact['xchan_name'] . ' [' . $contact['xchan_url'] . ']" alt="' . $contact['xchan_name'] + . '" >'. $contact['xchan_name'] . '' . "\r\n"; } else { return '
' . $contact['name'] 
+			. $contact['xchan_photo_s'] . '
' . "\r\n"; } }} diff --git a/view/tpl/profile_vcard.tpl b/view/tpl/profile_vcard.tpl index 0876e2dc6..1d0c433e9 100644 --- a/view/tpl/profile_vcard.tpl +++ b/view/tpl/profile_vcard.tpl @@ -25,7 +25,6 @@ {{ if $gender }}
$gender
$profile.gender
{{ endif }} - {{ if $profile.pubkey }}{{ endif }} {{ if $marital }}
$marital
$profile.marital
{{ endif }} -- cgit v1.2.3