if any of the standard headers are blank, read_body.php doesn't show
[squirrelmail.git] / src / folders_create.php
1 <?php
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
12 session_start();
13
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");
24
25 include("../src/load_prefs.php");
26
27 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
28 $dm = sqimap_get_delimiter($imapConnection);
29
30 if (strpos($folder_name, "\"") || strpos($folder_name, "\\") ||
31 strpos($folder_name, "'") || strpos($folder_name, "$dm")) {
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);
33 sqimap_logout($imapConnection);
34 exit;
35 }
36
37 if ($contain_subs == true)
38 $folder_name = "$folder_name$dm";
39
40 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
41 $folder_prefix = $folder_prefix . $dm;
42 }
43 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
44 $subfolder_orig = $subfolder;
45 $subfolder = $folder_prefix . $subfolder;
46 } else {
47 $subfolder_orig = $subfolder;
48 }
49
50 if ((trim($subfolder_orig) == "[ None ]") || (trim(sqStripSlashes($subfolder_orig)) == "[ None ]")) {
51 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
52 } else {
53 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
54 }
55 fputs($imapConnection, "1 logout\n");
56
57 $location = get_location();
58 header ("Location: $location/folders.php?success=create");
59 sqimap_logout($imapConnection);
60 /*
61 displayPageHeader($color, "None");
62 echo "<BR><BR><BR><CENTER><B>";
63 echo _("Folder Created!");
64 echo "</B><BR><BR>";
65 echo _("The folder has been successfully created.");
66 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
67 echo _("Click here");
68 echo "</A> ";
69 echo _("to continue.");
70 echo "</CENTER>";
71 echo "</BODY></HTML>";
72 */
73 ?>
74