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