- echo " <td width=1% bgcolor=$hlt_color align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."$checked></TD>\n";
- echo " <td width=30% bgcolor=$hlt_color>$italic$bold$flag$senderName$flag_end$bold_end$italic_end</td>\n";
- echo " <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
- if ($msg["FLAG_ANSWERED"] == true) echo " <td bgcolor=$hlt_color width=1%><b><small>A</small></b></td>";
- elseif (ereg("(1|2)",substr($msg["PRIORITY"],0,1))) echo " <td bgcolor=$hlt_color width=1%><b><small><font color=$color[1]>!</font></small></b></td>";
- else echo " <td bgcolor=$hlt_color width=1%> </td>";
- echo " <td bgcolor=$hlt_color width=%>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0\">$flag$subject$flag_end</a>$bold_end</td>\n";
+ for ($i=1; $i <= count($index_order); $i++) {
+ switch ($index_order[$i]) {
+ case 1: # checkbox
+ echo " <td width=1% bgcolor=$hlt_color align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."$checked></TD>\n";
+ break;
+ case 2: # from
+ echo " <td width=30% bgcolor=$hlt_color>$italic$bold$flag$fontstr$senderName$fontstr_end$flag_end$bold_end$italic_end</td>\n";
+ break;
+ case 3: # date
+ echo " <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag$fontstr".$msg["DATE_STRING"]."$fontstr_end$flag_end$bold_end</center></td>\n";
+ break;
+ case 4: # subject
+ echo " <td bgcolor=$hlt_color>$bold";
+ if (! isset($search_stuff)) { $search_stuff = ''; }
+ echo "<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0$search_stuff\"";
+ do_hook("subject_link");
+ echo ">$flag";
+ if (strlen($subject) > 55){
+ $ent_strlen=strlen($subject);
+ $trim_val=50;
+ // see if this is entities-encoded string
+ if (is_int(strpos($subject, "&#"))){
+ // Yes. Iterate through the whole string, find out
+ // the real number of characters, and if more
+ // than 55, substr with an updated trim value.
+ $ent_offset=0;
+ $ent_count=0;
+ do {
+ $ent_loc = strpos($subject, "&#", $ent_offset);
+ $ent_loc_end = strpos($subject, ";", $ent_offset);
+ if ($ent_loc_end){
+ $trim_val += ($ent_loc_end-$ent_loc)+1;
+ $ent_strlen -= $ent_loc_end-$ent_loc;
+ $ent_offset = $ent_loc_end+1;
+ $ent_count++;
+ } else $ent_loc=false;
+ } while (is_int($ent_loc));
+ }
+ if ($ent_strlen>55) echo substr($subject, 0, $trim_val) . '...';
+ else echo $subject;
+ } else echo $subject;
+
+ echo "$flag_end</a>$bold_end</td>\n";
+ break;
+ case 5: # flags
+ $stuff = false;
+ echo " <td bgcolor=$hlt_color align=center width=1% nowrap><b><small>\n";
+ if (isset($msg['FLAG_ANSWERED']) &&
+ $msg['FLAG_ANSWERED'] == true) {
+ echo "A\n";
+ $stuff = true;
+ }
+ if ($msg['TYPE0'] == 'multipart') {
+ echo "+\n";
+ $stuff = true;
+ }
+ if (ereg('(1|2)',substr($msg['PRIORITY'],0,1))) {
+ echo "<font color=$color[1]>!</font>\n";
+ $stuff = true;
+ }
+ if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
+ echo "<font color=\"$color[1]\">D</font>\n";
+ $stuff = true;
+ }
+
+ if (!$stuff) echo " \n";
+ echo "</small></b></td>\n";
+ break;
+ case 6: # size
+ echo " <td bgcolor=$hlt_color width=1%>$bold$fontstr".show_readable_size($msg['SIZE'])."$fontstr_end$bold_end</td>\n";
+ break;
+ }
+ }
+