2010-07-28 11:45:07 +00:00
|
|
|
<?php
|
|
|
|
|
2010-11-16 05:02:59 +00:00
|
|
|
require_once('include/acl_selectors.php');
|
2011-08-19 14:54:41 +00:00
|
|
|
require_once('include/message.php');
|
2012-12-06 02:39:07 +00:00
|
|
|
require_once('include/zot.php');
|
2013-01-25 20:28:32 +00:00
|
|
|
require_once("include/bbcode.php");
|
2013-01-25 21:55:42 +00:00
|
|
|
require_once('include/Contact.php');
|
2010-07-28 11:45:07 +00:00
|
|
|
|
2012-05-07 02:55:39 +00:00
|
|
|
|
2010-07-28 11:45:07 +00:00
|
|
|
function message_content(&$a) {
|
2010-10-31 23:38:22 +00:00
|
|
|
|
|
|
|
$o = '';
|
2011-08-17 16:36:24 +00:00
|
|
|
nav_set_selected('messages');
|
2010-07-28 11:45:07 +00:00
|
|
|
|
2015-01-29 04:56:04 +00:00
|
|
|
if(! local_channel()) {
|
2010-07-28 11:45:07 +00:00
|
|
|
notice( t('Permission denied.') . EOL);
|
2013-11-03 06:56:29 +00:00
|
|
|
return login();
|
2010-07-28 11:45:07 +00:00
|
|
|
}
|
|
|
|
|
2013-01-25 20:28:32 +00:00
|
|
|
$channel = $a->get_channel();
|
2013-07-08 00:22:40 +00:00
|
|
|
head_set_icon($channel['xchan_photo_s']);
|
2010-07-30 13:09:20 +00:00
|
|
|
|
2015-01-29 04:56:04 +00:00
|
|
|
$cipher = get_pconfig(local_channel(),'system','default_cipher');
|
2013-11-14 07:10:29 +00:00
|
|
|
if(! $cipher)
|
|
|
|
$cipher = 'aes256';
|
|
|
|
|
2015-09-28 15:40:38 +00:00
|
|
|
/*
|
2013-12-22 07:47:44 +00:00
|
|
|
if((argc() == 3) && (argv(1) === 'dropconv')) {
|
2013-10-12 06:12:10 +00:00
|
|
|
if(! intval(argv(2)))
|
|
|
|
return;
|
|
|
|
$cmd = argv(1);
|
2015-01-29 04:56:04 +00:00
|
|
|
$r = private_messages_drop(local_channel(), argv(2), true);
|
2013-12-22 07:47:44 +00:00
|
|
|
if($r)
|
|
|
|
info( t('Conversation removed.') . EOL );
|
2015-09-24 12:07:44 +00:00
|
|
|
goaway($a->get_baseurl(true) . '/mail/combined' );
|
2010-07-28 11:45:07 +00:00
|
|
|
}
|
2015-09-28 15:40:38 +00:00
|
|
|
|
2015-09-24 12:07:44 +00: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;
|
|
|
|
}
|
2012-07-02 02:17:21 +00:00
|
|
|
|
2013-01-25 02:51:02 +00:00
|
|
|
// private_messages_list() can do other more complicated stuff, for now keep it simple
|
|
|
|
|
2015-09-24 12:07:44 +00:00
|
|
|
$r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']);
|
2012-07-02 02:17:21 +00:00
|
|
|
|
2012-12-05 02:24:46 +00:00
|
|
|
if(! $r) {
|
2011-05-23 09:39:57 +00:00
|
|
|
info( t('No messages.') . EOL);
|
2010-07-31 05:27:41 +00:00
|
|
|
return $o;
|
2010-07-28 11:45:07 +00:00
|
|
|
}
|
|
|
|
|
2015-09-17 17:25:13 +00:00
|
|
|
$messages = array();
|
|
|
|
|
2010-07-30 13:09:20 +00:00
|
|
|
foreach($r as $rr) {
|
2015-09-24 12:07:44 +00:00
|
|
|
|
2015-09-17 17:25:13 +00: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']
|
|
|
|
);
|
2010-07-30 13:09:20 +00:00
|
|
|
}
|
2015-09-17 17:25:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
$tpl = get_markup_template('mail_head.tpl');
|
|
|
|
$o = replace_macros($tpl, array(
|
2015-09-24 12:07:44 +00:00
|
|
|
'$header' => $header,
|
2015-09-17 17:25:13 +00:00
|
|
|
'$messages' => $messages
|
|
|
|
));
|
|
|
|
|
|
|
|
|
2013-01-25 02:51:02 +00:00
|
|
|
$o .= alt_pager($a,count($r));
|
2015-09-24 12:07:44 +00:00
|
|
|
|
2010-07-30 13:09:20 +00:00
|
|
|
return $o;
|
2010-07-28 11:45:07 +00:00
|
|
|
|
2015-09-24 12:07:44 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|
2010-07-31 04:22:52 +00:00
|
|
|
|
2015-09-24 12:07:44 +00:00
|
|
|
return;
|
2011-05-23 09:39:57 +00:00
|
|
|
}
|