2015-08-23 22:38:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once('include/acl_selectors.php');
|
|
|
|
require_once('include/message.php');
|
|
|
|
require_once('include/zot.php');
|
|
|
|
require_once("include/bbcode.php");
|
|
|
|
require_once('include/Contact.php');
|
|
|
|
|
|
|
|
|
|
|
|
function message_content(&$a) {
|
|
|
|
|
|
|
|
$o = '';
|
|
|
|
nav_set_selected('messages');
|
|
|
|
|
|
|
|
if(! local_channel()) {
|
|
|
|
notice( t('Permission denied.') . EOL);
|
|
|
|
return login();
|
|
|
|
}
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
$channel = App::get_channel();
|
2015-08-23 22:38:18 +02:00
|
|
|
head_set_icon($channel['xchan_photo_s']);
|
|
|
|
|
|
|
|
$cipher = get_pconfig(local_channel(),'system','default_cipher');
|
|
|
|
if(! $cipher)
|
|
|
|
$cipher = 'aes256';
|
|
|
|
|
2015-10-24 13:04:14 +02:00
|
|
|
/*
|
2015-08-23 22:38:18 +02:00
|
|
|
if((argc() == 3) && (argv(1) === 'dropconv')) {
|
|
|
|
if(! intval(argv(2)))
|
|
|
|
return;
|
|
|
|
$cmd = argv(1);
|
|
|
|
$r = private_messages_drop(local_channel(), argv(2), true);
|
|
|
|
if($r)
|
|
|
|
info( t('Conversation removed.') . EOL );
|
2016-04-17 16:29:18 +02:00
|
|
|
goaway(z_root() . '/mail/combined' );
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2015-10-24 13:04:14 +02:00
|
|
|
if(argc() == 2) {
|
|
|
|
|
|
|
|
switch(argv(1)) {
|
|
|
|
case 'combined':
|
|
|
|
$mailbox = 'combined';
|
|
|
|
$header = t('Conversations');
|
|
|
|
break;
|
|
|
|
case 'inbox':
|
|
|
|
$mailbox = 'inbox';
|
|
|
|
$header = t('Received Messages');
|
|
|
|
break;
|
|
|
|
case 'outbox':
|
|
|
|
$mailbox = 'outbox';
|
|
|
|
$header = t('Sent Messages');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
|
|
|
|
// private_messages_list() can do other more complicated stuff, for now keep it simple
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
$r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']);
|
2015-08-23 22:38:18 +02:00
|
|
|
|
|
|
|
if(! $r) {
|
|
|
|
info( t('No messages.') . EOL);
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
|
2015-10-24 13:04:14 +02:00
|
|
|
$messages = array();
|
|
|
|
|
2015-08-23 22:38:18 +02:00
|
|
|
foreach($r as $rr) {
|
2015-10-24 13:04:14 +02:00
|
|
|
|
|
|
|
$messages[] = array(
|
|
|
|
'id' => $rr['id'],
|
|
|
|
'from_name' => $rr['from']['xchan_name'],
|
|
|
|
'from_url' => chanlink_hash($rr['from_xchan']),
|
|
|
|
'from_photo' => $rr['from']['xchan_photo_s'],
|
|
|
|
'to_name' => $rr['to']['xchan_name'],
|
|
|
|
'to_url' => chanlink_hash($rr['to_xchan']),
|
|
|
|
'to_photo' => $rr['to']['xchan_photo_s'],
|
|
|
|
'subject' => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'),
|
|
|
|
'delete' => t('Delete conversation'),
|
|
|
|
'body' => smilies(bbcode($rr['body'])),
|
|
|
|
'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], t('D, d M Y - g:i A')),
|
|
|
|
'seen' => $rr['seen']
|
|
|
|
);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
2015-10-24 13:04:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
$tpl = get_markup_template('mail_head.tpl');
|
|
|
|
$o = replace_macros($tpl, array(
|
|
|
|
'$header' => $header,
|
|
|
|
'$messages' => $messages
|
|
|
|
));
|
|
|
|
|
|
|
|
|
2015-08-23 22:38:18 +02:00
|
|
|
$o .= alt_pager($a,count($r));
|
2015-10-24 13:04:14 +02:00
|
|
|
|
2015-08-23 22:38:18 +02:00
|
|
|
return $o;
|
|
|
|
|
2015-10-24 13:04:14 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2015-10-24 13:04:14 +02:00
|
|
|
return;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|