| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | ** folders_create.php |
| 5 | ** |
| 6 | ** Copyright (c) 1999-2001 The SquirrelMail development team |
| 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 | **/ |
| 14 | |
| 15 | require_once('../src/validate.php'); |
| 16 | require_once('../functions/imap.php'); |
| 17 | require_once('../functions/display_messages.php'); |
| 18 | |
| 19 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
| 20 | global $delimiter; |
| 21 | |
| 22 | if (strpos($folder_name, "\"") || strpos($folder_name, "\\") || |
| 23 | strpos($folder_name, "'") || strpos($folder_name, "$delimiter")) { |
| 24 | echo "<html><body bgcolor=$color[4]>"; |
| 25 | plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color); |
| 26 | sqimap_logout($imapConnection); |
| 27 | exit; |
| 28 | } |
| 29 | |
| 30 | if (isset($contain_subs) && $contain_subs == true) |
| 31 | $folder_name = "$folder_name$delimiter"; |
| 32 | |
| 33 | if ($folder_prefix && (substr($folder_prefix, -1) != $delimiter)) { |
| 34 | $folder_prefix = $folder_prefix . $delimiter; |
| 35 | } |
| 36 | if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){ |
| 37 | $subfolder_orig = $subfolder; |
| 38 | $subfolder = $folder_prefix . $subfolder; |
| 39 | } else { |
| 40 | $subfolder_orig = $subfolder; |
| 41 | } |
| 42 | |
| 43 | if (trim($subfolder_orig) == '') { |
| 44 | sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ""); |
| 45 | } else { |
| 46 | sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, ""); |
| 47 | } |
| 48 | |
| 49 | $location = get_location(); |
| 50 | header ("Location: $location/folders.php?success=create"); |
| 51 | sqimap_logout($imapConnection); |
| 52 | ?> |