X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Ffolder_manip.php;h=877fa7b7fcca11def1c2832f0152990d3573a017;hp=e15ab6172e6ae6ef2fa2582462882fa76ad471ae;hb=9ae70b623b5bda18ee4b60d9481d49d057b2f508;hpb=9829e1d84ea35989d03c1956871a8f48ad3c538c diff --git a/functions/folder_manip.php b/functions/folder_manip.php index e15ab617..877fa7b7 100644 --- a/functions/folder_manip.php +++ b/functions/folder_manip.php @@ -7,7 +7,7 @@ * (un)subscribe, create, rename, delete. * * @author Thijs Kinkhorst - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright 1999-2014 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -41,6 +41,12 @@ function folders_checkname($imapConnection, $folder_name, $delimiter) /** * Called from folders.php to create a new folder. + * @param stream $imapConnection imap connection resource + * @param string $delimiter delimiter + * @param string $folder_name new folder name + * @param string $subfolder folder that stores new folder + * @param string $contain_subs if not empty, creates folder that can store subfolders + * @since 1.5.1 */ function folders_create ($imapConnection, $delimiter, $folder_name, $subfolder, $contain_subs) { @@ -51,7 +57,9 @@ function folders_create ($imapConnection, $delimiter, $folder_name, $subfolder, $folder_name = imap_utf7_encode_local($folder_name); if ( ! empty($contain_subs) ) { - $folder_name = $folder_name . $delimiter; + $folder_type = 'noselect'; + } else { + $folder_type = ''; } if ($folder_prefix && (substr($folder_prefix, -1) != $delimiter)) { @@ -65,9 +73,9 @@ function folders_create ($imapConnection, $delimiter, $folder_name, $subfolder, } if (trim($subfolder_orig) == '') { - sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ''); + sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, $folder_type); } else { - sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, ''); + sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, $folder_type); } return; @@ -98,7 +106,7 @@ function folders_rename_getname ($imapConnection, $delimiter, $old) { $old = imap_utf7_decode_local($old); if (strpos($old, $delimiter)) { - $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old)); + $old_name = substr($old, strrpos($old, $delimiter)+1); // hide default prefix (INBOX., mail/ or other) $quoted_prefix=preg_quote($default_folder_prefix,'/'); $prefix_length=(preg_match("/^$quoted_prefix/",$old) ? strlen($default_folder_prefix) : 0); @@ -116,11 +124,10 @@ function folders_rename_getname ($imapConnection, $delimiter, $old) { sqimap_logout($imapConnection); $oTemplate->assign('dialog_type', 'rename'); - $oTemplate->assign('color', $color); - $oTemplate->assign('old_parent', htmlspecialchars($old_parent)); - $oTemplate->assign('old', htmlspecialchars($old)); - $oTemplate->assign('old_name', htmlspecialchars($old_name)); - $oTemplate->assign('isfolder', $isfolder); + $oTemplate->assign('parent_folder', sm_encode_html_special_chars($old_parent)); + $oTemplate->assign('current_full_name', sm_encode_html_special_chars($old)); + $oTemplate->assign('current_folder_name', sm_encode_html_special_chars($old_name)); + $oTemplate->assign('is_folder', $isfolder); $oTemplate->display('folder_manip_dialog.tpl'); $oTemplate->display('footer.tpl'); @@ -191,9 +198,8 @@ function folders_delete_ask ($imapConnection, $folder_name) sqimap_logout($imapConnection); $oTemplate->assign('dialog_type', 'delete'); - $oTemplate->assign('color', $color); - $oTemplate->assign('folder_name', htmlspecialchars($folder_name)); - $oTemplate->assign('visible_folder_name', htmlspecialchars($visible_folder_name)); + $oTemplate->assign('folder_name', sm_encode_html_special_chars($folder_name)); + $oTemplate->assign('visible_folder_name', sm_encode_html_special_chars($visible_folder_name)); $oTemplate->display('folder_manip_dialog.tpl'); $oTemplate->display('footer.tpl'); @@ -220,18 +226,10 @@ function folders_delete_do ($imapConnection, $delimiter, $folder_name) /** lets see if we CAN move folders to the trash.. otherwise, ** just delete them **/ - - /* Courier IMAP doesn't like subfolders of Trash - * If global options say we can't move it into Trash - * If it's already a subfolder of trash, we'll have to delete it */ - if (strtolower($imap_server_type) == 'courier' || - (isset($delete_folder) && $delete_folder) || - eregi('^'.$trash_folder.'.+', $folder_name) ) - { + if ($delete_folder || preg_match('/^' . preg_quote($trash_folder, '/') . '.+/i', $folder_name) ) { $can_move_to_trash = FALSE; - } + } else { /* Otherwise, check if trash folder exits and support sub-folders */ - else { foreach($boxes as $box) { if ($box['unformatted'] == $trash_folder) { $can_move_to_trash = !in_array('noinferiors', $box['flags']);