X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fright_main.php;h=a2903eb4c02a7ca1180b7b85b4ca87b2809cfa36;hb=190dc452bedb05364a6f5842142b5e484995b1ca;hp=e7e5d7d02d7d9d3f6da693147ed6038607341b3e;hpb=bd466893162021274eda713b25e631738fe6226e;p=squirrelmail.git diff --git a/src/right_main.php b/src/right_main.php index e7e5d7d0..a2903eb4 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -3,73 +3,41 @@ /** * 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 © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ +//xdebug_start_profiling("/var/spool/xdebug/right_main.txt"); + + /** - * Path for SquirrelMail required files. - * @ignore + * Include the SquirrelMail initialization file. */ -define('SM_PATH','../'); +include('../include/init.php'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); -require_once(SM_PATH . 'functions/global.php'); -require_once(SM_PATH . 'functions/imap.php'); +require_once(SM_PATH . 'functions/imap_asearch.php'); +require_once(SM_PATH . 'functions/imap_general.php'); +require_once(SM_PATH . 'functions/imap_messages.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'); -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); 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); @@ -107,7 +75,7 @@ if ( sqgetGlobalVar('account', $account, SQ_GET) ) { /* Open an imap connection */ -$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); $mailbox = (isset($mailbox) && $mailbox) ? $mailbox : 'INBOX'; @@ -122,10 +90,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); @@ -282,7 +246,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'; } @@ -317,7 +281,8 @@ if (isset($mail_sent) && $mail_sent == 'yes') { $note = _("Your Message has been sent."); } if (isset($note)) { - echo html_tag( 'div', '' . htmlspecialchars($note) .'', 'center' ) . "
\n"; + $oTemplate->assign('note', htmlspecialchars($note)); + $oTemplate->display('note.tpl'); } if ( sqgetGlobalVar('just_logged_in', $just_logged_in, SQ_SESSION) ) { @@ -325,18 +290,10 @@ if ( sqgetGlobalVar('just_logged_in', $just_logged_in, SQ_SESSION) ) { $just_logged_in = false; sqsession_register($just_logged_in, 'just_logged_in'); - if (strlen(trim($motd)) > 0) { - echo html_tag( 'table', - html_tag( 'tr', - html_tag( 'td', - html_tag( 'table', - html_tag( 'tr', - html_tag( 'td', $motd, 'center' ) - ) , - '', $color[4], 'width="100%" cellpadding="5" cellspacing="1" border="0"' ) - ) - ) , - 'center', $color[9], 'width="70%" cellpadding="0" cellspacing="3" border="0"' ); + $motd = trim($motd); + if (strlen($motd) > 0) { + $oTemplate->assign('motd', $motd); + $oTemplate->display('motd.tpl'); } } } @@ -360,9 +317,7 @@ if ($aMailbox['EXISTS'] > 0) { $oTemplate->assign('compact_paginator', $compact_paginator); $oTemplate->assign('javascript_on', $javascript_on); $oTemplate->assign('enablesort', (isset($aProps['config']['enablesort'])) ? $aProps['config']['enablesort'] : false); - // Aaaaaahhhhhhh FIX ME DO NOT USE the string "none" for a var when you mean the boolean false or null - $oTemplate->assign('icon_theme', (isset($icon_theme) && $icon_theme !== 'none') ? $icon_theme : false); - $oTemplate->assign('use_icons', (isset($use_icons)) ? $use_icons : false); + $oTemplate->assign('icon_theme_path', $icon_theme_path); $oTemplate->assign('aOrder', array_keys($aColumns)); $oTemplate->assign('alt_index_colors', isset($alt_index_colors) ? $alt_index_colors: false); $oTemplate->assign('color', $color); @@ -371,18 +326,7 @@ if ($aMailbox['EXISTS'] > 0) { $oTemplate->display('message_list.tpl'); } else { - $string = '' . _("THIS FOLDER IS EMPTY") . ''; - echo ' '; - echo ' '; - echo '
'; - echo ' '; - echo ' '; - echo '

'; - echo ' '; - echo ' ' . html_tag( 'td', $string."\n", 'left') - . ''; - echo '
'; - echo '
'; + $oTemplate->display('empty_folder.tpl'); } do_hook('right_main_bottom'); @@ -393,4 +337,3 @@ $oTemplate->display('footer.tpl'); /* add the mailbox to the cache */ $mailbox_cache[$account.'_'.$aMailbox['NAME']] = $aMailbox; sqsession_register($mailbox_cache,'mailbox_cache'); -?>