X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fleft_main.php;h=de0055379db18f7c5391a2eb0c3de9f427680cc1;hp=13eb9055d4900f5a5b2b063e9708e6392947786e;hb=783e926eb2c99b6a55bdf774b64afa7828e5732b;hpb=6373ad1237c82a561fec8264457e3a3a845f7e87
diff --git a/src/left_main.php b/src/left_main.php
index 13eb9055..de005537 100644
--- a/src/left_main.php
+++ b/src/left_main.php
@@ -6,39 +6,31 @@
* This is the code for the left bar. The left bar shows the folders
* available, and has cookie information.
*
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright © 1999-2007 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
*/
+/** This is the left_main page */
+define('PAGE_NAME', 'left_main');
+
/**
- * Path for SquirrelMail required files.
- * @ignore
+ * Include the SquirrelMail initialization file.
*/
-define('SM_PATH','../');
+require('../include/init.php');
/* SquirrelMail required files. */
-include_once(SM_PATH . 'include/validate.php');
-require_once(SM_PATH . 'functions/imap.php');
-require_once(SM_PATH . 'functions/plugin.php');
-require_once(SM_PATH . 'functions/page_header.php');
-require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/imap_general.php');
require_once(SM_PATH . 'functions/date.php');
-
-/** add required includes */
-include_once(SM_PATH . 'templates/util_global.php');
-include_once(SM_PATH . 'templates/util_left_main.php');
+require_once(SM_PATH . 'functions/template/folder_list_util.php');
/* These constants are used for folder stuff. */
define('SM_BOX_UNCOLLAPSED', 0);
define('SM_BOX_COLLAPSED', 1);
/* get globals */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('fold', $fold, SQ_GET);
sqgetGlobalVar('unfold', $unfold, SQ_GET);
@@ -46,7 +38,7 @@ sqgetGlobalVar('unfold', $unfold, SQ_GET);
// open a connection on the imap port (143)
// why hide the output?
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, true);
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, true);
/**
* Using stristr since very old preferences may contain "None" and "none".
@@ -63,15 +55,16 @@ if (!empty($left_refresh) &&
/**
* Include extra javascript files needed by template
*/
-$js_includes = $oTemplate->getJavascriptIncludes();
+$js_includes = $oTemplate->get_javascript_includes(TRUE);
foreach ($js_includes as $js_file) {
$xtra .= '' ."\n";
}
-
+
// get mailbox list and cache it
$mailboxes=sqimap_get_mailboxes($imapConnection,false,$show_only_subscribed_folders);
-displayHtmlHeader( 'SquirrelMail', $xtra );
+displayHtmlHeader( $org_title, $xtra );
+$oErrorHandler->setDelayedErrors(true);
sqgetGlobalVar('auto_create_done',$auto_create_done,SQ_SESSION);
/* If requested and not yet complete, attempt to autocreate folders. */
@@ -79,9 +72,19 @@ if ($auto_create_special && !isset($auto_create_done)) {
$autocreate = array($sent_folder, $trash_folder, $draft_folder);
$folders_created = false;
foreach( $autocreate as $folder ) {
- if (($folder != '') && ($folder != 'none')) {
- // use $mailboxes array for checking if mailbox exists
- if ( !sqimap_mailbox_exists($imapConnection, $folder, $mailboxes)) {
+ if ($folder != '') {
+ /**
+ * If $show_only_subscribed_folders is true, don't use
+ * $mailboxes array for checking if mailbox exists.
+ * Mailbox list contains only subscribed folders.
+ * sqimap_mailbox_create() will fail, if folder exists.
+ */
+ if ($show_only_subscribed_folders) {
+ $mailbox_cache = false;
+ } else {
+ $mailbox_cache = $mailboxes;
+ }
+ if ( !sqimap_mailbox_exists($imapConnection, $folder, $mailbox_cache)) {
sqimap_mailbox_create($imapConnection, $folder, '');
$folders_created = true;
} else {
@@ -141,6 +144,7 @@ if ($date_format != 6) {
}
$clk = str_replace(' ',' ',$clk);
+//FIXME don't build HTML here - do it in template
$clock = ''
. str_replace(' ', ' ', _("Last Refresh"))
. ":
$clk
\n";
@@ -190,9 +194,8 @@ $oTemplate->assign('mailboxes', $mailbox_structure);
* globals, which are dirty, filthy things in templates. :)
*/
$settings = array();
-$settings['imapConnection'] = $imapConnection;
-$settings['iconThemePath'] = $icon_theme_path;
-$settings['templateDirectory'] = $sTplDir;
+#$settings['imapConnection'] = $imapConnection;
+$settings['templateID'] = $sTemplateID;
$settings['unreadNotificationEnabled'] = $unseen_notify!=1;
$settings['unreadNotificationAllFolders'] = $unseen_notify == 3;
$settings['unreadNotificationDisplayTotal'] = $unseen_type == 2;
@@ -206,4 +209,3 @@ $oTemplate->display('left_main.tpl');
sqimap_logout($imapConnection);
$oTemplate->display('footer.tpl');
-?>
\ No newline at end of file