Fix for #1093360.
[squirrelmail.git] / src / right_main.php
index b87d4b05fa52a46cd884ad0dedcc0df1707be7a0..ccbaf6d4632fb9c18e873d5ea9c641431263ddf6 100644 (file)
@@ -1,13 +1,13 @@
 <?php
+
 /**
  * right_main.php
  *
- * Copyright (c) 1999-2005 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 &copy; 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
-require_once(SM_PATH . 'include/validate.php');
-require_once(SM_PATH . 'functions/global.php');
+include_once(SM_PATH . 'include/validate.php');
+//include_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/date.php');
 require_once(SM_PATH . 'functions/mime.php');
 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');
+//require_once(SM_PATH . 'functions/plugin.php');
 
-//include_once(SM_PATH . 'templates/default/message_list.tpl');
-include_once(SM_PATH . 'class/template/template.class.php');
 
+// 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);
@@ -39,7 +40,11 @@ sqgetGlobalVar('username',  $username,      SQ_SESSION);
 sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
 sqgetGlobalVar('delimiter', $delimiter,     SQ_SESSION);
 sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
-
+sqgetGlobalVar('delayed_errors',  $delayed_errors,  SQ_SESSION);
+if (is_array($delayed_errors)) {
+    $oErrorHandler->AssignDelayedErrors($delayed_errors);
+    sqsession_unregister("delayed_errors");
+}
 sqgetGlobalVar('mailbox',   $mailbox);
 sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
 sqgetGlobalVar('targetMailbox', $lastTargetMailbox, SQ_POST);
@@ -92,10 +97,6 @@ if ($imap_server_type == 'uw' && (strstr($mailbox, '../') ||
  * 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);
@@ -236,10 +237,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/';
 
 
 /*
@@ -256,7 +253,7 @@ if (isset($aMailbox['FORWARD_SESSION'])) {
         session_write_close();
         // restart the session. Do not use sqsession_is_active because the session_id
         // isn't empty after a session_write_close
-        session_start();
+        sqsession_start();
         if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
             $compose_width = '640';
         }
@@ -276,7 +273,7 @@ if (isset($aMailbox['FORWARD_SESSION'])) {
         session_write_close();
         // we have to redirect to the compose page
         $location = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
-                    '&amp;session='.$aMailbox['FORWARD_SESSION'];
+                    '&session='.$aMailbox['FORWARD_SESSION'];
         header("Location: $location");
         exit;
     }
@@ -291,7 +288,7 @@ if (isset($mail_sent) && $mail_sent == 'yes') {
     $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) ) {
@@ -315,15 +312,9 @@ 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) {
 
     }
@@ -347,7 +338,6 @@ if ($aMailbox['EXISTS'] > 0) {
     $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');
 
@@ -368,10 +358,10 @@ if ($aMailbox['EXISTS'] > 0) {
 
 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