From: stekkel Date: Thu, 28 Jul 2005 21:04:59 +0000 (+0000) Subject: Error handling and more templates X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=580e80b86afdb75e8321801744fdf101dd420fe6;hp=b80b7b6baf4df064de743044698fa7f003e68f20 Error handling and more templates git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9843 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/right_main.php b/src/right_main.php index 9d73276e..019a4879 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -29,10 +29,39 @@ require_once(SM_PATH . 'functions/mailbox_display.php'); 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); @@ -237,10 +266,6 @@ if ($sError) { $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/'; /* @@ -316,12 +341,6 @@ 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); @@ -368,7 +387,8 @@ if ($aMailbox['EXISTS'] > 0) { do_hook('right_main_bottom'); sqimap_logout ($imapConnection); -echo ''; +$oTemplate->display('footer.tpl'); + /* add the mailbox to the cache */ $mailbox_cache[$account.'_'.$aMailbox['NAME']] = $aMailbox;