diff options
author | redmatrix <git@macgirvin.com> | 2016-04-18 20:38:38 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-18 20:38:38 -0700 |
commit | 2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289 (patch) | |
tree | 2376d950ba2bdc7753336a3e2b94865c95c238f2 /mod/dreport.php | |
parent | 2a61817bad96526994c0499f1fc0a843a9cc9405 (diff) | |
download | volse-hubzilla-2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289.tar.gz volse-hubzilla-2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289.tar.bz2 volse-hubzilla-2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289.zip |
module updates
Diffstat (limited to 'mod/dreport.php')
-rw-r--r-- | mod/dreport.php | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/mod/dreport.php b/mod/dreport.php deleted file mode 100644 index 4edec2e2b..000000000 --- a/mod/dreport.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php - -function dreport_content(&$a) { - - if(! local_channel()) { - notice( t('Permission denied') . EOL); - return; - } - - $table = 'item'; - - $channel = App::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']), - dbesc($mid) - ); - - if(! $r) { - notice( t('no results') . EOL); - return; - } - - $o .= '<div class="generic-content-wrapper-styled">'; - $o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>'; - $o .= '<table>'; - - 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; - $r[$x]['dreport_result'] = t('channel sync processed'); - break; - case 'queued': - $r[$x]['gravity'] = 2; - $r[$x]['dreport_result'] = t('queued'); - break; - case 'posted': - $r[$x]['gravity'] = 3; - $r[$x]['dreport_result'] = t('posted'); - break; - case 'accepted for delivery': - $r[$x]['gravity'] = 4; - $r[$x]['dreport_result'] = t('accepted for delivery'); - break; - case 'updated': - $r[$x]['gravity'] = 5; - $r[$x]['dreport_result'] = t('updated'); - case 'update ignored': - $r[$x]['gravity'] = 6; - $r[$x]['dreport_result'] = t('update ignored'); - break; - case 'permission denied': - $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; - } - } - - usort($r,'dreport_gravity_sort'); - - - foreach($r as $rr) { - $o .= '<tr><td width="40%">' . $rr['name'] . '</td><td width="20%">' . escape_tags($rr['dreport_result']) . '</td><td width="20%">' . escape_tags($rr['dreport_time']) . '</td></tr>'; - } - $o .= '</table>'; - $o .= '</div>'; - - return $o; - - - -} - -function dreport_gravity_sort($a,$b) { - if($a['gravity'] == $b['gravity']) { - if($a['name'] === $b['name']) - return strcmp($a['dreport_time'],$b['dreport_time']); - return strcmp($a['name'],$b['name']); - } - return (($a['gravity'] > $b['gravity']) ? 1 : (-1)); -} |