Uses the brand new configuration directive email_address to set the
[squirrelmail.git] / src / folders_rename_do.php
CommitLineData
be69e508 1<?
2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
be69e508 6
d3cdb279 7 include("../src/load_prefs.php");
8
813eba2f 9 $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
10 $dm = sqimap_get_delimiter($imapConnection);
d92b6f31 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");
813eba2f 23 $data = sqimap_read_data($imapConnection, ".", true, $a, $b);
d92b6f31 24
f16d469a 25 // Renaming a folder doesn't renames the folder but leaves you unsubscribed
26 // at least on Cyrus IMAP servers.
813eba2f 27 fputs ($imapConnection, "sub UNSUBSCRIBE \"$orig\"\n");
23fc64b3 28 fputs ($imapConnection, "sub SUBSCRIBE \"$newone\"\n");
813eba2f 29 $data = sqimap_read_data($imapConnection, "sub", true, $a, $b);
d92b6f31 30
be69e508 31 /** Log out this session **/
32 fputs($imapConnection, "1 logout");
33
f8f9bed9 34 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
036a8a9d 35 echo "<BR><BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
36 echo _("Return");
37 echo "</A>";
f8f9bed9 38 echo "</BODY></HTML>";
be69e508 39?>