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 | |
86725763 |
15 | /* Path for SquirrelMail required files. */ |
16 | define('SM_PATH','../'); |
17 | |
18 | /* SquirrelMail required files. */ |
08185f2a |
19 | require_once(SM_PATH . 'include/validate.php'); |
86725763 |
20 | require_once(SM_PATH . 'functions/imap.php'); |
21 | require_once(SM_PATH . 'functions/display_messages.php'); |
d3cdb279 |
22 | |
1c52ba77 |
23 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
24 | global $delimiter; |
25 | |
c6ee68f5 |
26 | $folder_name = trim($folder_name); |
27 | |
1c52ba77 |
28 | if (strpos($folder_name, "\"") || strpos($folder_name, "\\") || |
0037f048 |
29 | strpos($folder_name, "'") || strpos($folder_name, "$delimiter") || |
30 | ($folder_name == '')) { |
31 | displayPageHeader($color, 'None'); |
1c52ba77 |
32 | echo "<html><body bgcolor=$color[4]>"; |
33 | plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color); |
34 | sqimap_logout($imapConnection); |
35 | exit; |
36 | } |
37 | |
38 | if (isset($contain_subs) && $contain_subs ) { |
39 | $folder_name = "$folder_name$delimiter"; |
40 | } |
41 | |
42 | if ($folder_prefix && (substr($folder_prefix, -1) != $delimiter)) { |
43 | $folder_prefix = $folder_prefix . $delimiter; |
44 | } |
45 | if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){ |
46 | $subfolder_orig = $subfolder; |
47 | $subfolder = $folder_prefix . $subfolder; |
48 | } else { |
49 | $subfolder_orig = $subfolder; |
50 | } |
51 | |
52 | if (trim($subfolder_orig) == '') { |
53 | sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ''); |
54 | } else { |
55 | sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, ''); |
56 | } |
57 | |
58 | $location = get_location(); |
59 | header ("Location: $location/folders.php?success=create"); |
60 | sqimap_logout($imapConnection); |
525b7ae6 |
61 | ?> |