Of course the real fix for using utf7-functions inconsistently is making them more
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 28 Oct 2002 15:01:49 +0000 (15:01 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 28 Oct 2002 15:01:49 +0000 (15:01 +0000)
consistent, so from now on we assume that all input to these imap_mailbox_ functions is
utf7 in stead of non-utf7 for some and utf7 for others.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4050 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php
src/folders_create.php
src/folders_rename_do.php

index b981b4722d7f632cd5440f2e7fd02576c0bd036a..0cae70822d952b131522e978cc4b2f8cb5550e50 100755 (executable)
@@ -225,7 +225,7 @@ function sqimap_mailbox_create ($imap_stream, $mailbox, $type) {
     if (strtolower($type) == 'noselect') {
         $mailbox .= $delimiter;
     }
-    $mailbox  = imap_utf7_encode_local($mailbox);
+
     $read_ary = sqimap_run_command($imap_stream, "CREATE \"$mailbox\"",
                                    true, $response, $message);
     sqimap_subscribe ($imap_stream, $mailbox);
@@ -239,7 +239,6 @@ function sqimap_subscribe ($imap_stream, $mailbox) {
 
 /* Unsubscribes to an existing folder */
 function sqimap_unsubscribe ($imap_stream, $mailbox) {
-    global $imap_server_type;
     $read_ary = sqimap_run_command($imap_stream, "UNSUBSCRIBE \"$mailbox\"",
                                    true, $response, $message);
 }
@@ -250,7 +249,7 @@ function sqimap_mailbox_delete ($imap_stream, $mailbox) {
     $read_ary = sqimap_run_command($imap_stream, "DELETE \"$mailbox\"",
                                    true, $response, $message);
     sqimap_unsubscribe ($imap_stream, $mailbox);
-    do_hook_function("rename_or_delete_folder", $args = array($mailbox, 'delete', ''));
+    do_hook_function('rename_or_delete_folder', $args = array($mailbox, 'delete', ''));
     removePref($data_dir, $username, "thread_$mailbox");
 }
 
@@ -277,9 +276,6 @@ function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
             $postfix = '';
         }
 
-        $old_name = imap_utf7_encode_local($old_name);
-        $new_name = imap_utf7_encode_local($new_name);
-
         $boxesall = sqimap_mailbox_list($imap_stream);
         $cmd = 'RENAME "' . $old_name . '" "' . $new_name . '"';
         $data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
@@ -288,7 +284,7 @@ function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
         removePref($data_dir, $username, 'thread_'.$old_name.$postfix);
         sqimap_subscribe($imap_stream, $new_name.$postfix);
         setPref($data_dir, $username, 'thread_'.$new_name.$postfix, $oldpref);
-        do_hook_function("rename_or_delete_folder",$args = array($old_name, 'rename', $new_name));
+        do_hook_function('rename_or_delete_folder',$args = array($old_name, 'rename', $new_name));
         $l = strlen( $old_name ) + 1;
         $p = 'unformatted';
 
@@ -330,9 +326,9 @@ function sqimap_mailbox_parse ($line, $line_lsub) {
     for ($g = 0, $cnt = count($line); $g < $cnt; $g++) {
         /* Store the raw IMAP reply */
         if (isset($line[$g])) {
-            $boxesall[$g]["raw"] = $line[$g];
+            $boxesall[$g]['raw'] = $line[$g];
         } else {
-            $boxesall[$g]["raw"] = '';
+            $boxesall[$g]['raw'] = '';
         }
 
         /* Count number of delimiters ($delimiter) in folder name */
@@ -741,7 +737,7 @@ function sqimap_mailbox_list_all($imap_stream) {
         $g++;
     }
     if(is_array($boxes)) {
-        $boxes = sort ($boxes);
+        sort ($boxes);
     }
 
     return $boxes;
index 18d76fbf7492492d9b4577f71b68db15f16f6965..51a0a8dba2cbad68bc085c138ebc195bd69eba91 100644 (file)
@@ -46,7 +46,7 @@ if (substr_count($folder_name, '"') || substr_count($folder_name, "\\") ||
     exit;
 }
 
-$subfolder = imap_utf7_decode_local($subfolder);
+$folder_name = imap_utf7_encode_local($folder_name);
 
 if (isset($contain_subs) && $contain_subs ) {
     $folder_name = $folder_name . $delimiter;
index f625ac482da5a89600782ecbaf9a5247b0ce82ea..a7aba128d4ce9ec29bc678cd61cbbd1e1525bf29 100644 (file)
@@ -44,6 +44,10 @@ if (substr_count($new_name, '"') || substr_count($new_name, "\\") ||
     exit;
 }
 
+$orig = imap_utf7_encode_local($orig);
+$old_name = imap_utf7_encode_local($old_name);
+$new_name = imap_utf7_encode_local($new_name);
+
 if ($old_name <> $new_name) {
 
     $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);