updated changelog, fixed a few minor bugs
[squirrelmail.git] / src / folders_create.php
CommitLineData
59177427 1<?php
ef870322 2 /**
3 ** folders_create.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 ** Creates folders on the IMAP server.
9 ** Called from folders.php
10 **/
11
2a32fc83 12 session_start();
13
d068c0ec 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");
22 if (!isset($display_messages_php))
23 include("../functions/display_messages.php");
b40316f9 24
d3cdb279 25 include("../src/load_prefs.php");
26
e1469126 27 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
813eba2f 28 $dm = sqimap_get_delimiter($imapConnection);
7ce342dc 29
ecf51658 30 if (strpos($folder_name, "\"") || strpos($folder_name, "\\") ||
7ce342dc 31 strpos($folder_name, "'") || strpos($folder_name, "$dm")) {
9f2215a1 32 plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
7ce342dc 33 exit;
34 }
35
36 if ($contain_subs == true)
37 $folder_name = "$folder_name$dm";
38
5479d709 39 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
40 $folder_prefix = $folder_prefix . $dm;
41 }
42 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
43 $subfolder_orig = $subfolder;
44 $subfolder = $folder_prefix . $subfolder;
9988d19e 45 } else {
46 $subfolder_orig = $subfolder;
5479d709 47 }
48
ecf51658 49 if ((trim($subfolder_orig) == "[ None ]") || (trim(stripslashes($subfolder_orig)) == "[ None ]")) {
5479d709 50 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
d92b6f31 51 } else {
813eba2f 52 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
d92b6f31 53 }
b40316f9 54 fputs($imapConnection, "1 logout\n");
55
813eba2f 56// if ($auto_forward == true) {
57// header ("Location: webmail.php?right_frame=folders.php");
58// } else {
813eba2f 59 displayPageHeader($color, "None");
813eba2f 60 echo "<BR><BR><BR><CENTER><B>";
61 echo _("Folder Created!");
62 echo "</B><BR><BR>";
63 echo _("The folder has been successfully created.");
9f2215a1 64 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
813eba2f 65 echo _("Click here");
66 echo "</A> ";
67 echo _("to continue.");
aae41ae9 68 echo "</CENTER>";
813eba2f 69 echo "</BODY></HTML>";
70// }
b40316f9 71?>
b40316f9 72