X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=ae678a786ed8912b45619f933019d1f4c3672e3c;hp=12480fb208c2478706b1ee2d5cb6b56d20e1c66e;hb=6dc5eca489e0a529d9b6ac0316b7990701a0ec86;hpb=9701e9c8f0b83b9c515d9416dc3e43577db3e834 diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 12480fb2..ae678a78 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -17,8 +17,12 @@ require_once(SM_PATH . 'functions/html.php'); require_once(SM_PATH . 'class/html.class.php'); require_once(SM_PATH . 'functions/imap_mailbox.php'); -/* Default value for page_selector_max. */ +/* Constants: + * PG_SEL_MAX: default value for page_selector_max + * SUBJ_TRIM_AT: the length at which we trim off subjects + */ define('PG_SEL_MAX', 10); +define('SUBJ_TRIM_AT', 55); function elapsed($start) { @@ -420,8 +424,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, sqgetGlobalVar('msort', $msort, SQ_SESSION); } else { sqsession_unregister('msort'); - sqsession_unregister('msgs'); - } + sqsession_unregister('msgs'); } switch ($mode) { case 'thread': $id = get_thread_sort($imapConnection); @@ -720,7 +723,7 @@ function mail_message_listing_beginning ($imapConnection, echo getButton('SUBMIT', 'expungeButton',_("Expunge")) .' ' . _("mailbox") . "\n"; } - + do_hook('mailbox_display_buttons'); echo getButton('SUBMIT', 'markRead',_("Read")); echo getButton('SUBMIT', 'markUnread',_("Unread")); echo getButton('SUBMIT', 'delete',_("Delete")) ." \n"; @@ -1179,17 +1182,20 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs, function processSubject($subject, $threadlevel = 0) { global $languages, $squirrelmail_language; /* Shouldn't ever happen -- caught too many times in the IMAP functions */ - if ($subject == '') + if ($subject == '') { return _("(no subject)"); + } - $trim_at = 55; + $trim_at = SUBJ_TRIM_AT; /* if this is threaded, subtract two chars per indentlevel */ - if($threadlevel > 0 && $threadlevel <= 10) + if($threadlevel > 0 && $threadlevel <= 10) { $trim_at -= (2*$threadlevel); + } - if (strlen($subject) <= $trim_at) + if (strlen($subject) <= $trim_at) { return $subject; + } $ent_strlen = $orig_len = strlen($subject); $trim_val = $trim_at - 5; @@ -1222,7 +1228,13 @@ function processSubject($subject, $threadlevel = 0) { function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) { return $languages[$squirrelmail_language]['XTRA_CODE']('strimwidth', $subject, $trim_val); } - return substr($subject, 0, $trim_val) . '...'; + + // only print '...' when we're actually dropping part of the subject + if(strlen($subject) <= $trim_val) { + return $subject; + } else { + return substr($subject, 0, $trim_val) . '...'; + } } function getMbxList($imapConnection) {