mirror of
https://github.com/friendica/friendica
synced 2024-12-23 07:20:15 +00:00
remove html from profile vcard code
This commit is contained in:
parent
54f0685a03
commit
8b615133d5
5 changed files with 130 additions and 119 deletions
118
boot.php
118
boot.php
|
@ -808,8 +808,8 @@ function profile_load(&$a, $nickname, $profile = 0) {
|
||||||
|
|
||||||
$a->page['aside'] .= profile_sidebar($a->profile, $block);
|
$a->page['aside'] .= profile_sidebar($a->profile, $block);
|
||||||
|
|
||||||
if(! $block)
|
/*if(! $block)
|
||||||
$a->page['aside'] .= contact_block();
|
$a->page['aside'] .= contact_block();*/
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
|
@ -837,132 +837,68 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
$location = '';
|
$location = false;
|
||||||
$address = false;
|
$address = false;
|
||||||
|
$pdesc = true;
|
||||||
|
|
||||||
if((! is_array($profile)) && (! count($profile)))
|
if((! is_array($profile)) && (! count($profile)))
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
call_hooks('profile_sidebar_enter', $profile);
|
call_hooks('profile_sidebar_enter', $profile);
|
||||||
|
|
||||||
$fullname = '<div class="fn">' . $profile['name'] . '</div>';
|
|
||||||
|
|
||||||
$pdesc = '<div class="title">' . $profile['pdesc'] . '</div>';
|
|
||||||
|
|
||||||
$tabs = '';
|
|
||||||
|
|
||||||
$photo = '<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
|
|
||||||
|
|
||||||
// don't show connect link to yourself
|
// don't show connect link to yourself
|
||||||
$connect = (($profile['uid'] != local_user()) ? '<li><a id="dfrn-request-link" href="dfrn_request/' . $profile['nickname'] . '">' . t('Connect') . '</a></li>' : '');
|
$connect = (($profile['uid'] != local_user()) ? t('Connect') : False);
|
||||||
|
|
||||||
// don't show connect link to authenticated visitors either
|
// don't show connect link to authenticated visitors either
|
||||||
|
|
||||||
if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid']))
|
if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid']))
|
||||||
$connect = '';
|
$connect = False;
|
||||||
|
|
||||||
|
|
||||||
if((x($profile,'address') == 1)
|
if((x($profile,'address') == 1)
|
||||||
|| (x($profile,'locality') == 1)
|
|| (x($profile,'locality') == 1)
|
||||||
|| (x($profile,'region') == 1)
|
|| (x($profile,'region') == 1)
|
||||||
|| (x($profile,'postal-code') == 1)
|
|| (x($profile,'postal-code') == 1)
|
||||||
|| (x($profile,'country-name') == 1))
|
|| (x($profile,'country-name') == 1))
|
||||||
$address = true;
|
$location = t('Location:');
|
||||||
|
|
||||||
if($address) {
|
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
|
||||||
$location .= '<div class="location"><span class="location-label">' . t('Location:') . '</span> <div class="adr">';
|
|
||||||
$location .= ((x($profile,'address') == 1) ? '<div class="street-address">' . $profile['address'] . '</div>' : '');
|
|
||||||
$location .= (((x($profile,'locality') == 1) || (x($profile,'region') == 1) || (x($profile,'postal-code') == 1))
|
|
||||||
? '<span class="city-state-zip"><span class="locality">' . $profile['locality'] . '</span>'
|
|
||||||
. ((x($profile['locality']) == 1) ? t(', ') : '')
|
|
||||||
. '<span class="region">' . $profile['region'] . '</span>'
|
|
||||||
. ' <span class="postal-code">' . $profile['postal-code'] . '</span></span>' : '');
|
|
||||||
$location .= ((x($profile,'country-name') == 1) ? ' <span class="country-name">' . $profile['country-name'] . '</span>' : '');
|
|
||||||
$location .= '</div></div><div class="profile-clear"></div>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$gender = ((x($profile,'gender') == 1) ? '<div class="mf"><span class="gender-label">' . t('Gender:') . '</span> <span class="x-gender">' . $profile['gender'] . '</span></div><div class="profile-clear"></div>' : '');
|
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
|
||||||
|
|
||||||
$pubkey = ((x($profile,'pubkey') == 1) ? '<div class="key" style="display:none;">' . $profile['pubkey'] . '</div>' : '');
|
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
|
||||||
|
|
||||||
$marital = ((x($profile,'marital') == 1) ? '<div class="marital"><span class="marital-label"><span class="heart">♥</span> ' . t('Status:') . ' </span><span class="marital-text">' . $profile['marital'] . '</span></div><div class="profile-clear"></div>' : '');
|
|
||||||
|
|
||||||
$homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
|
|
||||||
|
|
||||||
if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
|
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();
|
$diaspora = array(
|
||||||
$searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' );
|
'podloc' => $a->get_baseurl(),
|
||||||
$nickname = $profile['nickname'];
|
'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ),
|
||||||
$photo300 = $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg';
|
'nickname ' => $profile['nickname'],
|
||||||
$photo100 = $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg';
|
'photo300 ' => $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg',
|
||||||
$photo50 = $a->get_baseurl() . '/photo/custom/50/' . $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
|
if (!$block){
|
||||||
|
$contact_block = contact_block();
|
||||||
<div style="display:none;">
|
}
|
||||||
<dl class='entity_nickname'>
|
|
||||||
<dt>Nickname</dt>
|
|
||||||
<dd>
|
|
||||||
<a class="nickname url uid" href="$podloc/" rel="me">$nickname</a>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl class='entity_fn'>
|
|
||||||
<dt>Full name</dt>
|
|
||||||
<dd>
|
|
||||||
<span class='fn'>$fullname</span>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl class="entity_url">
|
|
||||||
<dt>URL</dt>
|
|
||||||
<dd>
|
|
||||||
<a class="url" href="$podloc/" id="pod_location" rel="me">$podloc/</a>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl class="entity_photo">
|
|
||||||
<dt>Photo</dt>
|
|
||||||
<dd>
|
|
||||||
<img class="photo avatar" height="300px" width="300px" src="$photo300">
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl class="entity_photo_medium">
|
|
||||||
<dt>Photo</dt>
|
|
||||||
<dd>
|
|
||||||
<img class="photo avatar" height="100px" width="100px" src="$photo100">
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl class="entity_photo_small">
|
|
||||||
<dt>Photo</dt>
|
|
||||||
<dd>
|
|
||||||
<img class="photo avatar" height="50px" width="50px" src="$photo50">
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl class="entity_searchable">
|
|
||||||
<dt>Searchable</dt>
|
|
||||||
<dd>
|
|
||||||
<span class="searchable">$searchable</span>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
$tpl = get_markup_template('profile_vcard.tpl');
|
$tpl = get_markup_template('profile_vcard.tpl');
|
||||||
|
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$fullname' => $fullname,
|
'$profile' => $profile,
|
||||||
'$pdesc' => $pdesc,
|
|
||||||
'$tabs' => $tabs,
|
|
||||||
'$photo' => $photo,
|
|
||||||
'$connect' => $connect,
|
'$connect' => $connect,
|
||||||
'$location' => $location,
|
'$location' => $location,
|
||||||
'$gender' => $gender,
|
'$gender' => $gender,
|
||||||
'$pubkey' => $pubkey,
|
'$pdesc' => $pdesc,
|
||||||
'$marital' => $marital,
|
'$marital' => $marital,
|
||||||
'$homepage' => $homepage,
|
'$homepage' => $homepage,
|
||||||
'$diaspora' => $diaspora_vcard
|
'$diaspora' => $diaspora,
|
||||||
|
'$contact_block' => $contact_block,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -539,23 +539,31 @@ function contact_block() {
|
||||||
$total = intval($r[0]['total']);
|
$total = intval($r[0]['total']);
|
||||||
}
|
}
|
||||||
if(! $total) {
|
if(! $total) {
|
||||||
$o .= '<h4 class="contact-h4">' . t('No contacts') . '</h4>';
|
$contacts = t('No contacts');
|
||||||
return $o;
|
$micropro = Null;
|
||||||
}
|
|
||||||
$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 .= '<h4 class="contact-h4">' . sprintf( tt('%d Contact','%d Contacts', $total),$total) . '</h4><div id="contact-block">';
|
|
||||||
foreach($r as $rr) {
|
|
||||||
$o .= micropro($rr,true,'mpfriend');
|
|
||||||
}
|
|
||||||
$o .= '</div><div id="contact-block-end"></div>';
|
|
||||||
$o .= '<div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/' . $a->profile['nickname'] . '">' . t('View Contacts') . '</a></div>';
|
|
||||||
|
|
||||||
|
} 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);
|
$arr = array('contacts' => $r, 'output' => $o);
|
||||||
|
|
||||||
call_hooks('contact_block_end', $arr);
|
call_hooks('contact_block_end', $arr);
|
||||||
|
|
9
view/contact_block.tpl
Normal file
9
view/contact_block.tpl
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<h4 class="contact-h4">$contacts</h4>
|
||||||
|
{{ if $micropro }}
|
||||||
|
<div id="contact-block">
|
||||||
|
{{ for $micropro as $m }}
|
||||||
|
$m
|
||||||
|
{{ endfor }}
|
||||||
|
</div>
|
||||||
|
<div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/$nickname">$viewcontacts</a></div>
|
||||||
|
{{ endif }}
|
44
view/diaspora_vcard.tpl
Normal file
44
view/diaspora_vcard.tpl
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<div style="display:none;">
|
||||||
|
<dl class='entity_nickname'>
|
||||||
|
<dt>Nickname</dt>
|
||||||
|
<dd>
|
||||||
|
<a class="nickname url uid" href="$podloc/" rel="me">$diaspora.nickname</a>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class='entity_fn'>
|
||||||
|
<dt>Full name</dt>
|
||||||
|
<dd>
|
||||||
|
<span class='fn'>$diaspora.fullname</span>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_url">
|
||||||
|
<dt>URL</dt>
|
||||||
|
<dd>
|
||||||
|
<a class="url" href="$diaspora.podloc/" id="pod_location" rel="me">$diaspora.podloc/</a>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_photo">
|
||||||
|
<dt>Photo</dt>
|
||||||
|
<dd>
|
||||||
|
<img class="photo avatar" height="300px" width="300px" src="$diaspora.photo300">
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_photo_medium">
|
||||||
|
<dt>Photo</dt>
|
||||||
|
<dd>
|
||||||
|
<img class="photo avatar" height="100px" width="100px" src="$diaspora.photo100">
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_photo_small">
|
||||||
|
<dt>Photo</dt>
|
||||||
|
<dd>
|
||||||
|
<img class="photo avatar" height="50px" width="50px" src="$diaspora.photo50">
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="entity_searchable">
|
||||||
|
<dt>Searchable</dt>
|
||||||
|
<dd>
|
||||||
|
<span class="searchable">$diaspora.searchable</span>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
|
@ -1,29 +1,43 @@
|
||||||
<div class="vcard">
|
<div class="vcard">
|
||||||
|
|
||||||
$fullname
|
<div class="fn">$profile.name</div>
|
||||||
$pdesc
|
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
|
||||||
$tabs
|
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo" alt="$profile.name"></div>
|
||||||
|
|
||||||
$photo
|
|
||||||
|
|
||||||
<div id="profile-extra-links">
|
<div id="profile-extra-links">
|
||||||
<ul>
|
<ul>
|
||||||
$connect
|
{{ if $connect }}
|
||||||
|
<li><a id="dfrn-request-link" href="dfrn_request/$profile['nickname']">$connect</a></li>
|
||||||
|
{{ endif }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
$location
|
{{ if $location }}
|
||||||
|
<div class="location"><span class="location-label">$location</span>
|
||||||
|
<div class="adr">
|
||||||
|
{{ if $profile.address }}<div class="street-address">$profile.address</div>{{ endif }}
|
||||||
|
<span class="city-state-zip">
|
||||||
|
<span class="locality">$profile.locality</span>{{ if $profile.locality }}, {{ endif }}
|
||||||
|
<span class="region">$profile.region</span>
|
||||||
|
<span class="postal-code">$profile.postal-code</span>
|
||||||
|
</span>
|
||||||
|
{{ if $profile.country-name }}<span class="country-name">$profile.country-name</span>{{ endif }}
|
||||||
|
</div>
|
||||||
|
|
||||||
$gender
|
{{ endif }}
|
||||||
|
|
||||||
$pubkey
|
{{ if $gender }}<div class="mf"><span class="gender-label">$gender</span> <span class="x-gender">$profile.gender</span></div>{{ endif }}
|
||||||
|
|
||||||
$diaspora
|
{{ if $profile.pubkey }}<div class="key" style="display:none;">$profile.pubkey</div>{{ endif }}
|
||||||
|
|
||||||
|
{{ if $marital }}<div class="marital"><span class="marital-label"><span class="heart">♥</span>$marital</span><span class="marital-text">$profile.marital</span></div>{{ endif }}
|
||||||
|
|
||||||
|
{{ if $homepage }}<div class="homepage"><span class="homepage-label">$homepage</span><span class="homepage-url"><a href="$profile.homepage" target="external-link">$profile.homepage</a></span></div>{{ endif }}
|
||||||
|
|
||||||
|
{{ inc diaspora_vcard.tpl }}{{ endinc }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
$marital
|
$contact_block
|
||||||
|
|
||||||
$homepage
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue