Added use of $imapPort
[squirrelmail.git] / src / folders_rename_do.php
CommitLineData
be69e508 1<?
d068c0ec 2 if (!isset($config_php))
3 include("../config/config.php");
4 if (!isset($strings_php))
5 include("../functions/strings.php");
6 if (!isset($page_header_php))
7 include("../functions/page_header.php");
8 if (!isset($imap_php))
9 include("../functions/imap.php");
be69e508 10
d3cdb279 11 include("../src/load_prefs.php");
12
e1469126 13 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
813eba2f 14 $dm = sqimap_get_delimiter($imapConnection);
d92b6f31 15
16 if (strpos($orig, $dm))
17 $old_dir = substr($orig, 0, strrpos($orig, $dm));
18 else
19 $old_dir = "";
20
21 if ($old_dir != "")
22 $newone = "$old_dir$dm$new_name";
23 else
24 $newone = "$new_name";
25
d7092926 26 $orig = stripslashes($orig);
27 $newone = stripslashes($newone);
28
d92b6f31 29 fputs ($imapConnection, ". RENAME \"$orig\" \"$newone\"\n");
813eba2f 30 $data = sqimap_read_data($imapConnection, ".", true, $a, $b);
d92b6f31 31
f16d469a 32 // Renaming a folder doesn't renames the folder but leaves you unsubscribed
33 // at least on Cyrus IMAP servers.
693ccbc9 34 if ($isfolder) {
35 $newone = $newone.$dm;
36 $orig = $orig.$dm;
37 }
38
39 sqimap_unsubscribe($imapConnection, $orig);
40 sqimap_subscribe($imapConnection, $newone);
d92b6f31 41
be69e508 42 /** Log out this session **/
693ccbc9 43 sqimap_logout($imapConnection);
be69e508 44
f8f9bed9 45 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
d7092926 46 displayPageHeader($color, "None");
47 echo "<BR><BR><BR><CENTER><B>";
48 echo _("Folder Renamed!");
49 echo "</B><BR><BR>";
50 echo _("The folder has been successfully renamed.");
51 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
52 echo _("Click here");
53 echo "</A> ";
54 echo _("to continue.");
55 echo "</CENTER>";
56
57 echo "</BODY></HTML>";
be69e508 58?>