Mercurial > hg > rc2
comparison program/steps/mail/search.inc @ 22:303b85d5b561
More cleaning up php8 Warnings/deprecations
| author | Charlie Root |
|---|---|
| date | Wed, 15 Oct 2025 14:06:27 -0400 |
| parents | 4681f974d28b |
| children |
comparison
equal
deleted
inserted
replaced
| 21:73124dd49283 | 22:303b85d5b561 |
|---|---|
| 31 // using encodeURI with javascript "should" give us | 31 // using encodeURI with javascript "should" give us |
| 32 // a correctly encoded query string | 32 // a correctly encoded query string |
| 33 $imap_charset = RCUBE_CHARSET; | 33 $imap_charset = RCUBE_CHARSET; |
| 34 | 34 |
| 35 // get search string | 35 // get search string |
| 36 $str = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GET, true); | 36 $str = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GET, true)?:''; |
| 37 $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GET, true); | 37 $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GET, true); |
| 38 $filter = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET); | 38 $filter = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET); |
| 39 $headers = rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET); | 39 $headers = rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET); |
| 40 $scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET); | 40 $scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET); |
| 41 $interval = rcube_utils::get_input_value('_interval', rcube_utils::INPUT_GET); | 41 $interval = rcube_utils::get_input_value('_interval', rcube_utils::INPUT_GET); |
| 71 } | 71 } |
| 72 else if (preg_match("/^body:.*/i", $str)) { | 72 else if (preg_match("/^body:.*/i", $str)) { |
| 73 list(,$srch) = explode(":", $str); | 73 list(,$srch) = explode(":", $str); |
| 74 $subject['body'] = "BODY"; | 74 $subject['body'] = "BODY"; |
| 75 } | 75 } |
| 76 else if (strlen(trim($str))) { | 76 else if (strlen(trim($str??''))) { |
| 77 if ($headers) { | 77 if ($headers) { |
| 78 foreach (explode(',', $headers) as $header) { | 78 foreach (explode(',', $headers) as $header) { |
| 79 if ($header == 'text') { | 79 if ($header == 'text') { |
| 80 // #1488208: get rid of other headers when searching by "TEXT" | 80 // #1488208: get rid of other headers when searching by "TEXT" |
| 81 $subject = array('text' => 'TEXT'); | 81 $subject = array('text' => 'TEXT'); |
| 120 $RCMAIL->storage->set_search_set($_SESSION['search']); | 120 $RCMAIL->storage->set_search_set($_SESSION['search']); |
| 121 $search_str = $_SESSION['search'][0]; | 121 $search_str = $_SESSION['search'][0]; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // execute IMAP search | 124 // execute IMAP search |
| 125 $mboxes = array(); | |
| 126 $result = null; | |
| 125 if ($search_str) { | 127 if ($search_str) { |
| 126 // search all, current or subfolders folders | 128 // search all, current or subfolders folders |
| 127 if ($scope == 'all') { | 129 if ($scope == 'all') { |
| 128 $mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail', null, true); | 130 $mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail', null, true); |
| 129 natcasesort($mboxes); // we want natural alphabetic sorting of folders in the result set | 131 natcasesort($mboxes); // we want natural alphabetic sorting of folders in the result set |
| 156 $_SESSION['search_scope'] = $scope; | 158 $_SESSION['search_scope'] = $scope; |
| 157 $_SESSION['search_interval'] = $interval; | 159 $_SESSION['search_interval'] = $interval; |
| 158 $_SESSION['search_filter'] = $filter; | 160 $_SESSION['search_filter'] = $filter; |
| 159 | 161 |
| 160 // Get the headers | 162 // Get the headers |
| 161 if (!$result->incomplete) { | 163 if (empty($result->incomplete)) { |
| 162 $result_h = $RCMAIL->storage->list_messages($mbox, 1, $sort_column, rcmail_sort_order()); | 164 $result_h = $RCMAIL->storage->list_messages($mbox, 1, $sort_column, rcmail_sort_order()); |
| 163 } | 165 } |
| 164 | 166 |
| 165 // Make sure we got the headers | 167 // Make sure we got the headers |
| 166 if (!empty($result_h)) { | 168 if (!empty($result_h)) { |
| 213 // update unseen messages count | 215 // update unseen messages count |
| 214 if (empty($search_str)) { | 216 if (empty($search_str)) { |
| 215 rcmail_send_unread_count($mbox, false, empty($result_h) ? 0 : null); | 217 rcmail_send_unread_count($mbox, false, empty($result_h) ? 0 : null); |
| 216 } | 218 } |
| 217 | 219 |
| 218 if (!$result->incomplete) { | 220 if (empty($result->incomplete)) { |
| 219 $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $result->multi ? 'INBOX' : $mbox)); | 221 $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, empty($result->multi) ? $mbox : 'INBOX')); |
| 220 } | 222 } |
| 221 | 223 |
| 222 $OUTPUT->send(); | 224 $OUTPUT->send(); |
| 223 | 225 |
| 224 | 226 |
