mailbox_display.php 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. <?php
  2. /**
  3. * mailbox_display.php
  4. *
  5. * Copyright (c) 1999-2002 The SquirrelMail Project Team
  6. * Licensed under the GNU GPL. For full terms see the file COPYING.
  7. *
  8. * This contains functions that display mailbox information, such as the
  9. * table row that has sender, date, subject, etc...
  10. *
  11. * $Id$
  12. */
  13. require_once('../functions/strings.php');
  14. /* Default value for page_selector_max. */
  15. define('PG_SEL_MAX', 10);
  16. function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort,
  17. $start_msg, $where, $what){
  18. global $checkall,
  19. $color, $msgs, $msort,
  20. $sent_folder, $draft_folder,
  21. $default_use_priority,
  22. $message_highlight_list,
  23. $index_order,
  24. $indent_array, /* indent subject by */
  25. $pos, /* Search postion (if any) */
  26. $thread_sort_messages, /* thread sorting on/off */
  27. $server_sort_order, /* sort value when using server-sorting */
  28. $row_count,
  29. $allow_server_sort; /* enable/disable server-side sorting */
  30. $color_string = $color[4];
  31. if ($GLOBALS['alt_index_colors']) {
  32. if (!isset($row_count)) {
  33. $row_count = 0;
  34. }
  35. $row_count++;
  36. if ($row_count % 2) {
  37. if (!isset($color[12])) {
  38. $color[12] = '#EAEAEA';
  39. }
  40. $color_string = $color[12];
  41. }
  42. }
  43. $msg = $msgs[$key];
  44. /*
  45. * This is done in case you're looking into Sent folders,
  46. * because you can have multiple receivers.
  47. */
  48. $senderNames = explode(',', $msg['FROM']);
  49. $senderName = '';
  50. if (sizeof($senderNames)){
  51. foreach ($senderNames as $senderNames_part) {
  52. if ($senderName != '') {
  53. $senderName .= ', ';
  54. }
  55. $senderName .= sqimap_find_displayable_name($senderNames_part);
  56. }
  57. }
  58. if( $mailbox == 'None' ) {
  59. $boxes = sqimap_mailbox_list($imapConnection);
  60. $mailbox = $boxes[0]['unformatted'];
  61. unset( $boxes );
  62. }
  63. $urlMailbox = urlencode($mailbox);
  64. $subject = processSubject($msg['SUBJECT']);
  65. echo "<TR>\n";
  66. if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) {
  67. $flag = "<font color=\"$color[2]\">";
  68. $flag_end = '</font>';
  69. } else {
  70. $flag = '';
  71. $flag_end = '';
  72. }
  73. if (!isset($msg['FLAG_SEEN']) || ($msg['FLAG_SEEN'] == false)) {
  74. $bold = '<b>';
  75. $bold_end = '</b>';
  76. } else {
  77. $bold = '';
  78. $bold_end = '';
  79. }
  80. if (handleAsSent($mailbox)) {
  81. $italic = '<i>';
  82. $italic_end = '</i>';
  83. } else {
  84. $italic = '';
  85. $italic_end = '';
  86. }
  87. if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
  88. $fontstr = "<font color=\"$color[9]\">";
  89. $fontstr_end = '</font>';
  90. } else {
  91. $fontstr = '';
  92. $fontstr_end = '';
  93. }
  94. /**
  95. * AAAAH! Make my eyes stop bleeding!
  96. * Who wrote this?!
  97. */
  98. if (sizeof($message_highlight_list)){
  99. foreach ($message_highlight_list as $message_highlight_list_part) {
  100. if (trim($message_highlight_list_part['value']) != '') {
  101. if ($message_highlight_list_part['match_type'] == 'to_cc') {
  102. if (strstr('^^' . strtolower($msg['TO']),
  103. strtolower($message_highlight_list_part['value']))
  104. || strstr('^^'.strtolower($msg['CC']),
  105. strtolower($message_highlight_list_part['value']))) {
  106. $hlt_color = $message_highlight_list_part['color'];
  107. continue;
  108. }
  109. } else
  110. if (strstr('^^' . strtolower($msg[strtoupper($message_highlight_list_part['match_type'])]),
  111. strtolower($message_highlight_list_part['value']))) {
  112. $hlt_color = $message_highlight_list_part['color'];
  113. continue;
  114. }
  115. }
  116. }
  117. }
  118. if (!isset($hlt_color)) {
  119. $hlt_color = $color_string;
  120. }
  121. if ($where && $what) {
  122. if(!isset($pos) || $pos == '') {
  123. $pos = '0';
  124. }
  125. $search_stuff = "&amp;pos=" . urlencode($pos)
  126. . "&amp;where=" . urlencode($where) . '&amp;what=' . urlencode($what);
  127. } else {
  128. $search_stuff = '';
  129. }
  130. $checked = ($checkall == 1) ? ' checked' : '';
  131. if (sizeof($index_order)){
  132. foreach ($index_order as $index_order_part) {
  133. switch ($index_order_part) {
  134. case 1: /* checkbox */
  135. echo " <td bgcolor=\"$hlt_color\" align=center>"
  136. . "<input type=checkbox name=\"msg[$t]\" value="
  137. . $msg["ID"]."$checked></TD>\n";
  138. break;
  139. case 2: /* from */
  140. echo " <td bgcolor=\"$hlt_color\">$italic$bold$flag$fontstr"
  141. . "$senderName$fontstr_end$flag_end$bold_end$italic_end</td>\n";
  142. break;
  143. case 3: /* date */
  144. echo " <td nowrap bgcolor=\"$hlt_color\"><center>$bold$flag$fontstr"
  145. . $msg["DATE_STRING"]
  146. . "$fontstr_end$flag_end$bold_end</center></td>\n";
  147. break;
  148. case 4: /* subject */
  149. echo " <td bgcolor=\"$hlt_color\">$bold";
  150. if ($thread_sort_messages == 1) {
  151. if (isset($indent_array[$msg["ID"]])) {
  152. echo str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;",$indent_array[$msg["ID"]]);
  153. }
  154. }
  155. echo "<a href=\"read_body.php?mailbox=$urlMailbox&amp;passed_id="
  156. . $msg["ID"]
  157. . "&amp;startMessage=$start_msg&amp;show_more=0$search_stuff\"";
  158. do_hook("subject_link");
  159. if ($subject != $msg['SUBJECT']) {
  160. $title = get_html_translation_table(HTML_SPECIALCHARS);
  161. $title = array_flip($title);
  162. $title = strtr($msg['SUBJECT'], $title);
  163. $title = str_replace('"', "''", $title);
  164. echo " title=\"$title\"";
  165. }
  166. echo ">$flag$subject$flag_end</a>$bold_end</td>\n";
  167. break;
  168. case 5: /* flags */
  169. $stuff = false;
  170. echo " <td bgcolor=\"$hlt_color\" align=center nowrap><b><small>\n";
  171. if (isset($msg['FLAG_ANSWERED']) && $msg['FLAG_ANSWERED'] == true) {
  172. echo _("A") . "\n";
  173. $stuff = true;
  174. }
  175. if ($msg['TYPE0'] == 'multipart') {
  176. echo "+\n";
  177. $stuff = true;
  178. }
  179. if ($default_use_priority) {
  180. if ( ($msg['PRIORITY'] == 1) || ($msg['PRIORITY'] == 2) ) {
  181. echo "<font color=\"$color[1]\">!</font>\n";
  182. $stuff = true;
  183. }
  184. if ($msg['PRIORITY'] == 5) {
  185. echo "<font color=\"$color[8]\">?</font>\n";
  186. $stuff = true;
  187. }
  188. }
  189. if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'] == true) {
  190. echo "<font color=\"$color[1]\">D</font>\n";
  191. $stuff = true;
  192. }
  193. if (!$stuff) {
  194. echo "&nbsp;\n";
  195. }
  196. echo "</small></b></td>\n";
  197. break;
  198. case 6: /* size */
  199. echo " <td bgcolor=\"$hlt_color\">$bold$fontstr"
  200. . show_readable_size($msg['SIZE']) . "$fontstr_end$bold_end</td>\n";
  201. break;
  202. }
  203. }
  204. }
  205. echo "</tr>\n";
  206. }
  207. /*
  208. * This function loops through a group of messages in the mailbox
  209. * and shows them to the user.
  210. */
  211. function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
  212. $start_msg, $sort, $color, $show_num,
  213. $use_cache) {
  214. global $msgs, $msort,
  215. $sent_folder, $draft_folder,
  216. $message_highlight_list,
  217. $auto_expunge, $thread_sort_messages, $allow_server_sort,
  218. $data_dir, $username, $server_sort_order;
  219. /* if $start_msg is lower than $num_msgs, we probably deleted all messages
  220. * in the last page. We need to re-adjust the start_msg
  221. */
  222. if($start_msg > $num_msgs) {
  223. $start_msg -= $show_num;
  224. if($start_msg < 1) {
  225. $start_msg = 1;
  226. }
  227. }
  228. /* This code and the next if() block check for
  229. * server-side sorting methods. The $id array is
  230. * formatted and $sort is set to 6 to disable
  231. * SM internal sorting
  232. */
  233. if ($thread_sort_messages == 1) {
  234. $id = get_thread_sort($imapConnection);
  235. if ($id == 'no') {
  236. echo '<b><small><center><font color=red>Thread sorting is not'.
  237. ' supported by your IMAP server.<br>Please report this'.
  238. ' to the system administrator.</center></small></b>';
  239. $thread_sort_messages = 0;
  240. $id = array();
  241. }
  242. else {
  243. $sort = 6;
  244. if ($start_msg + ($show_num - 1) < $num_msgs) {
  245. $end_msg = $start_msg + ($show_num-1);
  246. }
  247. else {
  248. $end_msg = $num_msgs;
  249. }
  250. $id = array_slice($id, ($start_msg-1), ($end_msg));
  251. }
  252. }
  253. if ($allow_server_sort == TRUE && $thread_sort_messages != 1) {
  254. $server_sort_order = $sort;
  255. $id = sqimap_get_sort_order($imapConnection, $server_sort_order);
  256. if ($id == 'no') {
  257. echo '<b><small><center><font color=red>Server-side sorting'.
  258. ' is not supported by your IMAP server.<br>Please report this'.
  259. ' to the system administrator.</center></small></b>';
  260. $sort = $server_sort_order;
  261. $allow_server_sort = FALSE;
  262. $id = array();
  263. }
  264. else {
  265. $sort = 6;
  266. if ($start_msg + ($show_num - 1) < $num_msgs) {
  267. $end_msg = $start_msg + ($show_num-1);
  268. }
  269. else {
  270. $end_msg = $num_msgs;
  271. }
  272. $id = array_slice($id, ($start_msg-1), ($end_msg));
  273. }
  274. }
  275. /* If autoexpunge is turned on, then do it now. */
  276. if ($auto_expunge == true) {
  277. sqimap_mailbox_expunge($imapConnection, $mailbox, false);
  278. }
  279. sqimap_mailbox_select($imapConnection, $mailbox);
  280. $issent = handleAsSent($mailbox);
  281. if (!$use_cache) {
  282. /* If it is sorted... */
  283. if ($num_msgs >= 1) {
  284. if ($sort < 6 ) {
  285. $id = range(1, $num_msgs);
  286. }
  287. elseif ($thread_sort_messages != 1 && $allow_server_sort != TRUE && $sort == 6) {
  288. /* if it's not sorted */
  289. if ($start_msg + ($show_num - 1) < $num_msgs){
  290. $end_msg = $start_msg + ($show_num - 1);
  291. } else {
  292. $end_msg = $num_msgs;
  293. }
  294. if ($end_msg < $start_msg) {
  295. $start_msg = $start_msg - $show_num;
  296. if ($start_msg < 1) {
  297. $start_msg = 1;
  298. }
  299. }
  300. $real_startMessage = $num_msgs - $start_msg + 1;
  301. $real_endMessage = $num_msgs - $start_msg - $show_num + 2;
  302. if ($real_endMessage <= 0) {
  303. $real_endMessage = 1;
  304. }
  305. $id = array_reverse(range($real_endMessage, $real_startMessage));
  306. }
  307. $msgs_list = sqimap_get_small_header_list($imapConnection, $id, $issent);
  308. // $flags = sqimap_get_flags_list($imapConnection, $id, $issent);
  309. if (sizeof($msgs_list)){
  310. foreach ($msgs_list as $hdr) {
  311. $from[] = $hdr->from;
  312. $date[] = $hdr->date;
  313. $subject[] = $hdr->subject;
  314. $to[] = $hdr->to;
  315. $priority[] = $hdr->priority;
  316. $cc[] = $hdr->cc;
  317. $size[] = $hdr->size;
  318. $type[] = $hdr->type0;
  319. $flag_deleted[] = $hdr->flag_deleted;
  320. $flag_answered[] = $hdr->flag_answered;
  321. $flag_seen[] = $hdr->flag_seen;
  322. $flag_flagged[] = $hdr->flag_flagged;
  323. }
  324. }
  325. }
  326. $j = 0;
  327. if ($sort == 6) {
  328. $end = $start_msg + $show_num - 1;
  329. if ($num_msgs < $show_num) {
  330. $end_loop = $num_msgs;
  331. } else if ($end > $num_msgs) {
  332. $end_loop = $num_msgs - $start_msg + 1;
  333. } else {
  334. $end_loop = $show_num;
  335. }
  336. } else {
  337. $end = $num_msgs;
  338. $end_loop = $end;
  339. }
  340. while ($j < $end_loop) {
  341. if (isset($date[$j])) {
  342. $date[$j] = str_replace(' ', ' ', $date[$j]);
  343. $tmpdate = explode(' ', trim($date[$j]));
  344. } else {
  345. $tmpdate = $date = array('', '', '', '', '', '');
  346. }
  347. $messages[$j]['TIME_STAMP'] = getTimeStamp($tmpdate);
  348. $messages[$j]['DATE_STRING'] =
  349. getDateString($messages[$j]['TIME_STAMP']);
  350. $messages[$j]['ID'] = $id[$j];
  351. $messages[$j]['FROM'] = decodeHeader($from[$j]);
  352. $messages[$j]['FROM-SORT'] =
  353. strtolower(sqimap_find_displayable_name(decodeHeader($from[$j])));
  354. $messages[$j]['SUBJECT'] = decodeHeader($subject[$j]);
  355. $messages[$j]['SUBJECT-SORT'] = strtolower(decodeHeader($subject[$j]));
  356. $messages[$j]['TO'] = decodeHeader($to[$j]);
  357. $messages[$j]['PRIORITY'] = $priority[$j];
  358. $messages[$j]['CC'] = $cc[$j];
  359. $messages[$j]['SIZE'] = $size[$j];
  360. $messages[$j]['TYPE0'] = $type[$j];
  361. $messages[$j]['FLAG_DELETED'] = $flag_deleted[$j];
  362. $messages[$j]['FLAG_ANSWERED'] = $flag_answered[$j];
  363. $messages[$j]['FLAG_SEEN'] = $flag_seen[$j];
  364. $messages[$j]['FLAG_FLAGGED'] = $flag_flagged[$j];
  365. /*
  366. * fix SUBJECT-SORT to remove Re:
  367. * vedr|sv (Danish)
  368. * re|aw (English)
  369. *
  370. * TODO: i18n should be incorporated here. E.g. we catch the ones
  371. * we know about, but also define in i18n what the localized
  372. * "Re: " is for this or that locale.
  373. */
  374. if (preg_match("/^(vedr|sv|re|aw):\s*(.*)$/si",
  375. $messages[$j]['SUBJECT-SORT'], $matches)){
  376. $messages[$j]['SUBJECT-SORT'] = $matches[2];
  377. }
  378. /*
  379. $num = 0;
  380. while ($num < count($flags[$j])) {
  381. if ($flags[$j][$num] == 'Deleted') {
  382. $messages[$j]['FLAG_DELETED'] = true;
  383. } else if ($flags[$j][$num] == 'Answered') {
  384. $messages[$j]['FLAG_ANSWERED'] = true;
  385. } else if ($flags[$j][$num] == 'Seen') {
  386. $messages[$j]['FLAG_SEEN'] = true;
  387. } else if ($flags[$j][$num] == 'Flagged') {
  388. $messages[$j]['FLAG_FLAGGED'] = true;
  389. }
  390. $num++;
  391. }
  392. */
  393. $j++;
  394. }
  395. /*
  396. * Only ignore messages flagged as deleted if we are
  397. * using a trash folder or auto_expunge
  398. */
  399. if (((isset($move_to_trash) && $move_to_trash)
  400. || (isset($auto_expunge) && $auto_expunge))
  401. && $sort != 6) {
  402. /* Find and remove the ones that are deleted */
  403. $i = 0;
  404. $j = 0;
  405. while ($j < $num_msgs) {
  406. if (isset($messages[$j]['FLAG_DELETED'])
  407. && $messages[$j]['FLAG_DELETED'] == true) {
  408. $j++;
  409. continue;
  410. }
  411. $msgs[$i] = $messages[$j];
  412. $i++;
  413. $j++;
  414. }
  415. $num_msgs = $i;
  416. } else {
  417. if (!isset($messages)) {
  418. $messages = array();
  419. }
  420. $msgs = $messages;
  421. }
  422. }
  423. /* There's gotta be messages in the array for it to sort them. */
  424. if (($num_msgs > 0) && (!$use_cache)) {
  425. /*
  426. * 0 = Date (up)
  427. * 1 = Date (dn)
  428. * 2 = Name (up)
  429. * 3 = Name (dn)
  430. * 4 = Subject (up)
  431. * 5 = Subject (dn)
  432. */
  433. session_unregister('msgs');
  434. if (($sort == 0) || ($sort == 1)) {
  435. $msort = array_cleave ($msgs, 'TIME_STAMP');
  436. } elseif (($sort == 2) || ($sort == 3)) {
  437. $msort = array_cleave ($msgs, 'FROM-SORT');
  438. } elseif (($sort == 4) || ($sort == 5)) {
  439. $msort = array_cleave ($msgs, 'SUBJECT-SORT');
  440. } else {
  441. $msort = $msgs;
  442. }
  443. if ($sort < 6) {
  444. if ($sort % 2) {
  445. asort($msort);
  446. } else {
  447. arsort($msort);
  448. }
  449. }
  450. session_register('msort');
  451. } elseif ($thread_sort_messages == 1 || $allow_server_sort == TRUE) {
  452. $msort = $msgs;
  453. session_unregister('msgs');
  454. session_register('msort');
  455. }
  456. displayMessageArray($imapConnection, $num_msgs, $start_msg, $msgs,
  457. $msort, $mailbox, $sort, $color,$show_num);
  458. /**
  459. * TODO: Switch to using $_SESSION[] whenever we ditch the 4.0.x series.
  460. */
  461. session_register('msgs');
  462. }
  463. /* Generic function to convert the msgs array into an HTML table. */
  464. function displayMessageArray($imapConnection, $num_msgs, $start_msg,
  465. &$msgs, $msort, $mailbox, $sort, $color,
  466. $show_num) {
  467. global $folder_prefix, $sent_folder,
  468. $imapServerAddress, $data_dir, $username, $use_mailbox_cache,
  469. $index_order, $real_endMessage, $real_startMessage, $checkall,
  470. $indent_array, $thread_sort_messages, $allow_server_sort, $server_sort_order;
  471. /* If cache isn't already set, do it now. */
  472. if (!session_is_registered('msgs')) {
  473. session_register('msgs');
  474. }
  475. if (!session_is_registered('msort')) {
  476. session_register('msort');
  477. }
  478. if ($start_msg + ($show_num - 1) < $num_msgs){
  479. $end_msg = $start_msg + ($show_num - 1);
  480. } else {
  481. $end_msg = $num_msgs;
  482. }
  483. if ($end_msg < $start_msg) {
  484. $start_msg = $start_msg - $show_num;
  485. if ($start_msg < 1) {
  486. $start_msg = 1;
  487. }
  488. }
  489. $urlMailbox = urlencode($mailbox);
  490. do_hook('mailbox_index_before');
  491. $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
  492. $paginator_str = get_paginator_str($urlMailbox, $start_msg, $end_msg,
  493. $num_msgs, $show_num, $sort);
  494. if (!isset($msg)) {
  495. $msg = '';
  496. }
  497. /* get indent level for subject display */
  498. if ($thread_sort_messages == 1 ) {
  499. $indent_array = get_parent_level($imapConnection);
  500. }
  501. $fstring = "move_messages.php?msg=$msg&amp;mailbox=$urlMailbox"
  502. . "&amp;startMessage=$start_msg";
  503. mail_message_listing_beginning($imapConnection, $fstring,
  504. $mailbox, $sort, $msg_cnt_str,
  505. $paginator_str, $start_msg);
  506. $groupNum = $start_msg % ($show_num - 1);
  507. $real_startMessage = $start_msg;
  508. if ($sort == 6) {
  509. if ($end_msg - $start_msg < $show_num - 1) {
  510. $end_msg = $end_msg - $start_msg + 1;
  511. $start_msg = 1;
  512. } else if ($start_msg > $show_num) {
  513. $end_msg = $show_num;
  514. $start_msg = 1;
  515. }
  516. }
  517. $endVar = $end_msg + 1;
  518. /*
  519. * Loop through and display the info for each message.
  520. * ($t is used for the checkbox number)
  521. */
  522. $t = 0;
  523. if ($num_msgs == 0) {
  524. /* if there's no messages in this folder */
  525. echo "<TR><TD BGCOLOR=\"$color[4]\" COLSPAN="
  526. . count($index_order) . ">\n"
  527. . " <CENTER><BR><B>". _("THIS FOLDER IS EMPTY")
  528. . "</B><BR>&nbsp;</CENTER>\n"
  529. . "</TD></TR>";
  530. } elseif ($start_msg == $end_msg) {
  531. /* if there's only one message in the box, handle it differently. */
  532. if ($sort != 6){
  533. $i = $start_msg;
  534. } else {
  535. $i = 1;
  536. }
  537. reset($msort);
  538. $k = 0;
  539. do {
  540. $key = key($msort);
  541. next($msort);
  542. $k++;
  543. } while (isset ($key) && ($k < $i));
  544. printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort,
  545. $real_startMessage, 0, 0);
  546. } else {
  547. $i = $start_msg;
  548. reset($msort);
  549. $k = 0;
  550. do {
  551. $key = key($msort);
  552. next($msort);
  553. $k++;
  554. } while (isset ($key) && ($k < $i));
  555. do {
  556. printMessageInfo($imapConnection, $t, $i, $key, $mailbox,
  557. $sort, $real_startMessage, 0, 0);
  558. $key = key($msort);
  559. $t++;
  560. $i++;
  561. next($msort);
  562. } while ($i && $i < $endVar);
  563. }
  564. echo '</table>'
  565. . "<table bgcolor=\"$color[9]\" width=\"100%\" border=0 cellpadding=1 "
  566. . "cellspacing=1><tr BGCOLOR=\"$color[4]\"><td>"
  567. . "<table width=\"100%\" BGCOLOR=\"$color[4]\" border=0 cellpadding=1 "
  568. . "cellspacing=0><tr><td>$paginator_str</td>"
  569. . "<td align=right>$msg_cnt_str</td></tr></table>"
  570. . "</td></tr></table>";
  571. /* End of message-list table */
  572. do_hook('mailbox_index_after');
  573. echo "</TABLE></FORM>\n";
  574. }
  575. /*
  576. * Displays the standard message list header. To finish the table,
  577. * you need to do a "</table></table>";
  578. *
  579. * $moveURL is the URL to submit the delete/move form to
  580. * $mailbox is the current mailbox
  581. * $sort is the current sorting method (-1 for no sorting available [searches])
  582. * $Message is a message that is centered on top of the list
  583. * $More is a second line that is left aligned
  584. */
  585. function mail_message_listing_beginning ($imapConnection, $moveURL,
  586. $mailbox = '', $sort = -1,
  587. $msg_cnt_str = '',
  588. $paginator = '&nbsp;',
  589. $start_msg = 1) {
  590. global $color, $index_order, $auto_expunge, $move_to_trash, $base_uri,
  591. $checkall, $sent_folder, $draft_folder, $thread_sort_messages,
  592. $allow_thread_sort, $allow_server_sort, $server_sort_order;
  593. $urlMailbox = urlencode($mailbox);
  594. /*
  595. * This is the beginning of the message list table.
  596. * It wraps around all messages
  597. */
  598. echo "<FORM name=messageList method=post action=\"$moveURL\">\n"
  599. . "<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"1\" "
  600. . "CELLSPACING=\"0\">\n<TR BGCOLOR=\"$color[0]\"><TD>"
  601. . " <TABLE BGCOLOR=\"$color[4]\" width=\"100%\" CELLPADDING=\"2\" "
  602. . "CELLSPACING=\"0\" BORDER=\"0\"><TR>\n"
  603. . " <TD ALIGN=LEFT>$paginator\n";
  604. echo " <TD ALIGN=RIGHT>$msg_cnt_str</TD>\n"
  605. . " </TR></TABLE>\n"
  606. . '</TD></TR>'
  607. . "<TR><TD BGCOLOR=\"$color[0]\">\n"
  608. . "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0"
  609. . "cellspacing=0 width=\"100%\">\n"
  610. . " <TR>\n"
  611. . " <TD ALIGN=LEFT VALIGN=MIDDLE NOWRAP>\n"
  612. . ' <SMALL>&nbsp;' . _("Move Selected To:") . "</SMALL>\n"
  613. . " </TD>\n"
  614. . " <TD ALIGN=RIGHT NOWRAP>\n"
  615. . ' <SMALL>&nbsp;' . _("Transform Selected Messages")
  616. . ": &nbsp; </SMALL><BR>\n"
  617. . " </TD>\n"
  618. . " </TR>\n"
  619. . " <TR>\n"
  620. . " <TD ALIGN=\"LEFT\" VALIGN=\"MIDDLE\" NOWRAP>\n"
  621. . ' <SMALL>&nbsp;<TT><SELECT NAME="targetMailbox">';
  622. $boxes = sqimap_mailbox_list($imapConnection);
  623. foreach ($boxes as $boxes_part) {
  624. if (!in_array('noselect', $boxes_part['flags'])) {
  625. $box = $boxes_part['unformatted'];
  626. $box2 = str_replace(' ', '&nbsp;', $boxes_part['unformatted-disp']);
  627. if( $box2 == 'INBOX' ) {
  628. $box2 = _("INBOX");
  629. }
  630. echo " <OPTION VALUE=\"$box\">$box2</option>\n";
  631. }
  632. }
  633. echo ' </SELECT></TT>&nbsp;'
  634. . '<INPUT TYPE="SUBMIT" NAME="moveButton" VALUE="' . _("Move") . '">&nbsp;'
  635. . '<INPUT TYPE="SUBMIT" NAME="attache" VALUE="' . _("Forward")
  636. . "\">&nbsp;\n" . "</SMALL>\n";
  637. echo " </TD>\n"
  638. . " <TD ALIGN=\"RIGHT\" NOWRAP>";
  639. if (!$auto_expunge) {
  640. echo '<INPUT TYPE=SUBMIT NAME="expungeButton" VALUE="' . _("Expunge")
  641. . '">&nbsp;' . _("mailbox") . '&nbsp;';
  642. }
  643. echo '<INPUT TYPE="SUBMIT" NAME="markRead" VALUE="' . _("Read") . '">'
  644. . '<INPUT TYPE="SUBMIT" NAME="markUnread" VALUE="' . _("Unread") . '">'
  645. . '<INPUT TYPE="SUBMIT" VALUE="' . _("Delete") . '">&nbsp;'
  646. . "</TD>\n"
  647. . " </TR>\n";
  648. /* draws thread sorting links */
  649. if ($allow_thread_sort == TRUE) {
  650. if ($thread_sort_messages == 1 ) {
  651. $set_thread = 2;
  652. $thread_name = 'Unthread View';
  653. }
  654. elseif ($thread_sort_messages == 0) {
  655. $set_thread = 1;
  656. $thread_name = 'Thread View';
  657. }
  658. echo '<tr><td>&nbsp;<a href=' . "$base_uri" . 'src/right_main.php?sort='
  659. . "$sort" . '&start_messages=1&set_thread=' . "$set_thread"
  660. . '&mailbox=' . urlencode($mailbox) . '><small>' . _("$thread_name")
  661. . '</a></small>&nbsp;</td></tr>';
  662. }
  663. echo "</TABLE>\n";
  664. do_hook('mailbox_form_before');
  665. echo '</TD></TR>'
  666. . "<TR><TD BGCOLOR=\"$color[0]\">"
  667. . '<TABLE WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=';
  668. if ($GLOBALS['alt_index_colors']){
  669. echo '0';
  670. } else {
  671. echo '1';
  672. }
  673. echo " BGCOLOR=\"$color[0]\">"
  674. . "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
  675. /* if using server sort we highjack the
  676. * the $sort var and use $server_sort_order
  677. * instead. but here we reset sort for a bit
  678. * since its easy
  679. */
  680. if ($allow_server_sort == TRUE) {
  681. $sort = $server_sort_order;
  682. }
  683. /* Print the headers. */
  684. for ($i=1; $i <= count($index_order); $i++) {
  685. switch ($index_order[$i]) {
  686. case 1: /* checkbox */
  687. case 5: /* flags */
  688. echo ' <TD WIDTH="1%"><B>&nbsp;</B></TD>';
  689. break;
  690. case 2: /* from */
  691. if (handleAsSent($mailbox)) {
  692. echo ' <TD WIDTH="25%"><B>' . _("To") . '</B>';
  693. } else {
  694. echo ' <TD WIDTH="25%"><B>' . _("From") . '</B>';
  695. }
  696. if ($allow_thread_sort != TRUE || $thread_sort_messages != 1) {
  697. ShowSortButton($sort, $mailbox, 2, 3);
  698. }
  699. echo "</TD>\n";
  700. break;
  701. case 3: /* date */
  702. echo ' <TD NOWRAP WIDTH="5%"><B>' . _("Date") . '</B>';
  703. if ($allow_thread_sort != TRUE || $thread_sort_messages != 1) {
  704. ShowSortButton($sort, $mailbox, 0, 1);
  705. }
  706. echo "</TD>\n";
  707. break;
  708. case 4: /* subject */
  709. echo ' <TD><B>' . _("Subject") . '</B> ';
  710. if ($allow_thread_sort != TRUE || $thread_sort_messages != 1) {
  711. ShowSortButton($sort, $mailbox, 4, 5);
  712. }
  713. echo "</TD>\n";
  714. break;
  715. case 6: /* size */
  716. echo ' <TD WIDTH="5%"><b>' . _("Size") . "</b></TD>\n";
  717. break;
  718. }
  719. }
  720. /* if using server-sorting,
  721. * send sort back to 6
  722. */
  723. if ($allow_server_sort == TRUE) {
  724. $sort = 6;
  725. }
  726. echo "</TR>\n";
  727. }
  728. /*
  729. * This function shows the sort button. Isn't this a good comment?
  730. */
  731. function ShowSortButton($sort, $mailbox, $Up, $Down) {
  732. /* Figure out which image we want to use. */
  733. if ($sort != $Up && $sort != $Down) {
  734. $img = 'sort_none.png';
  735. $which = $Up;
  736. } elseif ($sort == $Up) {
  737. $img = 'up_pointer.png';
  738. $which = $Down;
  739. } else {
  740. $img = 'down_pointer.png';
  741. $which = 6;
  742. }
  743. /* Now that we have everything figured out, show the actual button. */
  744. echo ' <a href="right_main.php?newsort=' . $which
  745. . '&amp;startMessage=1&amp;mailbox=' . urlencode($mailbox)
  746. . '"><IMG SRC="../images/' . $img
  747. . '" BORDER=0 WIDTH=12 HEIGHT=10></a>';
  748. }
  749. function get_selectall_link($start_msg, $sort) {
  750. global $checkall, $what, $where, $mailbox, $javascript_on;
  751. global $PHP_SELF, $PG_SHOWNUM;
  752. $result = '';
  753. if ($javascript_on) {
  754. $result =
  755. '<script language="JavaScript" type="text/javascript">'
  756. . "\n<!-- \n"
  757. . "function CheckAll() {\n"
  758. . " for (var i = 0; i < document.messageList.elements.length; i++) {\n"
  759. . " if(document.messageList.elements[i].type == 'checkbox'){\n"
  760. . " document.messageList.elements[i].checked = "
  761. . " !(document.messageList.elements[i].checked);\n"
  762. . " }\n"
  763. . " }\n"
  764. . "}\n"
  765. . "//-->\n"
  766. . '</script><a href="#" onClick="CheckAll();">' . _("Toggle All")
  767. . "</a>\n";
  768. } else {
  769. if (strpos($PHP_SELF, "?")) {
  770. $result .= "<a href=\"$PHP_SELF&amp;mailbox=" . urlencode($mailbox)
  771. . "&amp;startMessage=$start_msg&amp;sort=$sort&amp;checkall=";
  772. } else {
  773. $result .= "<a href=\"$PHP_SELF?mailbox=" . urlencode($mailbox)
  774. . "&amp;startMessage=$start_msg&amp;sort=$sort&amp;checkall=";
  775. }
  776. if (isset($checkall) && $checkall == '1') {
  777. $result .= '0';
  778. } else {
  779. $result .= '1';
  780. }
  781. if (isset($where) && isset($what)) {
  782. $result .= '&amp;where=' . urlencode($where)
  783. . '&amp;what=' . urlencode($what);
  784. }
  785. $result .= "\">";
  786. if (isset($checkall) && ($checkall == '1')) {
  787. $result .= _("Unselect All");
  788. } else {
  789. $result .= _("Select All");
  790. }
  791. $result .= "</A>\n";
  792. }
  793. /* Return our final result. */
  794. return ($result);
  795. }
  796. /*
  797. * This function computes the "Viewing Messages..." string.
  798. */
  799. function get_msgcnt_str($start_msg, $end_msg, $num_msgs) {
  800. /* Compute the $msg_cnt_str. */
  801. $result = '';
  802. if ($start_msg < $end_msg) {
  803. $result = sprintf(_("Viewing Messages: <B>%s</B> to <B>%s</B> (%s total)"),
  804. $start_msg, $end_msg, $num_msgs);
  805. } else if ($start_msg == $end_msg) {
  806. $result = sprintf(_("Viewing Message: <B>%s</B> (1 total)"), $start_msg);
  807. } else {
  808. $result = '<br>';
  809. }
  810. /* Return our result string. */
  811. return ($result);
  812. }
  813. /*
  814. * Generate a paginator link.
  815. */
  816. function get_paginator_link($box, $start_msg, $use, $text) {
  817. $result = "<A HREF=\"right_main.php?use_mailbox_cache=$use"
  818. . "&amp;startMessage=$start_msg&amp;mailbox=$box\" "
  819. . "TARGET=\"right\">$text</A>";
  820. return ($result);
  821. }
  822. /*
  823. * This function computes the paginator string.
  824. */
  825. function get_paginator_str($box, $start_msg, $end_msg, $num_msgs,
  826. $show_num, $sort) {
  827. global $username, $data_dir, $use_mailbox_cache, $color, $PG_SHOWNUM;
  828. /* Initialize paginator string chunks. */
  829. $prv_str = '';
  830. $nxt_str = '';
  831. $pg_str = '';
  832. $all_str = '';
  833. $tgl_str = '';
  834. /* Create simple strings that will be creating the paginator. */
  835. $spc = '&nbsp;'; /* This will be used as a space. */
  836. $sep = '|'; /* This will be used as a seperator. */
  837. /* Get some paginator preference values. */
  838. $pg_sel = getPref($data_dir, $username, 'page_selector', SMPREF_ON);
  839. $pg_max = getPref($data_dir, $username, 'page_selector_max', PG_SEL_MAX);
  840. /* Make sure that our start message number is not too big. */
  841. $start_msg = min($start_msg, $num_msgs);
  842. /* Decide whether or not we will use the mailbox cache. */
  843. /* Not sure why $use_mailbox_cache is even passed in. */
  844. if ($sort == 6) {
  845. $use = 0;
  846. } else {
  847. $use = 1;
  848. }
  849. /* Compute the starting message of the previous and next page group. */
  850. $next_grp = $start_msg + $show_num;
  851. $prev_grp = $start_msg - $show_num;
  852. /* Compute the basic previous and next strings. */
  853. if (($next_grp <= $num_msgs) && ($prev_grp >= 0)) {
  854. $prv_str = get_paginator_link($box, $prev_grp, $use, _("Previous"));
  855. $nxt_str = get_paginator_link($box, $next_grp, $use, _("Next"));
  856. } else if (($next_grp > $num_msgs) && ($prev_grp >= 0)) {
  857. $prv_str = get_paginator_link($box, $prev_grp, $use, _("Previous"));
  858. $nxt_str = "<FONT COLOR=\"$color[9]\">"._("Next")."</FONT>\n";
  859. } else if (($next_grp <= $num_msgs) && ($prev_grp < 0)) {
  860. $prv_str = "<FONT COLOR=\"$color[9]\">"._("Previous") . '</FONT>';
  861. $nxt_str = get_paginator_link($box, $next_grp, $use, _("Next"));
  862. }
  863. /* Page selector block. Following code computes page links. */
  864. if ($pg_sel && ($num_msgs > $show_num)) {
  865. /* Most importantly, what is the current page!!! */
  866. $cur_pg = intval($start_msg / $show_num) + 1;
  867. /* Compute total # of pages and # of paginator page links. */
  868. $tot_pgs = ceil($num_msgs / $show_num); /* Total number of Pages */
  869. $vis_pgs = min($pg_max, $tot_pgs - 1); /* Visible Pages */
  870. /* Compute the size of the four quarters of the page links. */
  871. /* If we can, just show all the pages. */
  872. if (($tot_pgs - 1) <= $pg_max) {
  873. $q1_pgs = $cur_pg - 1;
  874. $q2_pgs = $q3_pgs = 0;
  875. $q4_pgs = $tot_pgs - $cur_pg;
  876. /* Otherwise, compute some magic to choose the four quarters. */
  877. } else {
  878. /*
  879. * Compute the magic base values. Added together,
  880. * these values will always equal to the $pag_pgs.
  881. * NOTE: These are DEFAULT values and do not take
  882. * the current page into account. That is below.
  883. */
  884. $q1_pgs = floor($vis_pgs/4);
  885. $q2_pgs = round($vis_pgs/4, 0);
  886. $q3_pgs = ceil($vis_pgs/4);
  887. $q4_pgs = round(($vis_pgs - $q2_pgs)/3, 0);
  888. /* Adjust if the first quarter contains the current page. */
  889. if (($cur_pg - $q1_pgs) < 1) {
  890. $extra_pgs = ($q1_pgs - ($cur_pg - 1)) + $q2_pgs;
  891. $q1_pgs = $cur_pg - 1;
  892. $q2_pgs = 0;
  893. $q3_pgs += ceil($extra_pgs / 2);
  894. $q4_pgs += floor($extra_pgs / 2);
  895. /* Adjust if the first and second quarters intersect. */
  896. } else if (($cur_pg - $q2_pgs - ceil($q2_pgs/3)) <= $q1_pgs) {
  897. $extra_pgs = $q2_pgs;
  898. $extra_pgs -= ceil(($cur_pg - $q1_pgs - 1) * 0.75);
  899. $q2_pgs = ceil(($cur_pg - $q1_pgs - 1) * 0.75);
  900. $q3_pgs += ceil($extra_pgs / 2);
  901. $q4_pgs += floor($extra_pgs / 2);
  902. /* Adjust if the fourth quarter contains the current page. */
  903. } else if (($cur_pg + $q4_pgs) >= $tot_pgs) {
  904. $extra_pgs = ($q4_pgs - ($tot_pgs - $cur_pg)) + $q3_pgs;
  905. $q3_pgs = 0;
  906. $q4_pgs = $tot_pgs - $cur_pg;
  907. $q1_pgs += floor($extra_pgs / 2);
  908. $q2_pgs += ceil($extra_pgs / 2);
  909. /* Adjust if the third and fourth quarter intersect. */
  910. } else if (($cur_pg + $q3_pgs + 1) >= ($tot_pgs - $q4_pgs + 1)) {
  911. $extra_pgs = $q3_pgs;
  912. $extra_pgs -= ceil(($tot_pgs - $cur_pg - $q4_pgs) * 0.75);
  913. $q3_pgs = ceil(($tot_pgs - $cur_pg - $q4_pgs) * 0.75);
  914. $q1_pgs += floor($extra_pgs / 2);
  915. $q2_pgs += ceil($extra_pgs / 2);
  916. }
  917. }
  918. /*
  919. * I am leaving this debug code here, commented out, because
  920. * it is a really nice way to see what the above code is doing.
  921. * echo "qts = $q1_pgs/$q2_pgs/$q3_pgs/$q4_pgs = "
  922. * . ($q1_pgs + $q2_pgs + $q3_pgs + $q4_pgs) . '<br>';
  923. */
  924. /* Print out the page links from the compute page quarters. */
  925. /* Start with the first quarter. */
  926. if (($q1_pgs == 0) && ($cur_pg > 1)) {
  927. $pg_str .= "...$spc";
  928. } else {
  929. for ($pg = 1; $pg <= $q1_pgs; ++$pg) {
  930. $start = (($pg-1) * $show_num) + 1;
  931. $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
  932. }
  933. if ($cur_pg - $q2_pgs - $q1_pgs > 1) {
  934. $pg_str .= "...$spc";
  935. }
  936. }
  937. /* Continue with the second quarter. */
  938. for ($pg = $cur_pg - $q2_pgs; $pg < $cur_pg; ++$pg) {
  939. $start = (($pg-1) * $show_num) + 1;
  940. $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
  941. }
  942. /* Now print the current page. */
  943. $pg_str .= $cur_pg . $spc;
  944. /* Next comes the third quarter. */
  945. for ($pg = $cur_pg + 1; $pg <= $cur_pg + $q3_pgs; ++$pg) {
  946. $start = (($pg-1) * $show_num) + 1;
  947. $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
  948. }
  949. /* And last, print the forth quarter page links. */
  950. if (($q4_pgs == 0) && ($cur_pg < $tot_pgs)) {
  951. $pg_str .= "...$spc";
  952. } else {
  953. if (($tot_pgs - $q4_pgs) > ($cur_pg + $q3_pgs)) {
  954. $pg_str .= "...$spc";
  955. }
  956. for ($pg = $tot_pgs - $q4_pgs + 1; $pg <= $tot_pgs; ++$pg) {
  957. $start = (($pg-1) * $show_num) + 1;
  958. $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
  959. }
  960. }
  961. } else if ($PG_SHOWNUM == 999999) {
  962. $pg_str = "<A HREF=\"right_main.php?PG_SHOWALL=0"
  963. . "&amp;use_mailbox_cache=$use&amp;startMessage=1&amp;mailbox=$box\" "
  964. . "TARGET=\"right\">" ._("Paginate") . '</A>' . $spc;
  965. }
  966. /* If necessary, compute the 'show all' string. */
  967. if (($prv_str != '') || ($nxt_str != '')) {
  968. $all_str = "<A HREF=\"right_main.php?PG_SHOWALL=1"
  969. . "&amp;use_mailbox_cache=$use&amp;startMessage=1&amp;mailbox=$box\" "
  970. . "TARGET=\"right\">" . _("Show All") . '</A>';
  971. }
  972. /* Last but not least, get the value for the toggle all link. */
  973. $tgl_str = get_selectall_link($start_msg, $sort);
  974. /* Put all the pieces of the paginator string together. */
  975. /**
  976. * Hairy code... But let's leave it like it is since I am not certain
  977. * a different approach would be any easier to read. ;)
  978. */
  979. $result = '';
  980. $result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : '');
  981. $result .= ($nxt_str != '' ? $nxt_str . $spc . $sep . $spc : '');
  982. $result .= ($pg_str != '' ? $pg_str : '');
  983. $result .= ($all_str != '' ? $sep . $spc . $all_str . $spc : '');
  984. $result .= ($result != '' ? $sep . $spc . $tgl_str: $tgl_str);
  985. /* If the resulting string is blank, return a non-breaking space. */
  986. if ($result == '') {
  987. $result = '&nbsp;';
  988. }
  989. /* Return our final magical paginator string. */
  990. return ($result);
  991. }
  992. function processSubject($subject) {
  993. /* Shouldn't ever happen -- caught too many times in the IMAP functions */
  994. if ($subject == '')
  995. return _("(no subject)");
  996. if (strlen($subject) <= 55)
  997. return $subject;
  998. $ent_strlen=strlen($subject);
  999. $trim_val=50;
  1000. $ent_offset=0;
  1001. /*
  1002. * see if this is entities-encoded string
  1003. * If so, Iterate through the whole string, find out
  1004. * the real number of characters, and if more
  1005. * than 55, substr with an updated trim value.
  1006. */
  1007. while ( (($ent_loc = strpos($subject, '&', $ent_offset)) !== false) &&
  1008. (($ent_loc_end = strpos($subject, ';', $ent_loc)) !== false) ) {
  1009. $trim_val += ($ent_loc_end-$ent_loc)+1;
  1010. $ent_strlen -= $ent_loc_end-$ent_loc;
  1011. $ent_offset = $ent_loc_end+1;
  1012. }
  1013. if ($ent_strlen <= 55){
  1014. return $subject;
  1015. }
  1016. return substr($subject, 0, $trim_val) . '...';
  1017. }
  1018. function handleAsSent($mailbox) {
  1019. global $sent_folder, $draft_folder, $handleAsSent_result;
  1020. /* First check if this is the sent or draft folder. */
  1021. $handleAsSent_result = (($mailbox == $sent_folder)
  1022. || ($mailbox == $draft_folder));
  1023. /* Then check the result of the handleAsSent hook. */
  1024. do_hook('check_handleAsSent_result', $mailbox);
  1025. /* And return the result. */
  1026. return ($handleAsSent_result);
  1027. }
  1028. ?>