Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Haakon Meland Eriksen 2015-10-01 17:31:22 +02:00
commit 2696cf9b9e
13 changed files with 24304 additions and 23029 deletions

View File

@ -11,6 +11,7 @@
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/hubloc.php');
require_once('include/DReport.php');
/**
@ -1556,7 +1557,6 @@ function allowed_public_recips($msg) {
function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) {
$result = array();
require_once('include/DReport.php');
$result['site'] = z_root();
@ -1569,6 +1569,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
}
}
foreach($deliveries as $d) {
$local_public = $public;
@ -1587,11 +1588,21 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
$channel = $r[0];
$DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
if($d['hash'] === $sender['hash']) {
$DR->update('self delivery ignored');
$result[] = $DR->get();
continue;
}
/**
* @FIXME: Somehow we need to block normal message delivery from our clones, as the delivered
* message doesn't have ACL information in it as the cloned copy does. That copy
* will normally arrive first via sync delivery, but this isn't guaranteed.
* There's a chance the current delivery could take place before the cloned copy arrives
* hence the item could have the wrong ACL and *could* be used in subsequent deliveries or
* access checks. So far all attempts at identifying this situation precisely
* have caused issues with delivery of relayed comments.
*/
// if(($d['hash'] === $sender['hash']) && ($sender['url'] !== z_root()) && (! $relay)) {
// $DR->update('self delivery ignored');
// $result[] = $DR->get();
// continue;
// }
// allow public postings to the sys channel regardless of permissions, but not
// for comments travelling upstream. Wait and catch them on the way down.
@ -1949,8 +1960,7 @@ function delete_imported_item($sender, $item, $uid, $relay) {
$item_found = false;
$post_id = 0;
$r = q("select id, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
$r = q("select id, author_xchan, owner_xchan, source_xchan, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
and mid = '%s' and uid = %d limit 1",
dbesc($sender['hash']),
dbesc($sender['hash']),
@ -1958,6 +1968,7 @@ function delete_imported_item($sender, $item, $uid, $relay) {
dbesc($item['mid']),
intval($uid)
);
if ($r) {
if ($r[0]['author_xchan'] === $sender['hash'] || $r[0]['owner_xchan'] === $sender['hash'] || $r[0]['source_xchan'] === $sender['hash'])
$ownership_valid = true;
@ -2031,20 +2042,26 @@ function process_mail_delivery($sender, $arr, $deliveries) {
}
foreach($deliveries as $d) {
$DR = new DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']);
$r = q("select * from channel where channel_hash = '%s' limit 1",
dbesc($d['hash'])
);
if(! $r) {
$result[] = array($d['hash'],'not found');
$DR->update('recipient not found');
$result[] = $DR->get();
continue;
}
$channel = $r[0];
$DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
if(! perm_is_allowed($channel['channel_id'],$sender['hash'],'post_mail')) {
logger("permission denied for mail delivery {$channel['channel_id']}");
$result[] = array($d['hash'],'permission denied',$channel['channel_name'],$arr['mid']);
$DR->update('permission denied');
$result[] = $DR->get();
continue;
}
@ -2058,11 +2075,13 @@ function process_mail_delivery($sender, $arr, $deliveries) {
intval($r[0]['id']),
intval($channel['channel_id'])
);
$result[] = array($d['hash'],'mail recalled',$channel['channel_name'],$arr['mid']);
$DR->update('mail recalled');
$result[] = $DR->get();
logger('mail_recalled');
}
else {
$result[] = array($d['hash'],'duplicate mail received',$channel['channel_name'],$arr['mid']);
$DR->update('duplicate mail received');
$result[] = $DR->get();
logger('duplicate mail received');
}
continue;
@ -2071,7 +2090,8 @@ function process_mail_delivery($sender, $arr, $deliveries) {
$arr['account_id'] = $channel['channel_account_id'];
$arr['channel_id'] = $channel['channel_id'];
$item_id = mail_store($arr);
$result[] = array($d['hash'],'mail delivered',$channel['channel_name'],$arr['mid']);
$DR->update('mail delivered');
$result[] = $DR->get();
}
}
@ -3855,4 +3875,4 @@ function check_zotinfo($channel,$locations,&$ret) {
}
}
}
}
}

View File

@ -7,14 +7,44 @@ function dreport_content(&$a) {
return;
}
$table = 'item';
$channel = $a->get_channel();
$mid = ((argc() > 1) ? argv(1) : '');
if($mid === 'mail') {
$table = 'mail';
$mid = ((argc() > 2) ? argv(2) : '');
}
if(! $mid) {
notice( t('Invalid message') . EOL);
return;
}
switch($table) {
case 'item':
$i = q("select id from item where mid = '%s' and author_xchan = '%s' ",
dbesc($mid),
dbesc($channel['channel_hash'])
);
break;
case 'mail':
$i = q("select id from mail where mid = '%s' and from_xchan = '%s'",
dbesc($mid),
dbesc($channel['channel_hash'])
);
break;
default:
break;
}
if(! $i) {
notice( t('Permission denied') . EOL);
return;
}
$r = q("select * from dreport where dreport_xchan = '%s' and dreport_mid = '%s'",
dbesc($channel['channel_hash']),
@ -33,6 +63,11 @@ function dreport_content(&$a) {
for($x = 0; $x < count($r); $x++ ) {
$r[$x]['name'] = escape_tags(substr($r[$x]['dreport_recip'],strpos($r[$x]['dreport_recip'],' ')));
// This has two purposes: 1. make the delivery report strings translateable, and
// 2. assign an ordering to item delivery results so we can group them and provide
// a readable report with more interesting events listed toward the top and lesser
// interesting items towards the bottom
switch($r[$x]['dreport_result']) {
case 'channel sync processed':
$r[$x]['gravity'] = 0;
@ -61,6 +96,18 @@ function dreport_content(&$a) {
$r[$x]['dreport_result'] = t('permission denied');
$r[$x]['gravity'] = 6;
break;
case 'recipient not found':
$r[$x]['dreport_result'] = t('recipient not found');
break;
case 'mail recalled':
$r[$x]['dreport_result'] = t('mail recalled');
break;
case 'duplicate mail received':
$r[$x]['dreport_result'] = t('duplicate mail received');
break;
case 'mail delivered':
$r[$x]['dreport_result'] = t('mail delivered');
break;
default:
$r[$x]['gravity'] = 1;
break;

View File

@ -324,6 +324,7 @@ function mail_content(&$a) {
$mails[] = array(
'mailbox' => $mailbox,
'id' => $message['id'],
'mid' => $message['mid'],
'from_name' => $message['from']['xchan_name'],
'from_url' => chanlink_hash($message['from_xchan']),
'from_photo' => $message['from']['xchan_photo_s'],
@ -333,6 +334,7 @@ function mail_content(&$a) {
'subject' => $message['title'],
'body' => smilies(bbcode($message['body']) . $s),
'delete' => t('Delete message'),
'dreport' => t('Delivery report'),
'recall' => t('Recall message'),
'can_recall' => (($channel['channel_hash'] == $message['from_xchan']) ? true : false),
'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''),

View File

@ -1 +1 @@
2015-09-28.1169
2015-09-30.1171

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,15 +12,15 @@ function drophub(id) {
<table>
<tr><td>{{$loc}}</td><td>{{$mkprm}}</td><td>{{$drop}}</td></tr>
{{foreach $hubs as $hub}}
{{if ! $hub.deleted }}
<tr><td>
{{if $hub.deleted}}<strike>{{/if}}
{{$hub.hubloc_url}} ({{$hub.hubloc_addr}}){{if $hub.deleted}}</strike>{{/if}}</td>
{{$hub.hubloc_url}} ({{$hub.hubloc_addr}})</td>
<td>
{{if $hub.primary}}<button class="btn btn-std"><i class="icon-check"></i></button>{{else}}<button class="btn btn-std" onclick="primehub({{$hub.hubloc_id}}); return false;" ><i class="icon-check-empty" ></i></button>{{/if}}
</td>
<td>{{if ! $hub.deleted}}<button class="btn btn-std" onclick="drophub({{$hub.hubloc_id}}); return false;"><i class="icon-trash"></i></button>{{/if}}</td>
<td><button class="btn btn-std" onclick="drophub({{$hub.hubloc_id}}); return false;"><i class="icon-trash"></i></button></td>
</tr>
{{/if}}
{{/foreach}}
</table>

View File

@ -9,6 +9,7 @@
<div class="mail-conv-body">{{$mail.body}}</div>
<div class="btn-group pull-right" id="mail-conv-delete-wrapper-{{$mail.id}}" >
{{if $mail.can_recall}}
<a href="dreport/mail/{{$mail.mid}}" title="{{$mail.dreport}}" id="mail-conv-dreport-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-barcode mail-icons"></i></a>
<a href="mail/{{$mail.mailbox}}/recall/{{$mail.id}}" title="{{$mail.recall}}" id="mail-conv-recall-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-undo mail-icons"></i></a>
{{/if}}
<a href="#" onclick="dropItem('mail/{{$mail.mailbox}}/drop/{{$mail.id}}', '#mail-{{$mail.id}}'); return false;" title="{{$mail.delete}}" id="mail-conv-delete-icon-{{$mail.id}}" class="btn btn-default" ><i class="icon-trash mail-icons"></i></a>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Hubzilla@{{$nodename}}</ShortName>
<Description>Search in The Hubzilla@{{$nodename}}</Description>
<Contact>http://github.com/friendica/red/</Contact>
<Image height="16" width="16" type="image/png">{{$baseurl}}/images/rm-16.png</Image>
<Image height="64" width="64" type="image/png">{{$baseurl}}/images/rm-64.png</Image>
<Description>Search in Hubzilla@{{$nodename}}</Description>
<Contact>http://github.com/redmatrix/hubzilla/</Contact>
<Image height="16" width="16" type="image/png">{{$baseurl}}/images/hz-16.png</Image>
<Image height="64" width="64" type="image/png">{{$baseurl}}/images/hz-64.png</Image>
<Url type="text/html"
template="{{$baseurl}}/search?search={searchTerms}"/>
<Url type="application/opensearchdescription+xml"