<?php
+
/**
* right_main.php
*
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
* This is where the mailboxes are listed. This controls most of what
* goes on in SquirrelMail.
*
+ * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
*/
require_once(SM_PATH . 'functions/display_messages.php');
require_once(SM_PATH . 'functions/html.php');
require_once(SM_PATH . 'functions/plugin.php');
+include_once(SM_PATH . 'class/error.class.php');
+
//include_once(SM_PATH . 'templates/default/message_list.tpl');
include_once(SM_PATH . 'class/template/template.class.php');
+/**
+ * Which templatedir are we using. TODO, add make a config var of this and make it possible to switch templates
+ */
+$sTplDir = SM_PATH . 'templates/default/';
+
+/*
+ * Initialize the template object
+ */
+$oTemplate = new Template($sTplDir);
+
+/*
+ * Initialize our custom error handler object
+ */
+$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
+
+/*
+ * Activate custom error handling
+ */
+if (version_compare(PHP_VERSION, "4.3.0", ">=")) {
+ $oldErrorHandler = set_error_handler(array($oErrorHandler, 'SquirrelMailErrorhandler'));
+} else {
+ $oldErrorHandler = set_error_handler('SquirrelMailErrorhandler');
+}
+
+// Trigger Developers to look at CSS ;)
+// trigger_error("This layout sucks. Adapt squirrelmail.css!!!",E_USER_WARNING);
+//sqm_trigger_imap_error('SQM_IMAP_NO_THREAD',"BLA1",'BAD', 'BLA2', array('test1'=>'test1'));
/* lets get the global vars we may need */
sqgetGlobalVar('key', $key, SQ_COOKIE);
* preferences.
*/
-
-/* not sure if this hook should be capable to alter the global pref array */
-do_hook ('generic_header');
-
$aMailboxPrefSer=getPref($data_dir, $username,'pref_'.$account.'_'.$mailbox);
if ($aMailboxPrefSer) {
$aMailboxPref = unserialize($aMailboxPrefSer);
$note = $sError;
}
-/**
- * Which templatedir are we using. TODO, add make a config var of this and make it possible to switch templates
- */
-$sTplDir = SM_PATH . 'templates/default/';
/*
// write the session in order to make sure that the compose window has
// access to the composemessages array which is stored in the session
session_write_close();
- sqsession_is_active();
-
+ // restart the session. Do not use sqsession_is_active because the session_id
+ // isn't empty after a session_write_close
+ sqsession_start();
if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
$compose_width = '640';
}
// do not use &, it will break the query string and $session will not be detected!!!
$comp_uri = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
'&session='.$aMailbox['FORWARD_SESSION'];
- displayPageHeader($color, $mailbox, "comp_in_new('$comp_uri', $compose_width, $compose_height);", false);
+ displayPageHeader($color, $mailbox, "comp_in_new('$comp_uri', $compose_width, $compose_height);", '');
} else {
$mailbox_cache[$account.'_'.$aMailbox['NAME']] = $aMailbox;
sqsession_register($mailbox_cache,'mailbox_cache');
session_write_close();
// we have to redirect to the compose page
$location = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
- '&session='.$aMailbox['FORWARD_SESSION'];
+ '&session='.$aMailbox['FORWARD_SESSION'];
header("Location: $location");
exit;
}
} else {
displayPageHeader($color, $mailbox);
-// $compose_uri = $base_uri.'src/compose.php?newmessage=1';
}
do_hook('right_main_after_header');
$note = _("Your Message has been sent.");
}
if (isset($note)) {
- echo html_tag( 'div', '<b>' . $note .'</b>', 'center' ) . "<br />\n";
+ echo html_tag( 'div', '<b>' . htmlspecialchars($note) .'</b>', 'center' ) . "<br />\n";
}
if ( sqgetGlobalVar('just_logged_in', $just_logged_in, SQ_SESSION) ) {
}
}
-/**
- * In the future, move this the the initialisation area
- */
-
-
-$oTemplate = new Template($sTplDir);
if ($aMailbox['EXISTS'] > 0) {
- $aTemplateVars =& showMessagesForMailbox($imapConnection,$aMailbox,$aProps,$iError);
+ $aTemplateVars = showMessagesForMailbox($imapConnection,$aMailbox,$aProps,$iError);
if ($iError) {
}
$oTemplate->assign('alt_index_colors', isset($alt_index_colors) ? $alt_index_colors: false);
$oTemplate->assign('color', $color);
$oTemplate->assign('align', $align);
- $oTemplate->assign('showall', $showall);
$oTemplate->display('message_list.tpl');
do_hook('right_main_bottom');
sqimap_logout ($imapConnection);
-echo '</body></html>';
+$oTemplate->display('footer.tpl');
+
/* add the mailbox to the cache */
$mailbox_cache[$account.'_'.$aMailbox['NAME']] = $aMailbox;
sqsession_register($mailbox_cache,'mailbox_cache');
-
-?>
+?>
\ No newline at end of file