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