Added i18n.php and moved som functionality to that file.
[squirrelmail.git] / src / folders_rename_do.php
1 <?
2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
6
7 include("../src/load_prefs.php");
8
9 $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
10 $dm = sqimap_get_delimiter($imapConnection);
11
12 if (strpos($orig, $dm))
13 $old_dir = substr($orig, 0, strrpos($orig, $dm));
14 else
15 $old_dir = "";
16
17 if ($old_dir != "")
18 $newone = "$old_dir$dm$new_name";
19 else
20 $newone = "$new_name";
21
22 fputs ($imapConnection, ". RENAME \"$orig\" \"$newone\"\n");
23 $data = sqimap_read_data($imapConnection, ".", true, $a, $b);
24
25 // Renaming a folder doesn't renames the folder but leaves you unsubscribed
26 // at least on Cyrus IMAP servers.
27 fputs ($imapConnection, "sub UNSUBSCRIBE \"$orig\"\n");
28 fputs ($imapConnection, "sub SUBSCRIBE \"$newone\"\n");
29 $data = sqimap_read_data($imapConnection, "sub", true, $a, $b);
30
31 /** Log out this session **/
32 fputs($imapConnection, "1 logout");
33
34 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
35 echo "<BR><BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
36 echo _("Return");
37 echo "</A>";
38 echo "</BODY></HTML>";
39 ?>