59177427 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * folders_create.php |
5 | * |
15e6162e |
6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
35586184 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * Creates folders on the IMAP server. |
10 | * Called from folders.php |
11 | * |
12 | * $Id$ |
13 | */ |
ef870322 |
14 | |
35586184 |
15 | /*****************************************************************/ |
16 | /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ |
17 | /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ |
18 | /*** + Base level indent should begin at left margin, as ***/ |
19 | /*** the require_once below looks. ***/ |
20 | /*** + All identation should consist of four space blocks ***/ |
21 | /*** + Tab characters are evil. ***/ |
22 | /*** + all comments should use "slash-star ... star-slash" ***/ |
23 | /*** style -- no pound characters, no slash-slash style ***/ |
24 | /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ |
25 | /*** ALWAYS USE { AND } CHARACTERS!!! ***/ |
26 | /*** + Please use ' instead of ", when possible. Note " ***/ |
27 | /*** should always be used in _( ) function calls. ***/ |
28 | /*** Thank you for your help making the SM code more readable. ***/ |
29 | /*****************************************************************/ |
30 | |
31 | require_once('../src/validate.php'); |
32 | require_once('../functions/imap.php'); |
33 | require_once('../functions/display_messages.php'); |
d3cdb279 |
34 | |
e1469126 |
35 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
525b7ae6 |
36 | global $delimiter; |
7ce342dc |
37 | |
ecf51658 |
38 | if (strpos($folder_name, "\"") || strpos($folder_name, "\\") || |
525b7ae6 |
39 | strpos($folder_name, "'") || strpos($folder_name, "$delimiter")) { |
9487c2ff |
40 | echo "<html><body bgcolor=$color[4]>"; |
9f2215a1 |
41 | 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 |
42 | sqimap_logout($imapConnection); |
7ce342dc |
43 | exit; |
44 | } |
45 | |
1863670d |
46 | if (isset($contain_subs) && $contain_subs == true) |
525b7ae6 |
47 | $folder_name = "$folder_name$delimiter"; |
7ce342dc |
48 | |
525b7ae6 |
49 | if ($folder_prefix && (substr($folder_prefix, -1) != $delimiter)) { |
50 | $folder_prefix = $folder_prefix . $delimiter; |
5479d709 |
51 | } |
52 | if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){ |
53 | $subfolder_orig = $subfolder; |
54 | $subfolder = $folder_prefix . $subfolder; |
9988d19e |
55 | } else { |
56 | $subfolder_orig = $subfolder; |
5479d709 |
57 | } |
58 | |
61457e01 |
59 | if (trim($subfolder_orig) == '') { |
5479d709 |
60 | sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ""); |
d92b6f31 |
61 | } else { |
525b7ae6 |
62 | sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, ""); |
d92b6f31 |
63 | } |
b40316f9 |
64 | |
1195c340 |
65 | $location = get_location(); |
66 | header ("Location: $location/folders.php?success=create"); |
67 | sqimap_logout($imapConnection); |
525b7ae6 |
68 | ?> |