summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-12-01 09:52:23 +0000
committeralecpl <alec@alec.pl>2010-12-01 09:52:23 +0000
commitb46edc0f906e00f8cff42541f49f0d58181c836c (patch)
tree121a068b0d3bd9f573d2dcd9b1aa9a8148d7bc31 /program/steps/mail/func.inc
parent43fb35b5cb97522e1fa3e358c8511788b7d02a3d (diff)
- Fix "Cannot use scalar value..." warning (#1487066)
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc26
1 files changed, 23 insertions, 3 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index c7498d5b1..4803956b6 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -545,7 +545,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 +555,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
*