From 0d18f61419f5bb0032cdd52228022e6586b75314 Mon Sep 17 00:00:00 2001 From: tokul Date: Sun, 5 Feb 2006 11:29:41 +0000 Subject: [PATCH] replacing obsolate function calls with current ones git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10646 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/tree.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/functions/tree.php b/functions/tree.php index 6d79ac15..9df95a5e 100644 --- a/functions/tree.php +++ b/functions/tree.php @@ -12,6 +12,9 @@ * @package squirrelmail */ +/** @ignore */ +if (! defined('SM_PATH')) define('SM_PATH','../'); + /** Clearly, this needs the IMAP functions.. */ require_once(SM_PATH . 'functions/imap.php'); @@ -154,24 +157,26 @@ function walkTreeInPostOrderCreatingFoldersUnderTrash($index, $imap_stream, $tre $subFolderName = substr($tree[$index]['value'], $position); if ($tree[$index]['doIHaveChildren']) { - sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ""); + // create new trash subfolder only if it does not exist. + if (!sqimap_mailbox_exists($imap_stream, $trash_folder . $delimiter . $subFolderName)) + sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ""); + $mbx_response = sqimap_mailbox_select($imap_stream, $tree[$index]['value']); $messageCount = $mbx_response['EXISTS']; if ($messageCount > 0) { - // FIXME: broken call - sqimap_messages_copy($imap_stream, 1, '*', $trash_folder . $delimiter . $subFolderName); + sqimap_msgs_list_copy($imap_stream, '1:*', $trash_folder . $delimiter . $subFolderName); } // after copy close the mailbox to get in unselected state sqimap_run_command($imap_stream,'CLOSE',false,$response,$message); for ($j = 0;$j < count($tree[$index]['subNodes']); $j++) walkTreeInPostOrderCreatingFoldersUnderTrash($tree[$index]['subNodes'][$j], $imap_stream, $tree, $topFolderName); } else { - sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ''); + if (!sqimap_mailbox_exists($imap_stream, $trash_folder . $delimiter . $subFolderName)) + sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ''); $mbx_response = sqimap_mailbox_select($imap_stream, $tree[$index]['value']); $messageCount = $mbx_response['EXISTS']; if ($messageCount > 0) { - // FIXME: broken call - sqimap_messages_copy($imap_stream, 1, '*', $trash_folder . $delimiter . $subFolderName); + sqimap_msgs_list_copy($imap_stream, '1:*', $trash_folder . $delimiter . $subFolderName); } // after copy close the mailbox to get in unselected state sqimap_run_command($imap_stream,'CLOSE',false,$response,$message); -- 2.25.1