Source for file search.php

Documentation is available at search.php

  1. <?php
  2. /**
  3. * search.php
  4. *
  5. * IMAP search page
  6. *
  7. * @copyright 1999-2020 The SquirrelMail Project Team
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @version $Id: search.php 14840 2020年01月07日 07:42:38Z pdontthink $
  10. * @package squirrelmail
  11. * @subpackage search
  12. */
  13. /** This is the search page */
  14. define ('PAGE_NAME', 'search');
  15. /**
  16. * Path for SquirrelMail required files.
  17. * @ignore
  18. */
  19. define ('SM_PATH','../');
  20. /** SquirrelMail required files.
  21. */
  22. require_once(SM_PATH . 'include/validate.php');
  23. require_once(SM_PATH . 'functions/imap.php');
  24. require_once(SM_PATH . 'functions/imap_search.php');
  25. require_once(SM_PATH . 'functions/imap_mailbox.php');
  26. require_once(SM_PATH . 'functions/strings.php');
  27. require_once(SM_PATH . 'functions/forms.php');
  28. global $allow_thread_sort;
  29. /* get globals we may need */
  30. sqgetGlobalVar ('username', $username, SQ_SESSION );
  31. sqgetGlobalVar ('key', $key, SQ_COOKIE );
  32. sqgetGlobalVar ('delimiter', $delimiter, SQ_SESSION );
  33. sqgetGlobalVar ('onetimepad', $onetimepad, SQ_SESSION );
  34. sqgetGlobalVar ('composenew' , $composenew, SQ_FORM );
  35. sqgetGlobalVar ('composesession' , $composesession , SQ_SESSION );
  36. if (!sqgetGlobalVar ('mailbox',$mailbox,SQ_GET )) {
  37. unset($mailbox);
  38. }
  39. if (!sqgetGlobalVar ('submit',$submit,SQ_GET )) {
  40. $submit = '';
  41. }
  42. if (!sqgetGlobalVar ('what',$what,SQ_GET )) {
  43. $what='';
  44. }
  45. if (! sqgetGlobalVar ('where',$where,SQ_GET ) ||
  46. ! in_array ( $where, array('BODY','TEXT','SUBJECT','FROM','CC','TO','TO_CC','TO_CC_FROM','TO_CC_FROM_SUBJECT'))) {
  47. // make sure that 'where' is one if standard IMAP SEARCH keywords
  48. if (isset($mailbox) && isSentMailbox ($mailbox, TRUE))
  49. $where = 'TO';
  50. else
  51. $where = 'FROM';
  52. }
  53. if ( !sqgetGlobalVar ('preselected', $preselected, SQ_GET ) || !is_array ($preselected)) {
  54. $preselected = array();
  55. } else {
  56. $preselected = array_keys ($preselected);
  57. }
  58. if (!sqgetGlobalVar ('checkall',$checkall,SQ_GET )) {
  59. unset($checkall);
  60. }
  61. if (sqgetGlobalVar ('count',$count,SQ_GET )) {
  62. $count = (int) $count;
  63. } else {
  64. unset($count);
  65. }
  66. if (!sqgetGlobalVar ('smtoken',$submitted_token, SQ_GET )) {
  67. $submitted_token = '';
  68. }
  69. /* end of get globals */
  70. /* here are some functions, could go in imap_search.php
  71. this was here, pretty handy */
  72. function s_opt ( $val, $sel, $tit ) {
  73. echo " <option value=\"$val\"";
  74. if ( $sel == $val ) {
  75. echo ' selected="selected"';
  76. }
  77. echo ">$tit</option>\n";
  78. }
  79. /* function to get the recent searches and put them in the attributes array */
  80. function get_recent ($username, $data_dir) {
  81. $attributes = array();
  82. $types = array('search_what', 'search_where', 'search_folder');
  83. $recent_count = getPref ($data_dir, $username, 'search_memory', 0);
  84. for ($x=1;$x<=$recent_count;$x++) {
  85. reset ($types);
  86. foreach ($types as $key) {
  87. $attributes[$key][$x] = getPref ($data_dir, $username, $key.$x, "");
  88. }
  89. }
  90. return $attributes;
  91. }
  92. /* function to get the saved searches and put them in the saved_attributes array */
  93. function get_saved ($username, $data_dir) {
  94. $saved_attributes = array();
  95. $types = array('saved_what', 'saved_where', 'saved_folder');
  96. foreach ($types as $key) {
  97. for ($x=1;;$x++) {
  98. $prefval = getPref ($data_dir, $username, $key."$x", "");
  99. if ($prefval == "") {
  100. break;
  101. } else {
  102. $saved_attributes[$key][$x] = $prefval;
  103. }
  104. }
  105. }
  106. return $saved_attributes;
  107. }
  108. /* function to update recent pref arrays */
  109. function update_recent ($what, $where, $mailbox, $username, $data_dir) {
  110. $attributes = array();
  111. $types = array('search_what', 'search_where', 'search_folder');
  112. $input = array($what, $where, $mailbox);
  113. $attributes = get_recent ( $username, $data_dir);
  114. reset ($types);
  115. $dupe = 'no';
  116. for ($i=1;$i<=count ($attributes['search_what']);$i++) {
  117. if (isset($attributes['search_what'][$i])) {
  118. if ($what == $attributes['search_what'][$i] &&
  119. $where == $attributes['search_where'][$i] &&
  120. $mailbox == $attributes['search_folder'][$i]) {
  121. $dupe = 'yes';
  122. }
  123. }
  124. }
  125. if ($dupe == 'no') {
  126. $i = 0;
  127. foreach ($types as $key) {
  128. array_push ($attributes[$key], $input[$i]);
  129. array_shift ($attributes[$key]);
  130. $i++;
  131. }
  132. $recent_count = getPref ($data_dir, $username, 'search_memory', 0);
  133. $n=0;
  134. for ($i=1;$i<=$recent_count;$i++) {
  135. reset ($types);
  136. foreach ($types as $key) {
  137. setPref ($data_dir, $username, $key.$i, $attributes[$key][$n]);
  138. }
  139. $n++;
  140. }
  141. }
  142. }
  143. /* function to forget a recent search */
  144. function forget_recent ($forget_index, $username, $data_dir) {
  145. $attributes = array();
  146. $types = array('search_what', 'search_where', 'search_folder');
  147. $attributes = get_recent ( $username, $data_dir);
  148. reset ($types);
  149. foreach ($types as $key) {
  150. array_splice ($attributes[$key], $forget_index - 1, 1);
  151. array_unshift ($attributes[$key], '');
  152. }
  153. reset ($types);
  154. $recent_count = getPref ($data_dir, $username, 'search_memory', 0);
  155. $n=0;
  156. for ($i=1;$i<=$recent_count;$i++) {
  157. reset ($types);
  158. foreach ($types as $key) {
  159. setPref ($data_dir, $username, $key.$i, $attributes[$key][$n]);
  160. }
  161. $n++;
  162. }
  163. }
  164. /* function to delete a saved search */
  165. function delete_saved ($delete_index, $username, $data_dir) {
  166. $types = array('saved_what', 'saved_where', 'saved_folder');
  167. $attributes = get_saved ($username, $data_dir);
  168. foreach ($types as $key) {
  169. array_splice ($attributes[$key], $delete_index, 1);
  170. }
  171. reset ($types);
  172. $n=0;
  173. $saved_count = count ($attributes['saved_what']);
  174. $last_element = $saved_count + 1;
  175. for ($i=1;$i<=$saved_count;$i++) {
  176. reset ($types);
  177. foreach ($types as $key) {
  178. setPref ($data_dir, $username, $key.$i, $attributes[$key][$n]);
  179. }
  180. $n++;
  181. }
  182. reset ($types);
  183. foreach($types as $key) {
  184. removePref ($data_dir, $username, $key.$last_element);
  185. }
  186. }
  187. /* function to save a search from recent to saved */
  188. function save_recent ($save_index, $username, $data_dir) {
  189. $attributes = array();
  190. $types = array('search_what', 'search_where', 'search_folder');
  191. $saved_types = array(0 => 'saved_what', 1 => 'saved_where', 2 => 'saved_folder');
  192. $saved_array = get_saved ($username, $data_dir);
  193. $save_index = $save_index -1;
  194. if (isset($saved_array['saved_what'])) {
  195. $saved_count = (count ($saved_array['saved_what']) + 1);
  196. } else {
  197. // there are no saved searches. Function is used to save first search
  198. $saved_count = 1;
  199. }
  200. $attributes = get_recent ($username, $data_dir);
  201. $n = 0;
  202. foreach ($types as $key) {
  203. $slice = array_slice ($attributes[$key], $save_index, 1);
  204. $name = $saved_types[$n];
  205. setPref ($data_dir, $username, $name.$saved_count, $slice[0]);
  206. $n++;
  207. }
  208. }
  209. function printSearchMessages ($msgs,$mailbox, $cnt, $imapConnection, $where, $what, $usecache = false, $newsort = false) {
  210. global $sort, $color, $allow_server_sort , $allow_server_thread;
  211. if ($cnt > 0) {
  212. if ((!empty($allow_server_sort) && $allow_server_sort) || (!empty($allow_server_thread) && $allow_server_thread)) {
  213. $msort = $msgs;
  214. } else {
  215. $msort = calc_msort ($msgs, $sort, $mailbox);
  216. }
  217. if ( $mailbox == 'INBOX' ) {
  218. $showbox = _ ("INBOX");
  219. } else {
  220. $showbox = imap_utf7_decode_local ($mailbox);
  221. }
  222. echo html_tag ( 'div', '<b><big>' . _ ("Folder:") . ' '.
  223. sm_encode_html_special_chars ($showbox) .'</big></b>','center') . "\n";
  224. $msg_cnt_str = get_msgcnt_str (1, $cnt, $cnt);
  225. $toggle_all = get_selectall_link (1, $sort);
  226. do_hook ('search_index_before');
  227. $safe_name = preg_replace ("/[^0-9A-Za-z_]/", '_', $mailbox);
  228. $form_name = "FormMsgs" . $safe_name;
  229. echo '<form name="' . $form_name . '" method="post" action="move_messages.php">' ."\n" .
  230. '<input type="hidden" name="mailbox" value="'.sm_encode_html_special_chars ($mailbox).'">' . "\n" .
  231. '<input type="hidden" name="startMessage" value="1">' . "\n" .
  232. addHidden ('smtoken', sm_generate_security_token ()) . "\n";
  233. echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
  234. echo '<tr><td>';
  235. mail_message_listing_beginning ($imapConnection, $mailbox, $sort,
  236. $msg_cnt_str, $toggle_all, 1);
  237. echo '<tr><td height="5" bgcolor="'.$color[4].'"></td></tr>';
  238. echo '<tr><td>';
  239. echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
  240. echo ' <tr><td>';
  241. echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[5].'">';
  242. printHeader ($mailbox, 6, $color, false);
  243. displayMessageArray ($imapConnection, $cnt, 1,
  244. $msort, $mailbox, $sort, $color, $cnt, $where, $what);
  245. echo '</table></td></tr></table>';
  246. // space for paginator argument is intentional, so html_tag() closes the tag
  247. mail_message_listing_end ($cnt, ' ', $msg_cnt_str, $color);
  248. echo "\n</table></form>\n\n";
  249. }
  250. }
  251. /* ------------------------ main ------------------------ */
  252. /* reset these arrays on each page load just in case */
  253. $attributes = array ();
  254. $saved_attributes = array ();
  255. $search_all = 'none';
  256. $perbox_count = array ();
  257. $recent_count = getPref ($data_dir, $username, 'search_memory', 0);
  258. /* get mailbox names */
  259. global $imap_stream_options; // in case not defined in config
  260. $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
  261. $boxes = sqimap_mailbox_list ($imapConnection);
  262. /* set current mailbox to INBOX if none was selected or if page
  263. was called to search all folders. */
  264. if ( !isset($mailbox) || $mailbox == 'None' || $mailbox == '' ) {
  265. $mailbox = $boxes[0]['unformatted'];
  266. }
  267. if ($mailbox == 'All Folders') {
  268. $search_all = 'all';
  269. }
  270. // the preg_match() is a fix for Dovecot wherein UIDs can be bigger than
  271. // normal integers - this isn't in 1.4 yet, but when adding new code, why not...
  272. if (sqgetGlobalVar ('unread_passed_id', $unread_passed_id, SQ_GET )
  273. && preg_match ('/^[0-9]+$/', $unread_passed_id)) {
  274. sqimap_mailbox_select ($imapConnection, $mailbox);
  275. sqimap_toggle_flag ($imapConnection, $unread_passed_id, '\\Seen', false, true);
  276. }
  277. if (isset($composenew) && $composenew) {
  278. $comp_uri = "../src/compose.php?mailbox=". urlencode ($mailbox).
  279. "&amp;session=$composesession&amp";
  280. displayPageHeader ($color, $mailbox, "comp_in_new('$comp_uri');", false);
  281. } else {
  282. displayPageHeader ($color, $mailbox);
  283. }
  284. /* See how the page was called and fire off correct function */
  285. if (empty($submit) && !empty($what)) {
  286. $submit = _ ("Search");
  287. }
  288. // need to verify security token if user wants to do anything
  289. if (!empty($submit)) {
  290. sm_validate_security_token ($submitted_token, -1, TRUE);
  291. }
  292. if ($submit == 'forget' && isset($count)) {
  293. forget_recent ($count, $username, $data_dir);
  294. }
  295. elseif ($submit == 'save' && isset($count)) {
  296. save_recent ($count, $username, $data_dir);
  297. }
  298. elseif ($submit == 'delete' && isset($count)) {
  299. delete_saved ($count, $username, $data_dir);
  300. }
  301. elseif (!empty($submit) && !empty($what)) {
  302. $submit = _ ("Search");
  303. if ($recent_count > 0) {
  304. update_recent ($what, $where, $mailbox, $username, $data_dir);
  305. }
  306. }
  307. do_hook ('search_before_form');
  308. echo html_tag ( 'table',
  309. html_tag ( 'tr', "\n" .
  310. html_tag ( 'td', '<b>' . _ ("Search") . '</b>', 'center', $color[0] )
  311. ) ,
  312. '', '', 'width="100%"') . "\n";
  313. /* update the recent and saved searches from the pref files */
  314. $attributes = get_recent ($username, $data_dir);
  315. $saved_attributes = get_saved ($username, $data_dir);
  316. if (isset($saved_attributes['saved_what'])) {
  317. $saved_count = count ($saved_attributes['saved_what']);
  318. } else {
  319. $saved_count = 0;
  320. }
  321. $count_all = 0;
  322. /* Saved Search Table */
  323. if ($saved_count > 0) {
  324. echo "<br />\n"
  325. . html_tag ( 'table', '', 'center', $color[9], 'width="95%" cellpadding="1" cellspacing="1" border="0"' )
  326. . html_tag ( 'tr',
  327. html_tag ( 'td', '<b>'._ ("Saved Searches") . '</b>', 'center' )
  328. )
  329. . html_tag ( 'tr' )
  330. . html_tag ( 'td' )
  331. . html_tag ( 'table', '', 'center', '', 'width="100%" cellpadding="2" cellspacing="2" border="0"' );
  332. for ($i=0; $i < $saved_count; ++$i) {
  333. if ($i % 2) {
  334. echo html_tag ( 'tr', '', '', $color[0] );
  335. } else {
  336. echo html_tag ( 'tr', '', '', $color[4] );
  337. }
  338. echo html_tag ( 'td', sm_encode_html_special_chars (imap_utf7_decode_local ($saved_attributes['saved_folder'][$i + 1])), 'left', '', 'width="35%"' )
  339. . html_tag ( 'td', sm_encode_html_special_chars ($saved_attributes['saved_what'][$i + 1]), 'left', '', 'width="35%"' )
  340. . html_tag ( 'td', sm_encode_html_special_chars ($saved_attributes['saved_where'][$i + 1]), 'center' )
  341. . html_tag ( 'td', '', 'right' )
  342. . '<a href="search.php'
  343. . '?mailbox=' . urlencode ($saved_attributes['saved_folder'][$i + 1])
  344. . '&amp;what=' . urlencode ($saved_attributes['saved_what'][$i + 1])
  345. . '&amp;where=' . urlencode ($saved_attributes['saved_where'][$i + 1])
  346. . '&amp;smtoken=' . sm_generate_security_token ()
  347. . '">' . _ ("edit") . '</a>'
  348. . '&nbsp;|&nbsp;'
  349. . '<a href="search.php'
  350. . '?mailbox=' . urlencode ($saved_attributes['saved_folder'][$i + 1])
  351. . '&amp;what=' . urlencode ($saved_attributes['saved_what'][$i + 1])
  352. . '&amp;where=' . urlencode ($saved_attributes['saved_where'][$i + 1])
  353. . '&amp;submit=Search_no_update'
  354. . '&amp;smtoken=' . sm_generate_security_token ()
  355. . '">' . _ ("search") . '</a>'
  356. . '&nbsp;|&nbsp;'
  357. . "<a href=\"search.php?count=$i&amp;submit=delete&amp;smtoken=" . sm_generate_security_token () .'">'
  358. . _ ("delete")
  359. . '</a>'
  360. . '</td></tr>';
  361. }
  362. echo "</table></td></tr></table>\n";
  363. }
  364. if ($recent_count > 0) {
  365. echo "<br />\n"
  366. . html_tag ( 'table', '', 'center', $color[9], 'width="95%" cellpadding="1" cellspacing="1" border="0"' )
  367. . html_tag ( 'tr',
  368. html_tag ( 'td', '<b>' . _ ("Recent Searches") . '</b>', 'center' )
  369. )
  370. . html_tag ( 'tr' )
  371. . html_tag ( 'td' )
  372. . html_tag ( 'table', '', 'center', '', 'width="100%" cellpadding="0" cellspacing="0" border="0"' );
  373. for ($i=1; $i <= $recent_count; ++$i) {
  374. if (isset($attributes['search_folder'][$i])) {
  375. if ($attributes['search_folder'][$i] == "") {
  376. $attributes['search_folder'][$i] = "INBOX";
  377. }
  378. }
  379. if ($i % 2) {
  380. echo html_tag ( 'tr', '', '', $color[0] );
  381. } else {
  382. echo html_tag ( 'tr', '', '', $color[0] );
  383. }
  384. if (isset($attributes['search_what'][$i]) &&
  385. !empty($attributes['search_what'][$i])) {
  386. echo html_tag ( 'td', sm_encode_html_special_chars (imap_utf7_decode_local ($attributes['search_folder'][$i])), 'left', '', 'width="35%"' )
  387. . html_tag ( 'td', sm_encode_html_special_chars ($attributes['search_what'][$i]), 'left', '', 'width="35%"' )
  388. . html_tag ( 'td', sm_encode_html_special_chars ($attributes['search_where'][$i]), 'center' )
  389. . html_tag ( 'td', '', 'right' )
  390. . "<a href=\"search.php?count=$i&amp;submit=save&amp;smtoken=" . sm_generate_security_token () . '">'
  391. . _ ("save")
  392. . '</a>'
  393. . '&nbsp;|&nbsp;'
  394. . '<a href="search.php'
  395. . '?mailbox=' . urlencode ($attributes['search_folder'][$i])
  396. . '&amp;what=' . urlencode ($attributes['search_what'][$i])
  397. . '&amp;where=' . urlencode ($attributes['search_where'][$i])
  398. . '&amp;submit=Search_no_update'
  399. . '&amp;smtoken=' . sm_generate_security_token ()
  400. . '">' . _ ("search") . '</a>'
  401. . '&nbsp;|&nbsp;'
  402. . "<a href=\"search.php?count=$i&amp;submit=forget&amp;smtoken=" . sm_generate_security_token () . '">'
  403. . _ ("forget")
  404. . '</a>'
  405. . '</td></tr>';
  406. }
  407. }
  408. echo '</table></td></tr></table><br />';
  409. }
  410. /** FIXME: remove or fix it. $newsort is not set and not extracted from request
  411. if (isset($newsort)) {
  412. $sort = $newsort;
  413. sqsession_register($sort, 'sort');
  414. }*/
  415. /*********************************************************************
  416. * Check to see if we can use cache or not. Currently the only time *
  417. * when you will not use it is when a link on the left hand frame is *
  418. * used. Also check to make sure we actually have the array in the *
  419. * registered session data. :) *
  420. *********************************************************************/
  421. /** FIXME: remove or fix it. $use_mailbox_cache is not set and not extracted from request
  422. if (! isset($use_mailbox_cache)) {
  423. $use_mailbox_cache = 0;
  424. }*/
  425. /* There is a problem with registered vars in 4.1 */
  426. /*
  427. if( substr( phpversion(), 0, 3 ) == '4.1' ) {
  428. $use_mailbox_cache = FALSE;
  429. }
  430. */
  431. /* Search Form */
  432. echo html_tag ( 'div', '<b>' . _ ("Current Search") . '</b>', 'left' ) . "\n"
  433. . '<form action="search.php" name="s">'
  434. . '<select name="mailbox">'
  435. . '<option value="All Folders"';
  436. if ($mailbox == 'All Folders') {
  437. echo ' selected="selected"';
  438. }
  439. echo '>[ ' . _ ("All Folders") . " ]</option>\n";
  440. $show_selected = array(strtolower ($mailbox));
  441. echo sqimap_mailbox_option_list ($imapConnection, $show_selected, 0, $boxes);
  442. // FIXME: explain all str_replace calls.
  443. $what_disp = str_replace (',', ' ', $what);
  444. $what_disp = str_replace ('\\\\', '\\', $what_disp);
  445. $what_disp = str_replace ('\\"', '"', $what_disp);
  446. $what_disp = str_replace ('"', '&quot;', $what_disp);
  447. echo ' </select>'
  448. . '<input type="text" size="35" name="what" value="' . $what_disp . '" />'
  449. . "<select name=\"where\">";
  450. s_opt ( 'BODY', $where, _ ("Body") );
  451. s_opt ( 'TEXT', $where, _ ("Everywhere") );
  452. s_opt ( 'SUBJECT', $where, _ ("Subject") );
  453. s_opt ( 'FROM', $where, _ ("From") );
  454. s_opt ( 'CC', $where, _ ("Cc") );
  455. s_opt ( 'TO', $where, _ ("To") );
  456. s_opt ( 'TO_CC', $where, _ ("To/Cc") );
  457. s_opt ( 'TO_CC_FROM', $where, _ ("To/Cc/From") );
  458. s_opt ( 'TO_CC_FROM_SUBJECT', $where, _ ("To/Cc/From/Subject") );
  459. echo " </select>\n"
  460. . '<input type="submit" name="submit" value="' . _ ("Search") . '" />'
  461. . "</form>\n";
  462. do_hook ('search_after_form');
  463. flush ();
  464. /*
  465. search all folders option still in the works. returns a table for each
  466. folder it finds a match in.
  467. */
  468. $old_value = 0;
  469. if ($allow_thread_sort == TRUE) {
  470. $old_value = $allow_thread_sort;
  471. $allow_thread_sort = FALSE;
  472. }
  473. if ($search_all == 'all') {
  474. $mailbox == '';
  475. $boxcount = count ($boxes);
  476. echo '<br /><center><b>' .
  477. _ ("Search Results") .
  478. "</b></center><br />\n";
  479. for ($x=0;$x<$boxcount;$x++) {
  480. if (!in_array ('noselect', $boxes[$x]['flags'])) {
  481. $mailbox = $boxes[$x]['unformatted'];
  482. if (($submit == _ ("Search") || $submit == 'Search_no_update') && !empty($what)) {
  483. sqimap_mailbox_select ($imapConnection, $mailbox);
  484. $msgs = sqimap_search ($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all);
  485. $count_all = count ($msgs);
  486. printSearchMessages ($msgs, $mailbox, $count_all, $imapConnection,
  487. $where, $what, false, false);
  488. array_push ($perbox_count, $count_all);
  489. }
  490. }
  491. }
  492. for ($i=0;$i<count ($perbox_count);$i++) {
  493. if ($perbox_count[$i]) {
  494. $count_all = true;
  495. break;
  496. }
  497. }
  498. if (!$count_all) {
  499. echo '<br /><center>' . _ ("No Messages Found") . '</center>';
  500. }
  501. }
  502. /* search one folder option */
  503. else {
  504. if (($submit == _ ("Search") || $submit == 'Search_no_update') && !empty($what)) {
  505. echo '<br />'
  506. . html_tag ( 'div', '<b>' . _ ("Search Results") . '</b>', 'center' ) . "\n";
  507. sqimap_mailbox_select ($imapConnection, $mailbox);
  508. $msgs = sqimap_search ($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all);
  509. if (count ($msgs)) {
  510. printSearchMessages ($msgs, $mailbox, count ($msgs), $imapConnection,
  511. $where, $what, false, false);
  512. } else {
  513. echo '<br /><center>' . _ ("No Messages Found") . '</center>';
  514. }
  515. }
  516. }
  517. /* must have search terms to search */
  518. if ($submit == _ ("Search") && empty($what)) {
  519. echo '<br />'
  520. . html_tag ( 'div', '<b>' . _ ("Please enter something to search for") . '</b>', 'center' ) . "\n";
  521. }
  522. $allow_thread_sort = $old_value;
  523. do_hook ('search_bottom');
  524. sqimap_logout ($imapConnection);
  525. echo '</body></html>';

Documentation generated on 2020年1月13日 04:25:15 +0100 by phpDocumentor 1.4.3

AltStyle によって変換されたページ (->オリジナル) /