alecpl
2008-05-21 a55606b12241264054054ab0c0520ec238ee2687
program/steps/settings/manage_folders.inc
@@ -19,11 +19,13 @@
*/
$OUTPUT->set_pagetitle(rcube_label('folders'));
// init IMAP connection
rcmail_imap_init(TRUE);
$RCMAIL->imap_init(true);
// subscribe to one or more mailboxes
if ($_action=='subscribe')
if ($RCMAIL->action=='subscribe')
  {
  if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))
    $IMAP->subscribe(array($mbox));
@@ -33,7 +35,7 @@
  }
// unsubscribe one or more mailboxes
else if ($_action=='unsubscribe')
else if ($RCMAIL->action=='unsubscribe')
  {
  if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))
    $IMAP->unsubscribe(array($mbox));
@@ -43,11 +45,16 @@
  }
// create a new mailbox
else if ($_action=='create-folder')
else if ($RCMAIL->action=='create-folder')
  {
  if (!empty($_POST['_name']))
    $create = $IMAP->create_mailbox(trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF-7')), TRUE);
    {
    $name = trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF-7'));
     // #1485036 (RFC3501, 5.1.3) TODO: it should be done on read not on write
    $name = str_replace('&-', '&', $name);
    $create = $IMAP->create_mailbox($name, TRUE);
    }
  if ($create && $OUTPUT->ajax_call)
    {
    $delimiter = $IMAP->get_hierarchy_delimiter();
@@ -62,11 +69,16 @@
  }
// rename a mailbox
else if ($_action=='rename-folder')
else if ($RCMAIL->action=='rename-folder')
  {
  if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname']))
    $rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_POST)), trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, FALSE, 'UTF-7')));
    {
    $name = trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, FALSE, 'UTF-7'));
     // #1485036 (RFC3501, 5.1.3) TODO: it should be done on read not on write
    $name = str_replace('&-', '&', $name);
    $rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_POST)), $name);
    }
  if ($rename && $OUTPUT->ajax_call)
    {
    $a_mboxes = array_unique(array_merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed()));
@@ -97,7 +109,7 @@
  }
// delete an existing IMAP mailbox
else if ($_action=='delete-folder')
else if ($RCMAIL->action=='delete-folder')
  {
  $a_mboxes = array_merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed());
  $delimiter = $IMAP->get_hierarchy_delimiter();