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)
{
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;
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) {