| | |
| | | |
| | | $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)); |
| | | else |
| | | $_SESSION['mbox'] = $IMAP->get_mailbox_name(); |
| | | |
| | | 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'])) |
| | |
| | | if (!$OUTPUT->ajax_call) |
| | | $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage'); |
| | | |
| | | $OUTPUT->set_pagetitle(rcmail_localize_foldername($IMAP->get_mailbox_name())); |
| | | $OUTPUT->set_pagetitle(rcmail_localize_foldername($mbox_name)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | $out = '<table' . $attrib_str . ">\n"; |
| | | |
| | | // define list of cols to be displayed |
| | | $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); |
| | | // define list of cols to be displayed based on parameter or config |
| | | if (empty($attrib['columns'])) |
| | | $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); |
| | | else |
| | | $a_show_cols = explode(',', strip_quotes($attrib['columns'])); |
| | | |
| | | // store column list in a session-variable |
| | | $_SESSION['list_columns'] = $a_show_cols; |
| | | |
| | | // define sortable columns |
| | | $a_sort_cols = array('subject', 'date', 'from', 'to', 'size'); |
| | | |
| | | $mbox = $IMAP->get_mailbox_name(); |
| | |
| | | $out .= '<col class="icon" />'; |
| | | |
| | | foreach ($a_show_cols as $col) |
| | | $out .= sprintf('<col class="%s" />', $col); |
| | | $out .= ($col!='attachment') ? sprintf('<col class="%s" />', $col) : '<col class="icon" />'; |
| | | |
| | | $out .= '<col class="icon" />'; |
| | | $out .= "</colgroup>\n"; |
| | | |
| | | // add table title |
| | |
| | | foreach ($a_show_cols as $col) |
| | | { |
| | | // get column name |
| | | $col_name = $col != 'flag' ? Q(rcube_label($col)) : sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); |
| | | switch ($col) |
| | | { |
| | | case 'flag': |
| | | $col_name = sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); |
| | | break; |
| | | case 'attachment': |
| | | $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], ''); |
| | | break; |
| | | default: |
| | | $col_name = Q(rcube_label($col)); |
| | | } |
| | | |
| | | // make sort links |
| | | $sort = ''; |
| | |
| | | $sort_class = $col==$sort_col ? " sorted$sort_order" : ''; |
| | | |
| | | // put it all together |
| | | $out .= '<td class="'.$col.$sort_class.'" id="rcmHead'.$col.'">' . "$col_name$sort</td>\n"; |
| | | if ($col!='attachment') |
| | | $out .= '<td class="'.$col.$sort_class.'" id="rcm'.$col.'">' . "$col_name$sort</td>\n"; |
| | | else |
| | | $out .= '<td class="icon" id="rcm'.$col.'">' . "$col_name$sort</td>\n"; |
| | | } |
| | | |
| | | $out .= '<td class="icon">'.($attrib['attachmenticon'] ? sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '') : ' ')."</td>\n"; |
| | | $out .= "</tr></thead>\n<tbody>\n"; |
| | | |
| | | // no messages in this mailbox |
| | |
| | | $flagged_icon = $attrib['unflaggedicon']; |
| | | |
| | | // set attachment icon |
| | | if ($attrib['attachmenticon'] && preg_match("/multipart\/[mr]/i", $header->ctype)) |
| | | if ($attrib['attachmenticon'] && preg_match("/multipart\/m/i", $header->ctype)) |
| | | $attach_icon = $attrib['attachmenticon']; |
| | | |
| | | $out .= sprintf('<tr id="rcmrow%d" class="message%s%s%s%s">'."\n", |
| | |
| | | else |
| | | $cont = Q($header->$col); |
| | | |
| | | $out .= '<td class="'.$col.'">' . $cont . "</td>\n"; |
| | | if ($col!='attachment') |
| | | $out .= '<td class="'.$col.'">' . $cont . "</td>\n"; |
| | | else |
| | | $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : ''); |
| | | } |
| | | |
| | | $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : ''); |
| | | $out .= "</tr>\n"; |
| | | |
| | | if (sizeof($js_row_arr)) |
| | |
| | | { |
| | | global $CONFIG, $IMAP, $OUTPUT; |
| | | |
| | | $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); |
| | | if (empty($_SESSION['list_columns'])) |
| | | $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); |
| | | else |
| | | $a_show_cols = $_SESSION['list_columns']; |
| | | |
| | | $mbox = $IMAP->get_mailbox_name(); |
| | | |
| | | // show 'to' instead of from in sent messages |
| | |
| | | |
| | | if (!empty($header->charset)) |
| | | $IMAP->set_charset($header->charset); |
| | | |
| | | // remove 'attachment' and 'flag' columns, we don't need them here |
| | | if(($key = array_search('attachment', $a_show_cols)) !== FALSE) |
| | | unset($a_show_cols[$key]); |
| | | if(($key = array_search('flag', $a_show_cols)) !== FALSE) |
| | | unset($a_show_cols[$key]); |
| | | |
| | | // format each col; similar as in rcmail_message_list() |
| | | foreach ($a_show_cols as $col) |
| | |
| | | // add head for malformed messages, washtml cannot work without that |
| | | if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html)) |
| | | $html = '<head></head>'. $html; |
| | | $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '</head>')), 0); |
| | | $html = substr_replace($html, '<meta http-equiv="content-type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0); |
| | | } |
| | | |
| | | // clean HTML with washhtml by Frederic Motte |