/* SquirrelMail required files. */
require_once(SM_PATH . 'functions/imap_general.php');
require_once(SM_PATH . 'functions/date.php');
-require_once(SM_PATH . 'templates/util_global.php');
require_once(SM_PATH . 'templates/util_left_main.php');
/* These constants are used for folder stuff. */
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);
// 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".
/**
* 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 .= '<script src="'.$js_file.'" type="text/javascript"></script>' ."\n";
}
$mailboxes=sqimap_get_mailboxes($imapConnection,false,$show_only_subscribed_folders);
displayHtmlHeader( 'SquirrelMail', $xtra );
+$oErrorHandler->setDelayedErrors(true);
sqgetGlobalVar('auto_create_done',$auto_create_done,SQ_SESSION);
/* If requested and not yet complete, attempt to autocreate folders. */
$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 $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 {
* 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;
sqimap_logout($imapConnection);
$oTemplate->display('footer.tpl');
-?>
\ No newline at end of file