|
+-----------------------------------------------------------------------+
$Id$
*/
require_once('lib/html2text.inc');
require_once('lib/enriched.inc');
require_once('include/rcube_smtp.inc');
$EMAIL_ADDRESS_PATTERN = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i';
if (empty($_SESSION['mbox']))
$_SESSION['mbox'] = $IMAP->get_mailbox_name();
// set imap properties and session vars
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC))
$IMAP->set_mailbox(($_SESSION['mbox'] = $mbox));
if (!empty($_GET['_page']))
$IMAP->set_page(($_SESSION['page'] = intval($_GET['_page'])));
// set mailbox to INBOX if not set
if (empty($_SESSION['mbox']))
$_SESSION['mbox'] = $IMAP->get_mailbox_name();
// set default sort col/order to session
if (!isset($_SESSION['sort_col']))
$_SESSION['sort_col'] = $CONFIG['message_sort_col'];
if (!isset($_SESSION['sort_order']))
$_SESSION['sort_order'] = $CONFIG['message_sort_order'];
// set message set for search result
if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
{
$IMAP->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
$OUTPUT->set_env('search_request', $_REQUEST['_search']);
$OUTPUT->set_env('search_text', $_SESSION['last_text_search']);
}
// define url for getting message parts
if (strlen($_GET['_uid']))
$GET_URL = rcmail_url('get', array('_mbox'=>$IMAP->get_mailbox_name(), '_uid'=>get_input_value('_uid', RCUBE_INPUT_GET)));
// set current mailbox in client environment
$OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name());
$OUTPUT->set_env('quota', $IMAP->get_capability('quota'));
if ($CONFIG['trash_mbox'])
$OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
if ($CONFIG['drafts_mbox'])
$OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
if ($CONFIG['junk_mbox'])
$OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']);
if (!$OUTPUT->ajax_call)
rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash');
// set page title
if (empty($_action) || $_action == 'list')
$OUTPUT->set_pagetitle(rcube_charset_convert($IMAP->get_mailbox_name(), 'UTF-7'));
// return the message list as HTML table
function rcmail_message_list($attrib)
{
global $IMAP, $CONFIG, $COMM_PATH, $OUTPUT;
$skin_path = $CONFIG['skin_path'];
$image_tag = '';
// check to see if we have some settings for sorting
$sort_col = $_SESSION['sort_col'];
$sort_order = $_SESSION['sort_order'];
// add some labels to client
rcube_add_label('from', 'to');
// get message headers
$a_headers = $IMAP->list_headers('', '', $sort_col, $sort_order);
// add id to message list table if not specified
if (!strlen($attrib['id']))
$attrib['id'] = 'rcubemessagelist';
// allow the following attributes to be added to the
\n"; $javascript = ''; foreach ($a_show_cols as $col) { // get column name $col_name = Q(rcube_label($col)); // make sort links $sort = ''; if ($IMAP->get_capability('sort') && in_array($col, $a_sort_cols)) { // have buttons configured if (!empty($attrib['sortdescbutton']) || !empty($attrib['sortascbutton'])) { $sort = ' '; // asc link if (!empty($attrib['sortascbutton'])) { $sort .= $OUTPUT->button(array( 'command' => 'sort', 'prop' => $col.'_ASC', 'image' => $attrib['sortascbutton'], 'align' => 'absmiddle', 'title' => 'sortasc')); } // desc link if (!empty($attrib['sortdescbutton'])) { $sort .= $OUTPUT->button(array( 'command' => 'sort', 'prop' => $col.'_DESC', 'image' => $attrib['sortdescbutton'], 'align' => 'absmiddle', 'title' => 'sortdesc')); } } // just add a link tag to the header else { $col_name = sprintf( '%s', JS_OBJECT_NAME, $col, rcube_label('sortby'), $col_name); } } $sort_class = $col==$sort_col ? " sorted$sort_order" : ''; // put it all together $out .= ' | ' . "$col_name$sort | \n"; } $out .= ''.($attrib['attachmenticon'] ? sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '') : '')." | \n"; $out .= "