X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Ffolders_create.php;h=c0b4de483411228e68e160e29a60b9f541e3f72a;hb=c4db9729040739972896dad259bb2c0619050d05;hp=5e927b12e740d86bef23c38581bbbba8eb312973;hpb=4c75ba81a6d0837bd36b711f22d59b842d9cdc0e;p=squirrelmail.git diff --git a/src/folders_create.php b/src/folders_create.php index 5e927b12..c0b4de48 100644 --- a/src/folders_create.php +++ b/src/folders_create.php @@ -1,64 +1,53 @@ "; - plain_error_message(_("Illegal folder name. Please select a different name.")."
"._("Click here to go back").".", $color); - sqimap_logout($imapConnection); - exit; - } - - if (isset($contain_subs) && $contain_subs == true) - $folder_name = "$folder_name$dm"; - - if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) { - $folder_prefix = $folder_prefix . $dm; - } - if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){ - $subfolder_orig = $subfolder; - $subfolder = $folder_prefix . $subfolder; - } else { - $subfolder_orig = $subfolder; - } - - if ((trim($subfolder_orig) == "[ None ]") || (trim($subfolder_orig) == "")) { - sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ""); - } else { - sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, ""); - } - fputs($imapConnection, "1 logout\n"); - - $location = get_location(); - header ("Location: $location/folders.php?success=create"); - sqimap_logout($imapConnection); +/** + * folders_create.php + * + * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Creates folders on the IMAP server. + * Called from folders.php + * + * $Id$ + */ + +require_once('../src/validate.php'); +require_once('../functions/imap.php'); +require_once('../functions/display_messages.php'); + +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +global $delimiter; + +if (strpos($folder_name, "\"") || strpos($folder_name, "\\") || + strpos($folder_name, "'") || strpos($folder_name, "$delimiter")) { + echo ""; + plain_error_message(_("Illegal folder name. Please select a different name.")."
"._("Click here to go back").".", $color); + sqimap_logout($imapConnection); + exit; +} + +if (isset($contain_subs) && $contain_subs ) { + $folder_name = "$folder_name$delimiter"; +} + +if ($folder_prefix && (substr($folder_prefix, -1) != $delimiter)) { + $folder_prefix = $folder_prefix . $delimiter; +} +if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){ + $subfolder_orig = $subfolder; + $subfolder = $folder_prefix . $subfolder; +} else { + $subfolder_orig = $subfolder; +} + +if (trim($subfolder_orig) == '') { + sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, ''); +} else { + sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, ''); +} + +$location = get_location(); +header ("Location: $location/folders.php?success=create"); +sqimap_logout($imapConnection); ?> -