Merge pull request #1937 from annando/1510-follow-notifications

Show RedMatrix and use the proxy for the profile pictures
This commit is contained in:
Tobias Diekershoff 2015-10-05 15:15:52 +02:00
commit 5545008768
6 changed files with 67 additions and 18 deletions

View File

@ -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;
}}

View File

@ -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;
}
}

View File

@ -1,6 +1,7 @@
<?php
require_once('include/contact_widgets.php');
require_once('include/socgraph.php');
require_once('include/Contact.php');
function dirfind_init(&$a) {
@ -113,6 +114,8 @@ function dirfind_content(&$a, $prefix = "") {
if(count($j->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,
));
}
}

View File

@ -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'))),

View File

@ -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'])
));

View File

@ -1,9 +1,25 @@
<div class="profile-match-wrapper">
<div class="profile-match-photo">
<div class="profile-match-photo" id="contact-entry-photo-{{$id}}"
onmouseover="if (typeof t{{$id}} != 'undefined') clearTimeout(t{{$id}}); openMenu('contact-photo-menu-button-{{$id}}')"
onmouseout="t{{$id}}=setTimeout('closeMenu(\'contact-photo-menu-button-{{$id}}\'); closeMenu(\'contact-photo-menu-{{$id}}\');',200)" >
<a href="{{$url}}">
<img width="80" height="80" src="{{$photo}}" alt="{{$name}}" title="{{$name}}[{{$tags}}]" />
</a>
{{if $photo_menu}}
<span onclick="openClose('contact-photo-menu-{{$id}}');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-{{$id}}">menu</span>
<div class="contact-photo-menu" id="contact-photo-menu-{{$id}}">
<ul>
{{foreach $photo_menu as $k=>$c}}
{{if $c.2}}
<li><a class="{{$k}}" target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
{{else}}
<li><a class="{{$k}}" href="{{$c.1}}">{{$c.0}}</a></li>
{{/if}}
{{/foreach}}
</ul>
</div>
{{/if}}
</div>
<div class="profile-match-break"></div>
<div class="profile-match-name">