diff --git a/boot.php b/boot.php index 42a0f72077..edad6e70f3 100644 --- a/boot.php +++ b/boot.php @@ -808,8 +808,8 @@ function profile_load(&$a, $nickname, $profile = 0) { $a->page['aside'] .= profile_sidebar($a->profile, $block); - if(! $block) - $a->page['aside'] .= contact_block(); + /*if(! $block) + $a->page['aside'] .= contact_block();*/ return; }} @@ -837,132 +837,68 @@ function profile_sidebar($profile, $block = 0) { $a = get_app(); $o = ''; - $location = ''; + $location = false; $address = false; + $pdesc = true; if((! is_array($profile)) && (! count($profile))) return $o; call_hooks('profile_sidebar_enter', $profile); - $fullname = '
' . $profile['name'] . '
'; - - $pdesc = '
' . $profile['pdesc'] . '
'; - - $tabs = ''; - - $photo = '
' . $profile['name'] . '
'; - + // don't show connect link to yourself - $connect = (($profile['uid'] != local_user()) ? '
  • ' . t('Connect') . '
  • ' : ''); + $connect = (($profile['uid'] != local_user()) ? t('Connect') : False); // don't show connect link to authenticated visitors either if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid'])) - $connect = ''; + $connect = False; + if((x($profile,'address') == 1) || (x($profile,'locality') == 1) || (x($profile,'region') == 1) || (x($profile,'postal-code') == 1) || (x($profile,'country-name') == 1)) - $address = true; + $location = t('Location:'); - if($address) { - $location .= '
    ' . t('Location:') . '
    '; - $location .= ((x($profile,'address') == 1) ? '
    ' . $profile['address'] . '
    ' : ''); - $location .= (((x($profile,'locality') == 1) || (x($profile,'region') == 1) || (x($profile,'postal-code') == 1)) - ? '' . $profile['locality'] . '' - . ((x($profile['locality']) == 1) ? t(', ') : '') - . '' . $profile['region'] . '' - . ' ' . $profile['postal-code'] . '' : ''); - $location .= ((x($profile,'country-name') == 1) ? ' ' . $profile['country-name'] . '' : ''); - $location .= '
    '; - - } + $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False); - $gender = ((x($profile,'gender') == 1) ? '
    ' . t('Gender:') . ' ' . $profile['gender'] . '
    ' : ''); + $marital = ((x($profile,'marital') == 1) ? t('Status:') : False); - $pubkey = ((x($profile,'pubkey') == 1) ? '' : ''); - - $marital = ((x($profile,'marital') == 1) ? '
    ' . t('Status:') . ' ' . $profile['marital'] . '
    ' : ''); - - $homepage = ((x($profile,'homepage') == 1) ? '
    ' . t('Homepage:') . ' ' . linkify($profile['homepage']) . '
    ' : ''); + $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False); if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) { - $location = $pdesc = $connect = $gender = $marital = $homepage = ''; + $location = $pdesc = $connect = $gender = $marital = $homepage = False; } - $podloc = $a->get_baseurl(); - $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ); - $nickname = $profile['nickname']; - $photo300 = $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg'; - $photo100 = $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg'; - $photo50 = $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg'; + $diaspora = array( + 'podloc' => $a->get_baseurl(), + 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ), + 'nickname ' => $profile['nickname'], + 'photo300 ' => $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg', + 'photo100 ' => $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg', + 'photo50 ' => $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg', + ); - $diaspora_vcard = <<< EOT - -
    -
    -
    Nickname
    -
    -$nickname -
    -
    -
    -
    Full name
    -
    -$fullname -
    -
    -
    -
    URL
    -
    -$podloc/ -
    -
    -
    -
    Photo
    -
    - -
    -
    -
    -
    Photo
    -
    - -
    -
    -
    -
    Photo
    -
    - -
    -
    -
    -
    Searchable
    -
    -$searchable -
    -
    -
    -EOT; + if (!$block){ + $contact_block = contact_block(); + } $tpl = get_markup_template('profile_vcard.tpl'); $o .= replace_macros($tpl, array( - '$fullname' => $fullname, - '$pdesc' => $pdesc, - '$tabs' => $tabs, - '$photo' => $photo, + '$profile' => $profile, '$connect' => $connect, '$location' => $location, '$gender' => $gender, - '$pubkey' => $pubkey, + '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, - '$diaspora' => $diaspora_vcard + '$diaspora' => $diaspora, + '$contact_block' => $contact_block, )); diff --git a/include/text.php b/include/text.php index 66447069e4..075caee000 100644 --- a/include/text.php +++ b/include/text.php @@ -539,22 +539,30 @@ function contact_block() { $total = intval($r[0]['total']); } if(! $total) { - $o .= '

    ' . t('No contacts') . '

    '; - return $o; - } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d", - intval($a->profile['uid']), - intval($shown) - ); - if(count($r)) { - $o .= '

    ' . sprintf( tt('%d Contact','%d Contacts', $total),$total) . '

    '; - foreach($r as $rr) { - $o .= micropro($rr,true,'mpfriend'); - } - $o .= '
    '; - $o .= '
    ' . t('View Contacts') . '
    '; + $contacts = t('No contacts'); + $micropro = Null; + } else { + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d", + intval($a->profile['uid']), + intval($shown) + ); + if(count($r)) { + $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total); + $micropro = Array(); + foreach($r as $rr) { + $micropro[] = micropro($rr,true,'mpfriend'); + } + } } + + $tpl = get_markup_template('contact_block.tpl'); + $o = replace_macros($tpl, array( + '$contacts' => $contacts, + '$nickname' => $a->profile['nickname'], + '$viewcontacts' => t('View Contacts'), + '$micropro' => $micropro, + )); $arr = array('contacts' => $r, 'output' => $o); diff --git a/view/contact_block.tpl b/view/contact_block.tpl new file mode 100644 index 0000000000..00b97a6d88 --- /dev/null +++ b/view/contact_block.tpl @@ -0,0 +1,9 @@ +

    $contacts

    +{{ if $micropro }} +
    + {{ for $micropro as $m }} + $m + {{ endfor }} +
    +
    $viewcontacts
    +{{ endif }} diff --git a/view/diaspora_vcard.tpl b/view/diaspora_vcard.tpl new file mode 100644 index 0000000000..aa2c9eded9 --- /dev/null +++ b/view/diaspora_vcard.tpl @@ -0,0 +1,44 @@ +
    +
    +
    Nickname
    +
    + $diaspora.nickname +
    +
    +
    +
    Full name
    +
    + $diaspora.fullname +
    +
    +
    +
    URL
    +
    + $diaspora.podloc/ +
    +
    +
    +
    Photo
    +
    + +
    +
    +
    +
    Photo
    +
    + +
    +
    +
    +
    Photo
    +
    + +
    +
    +
    +
    Searchable
    +
    + $diaspora.searchable +
    +
    +
    diff --git a/view/profile_vcard.tpl b/view/profile_vcard.tpl index 34f265ee67..01238ed5af 100644 --- a/view/profile_vcard.tpl +++ b/view/profile_vcard.tpl @@ -1,29 +1,43 @@
    - $fullname - $pdesc - $tabs - - $photo +
    $profile.name
    + {{ if $pdesc }}
    $profile.pdesc
    {{ endif }} +
    $profile.name
    - $location + {{ if $location }} +
    $location +
    + {{ if $profile.address }}
    $profile.address
    {{ endif }} + + $profile.locality{{ if $profile.locality }}, {{ endif }} + $profile.region + $profile.postal-code + + {{ if $profile.country-name }}$profile.country-name{{ endif }} +
    + + {{ endif }} - $gender + {{ if $gender }}
    $gender $profile.gender
    {{ endif }} + + {{ if $profile.pubkey }}{{ endif }} - $pubkey + {{ if $marital }}
    $marital$profile.marital
    {{ endif }} -$diaspora + {{ if $homepage }}{{ endif }} + + {{ inc diaspora_vcard.tpl }}{{ endinc }}
    -$marital - -$homepage +$contact_block