thomascube
2011-09-28 63d6e6dfc35e6d82c4a64f37c408794c163becd4
program/steps/settings/save_folder.inc
@@ -66,11 +66,25 @@
        $name_imap = $path . $delimiter . $name_imap;
    }
    else {
        $name_imap = $RCMAIL->imap->mod_mailbox($name, 'in');
        $name_imap = $RCMAIL->imap->mod_mailbox($name_imap, 'in');
    }
}
// Check access rights to the parent folder
if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) {
    $parent_opts = $RCMAIL->imap->mailbox_info($path);
    if ($parent_opts['namespace'] != 'personal'
        && (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts)))
    ) {
        $error = rcube_label('parentnotwritable');
    }
}
if (!$error) {
    $folder['name']     = $name_imap;
    $folder['oldname']  = $old_imap;
    $folder['class']    = '';
    $folder['options']  = $options;
    $folder['settings'] = array(
        // List view mode: 0-list, 1-threads
        'view_mode'   => (int) get_input_value('_viewmode', RCUBE_INPUT_POST),
@@ -82,12 +96,14 @@
// create a new mailbox
if (!$error && !strlen($old)) {
    $folder['subscribe'] = true;
    $plugin = $RCMAIL->plugins->exec_hook('folder_create', array('record' => $folder));
    $folder = $plugin['record'];
    if (!$plugin['abort']) {
        $created = $IMAP->create_mailbox($folder['name'], TRUE);
        $created = $IMAP->create_mailbox($folder['name'], $folder['subscribe']);
    }
    else {
        $created = $plugin['result'];
@@ -105,9 +121,11 @@
            $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded));
        }
        rcmail_update_folder_row($folder['name']);
        rcmail_update_folder_row($folder['name'], null, $folder['subscribe'], $folder['class']);
        $OUTPUT->show_message('foldercreated', 'confirmation');
        // reset folder preview frame
        $OUTPUT->command('subscription_select');
        $OUTPUT->send('iframe');
    }
    else {
@@ -163,7 +181,7 @@
        $OUTPUT->show_message('folderupdated', 'confirmation');
        if ($rename) {
            rcmail_update_folder_row($folder['name'], $folder['oldname']);
            rcmail_update_folder_row($folder['name'], $folder['oldname'], $folder['subscribe'], $folder['class']);
            $OUTPUT->send('iframe');
        }
    }