diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_imap.inc | 19 | ||||
-rw-r--r-- | program/js/app.js | 60 | ||||
-rw-r--r-- | program/localization/it/labels.inc | 4 | ||||
-rw-r--r-- | program/localization/it/messages.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 22 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/getunread.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/upload.inc | 6 | ||||
-rw-r--r-- | program/steps/settings/manage_folders.inc | 4 |
10 files changed, 95 insertions, 36 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 16cfb522e..d825a35b0 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -362,13 +362,18 @@ class rcube_imap if (!is_array($a_folders) || !sizeof($a_folders)) $a_folders = array(); - // create INBOX if it does not exist - if (!in_array_nocase('INBOX', $a_folders)) + // create Default folders if they do not exist + global $CONFIG; + foreach ($CONFIG['default_imap_folders'] as $folder) { - $this->create_mailbox('INBOX', TRUE); - array_unshift($a_folders, 'INBOX'); + if (!in_array_nocase($folder, $a_folders)) + { + $this->create_mailbox($folder, TRUE); + $this->subscribe($folder); + } } + $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter); $a_mailbox_cache = array(); // write mailboxlist to cache @@ -991,6 +996,7 @@ class rcube_imap // append a mail message (source) to a specific mailbox function save_message($mbox_name, &$message) { + $mbox_name = stripslashes($mbox_name); $mailbox = $this->_mod_mailbox($mbox_name); // make sure mailbox exists @@ -1010,6 +1016,8 @@ class rcube_imap // move a message from one mailbox to another function move_message($uids, $to_mbox, $from_mbox='') { + $to_mbox = stripslashes($to_mbox); + $from_mbox = stripslashes($from_mbox); $to_mbox = $this->_mod_mailbox($to_mbox); $from_mbox = $from_mbox ? $this->_mod_mailbox($from_mbox) : $this->mailbox; @@ -1067,6 +1075,7 @@ class rcube_imap // mark messages as deleted and expunge mailbox function delete_message($uids, $mbox_name='') { + $mbox_name = stripslashes($mbox_name); $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; // convert the list of uids to array @@ -1114,6 +1123,7 @@ class rcube_imap // clear all messages in a specific mailbox function clear_mailbox($mbox_name=NULL) { + $mbox_name = stripslashes($mbox_name); $mailbox = !empty($mbox_name) ? $this->_mod_mailbox($mbox_name) : $this->mailbox; $msg_count = $this->_messagecount($mailbox, 'ALL'); @@ -1140,6 +1150,7 @@ class rcube_imap // send IMAP expunge command and clear cache function expunge($mbox_name='', $clear_cache=TRUE) { + $mbox_name = stripslashes($mbox_name); $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; return $this->_expunge($mailbox, $clear_cache); } diff --git a/program/js/app.js b/program/js/app.js index c61c20a63..fb103bf43 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -143,7 +143,7 @@ function rcube_webmail() if (this.env.action=='compose') { - this.enable_command('add-attachment', 'send-attachment', 'send', true); + this.enable_command('add-attachment', 'send-attachment', 'remove-attachment', 'send', true); if (this.env.spellcheck) this.enable_command('spellcheck', true); if (this.env.drafts_mailbox) @@ -945,6 +945,10 @@ function rcube_webmail() case 'send-attachment': this.upload_file(props) break; + + case 'remove-attachment': + this.remove_attachment(props); + break; case 'reply-all': case 'reply': @@ -1347,8 +1351,6 @@ function rcube_webmail() { if (this.env.mailbox==this.env.drafts_mailbox) { - //alert(this.env.mailbox); - //this.disable_command('reply', 'reply-all', 'forward', 'print', 'moveto'); this.enable_command('show', selected); this.enable_command('delete', this.selection.length>0 ? true : false); } @@ -1669,7 +1671,6 @@ function rcube_webmail() lock = true; this.set_busy(true, 'movingmessage'); } - // send request to server this.http_request('moveto', '_uid='+a_uids.join(',')+'&_mbox='+escape(this.env.mailbox)+'&_target_mbox='+escape(mbox)+'&_from='+(this.env.action ? this.env.action : ''), lock); }; @@ -2095,17 +2096,36 @@ function rcube_webmail() // add file name to attachment list // called from upload page - this.add2attachment_list = function(name) + this.add2attachment_list = function(name,content) { if (!this.gui_objects.attachmentlist) return false; var li = document.createElement('LI'); - li.innerHTML = name; + li.id = name; + li.innerHTML = content; this.gui_objects.attachmentlist.appendChild(li); return true; }; + this.remove_from_attachment_list = function(name) + { + if (!this.gui_objects.attachmentlist) + return false; + + var list = this.gui_objects.attachmentlist.getElementsByTagName("li"); + for (i=0;i<list.length;i++) + if (list[i].id == name) + this.gui_objects.attachmentlist.removeChild(list[i]); + } + + this.remove_attachment = function(name) + { + if (name) + this.http_request('remove-attachment', '_filename='+escape(name)); + + return true; + } // send remote request to add a new contact this.add_contact = function(value) @@ -2621,8 +2641,7 @@ function rcube_webmail() if (oldname && newname) this.http_request('rename-folder', '_folder_oldname='+escape(oldname)+'&_folder_newname='+escape(newname)); - else if (form.elements['_folder_newname']) - form.elements['_folder_newname'].focus(); + }; @@ -2658,6 +2677,7 @@ function rcube_webmail() } } } + form.elements['_folder_newname'].value=''; }; @@ -2721,16 +2741,25 @@ function rcube_webmail() // add a new folder to the subscription list by cloning a folder row this.add_folder_row = function(name) { + name = name.replace('\\',""); if (!this.gui_objects.subscriptionlist) return false; var tbody = this.gui_objects.subscriptionlist.tBodies[0]; var id = tbody.childNodes.length+1; - - // clone a table row - var row = this.clone_table_row(tbody.rows[0]); - row.id = 'rcmrow'+id; - tbody.appendChild(row); + + if (!tbody.rows[0]) + { + // Refresh to create the first table row + location.href = this.env.comm_path+'&_action=folders'; + } + else + { + // clone a table row if there are existing rows + var row = this.clone_table_row(tbody.rows[0]); + row.id = 'rcmrow'+id; + tbody.appendChild(row); + } // add to folder/row-ID map this.env.subscriptionrows[row.id] = name; @@ -2743,15 +2772,14 @@ function rcube_webmail() row.cells[1].firstChild.checked = true; } if (row.cells[2].firstChild.tagName=='A') - row.cells[2].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name+"')"); + row.cells[2].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name.replace('\'','\\\'')+"')"); var form; if ((form = this.gui_objects.editform) && form.elements['_folder_name']) form.elements['_folder_name'].value = ''; // add new folder to rename-folder list - if (form.elements['_folder_oldname']) - form.elements['_folder_oldname'].options[form.elements['_folder_oldname'].options.length] = new Option(name,name); + form.elements['_folder_oldname'].options[form.elements['_folder_oldname'].options.length] = new Option(name,name); }; diff --git a/program/localization/it/labels.inc b/program/localization/it/labels.inc index 0a080eafb..0f78e7014 100644 --- a/program/localization/it/labels.inc +++ b/program/localization/it/labels.inc @@ -91,7 +91,7 @@ $labels['saturday'] = 'Sabato'; $labels['today'] = 'Oggi'; // toolbar buttons -$labels['checkmail'] = 'Controllando per vedere se c'è nuovi messaggi'; +$labels['checkmail'] = 'Controllo per vedere se ci sono nuovi messaggi'; $labels['writenewmessage'] = 'Scrivi un nuovo messaggio'; $labels['replytomessage'] = 'Rispondi al messaggio'; $labels['replytoallmessage'] = 'Rispondi a tutti'; @@ -203,4 +203,4 @@ $labels['sortasc'] = 'Ordinamento ascendente'; $labels['sortdesc'] = 'Ordinamento discendente'; -?>
\ No newline at end of file +?> diff --git a/program/localization/it/messages.inc b/program/localization/it/messages.inc index ae3c81819..92b7013c3 100644 --- a/program/localization/it/messages.inc +++ b/program/localization/it/messages.inc @@ -36,7 +36,7 @@ $messages['loading'] = 'Caricamento...'; $messages['loadingdata'] = 'Caricamento dati...'; -$messages['checkingmail'] = 'Controllando per vedere se c'è nuovi messaggi...'; +$messages['checkingmail'] = 'Controllo per vedere se ci sono nuovi messaggi...'; $messages['sendingmessage'] = 'Invio messaggio in corso...'; @@ -95,4 +95,4 @@ $messages['nocontactsreturned'] = 'Nessun contatto trovato'; $messages['nosearchname'] = 'Per favore, immetti un nome o un indirizzo e-mail'; -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index ba80a54f1..6d4cf9a61 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -32,6 +32,20 @@ $DRAFT_MESSAGE = NULL; if (!is_array($_SESSION['compose'])) $_SESSION['compose'] = array('id' => uniqid(rand())); +// remove an attachment +if ($_action=='remove-attachment' && !empty($_GET['_filename'])) + { + if (is_array($_SESSION['compose']['attachments'])) + foreach ($_SESSION['compose']['attachments'] as $i => $attachment) + if ($attachment['name'] == $_GET['_filename']) + { + @unlink($attachment['path']); + unset($_SESSION['compose']['attachments'][$i]); + $commands = sprintf("parent.%s.remove_from_attachment_list('%s');\n", $JS_OBJECT_NAME, $_GET['_filename']); + rcube_remote_response($commands); + exit; + } + } // add some labels to client rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'savingmessage', 'messagesaved'); @@ -611,8 +625,13 @@ function rcmail_compose_attachment_list($attrib) if (is_array($_SESSION['compose']['attachments'])) { + if ($attrib['deleteicon']) + $button = sprintf('<img src="%s%s" alt="%s" border="0" / style="padding-right:2px;vertical-align:middle">', $CONFIG['skin_path'], $attrib['deleteicon'], rcube_label('delete')); + else + $button = rcube_label('delete'); + foreach ($_SESSION['compose']['attachments'] as $i => $a_prop) - $out .= sprintf("<li>%s</li>\n", $a_prop['name']); + $out .= sprintf('<li id="%s"><a href="#" onclick="%s.command(\'remove-attachment\',\'%s\')" title="%s">%s</a>%s</li>', $a_prop['name'], $JS_OBJECT_NAME, $a_prop['name'], rcube_label('deletefolder'), $button, $a_prop['name']); } $OUTPUT->add_script(sprintf("%s.gui_object('attachmentlist', '%s');", $JS_OBJECT_NAME, $attrib['id'])); @@ -663,7 +682,6 @@ function rcmail_compose_attachment_field($attrib) return $out; } - function rcmail_priority_selector($attrib) { list($form_start, $form_end) = get_form_tags($attrib); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index eac4e3747..7e2b3b28d 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -220,13 +220,13 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m $class_name, $zebra_class, $unread_count ? ' unread' : '', - $folder['id']==$mbox_name ? ' selected' : '', + addslashes($folder['id'])==addslashes($mbox_name) ? ' selected' : '', $COMM_PATH, urlencode($folder['id']), $JS_OBJECT_NAME, - $folder['id'], + addslashes($folder['id']), $JS_OBJECT_NAME, - $folder['id'], + addslashes($folder['id']), $title, rep_specialchars_output($foldername, 'html', 'all')); diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc index 437e3aa00..ed4a5fb77 100644 --- a/program/steps/mail/getunread.inc +++ b/program/steps/mail/getunread.inc @@ -27,10 +27,10 @@ if (!empty($a_folders)) { foreach ($a_folders as $mbox_row) { - $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN')); + $commands = sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox_row), $IMAP->messagecount($mbox_row, 'UNSEEN')); rcube_remote_response($commands, TRUE); } } exit; -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index e4da207f4..116332a64 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -88,4 +88,4 @@ if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages) rcube_remote_response($commands); exit; -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/upload.inc b/program/steps/mail/upload.inc index 4cd929d0d..7fe7d3dcc 100644 --- a/program/steps/mail/upload.inc +++ b/program/steps/mail/upload.inc @@ -45,7 +45,9 @@ foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) 'mimetype' => $_FILES['_attachments']['type'][$i], 'path' => $tmpfname); - $response .= sprintf("parent.%s.add2attachment_list('%s');\n", $JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i]); + $button = sprintf('<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle">', $CONFIG['skin_path'], rcube_label('delete')); + $content = sprintf('<a href="#" onclick="%s.command(\\\'remove-attachment\\\',\\\'%s\\\')" title="%s">%s</a>%s',$JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i], rcube_label('deletefolder'), $button, $_FILES['_attachments']['name'][$i]); + $response .= sprintf('parent.%s.add2attachment_list(\'%s\',\'%s\');',$JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i], $content); } } @@ -64,4 +66,4 @@ parent.$JS_OBJECT_NAME.show_attachment_form(false); EOF; exit; -?>
\ No newline at end of file +?> diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc index dd321f0d8..7274bdc50 100644 --- a/program/steps/settings/manage_folders.inc +++ b/program/steps/settings/manage_folders.inc @@ -71,8 +71,8 @@ else if ($_action=='rename-folder') if ($rename && $REMOTE_REQUEST) { - $commands = sprintf("this.add_folder_row('%s');", rep_specialchars_output($rename, 'js')); - $commands .= sprintf("this.remove_folder_row('%s')", rep_specialchars_output($_GET['_folder_oldname'], 'js')); + $commands = sprintf("this.add_folder_row('%s');\n", addslashes(rep_specialchars_output($rename, 'js'))); + $commands .= sprintf("this.remove_folder_row('%s');", rep_specialchars_output($_GET['_folder_oldname'], 'js')); rcube_remote_response($commands); } else if (!$rename && $REMOTE_REQUEST) |