aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2015-10-02 09:45:03 +0200
committermrjive <mrjive@mrjive.it>2015-10-02 09:45:03 +0200
commit32522b61f235266384c81c0669fceaf58afeb4fe (patch)
tree48427e8f48421b3bb8f344d85f2ebfe1271ea34e /mod
parent11c1573b55f278a664a90a2872d06a40b3ac3026 (diff)
parent1da3828a09485a9b2bc6113cbab9ca9ca483ffc0 (diff)
downloadvolse-hubzilla-32522b61f235266384c81c0669fceaf58afeb4fe.tar.gz
volse-hubzilla-32522b61f235266384c81c0669fceaf58afeb4fe.tar.bz2
volse-hubzilla-32522b61f235266384c81c0669fceaf58afeb4fe.zip
Merge pull request #6 from redmatrix/master
updating from original codebase
Diffstat (limited to 'mod')
-rw-r--r--mod/dreport.php47
-rw-r--r--mod/item.php23
-rw-r--r--mod/mail.php2
3 files changed, 66 insertions, 6 deletions
diff --git a/mod/dreport.php b/mod/dreport.php
index 31a6274c8..c320bf0e6 100644
--- a/mod/dreport.php
+++ b/mod/dreport.php
@@ -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;
diff --git a/mod/item.php b/mod/item.php
index 93f24bd1a..7488e709b 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -372,12 +372,23 @@ function item_post(&$a) {
}
else {
- if((! $walltowall) &&
- ((array_key_exists('contact_allow',$_REQUEST))
- || (array_key_exists('group_allow',$_REQUEST))
- || (array_key_exists('contact_deny',$_REQUEST))
- || (array_key_exists('group_deny',$_REQUEST)))) {
- $acl->set_from_array($_REQUEST);
+ if(! $walltowall) {
+ if((array_key_exists('contact_allow',$_REQUEST))
+ || (array_key_exists('group_allow',$_REQUEST))
+ || (array_key_exists('contact_deny',$_REQUEST))
+ || (array_key_exists('group_deny',$_REQUEST))) {
+ $acl->set_from_array($_REQUEST);
+ }
+ elseif(! $api_source) {
+
+ // if no ACL has been defined and we aren't using the API, the form
+ // didn't send us any parameters. This means there's no ACL or it has
+ // been reset to the default audience.
+ // If $api_source is set and there are no ACL parameters, we default
+ // to the channel permissions which were set in the ACL contructor.
+
+ $acl->set(array('allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => ''));
+ }
}
diff --git a/mod/mail.php b/mod/mail.php
index e4a5ebafd..525127a71 100644
--- a/mod/mail.php
+++ b/mod/mail.php
@@ -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.') : ''),