* Forgot to mention that "Download this as a file" now sets showHeaders
[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 ** $Id$
12 **/
13
14 include('../src/validate.php');
15 include("../functions/strings.php");
16 include("../config/config.php");
17 include("../functions/page_header.php");
18 include("../functions/imap.php");
19 include("../functions/display_messages.php");
20 include("../src/load_prefs.php");
21
22 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
23 $dm = sqimap_get_delimiter($imapConnection);
24
25 if (strpos($folder_name, "\"") || strpos($folder_name, "\\") ||
26 strpos($folder_name, "'") || strpos($folder_name, "$dm")) {
27 print "<html><body bgcolor=$color[4]>";
28 plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
29 sqimap_logout($imapConnection);
30 exit;
31 }
32
33 if (isset($contain_subs) && $contain_subs == true)
34 $folder_name = "$folder_name$dm";
35
36 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
37 $folder_prefix = $folder_prefix . $dm;
38 }
39 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
40 $subfolder_orig = $subfolder;
41 $subfolder = $folder_prefix . $subfolder;
42 } else {
43 $subfolder_orig = $subfolder;
44 }
45
46 if (trim($subfolder_orig) == '') {
47 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
48 } else {
49 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
50 }
51
52 $location = get_location();
53 header ("Location: $location/folders.php?success=create");
54 sqimap_logout($imapConnection);
55 ?>
56