5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** Creates folders on the IMAP server.
9 ** Called from folders.php
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");
25 include("../src/load_prefs.php");
27 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
28 $dm = sqimap_get_delimiter($imapConnection);
30 if (strpos($folder_name, "\"") ||
strpos($folder_name, "\\") ||
31 strpos($folder_name, "'") ||
strpos($folder_name, "$dm")) {
32 print "<html><body bgcolor=$color[4]>";
33 plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
34 sqimap_logout($imapConnection);
38 if ($contain_subs == true)
39 $folder_name = "$folder_name$dm";
41 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
42 $folder_prefix = $folder_prefix . $dm;
44 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
45 $subfolder_orig = $subfolder;
46 $subfolder = $folder_prefix . $subfolder;
48 $subfolder_orig = $subfolder;
51 if ((trim($subfolder_orig) == "[ None ]") ||
(trim(sqStripSlashes($subfolder_orig)) == "[ None ]")) {
52 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
54 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
56 fputs($imapConnection, "1 logout\n");
58 $location = get_location();
59 header ("Location: $location/folders.php?success=create");
60 sqimap_logout($imapConnection);
62 displayPageHeader($color, "None");
63 echo "<BR><BR><BR><CENTER><B>";
64 echo _("Folder Created!");
66 echo _("The folder has been successfully created.");
67 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
70 echo _("to continue.");
72 echo "</BODY></HTML>";