\n"; fputs ($imapConnection, $cmd); $data = sqimap_read_data($imapConnection, "a024", true, $a, $b); // Renaming a folder doesn't renames the folder but leaves you unsubscribed // at least on Cyrus IMAP servers. if (isset($isfolder)) { $newone = $newone.$dm; $orig = $orig.$dm; } sqimap_unsubscribe($imapConnection, $orig); sqimap_subscribe($imapConnection, $newone); fputs ($imapConnection, "a001 LIST \"\" \"" . quoteIMAP($newone) . "*\"\r\n"); $data = sqimap_read_data($imapConnection, "a001", true, $a, $b); for ($i=0; $i < count($data); $i++) { $name = find_mailbox_name($data[$i]); if ($name != $newone) // don't try to resubscribe when renaming ab to abc { sqimap_unsubscribe($imapConnection, $name); $name = substr($name, strlen($orig)); $name = $newone . $name; sqimap_subscribe($imapConnection, $name); } } /** Log out this session **/ sqimap_logout($imapConnection); $location = get_location(); header ("Location: $location/folders.php?success=rename"); ?>