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 require_once('../src/validate.php');
15 require_once('../functions/imap.php');
16 require_once('../functions/display_messages.php');
18 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
19 $dm = sqimap_get_delimiter($imapConnection);
21 if (strpos($folder_name, "\"") ||
strpos($folder_name, "\\") ||
22 strpos($folder_name, "'") ||
strpos($folder_name, "$dm")) {
23 print "<html><body bgcolor=$color[4]>";
24 plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
25 sqimap_logout($imapConnection);
29 if (isset($contain_subs) && $contain_subs == true)
30 $folder_name = "$folder_name$dm";
32 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
33 $folder_prefix = $folder_prefix . $dm;
35 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
36 $subfolder_orig = $subfolder;
37 $subfolder = $folder_prefix . $subfolder;
39 $subfolder_orig = $subfolder;
42 if (trim($subfolder_orig) == '') {
43 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
45 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
48 $location = get_location();
49 header ("Location: $location/folders.php?success=create");
50 sqimap_logout($imapConnection);