59177427 |
1 | <?php |
ef870322 |
2 | /** |
3 | ** folders_rename_do.php |
4 | ** |
5 | ** Copyright (c) 1999-2000 The SquirrelMail development team |
6 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
7 | ** |
8 | ** Does the actual renaming of files on the IMAP server. |
9 | ** Called from the folders.php |
10 | **/ |
11 | |
12 | session_start(); |
13 | |
14 | if (!isset($config_php)) |
15 | include("../config/config.php"); |
16 | if (!isset($strings_php)) |
17 | include("../functions/strings.php"); |
18 | if (!isset($page_header_php)) |
19 | include("../functions/page_header.php"); |
20 | if (!isset($imap_php)) |
21 | include("../functions/imap.php"); |
ef870322 |
22 | |
23 | include("../src/load_prefs.php"); |
24 | |
25 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
26 | $dm = sqimap_get_delimiter($imapConnection); |
27 | |
d92b6f31 |
28 | if (strpos($orig, $dm)) |
29 | $old_dir = substr($orig, 0, strrpos($orig, $dm)); |
30 | else |
31 | $old_dir = ""; |
32 | |
33 | if ($old_dir != "") |
34 | $newone = "$old_dir$dm$new_name"; |
35 | else |
36 | $newone = "$new_name"; |
37 | |
d7092926 |
38 | $orig = stripslashes($orig); |
39 | $newone = stripslashes($newone); |
40 | |
d92b6f31 |
41 | fputs ($imapConnection, ". RENAME \"$orig\" \"$newone\"\n"); |
813eba2f |
42 | $data = sqimap_read_data($imapConnection, ".", true, $a, $b); |
d92b6f31 |
43 | |
f16d469a |
44 | // Renaming a folder doesn't renames the folder but leaves you unsubscribed |
45 | // at least on Cyrus IMAP servers. |
693ccbc9 |
46 | if ($isfolder) { |
47 | $newone = $newone.$dm; |
48 | $orig = $orig.$dm; |
49 | } |
50 | |
51 | sqimap_unsubscribe($imapConnection, $orig); |
52 | sqimap_subscribe($imapConnection, $newone); |
d92b6f31 |
53 | |
be69e508 |
54 | /** Log out this session **/ |
693ccbc9 |
55 | sqimap_logout($imapConnection); |
1195c340 |
56 | $location = get_location(); |
57 | header ("Location: $location/folders.php?success=rename"); |
58 | sqimap_logout($imapConnection); |
59 | /* |
d7092926 |
60 | displayPageHeader($color, "None"); |
61 | echo "<BR><BR><BR><CENTER><B>"; |
62 | echo _("Folder Renamed!"); |
63 | echo "</B><BR><BR>"; |
64 | echo _("The folder has been successfully renamed."); |
9f2215a1 |
65 | echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>"; |
d7092926 |
66 | echo _("Click here"); |
67 | echo "</A> "; |
68 | echo _("to continue."); |
69 | echo "</CENTER>"; |
70 | |
71 | echo "</BODY></HTML>"; |
1195c340 |
72 | */ |
be69e508 |
73 | ?> |