The contact template now displays the address if available

This commit is contained in:
Michael Vogel 2015-11-06 00:47:54 +01:00
commit 0f41f35041
13 changed files with 164 additions and 18 deletions

View file

@ -69,7 +69,7 @@ function allfriends_content(&$a) {
$entry = array(
'url' => $rr['url'],
'itemurl' => $rr['url'],
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
'name' => htmlentities($rr['name']),
'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
'img_hover' => htmlentities($rr['name']),

View file

@ -70,7 +70,7 @@ function common_content(&$a) {
if($cid == 0 && $zcid == 0)
return;
return;
if($cid)
@ -112,7 +112,7 @@ function common_content(&$a) {
$entry = array(
'url' => $rr['url'],
'itemurl' => $rr['url'],
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
'name' => $rr['name'],
'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
'img_hover' => htmlentities($rr['name']),

View file

@ -867,7 +867,7 @@ function _contact_detail_for_template($rr){
'name' => htmlentities($rr['name']),
'username' => htmlentities($rr['name']),
'sparkle' => $sparkle,
'itemurl' => $rr['url'],
'itemurl' => (($rr['addr'] != "") ? $rr['addr'] : $rr['url']),
'url' => $url,
'network' => network_to_name($rr['network'], $rr['url']),
);

View file

@ -69,7 +69,7 @@ function dirfind_content(&$a, $prefix = "") {
dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)),
dbesc(escape_tags($search)), dbesc(escape_tags($search)));
$results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`photo`, `gcontact`.`network` , `gcontact`.`keywords`
$results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`photo`, `gcontact`.`network`, `gcontact`.`keywords`, `gcontact`.`addr`
FROM `gcontact`
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
@ -101,6 +101,7 @@ function dirfind_content(&$a, $prefix = "") {
$objresult = new stdClass();
$objresult->cid = $result["cid"];
$objresult->name = $result["name"];
$objresult->addr = $result["addr"];
$objresult->url = $result["url"];
$objresult->photo = $result["photo"];
$objresult->tags = $result["keywords"];
@ -134,7 +135,9 @@ function dirfind_content(&$a, $prefix = "") {
$alt_text = "";
$itemurl = $jj->url;
$contact_details = get_contact_details_by_url($jj->url, local_user());
$itemurl = (($contact_details["addr"] != "") ? $contact_details["addr"] : $jj->url);
// If We already know this contact then don't show the "connect" button
if ($jj->cid > 0) {
@ -167,6 +170,9 @@ function dirfind_content(&$a, $prefix = "") {
'conntxt' => $conntxt,
'connlnk' => $connlnk,
'photo_menu' => $photo_menu,
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
'network' => network_to_name($jj->network, $jj->url),
'id' => ++$id,
);

View file

@ -70,10 +70,15 @@ function match_content(&$a) {
$photo_menu = array(array(t("View Profile"), zrl($jj->url)));
$photo_menu[] = array(t("Connect/Follow"), $connlnk);
$contact_details = get_contact_details_by_url($jj->url, local_user());
$entry = array(
'url' => zrl($jj->url),
'itemurl' => $jj->url,
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $jj->url),
'name' => $jj->name,
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
'inttxt' => ' ' . t('is interested in:'),
'conntxt' => t('Connect'),

View file

@ -35,6 +35,7 @@ function nogroup_content(&$a) {
if(count($r)) {
foreach($r as $rr) {
$contact_details = get_contact_details_by_url($rr['url'], local_user());
$contacts[] = array(
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
@ -46,8 +47,11 @@ function nogroup_content(&$a) {
'thumb' => $rr['thumb'],
'name' => $rr['name'],
'username' => $rr['name'],
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
'sparkle' => $sparkle,
'itemurl' => $rr['url'],
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
'url' => $url,
'network' => network_to_name($rr['network'], $url),
);

View file

@ -78,16 +78,20 @@ function suggest_content(&$a) {
$connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
$ignlnk = $a->get_baseurl() . '/suggest?ignore=' . $rr['id'];
$photo_menu = array(array(t("View Profile"), zrl($jj->url)));
$photo_menu = array(array(t("View Profile"), zrl($rr["url"])));
$photo_menu[] = array(t("Connect/Follow"), $connlnk);
$photo_menu[] = array(t('Ignore/Hide'), $ignlnk);
$contact_details = get_contact_details_by_url($rr["url"], local_user());
$entry = array(
'url' => zrl($rr['url']),
'itemurl' => $rr['url'],
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
'img_hover' => $rr['url'],
'name' => $rr['name'],
'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
'ignlnk' => $ignlnk,
'ignid' => $rr['id'],
'conntxt' => t('Connect'),

View file

@ -1,4 +1,5 @@
<?php
require_once('include/Contact.php');
require_once('include/contact_selectors.php');
function viewcontacts_init(&$a) {
@ -12,7 +13,6 @@ function viewcontacts_init(&$a) {
function viewcontacts_content(&$a) {
require_once("mod/proxy.php");
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@ -59,15 +59,20 @@ function viewcontacts_content(&$a) {
else
$url = zrl($url);
$contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid']);
$contacts[] = array(
'id' => $rr['id'],
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
'name' => htmlentities(substr($rr['name'],0,20)),
'username' => htmlentities($rr['name']),
'details' => $contact_details['location'],
'tags' => $contact_details['keywords'],
'about' => $contact_details['about'],
'url' => $url,
'sparkle' => '',
'itemurl' => $rr['url'],
'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
'network' => network_to_name($rr['network'], $rr['url']),
);
}