From 6201339c4c48f41291e01617f70b732210860eee Mon Sep 17 00:00:00 2001 From: kink Date: Mon, 15 Mar 2004 20:15:16 +0000 Subject: [PATCH] Remove almost all left overs of our non-uid-imap-server support. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6802 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + functions/global.php | 7 - functions/imap_asearch.php | 18 +-- functions/imap_mailbox.php | 7 +- functions/imap_messages.php | 120 +++++++----------- functions/imap_search.php | 4 +- functions/mime.php | 10 +- plugins/filters/filters.php | 15 +-- .../message_details_bottom.php | 4 +- plugins/spamcop/spamcop.php | 6 +- src/compose.php | 6 +- src/download.php | 2 - src/move_messages.php | 4 +- src/read_body.php | 18 +-- src/view_header.php | 5 +- 15 files changed, 93 insertions(+), 134 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4ae1e53..2bf91e0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ Version 1.5.1 -- CVS - Update required PHP version to 4.1.0, and remove PHP 4.0.x legacy code. - Make writing of preferences, abook, calendars fail better when disk full (#915527). + - Remove code related to non-UID-supporting IMAP servers. Version 1.5.0 -------------------- diff --git a/functions/global.php b/functions/global.php index 84db5ec5..09e50aaa 100644 --- a/functions/global.php +++ b/functions/global.php @@ -31,13 +31,6 @@ if(isset($session_name) && $session_name) { */ ini_set('magic_quotes_runtime','0'); -/* Since we decided all IMAP servers must implement the UID command as defined in - * the IMAP RFC, we force $uid_support to be on. - */ - -global $uid_support; -$uid_support = true; - sqsession_is_active(); /* if running with magic_quotes_gpc then strip the slashes diff --git a/functions/imap_asearch.php b/functions/imap_asearch.php index 4222d11a..8ebbdc17 100644 --- a/functions/imap_asearch.php +++ b/functions/imap_asearch.php @@ -328,21 +328,19 @@ function sqimap_array_merge_unique(&$to, $from) */ function sqimap_run_search($imapConnection, $search_string, $search_charset) { - global $uid_support; - /* 6.4.4 try OPTIONAL [CHARSET] specification first */ if ($search_charset != '') $query = 'SEARCH CHARSET "' . strtoupper($search_charset) . '" ALL ' . $search_string; else $query = 'SEARCH ALL ' . $search_string; s_debug_dump('C:', $query); - $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, TRUE); /* 6.4.4 try US-ASCII charset if we tried an OPTIONAL [CHARSET] and received a tagged NO response (SHOULD be [BADCHARSET]) */ if (($search_charset != '') && (strtoupper($response) == 'NO')) { $query = 'SEARCH CHARSET US-ASCII ALL ' . $search_string; s_debug_dump('C:', $query); - $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, TRUE); } if (strtoupper($response) != 'OK') { sqimap_asearch_error_box($response, $query, $message); @@ -378,13 +376,11 @@ function sqimap_run_search($imapConnection, $search_string, $search_charset) */ function sqimap_run_sort($imapConnection, $search_string, $search_charset, $sort_criteria) { - global $uid_support; - if ($search_charset == '') $search_charset = 'US-ASCII'; $query = 'SORT (' . $sort_criteria . ') "' . strtoupper($search_charset) . '" ALL ' . $search_string; s_debug_dump('C:', $query); - $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, TRUE); s_debug_dump('S:', $response); /* 6.4 try US-ASCII charset if we received a tagged NO response (SHOULD be [BADCHARSET]) */ @@ -392,7 +388,7 @@ function sqimap_run_sort($imapConnection, $search_string, $search_charset, $sort s_debug_dump('S:', $readin); $query = 'SORT (' . $sort_criteria . ') US-ASCII ALL ' . $search_string; s_debug_dump('C:', $query); - $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, TRUE); s_debug_dump('S:', $response); } @@ -446,13 +442,11 @@ function sqimap_run_thread($imapConnection, $search_string, $search_charset, $th $server_sort_array = array(); - global $uid_support; - if ($search_charset == '') $search_charset = 'US-ASCII'; $query = 'THREAD ' . $thread_algorithm . ' "' . strtoupper($search_charset) . '" ALL ' . $search_string; s_debug_dump('C:', $query); - $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, TRUE); s_debug_dump('S:', $response); /* 6.4 try US-ASCII charset if we received a tagged NO response (SHOULD be [BADCHARSET]) */ @@ -460,7 +454,7 @@ function sqimap_run_thread($imapConnection, $search_string, $search_charset, $th s_debug_dump('S:', $readin); $query = 'THREAD ' . $thread_algorithm . ' US-ASCII ALL ' . $search_string; s_debug_dump('C:', $query); - $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $query, false, $response, $message, TRUE); s_debug_dump('S:', $response); } diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 3e14e7c3..538bb189 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -224,13 +224,12 @@ function isDraftMailbox($box) { * Expunges a mailbox, ie. delete all contents. */ function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, $id='') { - global $uid_support; if ($id) { if (is_array($id)) { $id = sqimap_message_list_squisher($id); } $id = ' '.$id; - $uid = $uid_support; + $uid = TRUE; } else { $uid = false; } @@ -260,7 +259,7 @@ function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, function sqimap_mailbox_expunge_dmn($message_id) { global $msgs, $msort, $sort, $imapConnection, - $mailbox, $uid_support, $mbx_response, $auto_expunge, + $mailbox, $mbx_response, $auto_expunge, $sort, $allow_server_sort, $thread_sort_messages, $allow_thread_sort, $username, $data_dir; @@ -294,7 +293,7 @@ function sqimap_mailbox_expunge_dmn($message_id) $server_sort_array = get_thread_sort($imapConnection); } elseif ( $allow_server_sort ) { $server_sort_array = sqimap_get_sort_order($imapConnection, $sort, $mbx_response); - } elseif ( $uid_support ) { + } else { $server_sort_array = sqimap_get_php_sort_order($imapConnection, $mbx_response); } diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 23bb1ac2..b271674a 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -22,8 +22,7 @@ * @deprecated This function is obsolete and should not be used */ function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) { - global $uid_support; - $read = sqimap_run_command ($imap_stream, "COPY $start:$end " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "COPY $start:$end " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, TRUE); } /** @@ -34,9 +33,8 @@ function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) { * @return void */ function sqimap_msgs_list_copy ($imap_stream, $id, $mailbox) { - global $uid_support; $msgs_id = sqimap_message_list_squisher($id); - $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, TRUE); } /** @@ -47,10 +45,9 @@ function sqimap_msgs_list_copy ($imap_stream, $id, $mailbox) { * @return void */ function sqimap_msgs_list_move ($imap_stream, $id, $mailbox) { - global $uid_support; $msgs_id = sqimap_message_list_squisher($id); - $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support); - $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response,$message, $uid_support); + $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, TRUE); + $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response,$message, TRUE); } @@ -64,7 +61,7 @@ function sqimap_msgs_list_move ($imap_stream, $id, $mailbox) { * @return void */ function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox, $bypass_trash=false) { - global $move_to_trash, $trash_folder, $auto_expunge, $uid_support; + global $move_to_trash, $trash_folder, $auto_expunge; if (($move_to_trash == true) && ($bypass_trash != true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) { @@ -74,13 +71,13 @@ function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox, $bypass_t } function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id, $bypass_trash=false) { - global $move_to_trash, $trash_folder, $uid_support; + global $move_to_trash, $trash_folder; $msgs_id = sqimap_message_list_squisher($id); if (($move_to_trash == true) && ($bypass_trash != true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder)) ) { - $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($trash_folder), true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($trash_folder), true, $response, $message, TRUE); } - $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, TRUE); } @@ -88,15 +85,13 @@ function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id, $bypass_trash=fal * Sets the specified messages with specified flag */ function sqimap_messages_flag ($imap_stream, $start, $end, $flag, $handle_errors) { - global $uid_support; - $read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", $handle_errors, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", $handle_errors, $response, $message, TRUE); } function sqimap_toggle_flag($imap_stream, $id, $flag, $set, $handle_errors) { - global $uid_support; $msgs_id = sqimap_message_list_squisher($id); $set_string = ($set ? '+' : '-'); - $read = sqimap_run_command ($imap_stream, "STORE $msgs_id ".$set_string."FLAGS ($flag)", $handle_errors, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "STORE $msgs_id ".$set_string."FLAGS ($flag)", $handle_errors, $response, $message, TRUE); } /** @deprecated */ @@ -139,7 +134,7 @@ function sqimap_message_list_squisher($messages_array) { function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) { global $default_charset, $thread_sort_messages, $internal_date_sort, $server_sort_array, - $sent_folder, $mailbox, $uid_support; + $sent_folder, $mailbox; if (sqsession_is_registered('server_sort_array')) { sqsession_unregister('server_sort_array'); @@ -152,25 +147,20 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) { $sort_query = ''; if ($sort == 6) { - if ($uid_support) { - if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) { - $uidnext = $mbxresponse['UIDNEXT']-1; - } else { - $uidnext = '*'; - } - $query = "SEARCH UID 1:$uidnext"; - $uids = sqimap_run_command ($imap_stream, $query, true, $response, $message, true); - if (isset($uids[0])) { - if (preg_match("/^\* SEARCH (.+)$/", $uids[0], $regs)) { - $server_sort_array = preg_split("/ /", trim($regs[1])); - } - } - if (!preg_match("/OK/", $response)) { - $server_sort_array = 'no'; - } + if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) { + $uidnext = $mbxresponse['UIDNEXT']-1; } else { - $qty = $mbxresponse['EXISTS']; - $server_sort_array = range(1, $qty); + $uidnext = '*'; + } + $query = "SEARCH UID 1:$uidnext"; + $uids = sqimap_run_command ($imap_stream, $query, true, $response, $message, true); + if (isset($uids[0])) { + if (preg_match("/^\* SEARCH (.+)$/", $uids[0], $regs)) { + $server_sort_array = preg_split("/ /", trim($regs[1])); + } + } + if (!preg_match("/OK/", $response)) { + $server_sort_array = 'no'; } $server_sort_array = array_reverse($server_sort_array); sqsession_register($server_sort_array, 'server_sort_array'); @@ -193,7 +183,7 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) { } if (!empty($sort_on[$sort])) { $query = "SORT ($sort_on[$sort]) ".strtoupper($default_charset).' ALL'; - $sort_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, $uid_support); + $sort_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, TRUE); } if (isset($sort_test[0])) { for ($i=0,$iCnt=count($sort_test);$i<$iCnt;++$i) { @@ -222,7 +212,6 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) { * @return array $php_sort_array */ function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) { - global $uid_support; if (sqsession_is_registered('php_sort_array')) { sqsession_unregister('php_sort_array'); @@ -230,29 +219,24 @@ function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) { $php_sort_array = array(); - if ($uid_support) { - if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) { - $uidnext = $mbxresponse['UIDNEXT']-1; - } else { - $uidnext = '*'; - } - $query = "SEARCH UID 1:$uidnext"; - $uids = sqimap_run_command ($imap_stream, $query, true, $response, $message, true); - if (isset($uids[0])) { - $php_sort_array = array(); - // EIMS workaround. EIMS returns the result as multiple untagged SEARCH responses - foreach($uids as $line) { - if (preg_match("/^\* SEARCH (.+)$/", $line, $regs)) { - $php_sort_array += preg_split("/ /", trim($regs[1])); - } + if (isset($mbxresponse['UIDNEXT']) && $mbxresponse['UIDNEXT']) { + $uidnext = $mbxresponse['UIDNEXT']-1; + } else { + $uidnext = '*'; + } + $query = "SEARCH UID 1:$uidnext"; + $uids = sqimap_run_command ($imap_stream, $query, true, $response, $message, true); + if (isset($uids[0])) { + $php_sort_array = array(); + // EIMS workaround. EIMS returns the result as multiple untagged SEARCH responses + foreach($uids as $line) { + if (preg_match("/^\* SEARCH (.+)$/", $line, $regs)) { + $php_sort_array += preg_split("/ /", trim($regs[1])); } } - if (!preg_match("/OK/", $response)) { - $php_sort_array = 'no'; - } - } else { - $qty = $mbxresponse['EXISTS']; - $php_sort_array = range(1, $qty); + } + if (!preg_match("/OK/", $response)) { + $php_sort_array = 'no'; } sqsession_register($php_sort_array, 'php_sort_array'); return $php_sort_array; @@ -363,7 +347,7 @@ function get_parent_level ($imap_stream) { * message-thread as returned by the IMAP server. */ function get_thread_sort ($imap_stream) { - global $thread_new, $sort_by_ref, $default_charset, $server_sort_array, $uid_support; + global $thread_new, $sort_by_ref, $default_charset, $server_sort_array; if (sqsession_is_registered('thread_new')) { sqsession_unregister('thread_new'); } @@ -378,7 +362,7 @@ function get_thread_sort ($imap_stream) { $sort_type = 'ORDEREDSUBJECT'; } $query = "THREAD $sort_type ".strtoupper($default_charset)." ALL"; - $thread_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, $uid_support); + $thread_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, TRUE); if (isset($thread_test[0])) { for ($i=0,$iCnt=count($thread_test);$i<$iCnt;++$i) { if (preg_match("/^\* THREAD (.+)$/", $thread_test[$i], $regs)) { @@ -500,7 +484,7 @@ function parseArray($read,&$i) { function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) { global $squirrelmail_language, $color, $data_dir, $username, $imap_server_type; - global $uid_support, $allow_server_sort; + global $allow_server_sort; /* Get the small headers for each message in $msg_list */ $maxmsg = sizeof($msg_list); if ($show_num != '999999') { @@ -526,7 +510,7 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) } else { $query = "FETCH $msgs_str (FLAGS UID RFC822.SIZE BODY.PEEK[HEADER.FIELDS (Date To Cc From Subject X-Priority Content-Type)])"; } - $read_list = sqimap_run_command_list ($imap_stream, $query, true, $response, $message, $uid_support); + $read_list = sqimap_run_command_list ($imap_stream, $query, true, $response, $message, TRUE); $i = 0; foreach ($read_list as $r) { @@ -677,13 +661,8 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) } else { $tmpdate = $date = array(); } - if ($uid_support) { - $msgi ="$unique_id"; - $messages[$msgi]['ID'] = $unique_id; - } else { - $msgi = "$id"; - $messages[$msgi]['ID'] = $id; - } + $msgi ="$unique_id"; + $messages[$msgi]['ID'] = $unique_id; $messages[$msgi]['TIME_STAMP'] = getTimeStamp($tmpdate); $messages[$msgi]['DATE_STRING'] = getDateString($messages[$msgi]['TIME_STAMP']); $messages[$msgi]['FROM'] = $from; //parseAddress($from); @@ -731,10 +710,9 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) * See the documentation folder for more information about this array. */ function sqimap_get_message ($imap_stream, $id, $mailbox) { - global $uid_support; $flags = array(); - $read = sqimap_run_command ($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, TRUE); if ($read) { if (preg_match('/.+FLAGS\s\((.*)\)\s/AUi',$read[0],$regs)) { if (trim($regs[1])) { @@ -753,7 +731,7 @@ function sqimap_get_message ($imap_stream, $id, $mailbox) { } $bodystructure = implode('',$read); $msg = mime_structure($bodystructure,$flags); - $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[HEADER]", true, $response, $message, $uid_support); + $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[HEADER]", true, $response, $message, TRUE); $rfc822_header = new Rfc822Header(); $rfc822_header->parseHeader($read); $msg->rfc822_header = $rfc822_header; diff --git a/functions/imap_search.php b/functions/imap_search.php index 7c50f1cf..05cf2edd 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -24,7 +24,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox, $color, $search_position = '', $search_all, $count_all) { global $message_highlight_list, $squirrelmail_language, $languages, - $index_order, $pos, $allow_charset_search, $uid_support, + $index_order, $pos, $allow_charset_search, $imap_server_type; $pos = $search_position; @@ -77,7 +77,7 @@ function sqimap_search($imapConnection, $search_where, $search_what, $mailbox, } /* read data back from IMAP */ - $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, $uid_support); + $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, TRUE); /* try US-ASCII charset if search fails */ if (isset($languages[$squirrelmail_language]['CHARSET']) diff --git a/functions/mime.php b/functions/mime.php index 7433d7c8..1f0e1467 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -97,7 +97,6 @@ function mime_structure ($bodystructure, $flags=array()) { */ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { - global $uid_support; /* Do a bit of error correction. If we couldn't find the entity id, just guess * that it is the first one. That is usually the case anyway. */ @@ -110,7 +109,7 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { if ($fetch_size!=0) $cmd .= "<0.$fetch_size>"; - $data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message, $uid_support); + $data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message, TRUE); do { $topline = trim(array_shift($data)); } while($topline && ($topline[0] == '*') && !preg_match('/\* [0-9]+ FETCH.*/i', $topline)) ; @@ -122,7 +121,7 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { * in order to parse html messages. Let's get them here. */ // if ($ret{0} == '<') { -// $data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id.MIME]", true, $response, $message, $uid_support); +// $data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id.MIME]", true, $response, $message, TRUE); // } } else if (ereg('"([^"]*)"', $topline, $regs)) { $ret = $regs[1]; @@ -149,7 +148,7 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { '' . _("FETCH line:") . "$topline" . "

"; - $data = sqimap_run_command ($imap_stream, "FETCH $passed_id BODY[]", true, $response, $message, $uid_support); + $data = sqimap_run_command ($imap_stream, "FETCH $passed_id BODY[]", true, $response, $message, TRUE); array_shift($data); $wholemessage = implode('', $data); @@ -159,7 +158,6 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { } function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding) { - global $uid_support; /* Don't kill the connection if the browser is over a dialup * and it would take over 30 seconds to download it. @@ -177,7 +175,7 @@ function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding) { } else { $query = "FETCH $id BODY[$ent_id]"; } - sqimap_run_command($imap_stream,$query,true,$response,$message,$uid_support,'sqimap_base64_decode','php://stdout',true); + sqimap_run_command($imap_stream,$query,true,$response,$message,TRUE,'sqimap_base64_decode','php://stdout',true); } else { $body = mime_fetch_body ($imap_stream, $id, $ent_id); echo decodeBody($body, $encoding); diff --git a/plugins/filters/filters.php b/plugins/filters/filters.php index b85633a1..a70aa712 100644 --- a/plugins/filters/filters.php +++ b/plugins/filters/filters.php @@ -191,8 +191,8 @@ function user_filters($imap_stream) { function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_scan, $should_expunge) { - global $languages, $squirrelmail_language, $allow_charset_search, - $uid_support, $imap_server_type; + global $languages, $squirrelmail_language, $allow_charset_search, $imap_server_type; + if ($user_scan == 'new') { $category = 'UNSEEN'; } else { @@ -222,7 +222,7 @@ function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_ } /* read data back from IMAP */ - $read = sqimap_run_command($imap_stream, $search_str, true, $response, $message, $uid_support); + $read = sqimap_run_command($imap_stream, $search_str, true, $response, $message, TRUE); // This may have problems with EIMS due to it being goofy @@ -251,7 +251,7 @@ function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_ // These are the spam filters function spam_filters($imap_stream) { - global $data_dir, $username, $uid_support; + global $data_dir, $username; global $SpamFilters_YourHop; global $SpamFilters_DNScache; global $SpamFilters_SharedCache; @@ -289,7 +289,7 @@ function spam_filters($imap_stream) { if ($filters_spam_scan != 'new') { $query = 'FETCH 1:* (BODY.PEEK[HEADER.FIELDS (Received)])'; } else { - $read = sqimap_run_command($imap_stream, 'SEARCH UNSEEN', true, $response, $message, $uid_support); + $read = sqimap_run_command($imap_stream, 'SEARCH UNSEEN', true, $response, $message, TRUE); if ($response != 'OK' || trim($read[0]) == '* SEARCH') { $query = 'FETCH 1:* (BODY.PEEK[HEADER.FIELDS (RECEIVED)])'; } else { @@ -751,10 +751,9 @@ function update_for_folder ($args) { * The unused FETCH arguments and HEADERS are disabled. */ function filter_get_headers ($imap_stream, $query) { - global $uid_support; /* Get the small headers for each message in $msg_list */ - $read_list = sqimap_run_command_list ($imap_stream, $query, false, $response, $message, $uid_support); + $read_list = sqimap_run_command_list ($imap_stream, $query, false, $response, $message, TRUE); if (isset($response) && $response != 'OK') { return false; @@ -867,4 +866,4 @@ function filter_get_headers ($imap_stream, $query) { return $msgs; } -?> \ No newline at end of file +?> diff --git a/plugins/message_details/message_details_bottom.php b/plugins/message_details/message_details_bottom.php index 08a8b0e4..ea69ca1d 100644 --- a/plugins/message_details/message_details_bottom.php +++ b/plugins/message_details/message_details_bottom.php @@ -22,7 +22,7 @@ require_once(SM_PATH . 'functions/mime.php'); require_once(SM_PATH . 'config/config.php'); require_once(SM_PATH . 'functions/prefs.php'); -global $color, $uid_support; +global $color; sqgetGlobalVar('passed_id', $passed_id, SQ_GET); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); @@ -73,7 +73,7 @@ function GetMimeProperties($header) { $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $read = sqimap_mailbox_select($imapConnection, $mailbox); $start = gettimeofday(); -$body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, $uid_support); +$body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, TRUE); $message_body = ''; $header = false; $mimepart = false; diff --git a/plugins/spamcop/spamcop.php b/plugins/spamcop/spamcop.php index c0814a8f..e3b00568 100644 --- a/plugins/spamcop/spamcop.php +++ b/plugins/spamcop/spamcop.php @@ -22,18 +22,18 @@ require_once(SM_PATH . 'functions/imap.php'); */ function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id='', $imapConnection) { - global $attachments, $attachment_dir, $username, $data_dir, $uid_support; + global $attachments, $attachment_dir, $username, $data_dir; $hashed_attachment_dir = getHashedDir($username, $attachment_dir); if (!$passed_ent_id) { $body_a = sqimap_run_command($imapConnection, 'FETCH '.$passed_id.' RFC822', TRUE, $response, $readmessage, - $uid_support); + TRUE); } else { $body_a = sqimap_run_command($imapConnection, 'FETCH '.$passed_id.' BODY['.$passed_ent_id.']', - TRUE, $response, $readmessage, $uid_support); + TRUE, $response, $readmessage,TRUE); $message = $message->parent; } if ($response == 'OK') { diff --git a/src/compose.php b/src/compose.php index ea6112f6..69b08606 100644 --- a/src/compose.php +++ b/src/compose.php @@ -862,17 +862,17 @@ function getAttachments($message, &$composeMessage, $passed_id, $entities, $imap function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id='', $imapConnection) { - global $attachments, $attachment_dir, $username, $data_dir, $uid_support; + global $attachments, $attachment_dir, $username, $data_dir; $hashed_attachment_dir = getHashedDir($username, $attachment_dir); if (!$passed_ent_id) { $body_a = sqimap_run_command($imapConnection, 'FETCH '.$passed_id.' RFC822', TRUE, $response, $readmessage, - $uid_support); + TRUE); } else { $body_a = sqimap_run_command($imapConnection, 'FETCH '.$passed_id.' BODY['.$passed_ent_id.']', - TRUE, $response, $readmessage, $uid_support); + TRUE, $response, $readmessage, TRUE); $message = $message->parent; } if ($response == 'OK') { diff --git a/src/download.php b/src/download.php index 5feed3ea..ef3e48c6 100644 --- a/src/download.php +++ b/src/download.php @@ -38,8 +38,6 @@ if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) { /* end globals */ -global $uid_support; - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox); diff --git a/src/move_messages.php b/src/move_messages.php index b42cc11b..6e73b175 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -30,7 +30,7 @@ if ( !sqgetGlobalVar('composesession', $composesession, SQ_SESSION) ) { function attachSelectedMessages($msg, $imapConnection) { global $username, $attachment_dir, $startMessage, - $data_dir, $composesession, $uid_support, + $data_dir, $composesession, $msgs, $show_num, $compose_messages; if (!isset($compose_messages)) { @@ -54,7 +54,7 @@ function attachSelectedMessages($msg, $imapConnection) { $composeMessage->reply_rfc822_header = ''; foreach($msg as $id) { - $body_a = sqimap_run_command($imapConnection, "FETCH $id RFC822", true, $response, $readmessage, $uid_support); + $body_a = sqimap_run_command($imapConnection, "FETCH $id RFC822", true, $response, $readmessage, TRUE); if ($response == 'OK') { // fetch the subject for the message with $id from msgs. diff --git a/src/read_body.php b/src/read_body.php index a4588362..d9203819 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -315,11 +315,11 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { return $success; } -function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id, $uid_support) { +function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id) { $sg = $set?'+':'-'; $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)'; $read = sqimap_run_command ($imapConnection, $cmd, true, $response, - $readmessage, $uid_support); + $readmessage, TRUE); } function ClearAttachments() { @@ -487,7 +487,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, */ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response, $nav_on_top = TRUE) { global $base_uri, $draft_folder, $where, $what, $color, $sort, - $startMessage, $PHP_SELF, $save_as_draft, $uid_support, + $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, $data_dir, $username, $delete_prev_next_display; @@ -575,8 +575,8 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp } // Only bother with Delete & Prev and Delete & Next IF - // we have UID support, and top display is enabled. - if ( $uid_support && $delete_prev_next_display == 1 ) { + // top display is enabled. + if ( $delete_prev_next_display == 1 ) { $del_prev_link = _("Delete & Prev"); if ($prev >= 0) { $uri = $base_uri . 'src/read_body.php?passed_id='.$prev. @@ -793,7 +793,7 @@ if ( sqgetGlobalVar('startMessage', $temp) ) { } /* end of get globals */ -global $uid_support, $sqimap_capabilities, $lastTargetMailbox; +global $sqimap_capabilities, $lastTargetMailbox; $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true); @@ -818,7 +818,7 @@ $uidvalidity = $mbx_response['UIDVALIDITY']; if (!isset($messages[$uidvalidity])) { $messages[$uidvalidity] = array(); } -if (!isset($messages[$uidvalidity][$passed_id]) || !$uid_support) { +if (!isset($messages[$uidvalidity][$passed_id])) { $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); $FirstTimeSee = !$message->is_seen; $message->is_seen = true; @@ -834,7 +834,7 @@ if (isset($passed_ent_id) && $passed_ent_id) { if ($message->type0 != 'message' && $message->type1 != 'rfc822') { $message = $message->parent; } - $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, $uid_support); + $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, TRUE); $rfc822_header = new Rfc822Header(); $rfc822_header->parseHeader($read); $message->rfc822_header = $rfc822_header; @@ -858,7 +858,7 @@ if (isset($sendreceipt)) { $final_recipient = trim(getPref($data_dir, $username, 'email_address', '' )); $supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]); if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message, $imapConnection ) > 0 && $supportMDN ) { - ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id, $uid_support); + ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id); $message->is_mdnsent = true; $messages[$uidvalidity][$passed_id]=$message; } diff --git a/src/view_header.php b/src/view_header.php index e6ce1562..2f8c55c1 100644 --- a/src/view_header.php +++ b/src/view_header.php @@ -23,16 +23,15 @@ require_once(SM_PATH . 'functions/html.php'); require_once(SM_PATH . 'functions/url_parser.php'); function parse_viewheader($imapConnection,$id, $passed_ent_id) { - global $uid_support; $header_full = array(); if (!$passed_ent_id) { $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]", - true, $a, $b, $uid_support); + true, $a, $b, TRUE); } else { $query = "FETCH $id BODY[".$passed_ent_id.'.HEADER]'; $read=sqimap_run_command ($imapConnection, $query, - true, $a, $b, $uid_support); + true, $a, $b, TRUE); } $cnum = 0; for ($i=1; $i < count($read); $i++) { -- 2.25.1