- Fix handling of folders with name "0" (#1487119)
| | |
| | | - Add option for minimum length of autocomplete's string (#1486428) |
| | | - Fix operations on messages in unsubscribed folder (#1487107) |
| | | - Add support for shared folders (#1403507) |
| | | - Fix handling of folders with name "0" (#1487119) |
| | | |
| | | RELEASE 0.4.2 |
| | | ------------- |
| | |
| | | $suffix = $attrib['nl'] || ($content && $attrib['nl'] !== false && !in_array($tagname, $inline_tags)) ? "\n" : ''; |
| | | |
| | | $tagname = self::$lc_tags ? strtolower($tagname) : $tagname; |
| | | if ($content || in_array($tagname, self::$containers)) { |
| | | if (isset($content) || in_array($tagname, self::$containers)) { |
| | | $templ = $attrib['noclose'] ? "<%s%s>%s" : "<%s%s>%s</%s>%s"; |
| | | unset($attrib['noclose']); |
| | | return sprintf($templ, $tagname, self::attrib_string($attrib, $allowed_attrib), $content, $tagname, $suffix); |
| | |
| | | $currentFolder = substr($folder, 0, $pos); |
| | | |
| | | // sometimes folder has a delimiter as the last character |
| | | if (empty($subFolders)) |
| | | if (!strlen($subFolders)) |
| | | $virtual = false; |
| | | else if (!isset($arrFolders[$currentFolder])) |
| | | $virtual = true; |
| | |
| | | else |
| | | $arrFolders[$currentFolder]['virtual'] = $virtual; |
| | | |
| | | if (!empty($subFolders)) |
| | | if (strlen($subFolders)) |
| | | rcmail_build_folder_tree($arrFolders[$currentFolder]['folders'], $subFolders, $delm, $path.$delm); |
| | | } |
| | | |
| | |
| | | if ($default_folders = $this->config->get('default_imap_folders')) { |
| | | $this->imap->set_default_mailboxes($default_folders); |
| | | } |
| | | if (!empty($_SESSION['mbox'])) { |
| | | if (isset($_SESSION['mbox'])) { |
| | | $this->imap->set_mailbox($_SESSION['mbox']); |
| | | } |
| | | if (isset($_SESSION['page'])) { |
| | |
| | | */ |
| | | function messagecount($mbox_name='', $mode='ALL', $force=false, $status=true) |
| | | { |
| | | $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | return $this->_messagecount($mailbox, $mode, $force, $status); |
| | | } |
| | | |
| | |
| | | { |
| | | $mode = strtoupper($mode); |
| | | |
| | | if (empty($mailbox)) |
| | | if (!strlen($mailbox)) |
| | | $mailbox = $this->mailbox; |
| | | |
| | | // count search set |
| | |
| | | $fbox = $from_mbox; |
| | | $tbox = $to_mbox; |
| | | $to_mbox = $this->mod_mailbox($to_mbox); |
| | | $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; |
| | | $from_mbox = strlen($from_mbox) ? $this->mod_mailbox($from_mbox) : $this->mailbox; |
| | | |
| | | list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox); |
| | | |
| | |
| | | */ |
| | | function clear_mailbox($mbox_name=NULL) |
| | | { |
| | | $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; |
| | | |
| | | // SELECT will set messages count for clearFolder() |
| | | if ($this->conn->select($mailbox)) { |
| | |
| | | $a_mboxes = $this->_list_mailboxes($root, $filter); |
| | | |
| | | foreach ($a_mboxes as $idx => $mbox_row) { |
| | | if ($name = $this->mod_mailbox($mbox_row, 'out')) |
| | | if (strlen($name = $this->mod_mailbox($mbox_row, 'out'))) |
| | | $a_out[] = $name; |
| | | unset($a_mboxes[$idx]); |
| | | } |
| | |
| | | |
| | | // modify names with root dir |
| | | foreach ($a_mboxes as $idx => $mbox_name) { |
| | | if ($name = $this->mod_mailbox($mbox_name, 'out')) |
| | | if (strlen($name = $this->mod_mailbox($mbox_name, 'out'))) |
| | | $a_folders[] = $name; |
| | | unset($a_mboxes[$idx]); |
| | | } |
| | |
| | | */ |
| | | function mailbox_exists($mbox_name, $subscription=false) |
| | | { |
| | | if ($mbox_name) { |
| | | if ($mbox_name == 'INBOX') |
| | | return true; |
| | | if ($mbox_name == 'INBOX') |
| | | return true; |
| | | |
| | | $key = $subscription ? 'subscribed' : 'existing'; |
| | | $mbox = $this->mod_mailbox($mbox_name); |
| | | $key = $subscription ? 'subscribed' : 'existing'; |
| | | $mbox = $this->mod_mailbox($mbox_name); |
| | | |
| | | if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key])) |
| | | return true; |
| | | if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key])) |
| | | return true; |
| | | |
| | | if ($subscription) { |
| | | $a_folders = $this->conn->listSubscribed('', $mbox); |
| | | } |
| | | else { |
| | | $a_folders = $this->conn->listMailboxes('', $mbox); |
| | | } |
| | | if ($subscription) { |
| | | $a_folders = $this->conn->listSubscribed('', $mbox); |
| | | } |
| | | else { |
| | | $a_folders = $this->conn->listMailboxes('', $mbox); |
| | | } |
| | | |
| | | if (is_array($a_folders) && in_array($mbox, $a_folders)) { |
| | | $this->icache[$key][] = $mbox; |
| | | return true; |
| | | } |
| | | if (is_array($a_folders) && in_array($mbox, $a_folders)) { |
| | | $this->icache[$key][] = $mbox; |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | |
| | | */ |
| | | function mod_mailbox($mbox_name, $mode='in') |
| | | { |
| | | if (empty($mbox_name)) |
| | | if (!strlen($mbox_name)) |
| | | return ''; |
| | | |
| | | if ($mode == 'in') { |
| | |
| | | if ($mailbox) |
| | | $mailbox = $this->mod_mailbox($mailbox); |
| | | |
| | | if ($this->get_capability('METADATA') || |
| | | empty($mailbox) && $this->get_capability('METADATA-SERVER') |
| | | if ($this->get_capability('METADATA') || |
| | | (!strlen($mailbox) && $this->get_capability('METADATA-SERVER')) |
| | | ) { |
| | | return $this->conn->setMetadata($mailbox, $entries); |
| | | } |
| | |
| | | $mailbox = $this->mod_mailbox($mailbox); |
| | | |
| | | if ($this->get_capability('METADATA') || |
| | | empty($mailbox) && $this->get_capability('METADATA-SERVER') |
| | | (!strlen($mailbox) && $this->get_capability('METADATA-SERVER')) |
| | | ) { |
| | | return $this->conn->deleteMetadata($mailbox, $entries); |
| | | } |
| | |
| | | $mailbox = $this->mod_mailbox($mailbox); |
| | | |
| | | if ($this->get_capability('METADATA') || |
| | | empty($mailbox) && $this->get_capability('METADATA-SERVER') |
| | | !strlen(($mailbox) && $this->get_capability('METADATA-SERVER')) |
| | | ) { |
| | | return $this->conn->getMetadata($mailbox, $entries, $options); |
| | | } |
| | |
| | | |
| | | function select($mailbox) |
| | | { |
| | | if (empty($mailbox)) { |
| | | if (!strlen($mailbox)) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | */ |
| | | function status($mailbox, $items=array()) |
| | | { |
| | | if (empty($mailbox)) { |
| | | if (!strlen($mailbox)) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | function checkForRecent($mailbox) |
| | | { |
| | | if (empty($mailbox)) { |
| | | if (!strlen($mailbox)) { |
| | | $mailbox = 'INBOX'; |
| | | } |
| | | |
| | | $this->select($mailbox); |
| | | |
| | | if ($this->selected == $mailbox) { |
| | | return $this->data['RECENT']; |
| | | } |
| | |
| | | |
| | | function copy($messages, $from, $to) |
| | | { |
| | | if (empty($from) || empty($to)) { |
| | | return false; |
| | | } |
| | | |
| | | if (!$this->select($from)) { |
| | | return false; |
| | | } |
| | |
| | | |
| | | function move($messages, $from, $to) |
| | | { |
| | | if (!$from || !$to) { |
| | | return false; |
| | | } |
| | | |
| | | $r = $this->copy($messages, $from, $to); |
| | | |
| | | if ($r) { |
| | |
| | | private function _listMailboxes($ref, $mailbox, $subscribed=false, |
| | | $status_opts=array(), $select_opts=array()) |
| | | { |
| | | if (empty($mailbox)) { |
| | | if (!strlen($mailbox)) { |
| | | $mailbox = '*'; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // set imap properties and session vars |
| | | if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC)) |
| | | if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC)))) |
| | | $IMAP->set_mailbox(($_SESSION['mbox'] = $mbox)); |
| | | else if ($IMAP) |
| | | $_SESSION['mbox'] = $IMAP->get_mailbox_name(); |
| | |
| | | $old_pages = ceil($old_count / $IMAP->page_size); |
| | | |
| | | // move messages |
| | | if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) { |
| | | if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { |
| | | $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); |
| | | $target = get_input_value('_target_mbox', RCUBE_INPUT_POST); |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); |
| | |
| | | $_SESSION['unseen_count'][$mbox] = $unseen_count; |
| | | } |
| | | |
| | | if ($RCMAIL->action=='moveto' && $target) { |
| | | if ($RCMAIL->action=='moveto' && strlen($target)) { |
| | | rcmail_send_unread_count($target, true); |
| | | } |
| | | |
| | |
| | | // subscribe to one or more mailboxes |
| | | if ($RCMAIL->action=='subscribe') |
| | | { |
| | | if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); |
| | | if (strlen($mbox)) |
| | | $IMAP->subscribe(array($mbox)); |
| | | } |
| | | |
| | | // unsubscribe one or more mailboxes |
| | | else if ($RCMAIL->action=='unsubscribe') |
| | | { |
| | | if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); |
| | | if (strlen($mbox)) |
| | | $IMAP->unsubscribe(array($mbox)); |
| | | } |
| | | |
| | | // enable threading for one or more mailboxes |
| | | else if ($RCMAIL->action=='enable-threading') |
| | | { |
| | | if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); |
| | | if (strlen($mbox)) |
| | | rcube_set_threading($mbox, true); |
| | | } |
| | | |
| | | // enable threading for one or more mailboxes |
| | | else if ($RCMAIL->action=='disable-threading') |
| | | { |
| | | if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); |
| | | if (strlen($mbox)) |
| | | rcube_set_threading($mbox, false); |
| | | } |
| | | |
| | | // create a new mailbox |
| | | else if ($RCMAIL->action=='create-folder') |
| | | { |
| | | if (!empty($_POST['_name'])) |
| | | if (strlen(trim($_POST['_name']))) |
| | | { |
| | | $name = trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF7-IMAP')); |
| | | $create = $IMAP->create_mailbox($name, TRUE); |
| | |
| | | // rename a mailbox |
| | | else if ($RCMAIL->action=='rename-folder') |
| | | { |
| | | if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname'])) |
| | | if (strlen(trim($_POST['_folder_oldname'])) && strlen(trim($_POST['_folder_newname']))) |
| | | { |
| | | $name_utf8 = trim(get_input_value('_folder_newname', RCUBE_INPUT_POST)); |
| | | $oldname_utf8 = get_input_value('_folder_oldname', RCUBE_INPUT_POST); |
| | |
| | | foreach ($a_threaded as $key => $val) |
| | | if ($key == $oldname) { |
| | | unset($a_threaded[$key]); |
| | | $a_threaded[$name] = true; |
| | | $a_threaded[$name] = true; |
| | | } |
| | | else if (preg_match($oldprefix, $key)) { |
| | | unset($a_threaded[$key]); |
| | | $a_threaded[preg_replace($oldprefix, $name.$delimiter, $key)] = true; |
| | | $a_threaded[preg_replace($oldprefix, $name.$delimiter, $key)] = true; |
| | | } |
| | | |
| | | |
| | | $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded)); |
| | | } |
| | | |
| | |
| | | $mboxes_utf8 = get_input_value('_mboxes', RCUBE_INPUT_POST); |
| | | $mboxes = rcube_charset_convert($mboxes_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); |
| | | |
| | | if ($mboxes) |
| | | if (strlen($mboxes)) |
| | | $deleted = $IMAP->delete_mailbox(array($mboxes)); |
| | | |
| | | if ($OUTPUT->ajax_call && $deleted) |
| | |
| | | $protected = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_imap_folders'])); |
| | | $classes = array($i%2 ? 'even' : 'odd'); |
| | | $folder_js = JQ($folder['id']); |
| | | $display_folder = str_repeat(' ', $folder['level']) . ($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); |
| | | $display_folder = str_repeat(' ', $folder['level']) . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); |
| | | $folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP'); |
| | | |
| | | if ($folder['virtual']) { |
| | |
| | | |
| | | $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes))); |
| | | |
| | | $table->add('name', Q($display_folder)); |
| | | $table->add('name', $display_folder); |
| | | $table->add('msgcount', (($folder['virtual'] || $noselect) ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false))); |
| | | $table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''), |
| | | array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : ''))); |
| | |
| | | $a_js_folders['rcmrow'.$idx] = array($folder_utf8, $display_folder, $protected || $folder['virtual']); |
| | | } |
| | | |
| | | rcmail::get_instance()->plugins->exec_hook('folders_list', array('table'=>$table)); |
| | | rcmail::get_instance()->plugins->exec_hook('folders_list', array('table' => $table)); |
| | | |
| | | $OUTPUT->add_gui_object('subscriptionlist', $attrib['id']); |
| | | $OUTPUT->set_env('subscriptionrows', $a_js_folders); |