summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc93
1 files changed, 29 insertions, 64 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index c7498d5b1..750cf6f61 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -436,65 +436,6 @@ function rcmail_messagecount_display($attrib)
}
-function rcmail_quota_display($attrib)
- {
- global $OUTPUT;
-
- if (!$attrib['id'])
- $attrib['id'] = 'rcmquotadisplay';
-
- if(isset($attrib['display']))
- $_SESSION['quota_display'] = $attrib['display'];
-
- $OUTPUT->add_gui_object('quotadisplay', $attrib['id']);
-
- $quota = rcmail_quota_content($attrib);
-
- $OUTPUT->add_script('$(document).ready(function(){
- rcmail.set_quota('.json_serialize($quota).')});', 'foot');
-
- return html::span($attrib, '');
- }
-
-
-function rcmail_quota_content($attrib=NULL)
- {
- global $COMM_PATH, $RCMAIL;
-
- $quota = $RCMAIL->imap->get_quota();
- $quota = $RCMAIL->plugins->exec_hook('quota', $quota);
-
- $quota_result = (array) $quota;
- $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
-
- if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
- $quota_result['title'] = rcube_label('unlimited');
- $quota_result['percent'] = 0;
- }
- else if ($quota['total']) {
- if (!isset($quota['percent']))
- $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
-
- $title = sprintf('%s / %s (%.0f%%)',
- show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
- $quota_result['percent']);
-
- $quota_result['title'] = $title;
-
- if ($attrib['width'])
- $quota_result['width'] = $attrib['width'];
- if ($attrib['height'])
- $quota_result['height'] = $attrib['height'];
- }
- else {
- $quota_result['title'] = rcube_label('unknown');
- $quota_result['percent'] = 0;
- }
-
- return $quota_result;
- }
-
-
function rcmail_get_messagecount_text($count=NULL, $page=NULL)
{
global $RCMAIL, $IMAP;
@@ -545,7 +486,7 @@ function rcmail_send_unread_count($mbox_name, $force=false, $count=null)
{
global $RCMAIL;
- $old_unseen = $_SESSION['unseen_count'][$mbox_name];
+ $old_unseen = rcmail_get_unseen_count($mbox_name);
if ($count === null)
$unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force);
@@ -555,13 +496,33 @@ function rcmail_send_unread_count($mbox_name, $force=false, $count=null)
if ($unseen != $old_unseen || ($mbox_name == 'INBOX'))
$RCMAIL->output->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'));
- // @TODO: this data is doubled (session and cache tables) if caching is enabled
- $_SESSION['unseen_count'][$mbox_name] = $unseen;
+ rcmail_set_unseen_count($mbox_name, $unseen);
return $unseen;
}
+function rcmail_set_unseen_count($mbox_name, $count)
+{
+ // @TODO: this data is doubled (session and cache tables) if caching is enabled
+
+ // Make sure we have an array here (#1487066)
+ if (!is_array($_SESSION['unseen_count']))
+ $_SESSION['unseen_count'] = array();
+
+ $_SESSION['unseen_count'][$mbox_name] = $count;
+}
+
+
+function rcmail_get_unseen_count($mbox_name)
+{
+ if (is_array($_SESSION['unseen_count']) && array_key_exists($mbox_name, $_SESSION['unseen_count']))
+ return $_SESSION['unseen_count'][$mbox_name];
+ else
+ return null;
+}
+
+
/**
* Sets message is_safe flag according to 'show_images' option value
*
@@ -966,10 +927,14 @@ function rcmail_message_headers($attrib, $headers=NULL)
else
$header_value = trim($IMAP->decode_header($value));
- $output_headers[$hkey] = array('title' => rcube_label($hkey), 'value' => $header_value, 'raw' => $value);
+ $output_headers[$hkey] = array(
+ 'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)),
+ 'value' => $header_value, 'raw' => $value
+ );
}
- $plugin = $RCMAIL->plugins->exec_hook('message_headers_output', array('output' => $output_headers, 'headers' => $MESSAGE->headers));
+ $plugin = $RCMAIL->plugins->exec_hook('message_headers_output',
+ array('output' => $output_headers, 'headers' => $MESSAGE->headers));
// compose html table
$table = new html_table(array('cols' => 2));