* Header rearranged

* Toggle all fixed for Konq
* Page selector now allows more customization
* Added default paramenter to get pref
This commit is contained in:
philippe_mingo 2001-10-27 15:34:19 +00:00
parent 8c8c7b1e7d
commit c5eea2115b
5 changed files with 164 additions and 143 deletions

View file

@ -11,8 +11,8 @@
return; return;
define ('imap_general_php', true); define ('imap_general_php', true);
global $imap_general_debug; global $imap_general_debug;
$imap_general_debug = false; $imap_general_debug = false;
/****************************************************************************** /******************************************************************************
** Sets an unique session id in order to avoid simultanous sessions crash. ** Sets an unique session id in order to avoid simultanous sessions crash.
@ -30,10 +30,11 @@
******************************************************************************/ ******************************************************************************/
function sqimap_read_data_list ($imap_stream, $pre, $handle_errors, function sqimap_read_data_list ($imap_stream, $pre, $handle_errors,
&$response, &$message) { &$response, &$message) {
global $color, $squirrelmail_language, $imap_general_debug; global $color, $squirrelmail_language;
global $imap_general_debug;
$read = ""; $read = '';
$resultlist = array(); $resultlist = array();
$more_msgs = true; $more_msgs = true;
@ -48,11 +49,11 @@
$size = $regs[1]; $size = $regs[1];
} else if (ereg("^\\* [0-9]+ FETCH", $read, $regs)) { } else if (ereg("^\\* [0-9]+ FETCH", $read, $regs)) {
// Sizeless response, probably single-line // Sizeless response, probably single-line
// For debugging purposes // For debugging purposes
if ($imap_general_debug) { if ($imap_general_debug) {
echo "<small><tt><font color=\"#CC0000\">$read</font></tt></small><br>\n"; echo "<small><tt><font color=\"#CC0000\">$read</font></tt></small><br>\n";
flush(); flush();
} }
$size = 0; $size = 0;
$data[] = $read; $data[] = $read;
$read = fgets($imap_stream, 9096); $read = fgets($imap_stream, 9096);
@ -63,11 +64,11 @@
while (strpos($read, "\n") === false) { while (strpos($read, "\n") === false) {
$read .= fgets($imap_stream, 9096); $read .= fgets($imap_stream, 9096);
} }
// For debugging purposes // For debugging purposes
if ($imap_general_debug) { if ($imap_general_debug) {
echo "<small><tt><font color=\"#CC0000\">$read</font></tt></small><br>\n"; echo "<small><tt><font color=\"#CC0000\">$read</font></tt></small><br>\n";
flush(); flush();
} }
// If we know the size, no need to look at the end parameters // If we know the size, no need to look at the end parameters
if ($size > 0) { if ($size > 0) {
if ($total_size == $size) { if ($total_size == $size) {
@ -83,9 +84,9 @@
} else { } else {
$data[] = $read; $data[] = $read;
$read = fgets($imap_stream, 9096); $read = fgets($imap_stream, 9096);
while (strpos($read, "\n") === false) { while (strpos($read, "\n") === false) {
$read .= fgets($imap_stream, 9096); $read .= fgets($imap_stream, 9096);
} }
} }
$total_size += strlen($read); $total_size += strlen($read);
} else { } else {
@ -108,7 +109,7 @@
$response = $regs[1]; $response = $regs[1];
$message = trim($regs[2]); $message = trim($regs[2]);
if ($imap_general_debug) echo '--<br>'; if ($imap_general_debug) echo '--<br>';
if ($handle_errors == false) if ($handle_errors == false)
return $resultlist; return $resultlist;
@ -137,10 +138,10 @@
} }
function sqimap_read_data ($imap_stream, $pre, $handle_errors, &$response, &$message) { function sqimap_read_data ($imap_stream, $pre, $handle_errors, &$response, &$message) {
$res = sqimap_read_data_list($imap_stream, $pre, $handle_errors, $response, $message); $res = sqimap_read_data_list($imap_stream, $pre, $handle_errors, $response, $message);
return $res[0]; return $res[0];
} }
/****************************************************************************** /******************************************************************************
** Logs the user into the imap server. If $hide is set, no error messages ** Logs the user into the imap server. If $hide is set, no error messages
** will be displayed. This function returns the imap connection handle. ** will be displayed. This function returns the imap connection handle.
@ -151,7 +152,7 @@
$imap_stream = fsockopen ($imap_server_address, $imap_port, $imap_stream = fsockopen ($imap_server_address, $imap_port,
$error_number, $error_string, 15); $error_number, $error_string, 15);
$server_info = fgets ($imap_stream, 1024); $server_info = fgets ($imap_stream, 1024);
// Decrypt the password // Decrypt the password
$password = OneTimePadDecrypt($password, $onetimepad); $password = OneTimePadDecrypt($password, $onetimepad);
@ -165,7 +166,7 @@
exit; exit;
} }
fputs ($imap_stream, sqimap_session_id() . ' LOGIN "' . quoteIMAP($username) . fputs ($imap_stream, sqimap_session_id() . ' LOGIN "' . quoteIMAP($username) .
'" "' . quoteIMAP($password) . "\"\r\n"); '" "' . quoteIMAP($password) . "\"\r\n");
$read = sqimap_read_data ($imap_stream, sqimap_session_id(), false, $response, $message); $read = sqimap_read_data ($imap_stream, sqimap_session_id(), false, $response, $message);
@ -181,12 +182,12 @@
printf (_("Unknown error: %s") . "<br>\n", $message); printf (_("Unknown error: %s") . "<br>\n", $message);
echo '<br>'; echo '<br>';
echo _("Read data:") . "<br>\n"; echo _("Read data:") . "<br>\n";
if (is_array($read)) if (is_array($read))
{ {
foreach ($read as $line) foreach ($read as $line)
{ {
echo htmlspecialchars($line) . "<br>\n"; echo htmlspecialchars($line) . "<br>\n";
} }
} }
exit; exit;
} else { } else {
@ -198,9 +199,9 @@
// $squirrelmail_language is set by a cookie when // $squirrelmail_language is set by a cookie when
// the user selects language and logs out // the user selects language and logs out
set_up_language($squirrelmail_language, true); set_up_language($squirrelmail_language, true);
?> ?>
<html> <html>
<body bgcolor="ffffff"> <body bgcolor="ffffff">
@ -251,32 +252,32 @@
} }
function sqimap_capability($imap_stream, $capability) { function sqimap_capability($imap_stream, $capability) {
global $sqimap_capabilities; global $sqimap_capabilities;
global $imap_general_debug; global $imap_general_debug;
if (!is_array($sqimap_capabilities)) { if (!is_array($sqimap_capabilities)) {
fputs ($imap_stream, sqimap_session_id() . " CAPABILITY\r\n"); fputs ($imap_stream, sqimap_session_id() . " CAPABILITY\r\n");
$read = sqimap_read_data($imap_stream, sqimap_session_id(), true, $a, $b); $read = sqimap_read_data($imap_stream, sqimap_session_id(), true, $a, $b);
$c = explode(' ', $read[0]); $c = explode(' ', $read[0]);
for ($i=2; $i < count($c); $i++) { for ($i=2; $i < count($c); $i++) {
$cap_list = explode('=', $c[$i]); $cap_list = explode('=', $c[$i]);
if (isset($cap_list[1])) if (isset($cap_list[1]))
$sqimap_capabilities[$cap_list[0]] = $cap_list[1]; $sqimap_capabilities[$cap_list[0]] = $cap_list[1];
else else
$sqimap_capabilities[$cap_list[0]] = TRUE; $sqimap_capabilities[$cap_list[0]] = TRUE;
} }
} }
if (! isset($sqimap_capabilities[$capability])) if (! isset($sqimap_capabilities[$capability]))
return false; return false;
return $sqimap_capabilities[$capability]; return $sqimap_capabilities[$capability];
} }
/****************************************************************************** /******************************************************************************
** Returns the delimeter between mailboxes: INBOX/Test, or INBOX.Test... ** Returns the delimeter between mailboxes: INBOX/Test, or INBOX.Test...
******************************************************************************/ ******************************************************************************/
function sqimap_get_delimiter ($imap_stream = false) { function sqimap_get_delimiter ($imap_stream = false) {
global $imap_general_debug; global $imap_general_debug;
global $sqimap_delimiter; global $sqimap_delimiter;
global $optional_delimiter; global $optional_delimiter;
@ -286,38 +287,38 @@
/* Do some caching here */ /* Do some caching here */
if (!$sqimap_delimiter) { if (!$sqimap_delimiter) {
if (sqimap_capability($imap_stream, "NAMESPACE")) { if (sqimap_capability($imap_stream, "NAMESPACE")) {
/* According to something that I can't find, this is supposed to work on all systems /* According to something that I can't find, this is supposed to work on all systems
OS: This won't work in Courier IMAP. OS: This won't work in Courier IMAP.
OS: According to rfc2342 response from NAMESPACE command is: OS: According to rfc2342 response from NAMESPACE command is:
OS: * NAMESPACE (PERSONAL NAMESPACES) (OTHER_USERS NAMESPACE) (SHARED NAMESPACES) OS: * NAMESPACE (PERSONAL NAMESPACES) (OTHER_USERS NAMESPACE) (SHARED NAMESPACES)
OS: We want to lookup all personal NAMESPACES... OS: We want to lookup all personal NAMESPACES...
*/ */
fputs ($imap_stream, sqimap_session_id() . " NAMESPACE\r\n"); fputs ($imap_stream, sqimap_session_id() . " NAMESPACE\r\n");
$read = sqimap_read_data($imap_stream, sqimap_session_id(), true, $a, $b); $read = sqimap_read_data($imap_stream, sqimap_session_id(), true, $a, $b);
if (eregi('\\* NAMESPACE +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL)', $read[0], $data)) { if (eregi('\\* NAMESPACE +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL)', $read[0], $data)) {
if (eregi('^\\( *\\((.*)\\) *\\)', $data[1], $data2)) if (eregi('^\\( *\\((.*)\\) *\\)', $data[1], $data2))
$pn = $data2[1]; $pn = $data2[1];
$pna = explode(')(', $pn); $pna = explode(')(', $pn);
while (list($k, $v) = each($pna)) while (list($k, $v) = each($pna))
{ {
$lst = explode('"', $v); $lst = explode('"', $v);
if (isset($lst[3])) { if (isset($lst[3])) {
$pn[$lst[1]] = $lst[3]; $pn[$lst[1]] = $lst[3];
} else { } else {
$pn[$lst[1]] = ''; $pn[$lst[1]] = '';
} }
} }
} }
$sqimap_delimiter = $pn[0]; $sqimap_delimiter = $pn[0];
} else { } else {
fputs ($imap_stream, ". LIST \"INBOX\" \"\"\r\n"); fputs ($imap_stream, ". LIST \"INBOX\" \"\"\r\n");
$read = sqimap_read_data($imap_stream, '.', true, $a, $b); $read = sqimap_read_data($imap_stream, '.', true, $a, $b);
$quote_position = strpos ($read[0], '"'); $quote_position = strpos ($read[0], '"');
$sqimap_delimiter = substr ($read[0], $quote_position+1, 1); $sqimap_delimiter = substr ($read[0], $quote_position+1, 1);
} }
} }
return $sqimap_delimiter; return $sqimap_delimiter;
} }
@ -329,7 +330,7 @@
$read_ary = sqimap_read_data ($imap_stream, sqimap_session_id(), true, $result, $message); $read_ary = sqimap_read_data ($imap_stream, sqimap_session_id(), true, $result, $message);
for ($i = 0; $i < count($read_ary); $i++) { for ($i = 0; $i < count($read_ary); $i++) {
if (ereg("[^ ]+ +([^ ]+) +EXISTS", $read_ary[$i], $regs)) { if (ereg("[^ ]+ +([^ ]+) +EXISTS", $read_ary[$i], $regs)) {
return $regs[1]; return $regs[1];
} }
} }
return "BUG! Couldn't get number of messages in $mailbox!"; return "BUG! Couldn't get number of messages in $mailbox!";

View file

@ -13,6 +13,8 @@
return; return;
define('mailbox_display_php', true); define('mailbox_display_php', true);
define( 'PG_SEL_MAX', 10 ); // Default value for page_selector_max
function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, $where, $what) { function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, $where, $what) {
global $checkall; global $checkall;
global $color, $msgs, $msort; global $color, $msgs, $msort;
@ -269,7 +271,8 @@
$re_abbr = # Add more here! $re_abbr = # Add more here!
'vedr|sv|' . # Danish 'vedr|sv|' . # Danish
're|aw'; # English 're|aw'; # English
if (eregi("^($re_abbr):[ ]*(.*)$", $messages[$j]['SUBJECT-SORT'], $regs))
if (eregi( "^($re_abbr):[ ]*(.*)$", $messages[$j]['SUBJECT-SORT'], $regs))
$messages[$j]['SUBJECT-SORT'] = $regs[2]; $messages[$j]['SUBJECT-SORT'] = $regs[2];
$num = 0; $num = 0;
@ -379,9 +382,9 @@
$Message = ''; $Message = '';
if ($startMessage < $endMessage) { if ($startMessage < $endMessage) {
$Message = _("Viewing messages") ." <B>$startMessage</B> ". _("to") ." <B>$endMessage</B> ($numMessages " . _("total") . ")\n"; $Message = _("Viewing messages") .":<br><B>$startMessage</B> ". _("to") ." <B>$endMessage</B> ($numMessages " . _("total") . ")\n";
} elseif ($startMessage == $endMessage) { } elseif ($startMessage == $endMessage) {
$Message = _("Viewing message") ." <B>$startMessage</B> ($numMessages " . _("total") . ")\n"; $Message = _("Viewing message") .":<br><B>$startMessage</B> ($numMessages " . _("total") . ")\n";
} }
if ($sort == 6) { if ($sort == 6) {
@ -408,25 +411,30 @@
// Page selector block. Following code computes page links. // Page selector block. Following code computes page links.
$mMore = ''; $mMore = '';
if( getPref($data_dir, $username, 'page_selector') && $numMessages > $show_num ) { if( !getPref($data_dir, $username, 'page_selector') &&
$numMessages > $show_num ) {
$j = intval( $numMessages / $show_num ); $j = intval( $numMessages / $show_num ); // Max pages
$k = max( 1, $j / getPref($data_dir, $username, 'page_selector_max', PG_SEL_MAX ) );
if( $numMessages % $show_num <> 0 ) if( $numMessages % $show_num <> 0 )
$j++; $j++;
$startMessage = min( $startMessage, $numMessages ); $startMessage = min( $startMessage, $numMessages );
for( $i = 0; $i < $j; $i++ ) { $p = intval( $startMessage / $show_num ) + 1;
$i = 1;
$start = ( ( $i * $show_num ) + 1 ); while( $i < $p ) {
$pg = intval( $i );
if( $startMessage >= $start && $start = ( ($pg-1) * $show_num ) + 1;
$startMessage < $start + $show_num ) { $mMore .= "<a href=\"right_main.php?use_mailbox_cache=$use_mailbox_cache&startMessage=$start" .
$mMore .= '<b>' . ($i+1) . '</b> '; "&mailbox=$urlMailbox\" TARGET=\"right\">$pg</a> ";
} else { $i+=$k;
$mMore .= "<a href=\"right_main.php?use_mailbox_cache=$use_mailbox_cache&startMessage=$start" . }
"&mailbox=$urlMailbox\" TARGET=\"right\">" . $mMore .= "<b>$p</b> ";
($i+1) . $i += $k;
'</a> '; while( $i <= $j ) {
} $pg = intval( $i );
$start = ( ($pg-1) * $show_num ) + 1;
$mMore .= "<a href=\"right_main.php?use_mailbox_cache=$use_mailbox_cache&startMessage=$start" .
"&mailbox=$urlMailbox\" TARGET=\"right\">$pg</a> ";
$i+=$k;
} }
$mMore .= ' | '; $mMore .= ' | ';
} }
@ -493,11 +501,12 @@
echo "</td></tr>\n"; echo "</td></tr>\n";
echo "<TR BGCOLOR=\"$color[4]\"><TD>"; echo "<TR BGCOLOR=\"$color[4]\"><TD>";
echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>'; echo "<table BGCOLOR=\"$color[4]\" ".
echo "$lMore$mMore$rMore</td><td align=right>\n"; 'width="100%" cellpadding="0" cellspacing="2" border="0"><tr><td>';
if (!$startMessage) $startMessage=1; echo "$lMore$mMore$rMore</td><td align=right>";
if (!$startMessage)
$startMessage=1;
ShowSelectAllLink($startMessage, $sort); ShowSelectAllLink($startMessage, $sort);
echo '</td></tr></table></td></tr></table>'; /** End of message-list table */ echo '</td></tr></table></td></tr></table>'; /** End of message-list table */
do_hook('mailbox_index_after'); do_hook('mailbox_index_after');
@ -520,15 +529,8 @@
/** This is the beginning of the message list table. It wraps around all messages */ /** This is the beginning of the message list table. It wraps around all messages */
echo '<TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">'; echo '<TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">';
if ($Message) {
echo "<TR BGCOLOR=\"$color[4]\"><TD align=center>$Message</td></tr>\n";
}
echo "<TR BGCOLOR=\"$color[4]\"><TD>"; echo "<TR BGCOLOR=\"$color[4]\"><TD>";
echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
echo "$More</td><td align=right>\n";
ShowSelectAllLink($startMessage, $sort);
echo '</td></tr></table></td></tr>';
/** The delete and move options */ /** The delete and move options */
echo "<TR><TD BGCOLOR=\"$color[0]\">"; echo "<TR><TD BGCOLOR=\"$color[0]\">";
@ -536,18 +538,18 @@
echo "\n<FORM name=messageList method=post action=\"$moveURL\">\n"; echo "\n<FORM name=messageList method=post action=\"$moveURL\">\n";
echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0 width=100%>\n"; echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0 width=100%>\n";
echo " <TR>\n"; echo " <TR>\n" .
echo " <TD WIDTH=60% ALIGN=LEFT VALIGN=CENTER NOWRAP>\n"; " <TD ALIGN=LEFT VALIGN=CENTER NOWRAP>\n" .
echo ' <SMALL>&nbsp;' . _("Move selected to:") . "</SMALL>\n"; ' <SMALL>&nbsp;' . _("Move selected to:") . "</SMALL>\n" .
echo " </TD>\n"; " </TD>\n" .
echo " <TD>&nbsp;</TD>\n"; " <TD rowspan=2><center>$Message</TD>\n" .
echo " <TD WIDTH=\"1%\" ALIGN=RIGHT NOWRAP>\n"; " <TD ALIGN=RIGHT NOWRAP>\n" .
echo ' <SMALL>&nbsp;' . _("Transform Selected Messages") . ": &nbsp; </SMALL><BR>\n"; ' <SMALL>&nbsp;' . _("Transform Selected Messages") . ": &nbsp; </SMALL><BR>\n" .
echo " </TD>\n"; " </TD>\n" .
echo " </TR>\n"; " </TR>\n" .
echo " <TR>\n"; " <TR>\n" .
echo " <TD ALIGN=LEFT VALIGN=CENTER NOWRAP>\n"; " <TD ALIGN=LEFT VALIGN=CENTER NOWRAP>\n" .
echo ' <SMALL>&nbsp;<TT><SELECT NAME="targetMailbox">'; ' <SMALL>&nbsp;<TT><SELECT NAME="targetMailbox">';
$boxes = sqimap_mailbox_list($imapConnection); $boxes = sqimap_mailbox_list($imapConnection);
for ($i = 0; $i < count($boxes); $i++) { for ($i = 0; $i < count($boxes); $i++) {
@ -560,20 +562,28 @@
echo ' </SELECT></TT></SMALL>'; echo ' </SELECT></TT></SMALL>';
echo " <SMALL><INPUT TYPE=SUBMIT NAME=\"moveButton\" VALUE=\"" . _("Move") . "\"></SMALL>\n"; echo " <SMALL><INPUT TYPE=SUBMIT NAME=\"moveButton\" VALUE=\"" . _("Move") . "\"></SMALL>\n";
echo " </TD>\n"; echo " </TD>\n";
echo " <TD>&nbsp;</TD>\n";
echo " <TD ALIGN=RIGHT NOWRAP>&nbsp;&nbsp;&nbsp;\n"; echo " <TD ALIGN=RIGHT NOWRAP>&nbsp;&nbsp;&nbsp;\n";
if (! $auto_expunge) { if (! $auto_expunge) {
echo ' <INPUT TYPE=SUBMIT NAME="expungeButton" VALUE="'. _("Expunge") .'">&nbsp;'. _("mailbox") ."&nbsp;\n"; echo ' <INPUT TYPE=SUBMIT NAME="expungeButton" VALUE="'. _("Expunge") .'">&nbsp;'. _("mailbox") ."&nbsp;\n";
} }
echo " <INPUT TYPE=SUBMIT NAME=\"markRead\" VALUE=\"". _("Read")."\">\n"; echo " <INPUT TYPE=SUBMIT NAME=\"markRead\" VALUE=\"". _("Read")."\">\n";
echo " <INPUT TYPE=SUBMIT NAME=\"markUnread\" VALUE=\"". _("Unread")."\">\n"; echo " <INPUT TYPE=SUBMIT NAME=\"markUnread\" VALUE=\"". _("Unread")."\">\n";
echo " <INPUT TYPE=SUBMIT VALUE=\"". _("Delete") . "\">&nbsp;\n"; echo " <INPUT TYPE=SUBMIT VALUE=\"". _("Delete") . "\">&nbsp;\n";
echo " </TD>\n"; echo " </TD>\n";
echo " </TR>\n"; echo " </TR>\n";
echo "</TABLE>\n"; echo "</TABLE>\n";
do_hook('mailbox_form_before'); do_hook('mailbox_form_before');
echo '</TD></TR>'; echo '</TD></TR>';
echo "<tr bgcolor=\"$color[4]\"><td colspan=3>\n";
echo "<table bgcolor=\"$color[4]\" cellpadding=2".
' width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
echo "$More</td><td align=right>";
ShowSelectAllLink($startMessage, $sort);
echo "</td></tr></table>\n</td></tr>";
echo "<TR><TD BGCOLOR=\"$color[0]\">"; echo "<TR><TD BGCOLOR=\"$color[0]\">";
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING="; echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=";
if ($GLOBALS['alt_index_colors']) { if ($GLOBALS['alt_index_colors']) {
@ -621,6 +631,8 @@
echo "</TR>\n"; echo "</TR>\n";
} }
/* ----------------------------------------------------------------------- */
function ShowSortButton($sort, $mailbox, $Up, $Down) { function ShowSortButton($sort, $mailbox, $Up, $Down) {
if ($sort != $Up && $sort != $Down) { if ($sort != $Up && $sort != $Down) {
$img = 'sort_none.gif'; $img = 'sort_none.gif';
@ -642,21 +654,19 @@
{ {
global $checkall, $PHP_SELF, $what, $where, $mailbox; global $checkall, $PHP_SELF, $what, $where, $mailbox;
// This code is from Philippe Mingo <mingo@rotedic.com> ?>&nbsp;
?>
<script language="JavaScript"> <script language="JavaScript">
<!-- <!--
function CheckAll() { function CheckAll() {
for (var i = 0; i < document.messageList.elements.length; i++) { for (var i = 0; i < document.messageList.elements.length; i++) {
if( document.messageList.elements[i].name.substr( 0, 3 ) == 'msg') { if( document.messageList.elements[i].type == 'checkbox' ) {
document.messageList.elements[i].checked = document.messageList.elements[i].checked =
!(document.messageList.elements[i].checked); !(document.messageList.elements[i].checked);
} }
} }
} }
window.document.write('<a href="#" onClick="CheckAll();"><?php echo window.document.write('<input type=button onClick="CheckAll();" value="<?php echo
_("Toggle All") ?></A>'); _("Toggle All") ?>">');
//--> //-->
</script><noscript> </script><noscript>
<?PHP <?PHP

View file

@ -62,14 +62,15 @@
/** returns the value for $string **/ /** returns the value for $string **/
function getPref($data_dir, $username, $string) { function getPref($data_dir, $username, $string, $default = '') {
global $prefs_cache; global $prefs_cache;
cachePrefValues($data_dir, $username); cachePrefValues($data_dir, $username);
if (isset($prefs_cache[$string])) if (isset($prefs_cache[$string]))
return $prefs_cache[$string]; return $prefs_cache[$string];
return ''; else
return $default;
} }

View file

@ -110,10 +110,16 @@
removePref($data_dir, $username, 'include_self_reply_all'); removePref($data_dir, $username, 'include_self_reply_all');
} }
if (isset($pageselector)) { if (isset($pageselectormax)) {
setPref($data_dir, $username, 'page_selector', 1); setPref($data_dir, $username, 'page_selector_max', $pageselectormax);
} else { } else {
removePref($data_dir, $username, 'page_selector_max', 0 );
}
if (isset($pageselector)) {
removePref($data_dir, $username, 'page_selector'); removePref($data_dir, $username, 'page_selector');
} else {
setPref($data_dir, $username, 'page_selector', 1);
} }
do_hook('options_display_save'); do_hook('options_display_save');

View file

@ -84,7 +84,7 @@
if (isset($show_num)) if (isset($show_num))
echo ' <tt><input type="text" size="5" name="shownum" value="'.$show_num.'"></tt><br>'; echo ' <tt><input type="text" size="5" name="shownum" value="'.$show_num.'"></tt><br>';
else else
echo ' <tt><input type="text" size="5" name="shownum" value="25"></tt><br>'; echo ' <tt><input type="text" size="5" name="shownum" value="25"></tt><br>';
?> ?>
</td> </td>
</tr> </tr>
@ -235,7 +235,7 @@ echo _("Yes, show me the HTML version of a mail message, if it is available.");
</td> </td>
</tr> </tr>
<tr> <tr>
<td align=right> <td align=right valign=middle>
<?php echo _("Include Self"); ?>: <?php echo _("Include Self"); ?>:
</td> </td>
<td> <td>
@ -247,14 +247,16 @@ echo _("Yes, show me the HTML version of a mail message, if it is available.");
</td> </td>
</tr> </tr>
<tr> <tr>
<td align=right> <td align=right valign=middle>
<?php echo _("Page Selector"); ?>: <?php
</td> echo _("Page Selector") . ': </td><td>';
<td> echo '<input type=checkbox name=pageselector';
<input type=checkbox name=pageselector <?php if (!getPref($data_dir, $username, 'page_selector') )
if (getPref($data_dir, $username, 'page_selector') != '' ) echo ' checked';
echo " checked"; echo '> ' . _("Show page selector") . ' ';
echo '> ' . _("Show page selector"); $psw = getPref($data_dir, $username, 'page_selector_max', 10 );
echo "<input name=pageselectormax size=3 value=\"$psw\">";
echo ' ' . _("pages max");
?> ?>
</td> </td>
</tr> </tr>
@ -265,6 +267,7 @@ echo _("Yes, show me the HTML version of a mail message, if it is available.");
<input type="submit" value="<?php echo _("Submit"); ?>"name="submit_display"> <input type="submit" value="<?php echo _("Submit"); ?>"name="submit_display">
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>