diff --git a/include/Contact.php b/include/Contact.php index 920ec3c2b4..e6ec8daade 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -219,17 +219,20 @@ function contact_photo_menu($contact) { $status_link = $profile_link . "?url=status"; $photos_link = $profile_link . "?url=photos"; $profile_link = $profile_link . "?url=profile"; - $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id']; } - $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id']; + if (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA))) + $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id']; + + if ($contact["network"] == NETWORK_DFRN) + $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id']; + $contact_url = $a->get_baseurl() . '/contacts/' . $contact['id']; $posts_link = $a->get_baseurl() . '/network/0?nets=all&cid=' . $contact['id']; $contact_drop_link = $a->get_baseurl() . "/contacts/" . $contact['id'] . '/drop?confirm=1'; $menu = Array( - 'poke' => array(t("Poke"), $poke_link), 'status' => array(t("View Status"), $status_link), 'profile' => array(t("View Profile"), $profile_link), 'photos' => array(t("View Photos"), $photos_link), @@ -237,6 +240,7 @@ function contact_photo_menu($contact) { 'edit' => array(t("Edit Contact"), $contact_url), 'drop' => array(t("Drop Contact"), $contact_drop_link), 'pm' => array(t("Send PM"), $pm_url), + 'poke' => array(t("Poke"), $poke_link), ); @@ -254,6 +258,7 @@ function contact_photo_menu($contact) { } } return $o;*/ + foreach($menu as $k=>$v){ if ($v[1]!="") { if(($v[0] !== t("Network Posts")) && ($v[0] !== t("Send PM")) && ($v[0] !== t('Edit Contact'))) @@ -262,7 +267,14 @@ function contact_photo_menu($contact) { $menu[$k][2] = 0; } } - return $menu; + + $menucondensed = array(); + + foreach ($menu AS $menuitem) + if ($menuitem[1] != "") + $menucondensed[] = $menuitem; + + return $menucondensed; }} diff --git a/include/conversation.php b/include/conversation.php index 143dd4e424..0a33740555 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -792,10 +792,16 @@ function best_link_url($item,&$sparkle,$ssl_state = false) { if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) { $best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id']; $sparkle = true; - } - else + } else $best_url = $a->contacts[$clean_url]['url']; } + } elseif (local_user()) { + $r = q("SELECT `id`, `network` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s'", + dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url))); + if ($r) { + $best_url = $a->get_baseurl($ssl_state).'/redir/'.$r[0]['id']; + $sparkle = true; + } } if(! $best_url) { if(strlen($item['author-link'])) @@ -848,13 +854,16 @@ function item_photo_menu($item){ $profile_link = zrl($profile_link); if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) { $cid = $item['contact-id']; - } - else { - $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' ORDER BY `uid` DESC LIMIT 1", - intval($item['uid']), normalise_link($item['author-link'])); - if ($r) + } else { + $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' ORDER BY `uid` DESC LIMIT 1", + intval(local_user()), dbesc(normalise_link($item['author-link']))); + if ($r) { $cid = $r[0]["id"]; - else + + if ($r[0]["network"] == NETWORK_DIASPORA) + $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid; + + } else $cid = 0; } } diff --git a/mod/dirfind.php b/mod/dirfind.php index b0d578a3c6..488e10fa16 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -1,6 +1,7 @@ results)) { + $id = 0; + $tpl = get_markup_template('match.tpl'); foreach($j->results as $jj) { @@ -120,9 +123,16 @@ function dirfind_content(&$a, $prefix = "") { if ($jj->cid > 0) { $connlnk = ""; $conntxt = ""; + $contact = q("SELECT * FROM `contact` WHERE `id` = %d", + intval($jj->cid)); + if ($contact) + $photo_menu = contact_photo_menu($contact[0]); + else + $photo_menu = array(); } else { $connlnk = $a->get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $conntxt = t('Connect'); + $photo_menu = array(array(t("Connect/Follow"), $connlnk)); } $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); @@ -134,6 +144,8 @@ function dirfind_content(&$a, $prefix = "") { '$tags' => $jj->tags, '$conntxt' => $conntxt, '$connlnk' => $connlnk, + '$photo_menu' => $photo_menu, + '$id' => ++$id, )); } } diff --git a/mod/follow.php b/mod/follow.php index 8affa11b56..2c8452b1bf 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -72,11 +72,11 @@ function follow_content(&$a) { if ($ret["addr"] != "") $header .= " <".$ret["addr"].">"; - $header .= " (".network_to_name($ret['network']).")"; + $header .= " (".network_to_name($ret['network'], $ret['url']).")"; $o = replace_macros($tpl,array( '$header' => htmlentities($header), - '$photo' => $ret["photo"], + '$photo' => proxy_url($ret["photo"]), '$desc' => "", '$pls_answer' => t('Please answer the following:'), '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', array(t('No'),t('Yes'))), diff --git a/mod/notifications.php b/mod/notifications.php index bcda5ba343..69ab592afe 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -166,7 +166,7 @@ function notifications_content(&$a) { '$intro_id' => $rr['intro_id'], '$madeby' => sprintf( t('suggested by %s'),$rr['name']), '$contact_id' => $rr['contact-id'], - '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"), + '$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto']) : "images/person-175.jpg"), '$fullname' => $rr['fname'], '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), @@ -220,7 +220,7 @@ function notifications_content(&$a) { if ($ret["addr"] != "") $header .= " <".$ret["addr"].">"; - $header .= " (".network_to_name($rr['gnetwork']).")"; + $header .= " (".network_to_name($rr['gnetwork'], $rr['url']).")"; $notif_content .= replace_macros($tpl, array( '$header' => htmlentities($header), @@ -368,7 +368,7 @@ function notifications_content(&$a) { foreach ($r as $it) { $notif_content .= replace_macros($not_tpl,array( '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], - '$item_image' => $it['photo'], + '$item_image' => proxy_url($it['photo']), '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date']) )); diff --git a/view/templates/match.tpl b/view/templates/match.tpl index 32f046e6aa..3ebabf1854 100644 --- a/view/templates/match.tpl +++ b/view/templates/match.tpl @@ -1,9 +1,25 @@
-
+
{{$name}} + {{if $photo_menu}} + menu +
+
    + {{foreach $photo_menu as $k=>$c}} + {{if $c.2}} +
  • {{$c.0}}
  • + {{else}} +
  • {{$c.0}}
  • + {{/if}} + {{/foreach}} +
+
+ {{/if}}