moved address-parsing to the displayable headers
[squirrelmail.git] / functions / mailbox_display.php
... / ...
CommitLineData
1<?php
2
3/**
4 * mailbox_display.php
5 *
6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This contains functions that display mailbox information, such as the
10 * table row that has sender, date, subject, etc...
11 *
12 * $Id$
13 */
14
15require_once(SM_PATH . 'functions/strings.php');
16require_once(SM_PATH . 'functions/html.php');
17require_once(SM_PATH . 'class/html.class.php');
18require_once(SM_PATH . 'functions/imap_mailbox.php');
19
20/* Default value for page_selector_max. */
21define('PG_SEL_MAX', 10);
22
23function elapsed($start)
24{
25 $end = microtime();
26 list($start2, $start1) = explode(" ", $start);
27 list($end2, $end1) = explode(" ", $end);
28 $diff1 = $end1 - $start1;
29 $diff2 = $end2 - $start2;
30 if( $diff2 < 0 ){
31 $diff1 -= 1;
32 $diff2 += 1.0;
33 }
34 return $diff2 + $diff1;
35}
36
37function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
38 $start_msg, $where, $what) {
39 global $checkall,
40 $color, $msgs, $msort, $td_str, $msg,
41 $default_use_priority,
42 $message_highlight_list,
43 $index_order,
44 $indent_array, /* indent subject by */
45 $pos, /* Search postion (if any) */
46 $thread_sort_messages, /* thread sorting on/off */
47 $server_sort_order, /* sort value when using server-sorting */
48 $row_count,
49 $allow_server_sort; /* enable/disable server-side sorting */
50 $color_string = $color[4];
51
52 if ($GLOBALS['alt_index_colors']) {
53 if (!isset($row_count)) {
54 $row_count = 0;
55 }
56 $row_count++;
57 if ($row_count % 2) {
58 if (!isset($color[12])) {
59 $color[12] = '#EAEAEA';
60 }
61 $color_string = $color[12];
62 }
63 }
64 $msg = $msgs[$key];
65
66 if($mailbox == 'None') {
67 $boxes = sqimap_mailbox_list($imapConnection);
68 $mailbox = $boxes[0]['unformatted'];
69 unset($boxes);
70 }
71 $urlMailbox = urlencode($mailbox);
72
73 if (handleAsSent($mailbox)) {
74 $msg['FROM'] = $msg['TO'];
75 }
76 $msg['FROM'] = parseAddress($msg['FROM']);
77
78 /*
79 * This is done in case you're looking into Sent folders,
80 * because you can have multiple receivers.
81 */
82
83 $senderNames = $msg['FROM'];
84 $senderName = '';
85 if (sizeof($senderNames)){
86 foreach ($senderNames as $senderNames_part) {
87 if ($senderName != '') {
88 $senderName .= ', ';
89 }
90 if ($senderNames_part[1]) {
91 $senderName .= decodeHeader($senderNames_part[1]);
92 } else {
93 $senderName .= htmlspecialchars($senderNames_part[0]);
94 }
95 }
96 }
97
98 $msg['SUBJECT'] = decodeHeader($msg['SUBJECT']);
99 $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
100
101 echo html_tag( 'tr','','','','VALIGN="top"') . "\n";
102
103 if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) {
104 $flag = "<font color=\"$color[2]\">";
105 $flag_end = '</font>';
106 } else {
107 $flag = '';
108 $flag_end = '';
109 }
110 if (!isset($msg['FLAG_SEEN']) || ($msg['FLAG_SEEN'] == false)) {
111 $bold = '<b>';
112 $bold_end = '</b>';
113 } else {
114 $bold = '';
115 $bold_end = '';
116 }
117 if (handleAsSent($mailbox)) {
118 $italic = '<i>';
119 $italic_end = '</i>';
120 } else {
121 $italic = '';
122 $italic_end = '';
123 }
124 if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
125 $fontstr = "<font color=\"$color[9]\">";
126 $fontstr_end = '</font>';
127 } else {
128 $fontstr = '';
129 $fontstr_end = '';
130 }
131
132 if ($where && $what) {
133 $searchstr = '&amp;where='.$where.'&amp;what='.$what;
134 } else {
135 $searchstr = '';
136 }
137 /**
138 * AAAAH! Make my eyes stop bleeding!
139 * Who wrote this?!
140 */
141 if (is_array($message_highlight_list) && count($message_highlight_list)) {
142 $msg['TO'] = parseAddress($msg['TO']);
143 $msg['CC'] = parseAddress($msg['CC']);
144 foreach ($message_highlight_list as $message_highlight_list_part) {
145 if (trim($message_highlight_list_part['value']) != '') {
146 $high_val = strtolower($message_highlight_list_part['value']);
147 $match_type = strtoupper($message_highlight_list_part['match_type']);
148 switch($match_type) {
149 case('TO'):
150 case('TO_CC'):
151 foreach ($msg['TO'] as $address) {
152 $address[0] = decodeHeader($address[0]);
153 $address[1] = decodeHeader($address[1]);
154 if (strstr('^^' . strtolower($address[0]), $high_val) ||
155 strstr('^^' . strtolower($address[1]), $high_val)) {
156 $hlt_color = $message_highlight_list_part['color'];
157 continue;
158 }
159 }
160 if($match_type != 'TO_CC') {
161 break;
162 }
163 case('CC'):
164 foreach ($msg['CC'] as $address) {
165 $address[0] = decodeHeader($address[0]);
166 $address[1] = decodeHeader($address[1]);
167 if( strstr('^^' . strtolower($address[0]), $high_val) ||
168 strstr('^^' . strtolower($address[1]), $high_val)) {
169 $hlt_color = $message_highlight_list_part['color'];
170 continue;
171 }
172 }
173 break;
174 case('FROM'):
175 foreach ($msg['FROM'] as $address) {
176 $address[0] = decodeHeader($address[0]);
177 $address[1] = decodeHeader($address[1]);
178 if( strstr('^^' . strtolower($address[0]), $high_val) ||
179 strstr('^^' . strtolower($address[1]), $high_val)) {
180 $hlt_color = $message_highlight_list_part['color'];
181 continue;
182 }
183 }
184 break;
185 default:
186 if (strstr('^^' . strtolower($msg[$match_type]), $high_val)) {
187 $hlt_color = $message_highlight_list_part['color'];
188 continue;
189 }
190 break;
191 }
192 }
193 }
194 }
195
196 if (!isset($hlt_color)) {
197 $hlt_color = $color_string;
198 }
199 $checked = ($checkall == 1) ? ' CHECKED' : '';
200 $col = 0;
201 if (sizeof($index_order)) {
202 foreach ($index_order as $index_order_part) {
203 switch ($index_order_part) {
204 case 1: /* checkbox */
205 echo html_tag( 'td',
206 "<input type=checkbox name=\"msg[$t]\" value=\"".$msg['ID']."\"$checked>",
207 'center',
208 $hlt_color );
209 break;
210 case 2: /* from */
211 echo html_tag( 'td',
212 $italic . $bold . $flag . $fontstr . $senderName .
213 $fontstr_end . $flag_end . $bold_end . $italic_end,
214 'left',
215 $hlt_color );
216 break;
217 case 3: /* date */
218 $date_string = $msg['DATE_STRING'] . '';
219 if ($date_string == '') {
220 $date_string = _("Unknown date");
221 }
222 echo html_tag( 'td',
223 $bold . $flag . $fontstr . $date_string .
224 $fontstr_end . $flag_end . $bold_end,
225 'center',
226 $hlt_color,
227 'nowrap' );
228 break;
229 case 4: /* subject */
230 $td_str = $bold;
231 if ($thread_sort_messages == 1) {
232 if (isset($indent_array[$msg['ID']])) {
233 $td_str .= str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;",$indent_array[$msg['ID']]);
234 }
235 }
236 $td_str .= '<a href="read_body.php?mailbox='.$urlMailbox
237 . '&amp;passed_id='. $msg["ID"]
238 . '&amp;startMessage='.$start_msg.$searchstr.'"';
239 $td_str .= ' ' .concat_hook_function('subject_link');
240 if ($subject != $msg['SUBJECT']) {
241 $title = get_html_translation_table(HTML_SPECIALCHARS);
242 $title = array_flip($title);
243 $title = strtr($msg['SUBJECT'], $title);
244 $title = str_replace('"', "''", $title);
245 $td_str .= " title=\"$title\"";
246 }
247 $td_str .= ">$flag$subject$flag_end</a>$bold_end";
248 echo html_tag( 'td', $td_str, 'left', $hlt_color );
249 break;
250 case 5: /* flags */
251 $stuff = false;
252 $td_str = "<b><small>";
253
254 if (isset($msg['FLAG_ANSWERED']) && $msg['FLAG_ANSWERED'] == true) {
255 $td_str .= _("A");
256 $stuff = true;
257 }
258 if ($msg['TYPE0'] == 'multipart') {
259 $td_str .= '+';
260 $stuff = true;
261 }
262 if ($default_use_priority) {
263 if ( ($msg['PRIORITY'] == 1) || ($msg['PRIORITY'] == 2) ) {
264 $td_str .= "<font color=\"$color[1]\">!</font>";
265 $stuff = true;
266 }
267 if ($msg['PRIORITY'] == 5) {
268 $td_str .= "<font color=\"$color[8]\">?</font>";
269 $stuff = true;
270 }
271 }
272 if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'] == true) {
273 $td_str .= "<font color=\"$color[1]\">D</font>";
274 $stuff = true;
275 }
276 if (!$stuff) {
277 $td_str .= '&nbsp;';
278 }
279 do_hook("msg_envelope");
280 $td_str .= '</small></b>';
281 echo html_tag( 'td',
282 $td_str,
283 'center',
284 $hlt_color,
285 'nowrap' );
286 break;
287 case 6: /* size */
288 echo html_tag( 'td',
289 $bold . $fontstr . show_readable_size($msg['SIZE']) .
290 $fontstr_end . $bold_end,
291 'right',
292 $hlt_color );
293 break;
294 }
295 ++$col;
296 }
297 }
298 if ($not_last) {
299 echo '</tr>' . "\n" . '<tr><td COLSPAN="' . $col . '" BGCOLOR="' .
300 $color[0] . '" HEIGHT="1"></td></tr>' . "\n";
301 } else {
302 echo '</tr>'."\n";
303 }
304}
305
306function getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id) {
307 if ($id != 'no') {
308 $id = array_slice($id, ($start_msg-1), $show_num);
309 $end = $start_msg + $show_num - 1;
310 if ($num_msgs < $show_num) {
311 $end_loop = $num_msgs;
312 } else if ($end > $num_msgs) {
313 $end_loop = $num_msgs - $start_msg + 1;
314 } else {
315 $end_loop = $show_num;
316 }
317 return fillMessageArray($imapConnection,$id,$end_loop);
318 } else {
319 return false;
320 }
321}
322
323function getThreadMessages($imapConnection, $start_msg, $show_num, $num_msgs) {
324 $id = get_thread_sort($imapConnection);
325 return getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
326}
327
328function getServerSortMessages($imapConnection, $start_msg, $show_num,
329 $num_msgs, $server_sort_order, $mbxresponse) {
330 $id = sqimap_get_sort_order($imapConnection, $server_sort_order,$mbxresponse);
331 return getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
332}
333
334function getSelfSortMessages($imapConnection, $start_msg, $show_num,
335 $num_msgs, $sort, $mbxresponse) {
336 $msgs = array();
337 if ($num_msgs >= 1) {
338 $id = sqimap_get_php_sort_order ($imapConnection, $mbxresponse);
339 if ($sort < 6 ) {
340 $end = $num_msgs;
341 $end_loop = $end;
342 } else {
343 /* if it's not sorted */
344 if ($start_msg + ($show_num - 1) < $num_msgs) {
345 $end_msg = $start_msg + ($show_num - 1);
346 } else {
347 $end_msg = $num_msgs;
348 }
349 if ($end_msg < $start_msg) {
350 $start_msg = $start_msg - $show_num;
351 if ($start_msg < 1) {
352 $start_msg = 1;
353 }
354 }
355 $id = array_slice(array_reverse($id), ($start_msg-1), $show_num);
356 $end = $start_msg + $show_num - 1;
357 if ($num_msgs < $show_num) {
358 $end_loop = $num_msgs;
359 } else if ($end > $num_msgs) {
360 $end_loop = $num_msgs - $start_msg + 1;
361 } else {
362 $end_loop = $show_num;
363 }
364 }
365 $msgs = fillMessageArray($imapConnection,$id,$end_loop);
366 }
367 return $msgs;
368}
369
370
371
372/*
373 * This function loops through a group of messages in the mailbox
374 * and shows them to the user.
375 */
376function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
377 $start_msg, $sort, $color, $show_num,
378 $use_cache, $mode='') {
379 global $msgs, $msort, $auto_expunge, $thread_sort_messages,
380 $allow_server_sort, $server_sort_order;
381
382 /*
383 * For some reason, on PHP 4.3+, this being unset, and set in the session causes havoc
384 * so setting it to an empty array beforehand seems to clean up the issue, and stopping the
385 * "Your script possibly relies on a session side-effect which existed until PHP 4.2.3" error
386 */
387
388 if (!isset($msort)) {
389 $msort = array();
390 }
391
392 if (!isset($msgs)) {
393 $msgs = array();
394 }
395
396 $start = microtime();
397 /* If autoexpunge is turned on, then do it now. */
398 $mbxresponse = sqimap_mailbox_select($imapConnection, $mailbox);
399 $srt = $sort;
400 /* If autoexpunge is turned on, then do it now. */
401 if ($auto_expunge == true) {
402 $exp_cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, false, '');
403 $mbxresponse['EXISTS'] = $mbxresponse['EXISTS'] - $exp_cnt;
404 $num_msgs = $mbxresponse['EXISTS'];
405 }
406
407 if ($mbxresponse['EXISTS'] > 0) {
408 /* if $start_msg is lower than $num_msgs, we probably deleted all messages
409 * in the last page. We need to re-adjust the start_msg
410 */
411
412 if($start_msg > $num_msgs) {
413 $start_msg -= $show_num;
414 if($start_msg < 1) {
415 $start_msg = 1;
416 }
417 }
418
419 /* This code and the next if() block check for
420 * server-side sorting methods. The $id array is
421 * formatted and $sort is set to 6 to disable
422 * SM internal sorting
423 */
424
425 if ($thread_sort_messages == 1) {
426 $mode = 'thread';
427 } elseif ($allow_server_sort == 1) {
428 $mode = 'serversort';
429 } else {
430 $mode = '';
431 }
432
433 sqsession_unregister('msort');
434 sqsession_unregister('msgs');
435 switch ($mode) {
436 case 'thread':
437 $id = get_thread_sort($imapConnection);
438 $msgs = getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
439 if ($msgs === false) {
440 echo '<b><small><center><font color=red>' .
441 _("Thread sorting is not supported by your IMAP server.<br>Please report this to the system administrator.").
442 '</center></small></b>';
443 $thread_sort_messages = 0;
444 $msort = $msgs = array();
445 } else {
446 $msort= $msgs;
447 $sort = 6;
448 }
449 break;
450 case 'serversort':
451 $id = sqimap_get_sort_order($imapConnection, $sort, $mbxresponse);
452 $msgs = getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
453 if ($msgs === false) {
454 echo '<b><small><center><font color=red>' .
455 _( "Server-side sorting is not supported by your IMAP server.<br>Please report this to the system administrator.").
456 '</center></small></b>';
457 $sort = $server_sort_order;
458 $allow_server_sort = FALSE;
459 $msort = $msgs = array();
460 $id = array();
461 } else {
462 $msort = $msgs;
463 $sort = 6;
464 }
465 break;
466 default:
467 if (!$use_cache) {
468 $msgs = getSelfSortMessages($imapConnection, $start_msg, $show_num,
469 $num_msgs, $sort, $mbxresponse);
470 $msort = calc_msort($msgs, $sort);
471 } /* !use cache */
472 break;
473 } // switch
474 sqsession_register($msort, 'msort');
475 sqsession_register($msgs, 'msgs');
476 } /* if exists > 0 */
477
478 $res = getEndMessage($start_msg, $show_num, $num_msgs);
479 $start_msg = $res[0];
480 $end_msg = $res[1];
481
482 $paginator_str = get_paginator_str($mailbox, $start_msg, $end_msg,
483 $num_msgs, $show_num, $sort);
484
485 $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
486
487 do_hook('mailbox_index_before');
488 echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
489 echo '<tr><td>';
490
491 mail_message_listing_beginning($imapConnection, $mailbox, $sort,
492 $msg_cnt_str, $paginator_str, $start_msg);
493 echo '</td></tr>';
494 /* line between the button area and the list */
495 echo '<tr><td HEIGHT="5" BGCOLOR="'.$color[4].'"></td></tr>';
496
497 echo '<tr><td>';
498 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
499 echo ' <tr><td>';
500 echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[5].'">';
501 echo '<tr><td>';
502 printHeader($mailbox, $srt, $color, !$thread_sort_messages);
503
504 displayMessageArray($imapConnection, $num_msgs, $start_msg,
505 $msort, $mailbox, $sort, $color, $show_num,0,0);
506 echo '</td></tr></table></td></tr></table>';
507
508 mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $color);
509 echo '</td></tr></table>';
510 $t = elapsed($start);
511 //echo("elapsed time = $t seconds\n");
512}
513
514function calc_msort($msgs, $sort) {
515
516 /*
517 * 0 = Date (up)
518 * 1 = Date (dn)
519 * 2 = Name (up)
520 * 3 = Name (dn)
521 * 4 = Subject (up)
522 * 5 = Subject (dn)
523 */
524
525 if (($sort == 0) || ($sort == 1)) {
526 foreach ($msgs as $item) {
527 $msort[] = $item['TIME_STAMP'];
528 }
529 } elseif (($sort == 2) || ($sort == 3)) {
530 foreach ($msgs as $item) {
531 $msort[] = $item['FROM-SORT'];
532 }
533 } elseif (($sort == 4) || ($sort == 5)) {
534 foreach ($msgs as $item) {
535 $msort[] = $item['SUBJECT-SORT'];
536 }
537 } else {
538 $msort = $msgs;
539 }
540 if ($sort < 6) {
541 if ($sort % 2) {
542 asort($msort);
543 } else {
544 arsort($msort);
545 }
546 }
547 return $msort;
548}
549
550function fillMessageArray($imapConnection, $id, $count) {
551 return sqimap_get_small_header_list($imapConnection, $id);
552}
553
554
555/* Generic function to convert the msgs array into an HTML table. */
556function displayMessageArray($imapConnection, $num_msgs, $start_msg,
557 $msort, $mailbox, $sort, $color,
558 $show_num, $where=0, $what=0) {
559 global $imapServerAddress, $use_mailbox_cache, $index_order,
560 $indent_array, $thread_sort_messages, $allow_server_sort,
561 $server_sort_order, $PHP_SELF;
562
563 $res = getEndMessage($start_msg, $show_num, $num_msgs);
564 $start_msg = $res[0];
565 $end_msg = $res[1];
566
567 $urlMailbox = urlencode($mailbox);
568
569 /* get indent level for subject display */
570 if ($thread_sort_messages == 1 && $num_msgs) {
571 $indent_array = get_parent_level($imapConnection);
572 }
573
574 $real_startMessage = $start_msg;
575 if ($sort == 6) {
576 if ($end_msg - $start_msg < $show_num - 1) {
577 $end_msg = $end_msg - $start_msg + 1;
578 $start_msg = 1;
579 } else if ($start_msg > $show_num) {
580 $end_msg = $show_num;
581 $start_msg = 1;
582 }
583 }
584 $endVar = $end_msg + 1;
585
586 /*
587 * Loop through and display the info for each message.
588 * ($t is used for the checkbox number)
589 */
590 $t = 0;
591
592 /* messages display */
593
594 if (!$num_msgs) {
595 /* if there's no messages in this folder */
596 echo html_tag( 'tr',
597 html_tag( 'td',
598 "<BR><b>" . _("THIS FOLDER IS EMPTY") . "</b><BR>&nbsp;",
599 'center',
600 $color[4],
601 'COLSPAN="' . count($index_order) . '"'
602 )
603 );
604 } elseif ($start_msg == $end_msg) {
605 /* if there's only one message in the box, handle it differently. */
606 if ($sort != 6) {
607 $i = $start_msg;
608 } else {
609 $i = 1;
610 }
611 reset($msort);
612 $k = 0;
613 do {
614 $key = key($msort);
615 next($msort);
616 $k++;
617 } while (isset ($key) && ($k < $i));
618 printMessageInfo($imapConnection, $t, true, $key, $mailbox,
619 $real_startMessage, $where, $what);
620 } else {
621 $i = $start_msg;
622 reset($msort);
623 $k = 0;
624 do {
625 $key = key($msort);
626 next($msort);
627 $k++;
628 } while (isset ($key) && ($k < $i));
629 $not_last = true;
630 do {
631 if (!$i || $i == $endVar-1) $not_last = false;
632 printMessageInfo($imapConnection, $t, $not_last, $key, $mailbox,
633 $real_startMessage, $where, $what);
634 $key = key($msort);
635 $t++;
636 $i++;
637 next($msort);
638 } while ($i && $i < $endVar);
639 }
640}
641
642/*
643 * Displays the standard message list header. To finish the table,
644 * you need to do a "</table></table>";
645 *
646 * $moveURL is the URL to submit the delete/move form to
647 * $mailbox is the current mailbox
648 * $sort is the current sorting method (-1 for no sorting available [searches])
649 * $Message is a message that is centered on top of the list
650 * $More is a second line that is left aligned
651 */
652
653function mail_message_listing_beginning ($imapConnection,
654 $mailbox = '', $sort = -1,
655 $msg_cnt_str = '',
656 $paginator = '&nbsp;',
657 $start_msg = 1) {
658 global $color, $auto_expunge, $base_uri, $thread_sort_messages,
659 $allow_thread_sort, $allow_server_sort, $server_sort_order,
660 $PHP_SELF;
661
662 $php_self = $PHP_SELF;
663 /* fix for incorrect $PHP_SELF */
664 if (strpos($php_self, 'move_messages.php')) {
665 $php_self = str_replace('move_messages.php', 'right_main.php', $php_self);
666 }
667 $urlMailbox = urlencode($mailbox);
668
669 if (preg_match('/^(.+)\?.+$/',$php_self,$regs)) {
670 $source_url = $regs[1];
671 } else {
672 $source_url = $php_self;
673 }
674
675 if (!isset($msg)) {
676 $msg = '';
677 }
678 $moveFields = '<input type="hidden" name="msg" value="'.htmlspecialchars($msg).'">' .
679 '<input type="hidden" name="mailbox" value="'.htmlspecialchars($mailbox).'">' .
680 '<input type="hidden" name="startMessage" value="'.htmlspecialchars($start_msg).'">';
681
682// $moveURL = "move_messages.php?msg=$msg&amp;mailbox=$urlMailbox"
683// . "&amp;startMessage=$start_msg";
684 /*
685 * This is the beginning of the message list table.
686 * It wraps around all messages
687 */
688 echo '<form name="messageList" method="post" action="move_messages.php">' ."\n"
689 . $moveFields
690 . html_tag( 'table' ,
691 html_tag( 'tr',
692 html_tag( 'td' ,
693 html_tag( 'table' ,
694 html_tag( 'tr',
695 html_tag( 'td', $paginator, 'left' ) .
696 html_tag( 'td', $msg_cnt_str, 'right' )
697 )
698 , '', $color[4], 'border="0" width="100%" cellpadding="1" cellspacing="0"' )
699 , 'left', '', '' )
700 , '', $color[0] )
701 , '', '', 'border="0" width="100%" cellpadding="1" cellspacing="0"' );
702 /* line between header and button area */
703 echo '<tr><td HEIGHT="5" BGCOLOR="'.$color[4].'"></td></tr>';
704
705 echo '<tr><td>';
706 echo html_tag( 'tr' ) . "\n"
707 . html_tag( 'td' ,'' , 'left', '', '' )
708 . html_tag( 'table' ,'' , '', $color[9], 'border="0" width="100%" cellpadding="1" cellspacing="0"' )
709 . '<tr><td>'
710 . html_tag( 'table' ,'' , '', $color[0], 'border="0" width="100%" cellpadding="1" cellspacing="0"' )
711 . html_tag( 'tr',
712 getSmallStringCell(_("Move Selected To"), 'left', 'nowrap') .
713 getSmallStringCell(_("Transform Selected Messages"), 'right')
714 )
715 . html_tag( 'tr' ) ."\n"
716 . html_tag( 'td', '', 'left', '', 'valign="middle" nowrap' );
717 getMbxList($imapConnection);
718 echo getButton('SUBMIT', 'moveButton',_("Move")) . "\n";
719 echo getButton('SUBMIT', 'attache',_("Forward")) . "\n";
720
721 echo " </TD>\n"
722 . html_tag( 'td', '', 'right', '', 'nowrap' );
723
724
725
726 if (!$auto_expunge) {
727 echo getButton('SUBMIT', 'expungeButton',_("Expunge"))
728 .'&nbsp;' . _("mailbox") . "\n";
729 }
730
731 echo getButton('SUBMIT', 'markRead',_("Read"));
732 echo getButton('SUBMIT', 'markUnread',_("Unread"));
733 echo getButton('SUBMIT', 'delete',_("Delete")) ."&nbsp;\n";
734 if (!strpos($php_self,'mailbox')) {
735 $location = $php_self.'?mailbox=INBOX&amp;startMessage=1';
736 } else {
737 $location = $php_self;
738 }
739 echo '<INPUT TYPE="HIDDEN" NAME="location" VALUE="'.$location.'">';
740 echo "</TD>\n"
741 . " </TR>\n";
742
743 /* draws thread sorting links */
744 if ($allow_thread_sort == TRUE) {
745 if ($thread_sort_messages == 1 ) {
746 $set_thread = 2;
747 $thread_name = _("Unthread View");
748 } elseif ($thread_sort_messages == 0) {
749 $set_thread = 1;
750 $thread_name = _("Thread View");
751 }
752 echo html_tag( 'tr' ,
753 html_tag( 'td' ,
754 '&nbsp;<a href=' . $source_url . '?sort='
755 . "$sort" . '&start_messages=1&set_thread=' . "$set_thread"
756 . '&mailbox=' . urlencode($mailbox) . '><small>' . $thread_name
757 . '</a></small>&nbsp;'
758 , '', '', '' )
759 , '', '', '' );
760 }
761
762 echo "</TABLE></td></tr></table></td></tr>\n";
763
764 do_hook('mailbox_form_before');
765
766 /* if using server sort we highjack the
767 * the $sort var and use $server_sort_order
768 * instead. but here we reset sort for a bit
769 * since its easy
770 */
771 if ($allow_server_sort == TRUE) {
772 $sort = $server_sort_order;
773 }
774}
775
776function mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $color) {
777 if ($num_msgs) {
778 /* space between list and footer */
779 echo '<tr><td HEIGHT="5" BGCOLOR="'.$color[4].'" COLSPAN="1">';
780
781 echo '</td></tr><tr><td>';
782 echo html_tag( 'table',
783 html_tag( 'tr',
784 html_tag( 'td',
785 html_tag( 'table',
786 html_tag( 'tr',
787 html_tag( 'td', $paginator_str ) .
788 html_tag( 'td', $msg_cnt_str, 'right' )
789 )
790 , '', $color[4], 'width="100%" border="0" cellpadding="1" cellspacing="0"' )
791 )
792 )
793 , '', $color[9], 'width="100%" border="0" cellpadding="1" cellspacing="0"' );
794 echo '</td></tr>';
795 }
796 /* End of message-list table */
797
798 do_hook('mailbox_index_after');
799 echo "</FORM>\n";
800}
801
802function printHeader($mailbox, $sort, $color, $showsort=true) {
803 global $index_order;
804 echo html_tag( 'tr' ,'' , 'center', $color[5] );
805
806 /* calculate the width of the subject column based on the
807 * widths of the other columns */
808 $widths = array(1=>1,2=>25,3=>5,4=>0,5=>1,6=>5);
809 $subjectwidth = 100;
810 foreach($index_order as $item) {
811 $subjectwidth -= $widths[$item];
812 }
813
814 foreach ($index_order as $item) {
815 switch ($item) {
816 case 1: /* checkbox */
817 case 5: /* flags */
818 echo html_tag( 'td' ,'&nbsp;' , '', '', 'width="1%"' );
819 break;
820 case 2: /* from */
821 if (handleAsSent($mailbox)) {
822 echo html_tag( 'td' ,'' , 'left', '', 'width="25%"' )
823 . '<b>' . _("To") . '</b>';
824 } else {
825 echo html_tag( 'td' ,'' , 'left', '', 'width="25%"' )
826 . '<b>' . _("From") . '</b>';
827 }
828 if ($showsort) {
829 ShowSortButton($sort, $mailbox, 2, 3);
830 }
831 echo "</td>\n";
832 break;
833 case 3: /* date */
834 echo html_tag( 'td' ,'' , 'left', '', 'width="5%" nowrap' )
835 . '<b>' . _("Date") . '</b>';
836 if ($showsort) {
837 ShowSortButton($sort, $mailbox, 0, 1);
838 }
839 echo "</td>\n";
840 break;
841 case 4: /* subject */
842 echo html_tag( 'td' ,'' , 'left', '', 'width="'.$subjectwidth.'%"' )
843 . '<b>' . _("Subject") . '</b>';
844 if ($showsort) {
845 ShowSortButton($sort, $mailbox, 4, 5);
846 }
847 echo "</td>\n";
848 break;
849 case 6: /* size */
850 echo html_tag( 'td', '<b>' . _("Size") . '</b>', 'center', '', 'width="5%" nowrap' );
851 break;
852 }
853 }
854 echo "</tr>\n";
855}
856
857
858/*
859 * This function shows the sort button. Isn't this a good comment?
860 */
861function ShowSortButton($sort, $mailbox, $Up, $Down ) {
862 global $PHP_SELF;
863 /* Figure out which image we want to use. */
864 if ($sort != $Up && $sort != $Down) {
865 $img = 'sort_none.png';
866 $which = $Up;
867 } elseif ($sort == $Up) {
868 $img = 'up_pointer.png';
869 $which = $Down;
870 } else {
871 $img = 'down_pointer.png';
872 $which = 6;
873 }
874
875 if (preg_match('/^(.+)\?.+$/',$PHP_SELF,$regs)) {
876 $source_url = $regs[1];
877 } else {
878 $source_url = $PHP_SELF;
879 }
880
881 /* Now that we have everything figured out, show the actual button. */
882 echo ' <a href="' . $source_url .'?newsort=' . $which
883 . '&amp;startMessage=1&amp;mailbox=' . urlencode($mailbox)
884 . '"><IMG SRC="../images/' . $img
885 . '" BORDER=0 WIDTH=12 HEIGHT=10 ALT="sort"></a>';
886}
887
888function get_selectall_link($start_msg, $sort) {
889 global $checkall, $what, $where, $mailbox, $javascript_on;
890 global $PHP_SELF, $PG_SHOWNUM;
891
892 $result = '';
893 if ($javascript_on) {
894 $result = '<script language="JavaScript" type="text/javascript">'
895 . "\n<!-- \n"
896 . "function CheckAll() {\n"
897 . " for (var i = 0; i < document.messageList.elements.length; i++) {\n"
898 . " if(document.messageList.elements[i].type == 'checkbox'){\n"
899 . " document.messageList.elements[i].checked = "
900 . " !(document.messageList.elements[i].checked);\n"
901 . " }\n"
902 . " }\n"
903 . "}\n"
904 . "//-->\n"
905 . '</script><a href="#" onClick="CheckAll();">' . _("Toggle All")
906 . "</a>\n";
907 } else {
908 if (strpos($PHP_SELF, "?")) {
909 $result .= "<a href=\"$PHP_SELF&amp;mailbox=" . urlencode($mailbox)
910 . "&amp;startMessage=$start_msg&amp;sort=$sort&amp;checkall=";
911 } else {
912 $result .= "<a href=\"$PHP_SELF?mailbox=" . urlencode($mailbox)
913 . "&amp;startMessage=$start_msg&amp;sort=$sort&amp;checkall=";
914 }
915 if (isset($checkall) && $checkall == '1') {
916 $result .= '0';
917 } else {
918 $result .= '1';
919 }
920
921 if (isset($where) && isset($what)) {
922 $result .= '&amp;where=' . urlencode($where)
923 . '&amp;what=' . urlencode($what);
924 }
925 $result .= "\">";
926
927 if (isset($checkall) && ($checkall == '1')) {
928 $result .= _("Unselect All");
929 } else {
930 $result .= _("Select All");
931 }
932 $result .= "</A>\n";
933 }
934
935 /* Return our final result. */
936 return ($result);
937}
938
939/*
940 * This function computes the "Viewing Messages..." string.
941 */
942function get_msgcnt_str($start_msg, $end_msg, $num_msgs) {
943 /* Compute the $msg_cnt_str. */
944 $result = '';
945 if ($start_msg < $end_msg) {
946 $result = sprintf(_("Viewing Messages: <B>%s</B> to <B>%s</B> (%s total)"),
947 $start_msg, $end_msg, $num_msgs);
948 } else if ($start_msg == $end_msg) {
949 $result = sprintf(_("Viewing Message: <B>%s</B> (1 total)"), $start_msg);
950 } else {
951 $result = '<br>';
952 }
953 /* Return our result string. */
954 return ($result);
955}
956
957/*
958 * Generate a paginator link.
959 */
960function get_paginator_link($box, $start_msg, $use, $text) {
961 global $PHP_SELF;
962
963 $result = "<A HREF=\"right_main.php?use_mailbox_cache=$use"
964 . "&amp;startMessage=$start_msg&amp;mailbox=$box\" "
965 . "TARGET=\"right\">$text</A>";
966 return ($result);
967/*
968 if (preg_match('/^(.+)\?.+$/',$PHP_SELF,$regs)) {
969 $source_url = $regs[1];
970 } else {
971 $source_url = $PHP_SELF;
972 }
973
974 $result = '<A HREF="'. $source_url . "?use_mailbox_cache=$use"
975 . "&amp;startMessage=$start_msg&amp;mailbox=$box\" "
976 . "TARGET=\"right\">$text</A>";
977 return ($result);
978*/
979}
980
981/*
982 * This function computes the paginator string.
983 */
984function get_paginator_str($box, $start_msg, $end_msg, $num_msgs,
985 $show_num, $sort) {
986 global $username, $data_dir, $use_mailbox_cache, $color, $PG_SHOWNUM;
987
988 /* Initialize paginator string chunks. */
989 $prv_str = '';
990 $nxt_str = '';
991 $pg_str = '';
992 $all_str = '';
993 $tgl_str = '';
994
995 $box = urlencode($box);
996
997 /* Create simple strings that will be creating the paginator. */
998 $spc = '&nbsp;'; /* This will be used as a space. */
999 $sep = '|'; /* This will be used as a seperator. */
1000
1001 /* Get some paginator preference values. */
1002 $pg_sel = getPref($data_dir, $username, 'page_selector', SMPREF_ON);
1003 $pg_max = getPref($data_dir, $username, 'page_selector_max', PG_SEL_MAX);
1004
1005 /* Make sure that our start message number is not too big. */
1006 $start_msg = min($start_msg, $num_msgs);
1007
1008 /* Decide whether or not we will use the mailbox cache. */
1009 /* Not sure why $use_mailbox_cache is even passed in. */
1010 if ($sort == 6) {
1011 $use = 0;
1012 } else {
1013 $use = 1;
1014 }
1015
1016 /* Compute the starting message of the previous and next page group. */
1017 $next_grp = $start_msg + $show_num;
1018 $prev_grp = $start_msg - $show_num;
1019
1020 /* Compute the basic previous and next strings. */
1021 if (($next_grp <= $num_msgs) && ($prev_grp >= 0)) {
1022 $prv_str = get_paginator_link($box, $prev_grp, $use, _("Previous"));
1023 $nxt_str = get_paginator_link($box, $next_grp, $use, _("Next"));
1024 } else if (($next_grp > $num_msgs) && ($prev_grp >= 0)) {
1025 $prv_str = get_paginator_link($box, $prev_grp, $use, _("Previous"));
1026 $nxt_str = "<FONT COLOR=\"$color[9]\">"._("Next")."</FONT>\n";
1027 } else if (($next_grp <= $num_msgs) && ($prev_grp < 0)) {
1028 $prv_str = "<FONT COLOR=\"$color[9]\">"._("Previous") . '</FONT>';
1029 $nxt_str = get_paginator_link($box, $next_grp, $use, _("Next"));
1030 }
1031
1032 /* Page selector block. Following code computes page links. */
1033 if ($pg_sel && ($num_msgs > $show_num)) {
1034 /* Most importantly, what is the current page!!! */
1035 $cur_pg = intval($start_msg / $show_num) + 1;
1036
1037 /* Compute total # of pages and # of paginator page links. */
1038 $tot_pgs = ceil($num_msgs / $show_num); /* Total number of Pages */
1039 $vis_pgs = min($pg_max, $tot_pgs - 1); /* Visible Pages */
1040
1041 /* Compute the size of the four quarters of the page links. */
1042
1043 /* If we can, just show all the pages. */
1044 if (($tot_pgs - 1) <= $pg_max) {
1045 $q1_pgs = $cur_pg - 1;
1046 $q2_pgs = $q3_pgs = 0;
1047 $q4_pgs = $tot_pgs - $cur_pg;
1048
1049 /* Otherwise, compute some magic to choose the four quarters. */
1050 } else {
1051 /*
1052 * Compute the magic base values. Added together,
1053 * these values will always equal to the $pag_pgs.
1054 * NOTE: These are DEFAULT values and do not take
1055 * the current page into account. That is below.
1056 */
1057 $q1_pgs = floor($vis_pgs/4);
1058 $q2_pgs = round($vis_pgs/4, 0);
1059 $q3_pgs = ceil($vis_pgs/4);
1060 $q4_pgs = round(($vis_pgs - $q2_pgs)/3, 0);
1061
1062 /* Adjust if the first quarter contains the current page. */
1063 if (($cur_pg - $q1_pgs) < 1) {
1064 $extra_pgs = ($q1_pgs - ($cur_pg - 1)) + $q2_pgs;
1065 $q1_pgs = $cur_pg - 1;
1066 $q2_pgs = 0;
1067 $q3_pgs += ceil($extra_pgs / 2);
1068 $q4_pgs += floor($extra_pgs / 2);
1069
1070 /* Adjust if the first and second quarters intersect. */
1071 } else if (($cur_pg - $q2_pgs - ceil($q2_pgs/3)) <= $q1_pgs) {
1072 $extra_pgs = $q2_pgs;
1073 $extra_pgs -= ceil(($cur_pg - $q1_pgs - 1) * 0.75);
1074 $q2_pgs = ceil(($cur_pg - $q1_pgs - 1) * 0.75);
1075 $q3_pgs += ceil($extra_pgs / 2);
1076 $q4_pgs += floor($extra_pgs / 2);
1077
1078 /* Adjust if the fourth quarter contains the current page. */
1079 } else if (($cur_pg + $q4_pgs) >= $tot_pgs) {
1080 $extra_pgs = ($q4_pgs - ($tot_pgs - $cur_pg)) + $q3_pgs;
1081 $q3_pgs = 0;
1082 $q4_pgs = $tot_pgs - $cur_pg;
1083 $q1_pgs += floor($extra_pgs / 2);
1084 $q2_pgs += ceil($extra_pgs / 2);
1085
1086 /* Adjust if the third and fourth quarter intersect. */
1087 } else if (($cur_pg + $q3_pgs + 1) >= ($tot_pgs - $q4_pgs + 1)) {
1088 $extra_pgs = $q3_pgs;
1089 $extra_pgs -= ceil(($tot_pgs - $cur_pg - $q4_pgs) * 0.75);
1090 $q3_pgs = ceil(($tot_pgs - $cur_pg - $q4_pgs) * 0.75);
1091 $q1_pgs += floor($extra_pgs / 2);
1092 $q2_pgs += ceil($extra_pgs / 2);
1093 }
1094 }
1095
1096 /*
1097 * I am leaving this debug code here, commented out, because
1098 * it is a really nice way to see what the above code is doing.
1099 * echo "qts = $q1_pgs/$q2_pgs/$q3_pgs/$q4_pgs = "
1100 * . ($q1_pgs + $q2_pgs + $q3_pgs + $q4_pgs) . '<br>';
1101 */
1102
1103 /* Print out the page links from the compute page quarters. */
1104
1105 /* Start with the first quarter. */
1106 if (($q1_pgs == 0) && ($cur_pg > 1)) {
1107 $pg_str .= "...$spc";
1108 } else {
1109 for ($pg = 1; $pg <= $q1_pgs; ++$pg) {
1110 $start = (($pg-1) * $show_num) + 1;
1111 $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
1112 }
1113 if ($cur_pg - $q2_pgs - $q1_pgs > 1) {
1114 $pg_str .= "...$spc";
1115 }
1116 }
1117
1118 /* Continue with the second quarter. */
1119 for ($pg = $cur_pg - $q2_pgs; $pg < $cur_pg; ++$pg) {
1120 $start = (($pg-1) * $show_num) + 1;
1121 $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
1122 }
1123
1124 /* Now print the current page. */
1125 $pg_str .= $cur_pg . $spc;
1126
1127 /* Next comes the third quarter. */
1128 for ($pg = $cur_pg + 1; $pg <= $cur_pg + $q3_pgs; ++$pg) {
1129 $start = (($pg-1) * $show_num) + 1;
1130 $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
1131 }
1132
1133 /* And last, print the forth quarter page links. */
1134 if (($q4_pgs == 0) && ($cur_pg < $tot_pgs)) {
1135 $pg_str .= "...$spc";
1136 } else {
1137 if (($tot_pgs - $q4_pgs) > ($cur_pg + $q3_pgs)) {
1138 $pg_str .= "...$spc";
1139 }
1140 for ($pg = $tot_pgs - $q4_pgs + 1; $pg <= $tot_pgs; ++$pg) {
1141 $start = (($pg-1) * $show_num) + 1;
1142 $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
1143 }
1144 }
1145 } else if ($PG_SHOWNUM == 999999) {
1146 $pg_str = "<A HREF=\"right_main.php?PG_SHOWALL=0"
1147 . "&amp;use_mailbox_cache=$use&amp;startMessage=1&amp;mailbox=$box\" "
1148 . "TARGET=\"right\">" ._("Paginate") . '</A>' . $spc;
1149 }
1150
1151 /* If necessary, compute the 'show all' string. */
1152 if (($prv_str != '') || ($nxt_str != '')) {
1153 $all_str = "<A HREF=\"right_main.php?PG_SHOWALL=1"
1154 . "&amp;use_mailbox_cache=$use&amp;startMessage=1&amp;mailbox=$box\" "
1155 . "TARGET=\"right\">" . _("Show All") . '</A>';
1156 }
1157
1158 /* Last but not least, get the value for the toggle all link. */
1159 $tgl_str = get_selectall_link($start_msg, $sort);
1160
1161 /* Put all the pieces of the paginator string together. */
1162 /**
1163 * Hairy code... But let's leave it like it is since I am not certain
1164 * a different approach would be any easier to read. ;)
1165 */
1166 $result = '';
1167 $result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : '');
1168 $result .= ($nxt_str != '' ? $nxt_str . $spc . $sep . $spc : '');
1169 $result .= ($pg_str != '' ? $pg_str : '');
1170 $result .= ($all_str != '' ? $sep . $spc . $all_str . $spc : '');
1171 $result .= ($result != '' ? $sep . $spc . $tgl_str: $tgl_str);
1172
1173 /* If the resulting string is blank, return a non-breaking space. */
1174 if ($result == '') {
1175 $result = '&nbsp;';
1176 }
1177
1178 /* Return our final magical paginator string. */
1179 return ($result);
1180}
1181
1182function processSubject($subject, $threadlevel = 0) {
1183 global $languages, $squirrelmail_language;
1184 /* Shouldn't ever happen -- caught too many times in the IMAP functions */
1185 if ($subject == '')
1186 return _("(no subject)");
1187
1188 $trim_at = 55;
1189
1190 /* if this is threaded, subtract two chars per indentlevel */
1191 if($threadlevel > 0 && $threadlevel <= 10)
1192 $trim_at -= (2*$threadlevel);
1193
1194 if (strlen($subject) <= $trim_at)
1195 return $subject;
1196
1197 $ent_strlen = $orig_len = strlen($subject);
1198 $trim_val = $trim_at - 5;
1199 $ent_offset = 0;
1200 /*
1201 * see if this is entities-encoded string
1202 * If so, Iterate through the whole string, find out
1203 * the real number of characters, and if more
1204 * than 55, substr with an updated trim value.
1205 */
1206 $step = $ent_loc = 0;
1207 while ( $ent_loc < $trim_val && (($ent_loc = strpos($subject, '&', $ent_offset)) !== false) &&
1208 (($ent_loc_end = strpos($subject, ';', $ent_loc+3)) !== false) ) {
1209 $trim_val += ($ent_loc_end-$ent_loc);
1210 $ent_offset = $ent_loc_end+1;
1211 ++$step;
1212 }
1213
1214 if (($trim_val > 50) && (strlen($subject) > ($trim_val))&& (strpos($subject,';',$trim_val) < ($trim_val +6))) {
1215 $i = strpos($subject,';',$trim_val);
1216 if ($i) {
1217 $trim_val = strpos($subject,';',$trim_val);
1218 }
1219 }
1220 if ($ent_strlen <= $trim_at){
1221 return $subject;
1222 }
1223
1224 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
1225 function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
1226 return $languages[$squirrelmail_language]['XTRA_CODE']('strimwidth', $subject, $trim_val);
1227 }
1228 return substr($subject, 0, $trim_val) . '...';
1229}
1230
1231function getMbxList($imapConnection) {
1232 global $lastTargetMailbox;
1233 echo ' <small>&nbsp;<tt><select name="targetMailbox">';
1234 echo sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)) );
1235 echo ' </SELECT></TT>&nbsp;';
1236}
1237
1238function getButton($type, $name, $value) {
1239 return '<INPUT TYPE="'.$type.'" NAME="'.$name.'" VALUE="'.$value . '">';
1240}
1241
1242function getSmallStringCell($string, $align) {
1243 return html_tag('td',
1244 '<small>' . $string . ':&nbsp; </small>',
1245 $align,
1246 '',
1247 'nowrap' );
1248}
1249
1250function getEndMessage($start_msg, $show_num, $num_msgs) {
1251 if ($start_msg + ($show_num - 1) < $num_msgs){
1252 $end_msg = $start_msg + ($show_num - 1);
1253 } else {
1254 $end_msg = $num_msgs;
1255 }
1256
1257 if ($end_msg < $start_msg) {
1258 $start_msg = $start_msg - $show_num;
1259 if ($start_msg < 1) {
1260 $start_msg = 1;
1261 }
1262 }
1263 return (array($start_msg,$end_msg));
1264}
1265
1266function handleAsSent($mailbox) {
1267 global $handleAsSent_result;
1268
1269 /* First check if this is the sent or draft folder. */
1270 $handleAsSent_result = isSentMailbox($mailbox) || isDraftMailbox($mailbox);
1271
1272 /* Then check the result of the handleAsSent hook. */
1273 do_hook('check_handleAsSent_result', $mailbox);
1274
1275 /* And return the result. */
1276 return $handleAsSent_result;
1277}
1278
1279?>