- ** left_main.php
- ** Copyright (c) 1999-2000 The SquirrelMail development team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** This is the code for the left bar. The left bar shows the folders
- ** available, and has cookie information.
- **
- ** $Id$
- **/
-
- include('../src/validate.php');
- include("../functions/array.php");
- include("../functions/imap.php");
- include("../functions/plugin.php");
-
- // open a connection on the imap port (143)
- $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
-
- displayHtmlHeader();
-
- if ($auto_create_special && ! isset($auto_create_done)) {
- if (isset ($sent_folder) && $sent_folder != "none") {
- if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
- sqimap_mailbox_create ($imapConnection, $sent_folder, "");
- } else {
- sqimap_subscribe($imapConnection, $sent_folder);
- }
- }
- if (isset ($trash_folder) && $trash_folder != "none") {
- if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
- sqimap_mailbox_create ($imapConnection, $trash_folder, "");
- } else {
- sqimap_subscribe($imapConnection, $trash_folder);
- }
- }
- $auto_create_done = true;
- session_register('auto_create_done');
- }
+ * left_main.php
+ * Copyright (c) 1999-2001 The Squirrelmail Development Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This is the code for the left bar. The left bar shows the folders
+ * available, and has cookie information.
+ *
+ * $Id$
+ */
+
+ require_once('../src/validate.php');
+ require_once('../functions/array.php');
+ require_once('../functions/imap.php');
+ require_once('../functions/plugin.php');
+
+ /* These constants are used for folder stuff. */
+ define('SM_BOX_UNCOLLAPSED', 0);
+ define('SM_BOX_COLLAPSED', 1);
+
+ // open a connection on the imap port (143)
+ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output
+
+ displayHtmlHeader();
+
+ /* If requested and not yet complete, attempt to autocreate folders. */
+ if ($auto_create_special && ! isset($auto_create_done)) {
+ /* Autocreate the sent folder, if needed. */
+ if (isset ($sent_folder) && $sent_folder != 'none') {
+ if (!sqimap_mailbox_exists ($imapConnection, $sent_folder)) {
+ sqimap_mailbox_create ($imapConnection, $sent_folder, '');
+ } else if (! sqimap_mailbox_is_subscribed($imapConnection, $sent_folder)) {
+ sqimap_subscribe($imapConnection, $sent_folder);
+ }
+ }
+
+ /* Autocreate the trash folder, if needed. */
+ if (isset ($trash_folder) && $trash_folder != 'none') {
+ if (!sqimap_mailbox_exists ($imapConnection, $trash_folder)) {
+ sqimap_mailbox_create ($imapConnection, $trash_folder, '');
+ } else if (! sqimap_mailbox_is_subscribed($imapConnection, $trash_folder)) {
+ sqimap_subscribe($imapConnection, $trash_folder);
+ }
+ }
+
+ /* Autocreate the drafts folder, if needed. */
+ if (isset ($draft_folder) && $draft_folder != 'none') {
+ if (!sqimap_mailbox_exists ($imapConnection, $draft_folder)) {
+ sqimap_mailbox_create ($imapConnection, $draft_folder, '');
+ } else if (! sqimap_mailbox_is_subscribed($imapConnection, $draft_folder)) {
+ sqimap_subscribe($imapConnection, $draft_folder);
+ }
+ }
+
+ /* Let the world know that autocreation is complete! Hurrah! */
+ $auto_create_done = true;
+ session_register('auto_create_done');
+ }