<?php
/**
* right_main.php
*
* This is where the mailboxes are listed. This controls most of what
* goes on in SquirrelMail.
*
* @copyright 1999-2020 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: right_main.php 14840 2020年01月07日 07:42:38Z pdontthink $
* @package squirrelmail
*/
/** This is the right_main page */
define ('PAGE_NAME', 'right_main');
/**
* Path for SquirrelMail required files.
* @ignore
*/
/* SquirrelMail required files. */
require_once(SM_PATH . 'include/validate.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');
/***********************************************************
* incoming variables from URL: *
* $sort Direction to sort by date *
* values: 0 - descending order *
* values: 1 - ascending order *
* $startMessage Message to start at *
* $mailbox Full Mailbox name *
* *
* incoming from cookie: *
* $key pass *
* incoming from session: *
* $username duh *
* *
***********************************************************/
// Disable Browser Caching //
header ('Cache-Control: no-cache, no-store, must-revalidate');
header ('Expires: Sat, 1 Jan 2000 00:00:00 GMT');
/* lets get the global vars we may need */
$startMessage = (int) $temp;
}
$PG_SHOWNUM = (int) $temp;
}
$PG_SHOWALL = (int) $temp;
}
$newsort = (int) $temp;
}
$preselected = array();
} else {
}
$checkall = (int) $temp;
}
$set_thread = (int) $temp;
}
$composenew = false;
}
/* end of get globals */
/* Open a connection on the imap port (143) */
global $imap_stream_options; // in case not defined in config
$imapConnection =
sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
if (isset($PG_SHOWALL)) {
if ($PG_SHOWALL) {
$PG_SHOWNUM=999999;
$show_num=$PG_SHOWNUM;
}
else {
unset($PG_SHOWNUM);
}
}
else if( isset( $PG_SHOWNUM ) ) {
$show_num = $PG_SHOWNUM;
}
if (!isset($show_num) || empty($show_num) || ($show_num == 0)) {
setPref ($data_dir, $username, 'show_num' , 15);
$show_num = 15;
}
if (isset($newsort) && $newsort != $sort) {
setPref ($data_dir, $username, 'sort', $newsort);
}
/* If the page has been loaded without a specific mailbox, */
/* send them to the inbox */
if (!isset($mailbox)) {
$mailbox = 'INBOX';
$startMessage = 1;
}
if (!isset($startMessage) || ($startMessage == '')) {
$startMessage = 1;
}
/* decide if we are thread sorting or not */
if (!empty($allow_thread_sort) && ($allow_thread_sort == TRUE)) {
if (isset($set_thread)) {
if ($set_thread == 1) {
setPref ($data_dir, $username, "thread_$mailbox", 1);
$thread_sort_messages = '1';
}
elseif ($set_thread == 2) {
setPref ($data_dir, $username, "thread_$mailbox", 0);
$thread_sort_messages = '0';
}
}
else {
$thread_sort_messages =
getPref ($data_dir, $username, "thread_$mailbox");
}
}
else {
$thread_sort_messages = 0;
}
// the preg_match() is a fix for Dovecot wherein UIDs can be bigger than
// normal integers - this isn't in 1.4 yet, but when adding new code, why not...
&&
preg_match ('/^[0-9]+$/', $unread_passed_id)) {
}
if ($composenew) {
} else {
}
do_hook ('right_main_after_header');
if (isset($note)) {
}
if ($just_logged_in == true) {
$just_logged_in = false;
) ,
'', $color[4], 'width="100%" cellpadding="5" cellspacing="1" border="0"' )
)
) ,
'center', $color[9], 'width="70%" cellpadding="0" cellspacing="3" border="0"' );
}
}
}
if (isset($newsort)) {
$sort = $newsort;
}
/*********************************************************************
* Check to see if we can use cache or not. Currently the only time *
* when you will not use it is when a link on the left hand frame is *
* used. Also check to make sure we actually have the array in the *
* registered session data. :) *
*********************************************************************/
if (! isset($use_mailbox_cache)) {
$use_mailbox_cache = 0;
}
showMessagesForMailbox ($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color, $show_num, $use_mailbox_cache);
} else {
unset($msgs);
}
unset($msort);
}
unset($numMessages);
}
// set 8th argument to false in order to make sure that cache is not used.
$startMessage, $sort, $color, $show_num,
false);
}
}
}
echo '</body></html>';