From 7dfb1fba5001299300736e6b5d95d9400575e3e7 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 18 Sep 2008 14:59:02 -0400
Subject: [PATCH] Set the right number of arguments for setcookie()

---
 program/steps/mail/folders.inc |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc
index b84398f..7fd1f62 100644
--- a/program/steps/mail/folders.inc
+++ b/program/steps/mail/folders.inc
@@ -21,7 +21,7 @@
 $mbox_name = $IMAP->get_mailbox_name();
 
 // send EXPUNGE command
-if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
+if ($RCMAIL->action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
 {
   $success = $IMAP->expunge($mbox);
 
@@ -29,7 +29,7 @@
   if ($success && !empty($_REQUEST['_reload']))
   {
     $OUTPUT->command('message_list.clear');
-    $_action = 'list';
+    $RCMAIL->action = 'list';
     return;
   }
   else
@@ -37,10 +37,15 @@
 }
 
 // clear mailbox
-else if ($_action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
+else if ($RCMAIL->action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)))
 {
-  // we should only be purging trash and junk
-  if($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']) 
+  $delimiter = $IMAP->get_hierarchy_delimiter();
+  $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
+  $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/';		      
+
+  // we should only be purging trash and junk (or their subfolders)
+  if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
+    || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox))
   {
     $success = $IMAP->clear_mailbox($mbox);
   

--
Gitblit v1.9.1