Fixed handling of error in folder rename/create (#233)

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-29 12:50:35 +02:00
parent fd27a21693
commit d26d874c7b

View file

@ -102,40 +102,42 @@ class kolab_addressbook_ui
{ {
$action = trim(get_input_value('_act', RCUBE_INPUT_GPC)); $action = trim(get_input_value('_act', RCUBE_INPUT_GPC));
$folder = trim(get_input_value('_source', RCUBE_INPUT_GPC, true)); // UTF8 $folder = trim(get_input_value('_source', RCUBE_INPUT_GPC, true)); // UTF8
$name = trim(get_input_value('_name', RCUBE_INPUT_GPC, true)); // UTF8
$old = trim(get_input_value('_oldname', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$path_imap = trim(get_input_value('_parent', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$hidden_fields[] = array('name' => '_source', 'value' => $folder); $hidden_fields[] = array('name' => '_source', 'value' => $folder);
$folder = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP'); $folder = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
$delim = $_SESSION['imap_delimiter']; $delim = $_SESSION['imap_delimiter'];
$form = array();
if ($this->rc->action == 'plugin.book-save') { if ($this->rc->action == 'plugin.book-save') {
// save error // save error
$path_imap = $folder; $name = trim(get_input_value('_name', RCUBE_INPUT_GPC, true)); // UTF8
$old = trim(get_input_value('_oldname', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$path_imap = trim(get_input_value('_parent', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$hidden_fields[] = array('name' => '_oldname', 'value' => $old); $hidden_fields[] = array('name' => '_oldname', 'value' => $old);
if (strlen($old)) { $folder = $old;
$this->rc->imap_connect();
$options = $this->rc->imap->mailbox_info($old);
}
} }
else if ($action == 'edit') { else if ($action == 'edit') {
$path_imap = explode($delim, $folder); $path_imap = explode($delim, $folder);
$name = rcube_charset_convert(array_pop($path_imap), 'UTF7-IMAP'); $name = rcube_charset_convert(array_pop($path_imap), 'UTF7-IMAP');
$path_imap = implode($path_imap, $delim); $path_imap = implode($path_imap, $delim);
}
else { // create
$path_imap = $folder;
$name = '';
$folder = '';
}
// Store old name, get folder options
if (strlen($folder)) {
$hidden_fields[] = array('name' => '_oldname', 'value' => $folder);
$this->rc->imap_connect(); $this->rc->imap_connect();
$options = $this->rc->imap->mailbox_info($folder); $options = $this->rc->imap->mailbox_info($folder);
}
$hidden_fields[] = array('name' => '_oldname', 'value' => $folder); $form = array();
}
else {
$path_imap = $folder;
$name = '';
}
// General tab // General tab
$form['props'] = array( $form['props'] = array(