Many more warnings removed.
[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
245a6892 10 **
11 ** $Id$
ef870322 12 **/
13
2a32fc83 14 session_start();
15
d068c0ec 16 if (!isset($strings_php))
17 include("../functions/strings.php");
1863670d 18 if (!isset($config_php))
19 include("../config/config.php");
d068c0ec 20 if (!isset($page_header_php))
21 include("../functions/page_header.php");
22 if (!isset($imap_php))
23 include("../functions/imap.php");
24 if (!isset($display_messages_php))
25 include("../functions/display_messages.php");
b40316f9 26
d3cdb279 27 include("../src/load_prefs.php");
28
e1469126 29 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
813eba2f 30 $dm = sqimap_get_delimiter($imapConnection);
7ce342dc 31
ecf51658 32 if (strpos($folder_name, "\"") || strpos($folder_name, "\\") ||
7ce342dc 33 strpos($folder_name, "'") || strpos($folder_name, "$dm")) {
66289791 34 print "<html><body bgcolor=$color[4]>";
9f2215a1 35 plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
eabc2883 36 sqimap_logout($imapConnection);
7ce342dc 37 exit;
38 }
39
1863670d 40 if (isset($contain_subs) && $contain_subs == true)
7ce342dc 41 $folder_name = "$folder_name$dm";
42
5479d709 43 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
44 $folder_prefix = $folder_prefix . $dm;
45 }
46 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
47 $subfolder_orig = $subfolder;
48 $subfolder = $folder_prefix . $subfolder;
9988d19e 49 } else {
50 $subfolder_orig = $subfolder;
5479d709 51 }
52
7aaa81fc 53 if ((trim($subfolder_orig) == "[ None ]") || (trim(sqStripSlashes($subfolder_orig)) == "[ None ]")) {
5479d709 54 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
d92b6f31 55 } else {
813eba2f 56 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
d92b6f31 57 }
b40316f9 58 fputs($imapConnection, "1 logout\n");
59
1195c340 60 $location = get_location();
61 header ("Location: $location/folders.php?success=create");
62 sqimap_logout($imapConnection);
b40316f9 63?>
b40316f9 64