Operation "foo_once".
[squirrelmail.git] / src / folders_create.php
CommitLineData
59177427 1<?php
ef870322 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
245a6892 10 **
11 ** $Id$
ef870322 12 **/
13
f740c049 14 include('../src/validate.php');
f740c049 15 include("../functions/imap.php");
16 include("../functions/display_messages.php");
d3cdb279 17
e1469126 18 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
813eba2f 19 $dm = sqimap_get_delimiter($imapConnection);
7ce342dc 20
ecf51658 21 if (strpos($folder_name, "\"") || strpos($folder_name, "\\") ||
7ce342dc 22 strpos($folder_name, "'") || strpos($folder_name, "$dm")) {
66289791 23 print "<html><body bgcolor=$color[4]>";
9f2215a1 24 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 25 sqimap_logout($imapConnection);
7ce342dc 26 exit;
27 }
28
1863670d 29 if (isset($contain_subs) && $contain_subs == true)
7ce342dc 30 $folder_name = "$folder_name$dm";
31
5479d709 32 if ($folder_prefix && (substr($folder_prefix, -1) != $dm)) {
33 $folder_prefix = $folder_prefix . $dm;
34 }
35 if ($folder_prefix && (substr($subfolder, 0, strlen($folder_prefix)) != $folder_prefix)){
36 $subfolder_orig = $subfolder;
37 $subfolder = $folder_prefix . $subfolder;
9988d19e 38 } else {
39 $subfolder_orig = $subfolder;
5479d709 40 }
41
61457e01 42 if (trim($subfolder_orig) == '') {
5479d709 43 sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, "");
d92b6f31 44 } else {
813eba2f 45 sqimap_mailbox_create ($imapConnection, $subfolder.$dm.$folder_name, "");
d92b6f31 46 }
b40316f9 47
1195c340 48 $location = get_location();
49 header ("Location: $location/folders.php?success=create");
50 sqimap_logout($imapConnection);
b40316f9 51?>
b40316f9 52