aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/dreport.php47
-rw-r--r--mod/item.php23
-rw-r--r--mod/mail.php80
3 files changed, 94 insertions, 56 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..23d1f5224 100644
--- a/mod/mail.php
+++ b/mod/mail.php
@@ -185,68 +185,48 @@ function mail_content(&$a) {
$a->page['htmlhead'] .= $header;
-
- $preselect = (isset($a->argv[2])?array($a->argv[2]):false);
- $prename = $preurl = $preid = '';
-
+ $prename = '';
+ $preid = '';
+
if(x($_REQUEST,'hash')) {
+
$r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash
where abook_channel = %d and abook_xchan = '%s' limit 1",
intval(local_channel()),
dbesc($_REQUEST['hash'])
);
- if($r) {
- $prename = $r[0]['xchan_name'];
- $preurl = $r[0]['xchan_url'];
- $preid = $r[0]['abook_id'];
- $preselect = array($preid);
- }
- }
+ if(!$r) {
+ $r = q("select * from xchan where xchan_hash = '%s' and xchan_network = 'zot' limit 1",
+ dbesc($_REQUEST['hash'])
+ );
+ }
- if($preselect) {
- $r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash
- where abook_channel = %d and abook_id = %d limit 1",
- intval(local_channel()),
- intval(argv(2))
- );
if($r) {
- $prename = $r[0]['xchan_name'];
+ $prename = (($r[0]['abook_id']) ? $r[0]['xchan_name'] : $r[0]['xchan_addr']);
$preurl = $r[0]['xchan_url'];
- $preid = $r[0]['abook_id'];
+ $preid = (($r[0]['abook_id']) ? ($r[0]['xchan_hash']) : '');
+ }
+ else {
+ notice( t('Requested channel is not in this network') . EOL );
}
- }
-
- $prefill = (($preselect) ? $prename : '');
- if(! $prefill) {
- if(array_key_exists('to',$_REQUEST))
- $prefill = $_REQUEST['to'];
}
- // the ugly select box
-
- $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
-
$tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl,array(
+ '$new' => true,
'$header' => t('Send Private Message'),
'$to' => t('To:'),
- '$showinputs' => 'true',
- '$prefill' => $prefill,
- '$autocomp' => $autocomp,
+ '$prefill' => $prename,
'$preid' => $preid,
'$subject' => t('Subject:'),
'$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''),
'$text' => ((x($_REQUEST,'body')) ? htmlspecialchars($_REQUEST['body'], ENT_COMPAT, 'UTF-8') : ''),
- '$readonly' => '',
'$yourmessage' => t('Your message:'),
- '$select' => $select,
'$parent' => '',
- '$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
- '$wait' => t('Please wait'),
'$submit' => t('Send'),
'$defexpire' => '',
'$feature_expire' => ((feature_enabled(local_channel(),'content_expire')) ? true : false),
@@ -254,8 +234,6 @@ function mail_content(&$a) {
'$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false),
'$encrypt' => t('Encrypt text'),
'$cipher' => $cipher,
-
-
));
return $o;
@@ -285,7 +263,14 @@ function mail_content(&$a) {
// if( local_channel() && feature_enabled(local_channel(),'richtext') )
// $plaintext = false;
- $messages = private_messages_fetch_conversation(local_channel(), $mid, true);
+
+
+ if($mailbox == 'combined') {
+ $messages = private_messages_fetch_conversation(local_channel(), $mid, true);
+ }
+ else {
+ $messages = private_messages_fetch_message(local_channel(), $mid, true);
+ }
if(! $messages) {
//info( t('Message not found.') . EOL);
@@ -324,6 +309,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 +319,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.') : ''),
@@ -345,10 +332,6 @@ function mail_content(&$a) {
$recp = (($message['from_xchan'] === $channel['channel_hash']) ? 'to' : 'from');
-// FIXME - move this HTML to template
-
- $select = $message[$recp]['xchan_name'] . '<input type="hidden" name="messageto" value="' . $message[$recp]['xchan_hash'] . '" />';
- $parent = '<input type="hidden" name="replyto" value="' . $message['parent_mid'] . '" />';
$tpl = get_markup_template('mail_display.tpl');
$o = replace_macros($tpl, array(
'$mailbox' => $mailbox,
@@ -364,19 +347,16 @@ function mail_content(&$a) {
// reply
'$header' => t('Send Reply'),
'$to' => t('To:'),
- '$showinputs' => '',
+ '$reply' => true,
'$subject' => t('Subject:'),
'$subjtxt' => $message['title'],
- '$readonly' => 'readonly="readonly"',
- '$yourmessage' => t('Your message:'),
+ '$yourmessage' => sprintf(t('Your message for %s (%s):'), $message[$recp]['xchan_name'], $message[$recp]['xchan_addr']),
'$text' => '',
- '$select' => $select,
- '$parent' => $parent,
- '$upload' => t('Upload photo'),
+ '$parent' => $message['parent_mid'],
+ '$recphash' => $message[$recp]['xchan_hash'],
'$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$submit' => t('Submit'),
- '$wait' => t('Please wait'),
'$defexpire' => '',
'$feature_expire' => ((feature_enabled(local_channel(),'content_expire')) ? true : false),
'$expires' => t('Set expiration date'),