From c5097c633b41b242a72ddbd1a8a486599520eabf Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 2 Apr 2008 17:27:35 +0000 Subject: [PATCH] #1484681 --- program/include/rcube_imap.inc | 22 ++++------ program/js/app.js | 50 ++--------------------- program/steps/settings/manage_folders.inc | 8 ++-- 3 files changed, 17 insertions(+), 63 deletions(-) diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 909af8de1..9a594854c 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -1648,16 +1648,14 @@ class rcube_imap /** * Subscribe to a specific mailbox(es) * - * @param string Mailbox name(s) + * @param array Mailbox name(s) * @return boolean True on success */ - function subscribe($mbox_name) + function subscribe($a_mboxes) { - if (is_array($mbox_name)) - $a_mboxes = $mbox_name; - else if (is_string($mbox_name) && strlen($mbox_name)) - $a_mboxes = explode(',', $mbox_name); - + if (!is_array($a_mboxes)) + $a_mboxes = array($a_mboxes); + // let this common function do the main work return $this->_change_subscription($a_mboxes, 'subscribe'); } @@ -1666,15 +1664,13 @@ class rcube_imap /** * Unsubscribe mailboxes * - * @param string Mailbox name(s) + * @param array Mailbox name(s) * @return boolean True on success */ - function unsubscribe($mbox_name) + function unsubscribe($a_mboxes) { - if (is_array($mbox_name)) - $a_mboxes = $mbox_name; - else if (is_string($mbox_name) && strlen($mbox_name)) - $a_mboxes = (array)$mbox_name; + if (!is_array($a_mboxes)) + $a_mboxes = array($a_mboxes); // let this common function do the main work return $this->_change_subscription($a_mboxes, 'unsubscribe'); diff --git a/program/js/app.js b/program/js/app.js index 9f7b7ee6e..46a79659d 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2825,60 +2825,18 @@ function rcube_webmail() this.subscribe_folder = function(folder) { - var form; - if ((form = this.gui_objects.editform) && form.elements['_unsubscribed']) - this.change_subscription('_unsubscribed', '_subscribed', 'subscribe'); - else if (folder) - this.http_post('subscribe', '_mboxes='+urlencode(folder)); + if (folder) + this.http_post('subscribe', '_mbox='+urlencode(folder)); }; this.unsubscribe_folder = function(folder) { - var form; - if ((form = this.gui_objects.editform) && form.elements['_subscribed']) - this.change_subscription('_subscribed', '_unsubscribed', 'unsubscribe'); - else if (folder) - this.http_post('unsubscribe', '_mboxes='+urlencode(folder)); + if (folder) + this.http_post('unsubscribe', '_mbox='+urlencode(folder)); }; - this.change_subscription = function(from, to, action) - { - var form; - if (form = this.gui_objects.editform) - { - var a_folders = new Array(); - var list_from = form.elements[from]; - - for (var i=0; list_from && iinclude_script('list.js'); // subscribe to one or more mailboxes if ($_action=='subscribe') { - if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) - $IMAP->subscribe($mboxes); + if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)) + $IMAP->subscribe(array($mbox)); if ($OUTPUT->ajax_call) $OUTPUT->remote_response('// subscribed'); @@ -38,8 +38,8 @@ if ($_action=='subscribe') // unsubscribe one or more mailboxes else if ($_action=='unsubscribe') { - if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) - $IMAP->unsubscribe($mboxes); + if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST)) + $IMAP->unsubscribe(array($mbox)); if ($OUTPUT->ajax_call) $OUTPUT->remote_response('// unsubscribed');