comparison program/lib/Roundcube/rcube_imap.php @ 21:73124dd49283

More cleaning up php8 Warnings/deprecations, noticed that setting non-my-Dates mailboxes to sort on Date isn't sticky over ctrl-R
author Charlie Root
date Thu, 09 Oct 2025 11:31:41 -0400
parents b6a96bdd6b29
children 303b85d5b561
comparison
equal deleted inserted replaced
20:4aec5e272733 21:73124dd49283
55 * @var array 55 * @var array
56 */ 56 */
57 protected $icache = array(); 57 protected $icache = array();
58 58
59 protected $plugins; 59 protected $plugins;
60 protected $parts;
60 protected $delimiter; 61 protected $delimiter;
61 protected $namespace; 62 protected $namespace;
62 protected $sort_field = ''; 63 protected $sort_field = '';
63 protected $sort_order = 'DESC'; 64 protected $sort_order = 'DESC';
64 protected $struct_charset; 65 protected $struct_charset;
1810 // decode combined UID-folder identifier 1811 // decode combined UID-folder identifier
1811 if (preg_match('/^\d+-.+/', $uid)) { 1812 if (preg_match('/^\d+-.+/', $uid)) {
1812 list($uid, $folder) = explode('-', $uid, 2); 1813 list($uid, $folder) = explode('-', $uid, 2);
1813 } 1814 }
1814 1815
1815 if (!strlen($folder)) { 1816 if (empty($folder)) {
1816 $folder = $this->folder; 1817 $folder = $this->folder;
1817 } 1818 }
1818 1819
1819 // get cached headers 1820 // get cached headers
1820 if (!$force && $uid && ($mcache = $this->get_mcache_engine())) { 1821 if (!$force && $uid && ($mcache = $this->get_mcache_engine())) {
1843 * 1844 *
1844 * @return object rcube_message_header Message data 1845 * @return object rcube_message_header Message data
1845 */ 1846 */
1846 public function get_message($uid, $folder = null) 1847 public function get_message($uid, $folder = null)
1847 { 1848 {
1848 if (!strlen($folder)) { 1849 if (!empty($folder)) {
1849 $folder = $this->folder; 1850 $folder = $this->folder;
1850 } 1851 }
1851 1852
1852 // decode combined UID-folder identifier 1853 // decode combined UID-folder identifier
1853 if (preg_match('/^\d+-.+/', $uid)) { 1854 if (preg_match('/^\d+-.+/', $uid)) {
2026 } 2027 }
2027 2028
2028 // pre-fetch headers of all parts (in one command for better performance) 2029 // pre-fetch headers of all parts (in one command for better performance)
2029 // @TODO: we could do this before _structure_part() call, to fetch 2030 // @TODO: we could do this before _structure_part() call, to fetch
2030 // headers for parts on all levels 2031 // headers for parts on all levels
2031 if ($mime_part_headers) { 2032 if (!empty($mime_part_headers)) {
2032 $mime_part_headers = $this->conn->fetchMIMEHeaders($this->folder, 2033 $mime_part_headers = $this->conn->fetchMIMEHeaders($this->folder,
2033 $this->msg_uid, $mime_part_headers); 2034 $this->msg_uid, $mime_part_headers);
2034 } 2035 }
2035 2036
2036 $struct->parts = array(); 2037 $struct->parts = array();
2038 if (!is_array($part[$i])) { 2039 if (!is_array($part[$i])) {
2039 break; 2040 break;
2040 } 2041 }
2041 $tmp_part_id = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1; 2042 $tmp_part_id = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1;
2042 $struct->parts[] = $this->structure_part($part[$i], ++$count, $struct->mime_id, 2043 $struct->parts[] = $this->structure_part($part[$i], ++$count, $struct->mime_id,
2043 $mime_part_headers ? $mime_part_headers[$tmp_part_id] : null); 2044 empty($mime_part_headers[$tmp_part_id]) ? null : $mime_part_headers[$tmp_part_id]) ;
2044 } 2045 }
2045 2046
2046 return $struct; 2047 return $struct;
2047 } 2048 }
2048 2049
2142 $struct->disposition = 'inline'; 2143 $struct->disposition = 'inline';
2143 } 2144 }
2144 } 2145 }
2145 2146
2146 // fetch message headers if message/rfc822 or named part (could contain Content-Location header) 2147 // fetch message headers if message/rfc822 or named part (could contain Content-Location header)
2147 if ($struct->ctype_primary == 'message' || ($struct->ctype_parameters['name'] && !$struct->content_id)) { 2148 if ($struct->ctype_primary == 'message' || (!empty($struct->ctype_parameters['name']) && !$struct->content_id)) {
2148 if (empty($mime_headers)) { 2149 if (empty($mime_headers)) {
2149 $mime_headers = $this->conn->fetchPartHeader( 2150 $mime_headers = $this->conn->fetchPartHeader(
2150 $this->folder, $this->msg_uid, true, $struct->mime_id); 2151 $this->folder, $this->msg_uid, true, $struct->mime_id);
2151 } 2152 }
2152 2153