Changeset 2358 in subversion
- Timestamp:
- Mar 17, 2009 5:40:43 PM (4 years ago)
- Location:
- branches/devel-api
- Files:
-
- 2 added
- 5 edited
-
plugins/additional_message_headers/additional_message_headers.php (modified) (1 diff)
-
plugins/show_additional_headers (added)
-
plugins/show_additional_headers/show_additional_headers.php (added)
-
program/include/rcube_imap.php (modified) (7 diffs)
-
program/include/rcube_plugin_api.php (modified) (2 diffs)
-
program/lib/imap.inc (modified) (6 diffs)
-
program/steps/mail/func.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-api/plugins/additional_message_headers/additional_message_headers.php
r2290 r2358 23 23 class additional_message_headers extends rcube_plugin 24 24 { 25 25 public $task = 'mail'; 26 26 27 function init() 27 28 { -
branches/devel-api/program/include/rcube_imap.php
r2329 r2358 55 55 var $default_folders = array('INBOX'); 56 56 var $default_folders_lc = array('inbox'); 57 var $fetch_add_headers = ''; 57 58 var $cache = array(); 58 59 var $cache_keys = array(); … … 782 783 783 784 // fetch reuested headers from server 784 $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, $msgs );785 $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, $msgs, false, $this->fetch_add_headers); 785 786 $deleted_count = 0; 786 787 … … 836 837 $this->search('', $this->search_string, $this->search_charset, $this->sort_field); 837 838 838 if ($this->sort_order == 'DESC')839 if ($this->sort_order == 'DESC') 839 840 $this->cache[$key] = array_reverse($this->search_set); 840 else841 $this->cache[$key] = $this->search_set;841 else 842 $this->cache[$key] = $this->search_set; 842 843 } 843 844 else 844 845 { 845 $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, join(',', $this->search_set), $this->sort_field);846 $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, join(',', $this->search_set), $this->sort_field, false); 846 847 847 848 if ($this->sort_order=="ASC") … … 930 931 931 932 // fetch complete headers and add to cache 932 $headers = iil_C_FetchHeader($this->conn, $mailbox, $id );933 $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, false, $this->fetch_add_headers); 933 934 $this->add_message_cache($cache_key, $headers->id, $headers); 934 935 } … … 1067 1068 return $headers; 1068 1069 1069 $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, $is_uid );1070 $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, $is_uid, $this->fetch_add_headers); 1070 1071 1071 1072 // write headers cache … … 2224 2225 { 2225 2226 // get highest index 2226 $header = iil_C_FetchHeader($this->conn, $mailbox, "$msg_count" );2227 $header = iil_C_FetchHeader($this->conn, $mailbox, "$msg_count", false, $this->fetch_add_headers); 2227 2228 $cache_uid = array_pop($cache_index); 2228 2229 … … 2274 2275 // featch headers if unserialize failed 2275 2276 if (empty($this->cache[$cache_key][$uid])) 2276 $this->cache[$cache_key][$uid] = iil_C_FetchHeader($this->conn, preg_replace('/.msg$/', '', $key), $uid, true );2277 $this->cache[$cache_key][$uid] = iil_C_FetchHeader($this->conn, preg_replace('/.msg$/', '', $key), $uid, true, $this->fetch_add_headers); 2277 2278 } 2278 2279 } -
branches/devel-api/program/include/rcube_plugin_api.php
r2354 r2358 33 33 public $output; 34 34 35 p rivate$handlers = array();35 public $handlers = array(); 36 36 private $plugins = array(); 37 37 private $actions = array(); … … 143 143 144 144 // maybe also register a shudown function which triggers shutdown functions of all plugin objects 145 146 147 // call imap_init right now 148 // (should actually be done in rcmail::imap_init() but plugins are not initialized then) 149 if ($rcmail->imap) { 150 $hook = $this->exec_hook('imap_init', array('fetch_headers' => $rcmail->imap->fetch_add_headers)); 151 if ($hook['fetch_headers']) 152 $rcmail->imap->fetch_add_headers = $hook['fetch_headers']; 153 } 145 154 } 146 155 -
branches/devel-api/program/lib/imap.inc
r2185 r2358 177 177 var $junk = false; 178 178 var $flagged = false; 179 var $others = array(); 179 180 } 180 181 … … 1618 1619 } 1619 1620 1620 function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false )1621 function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false, $add='') 1621 1622 { 1622 1623 global $IMAP_USE_INTERNAL_DATE; … … 1665 1666 $request .= "(DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC "; 1666 1667 $request .= "CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID "; 1667 $request .= "REFERENCES DISPOSITION-NOTIFICATION-TO X-PRIORITY )])";1668 $request .= "REFERENCES DISPOSITION-NOTIFICATION-TO X-PRIORITY ".strtoupper($add).")])"; 1668 1669 1669 1670 if (!iil_PutLine($fp, $request)) { … … 1813 1814 1814 1815 $field = strtolower($field); 1815 $string = ereg_replace("\n[[:space:]]*"," ",$string); 1816 $string = ereg_replace("\n[[:space:]]*"," ",$string); 1816 1817 1817 1818 switch ($field) { … … 1871 1872 $result[$id]->priority = intval($matches[1]); 1872 1873 break; 1874 default: 1875 if (strlen($field) > 2) 1876 $result[$id]->others[$field] = $string; 1877 break; 1873 1878 } // end switch () 1874 1879 } // end while () … … 1888 1893 } 1889 1894 1890 function iil_C_FetchHeader(&$conn, $mailbox, $id, $uidfetch=false ) {1891 1892 $a = iil_C_FetchHeaders($conn, $mailbox, $id, $uidfetch );1895 function iil_C_FetchHeader(&$conn, $mailbox, $id, $uidfetch=false, $add='') { 1896 1897 $a = iil_C_FetchHeaders($conn, $mailbox, $id, $uidfetch, $add); 1893 1898 if (is_array($a)) { 1894 1899 return array_shift($a); -
branches/devel-api/program/steps/mail/func.inc
r2336 r2358 815 815 function rcmail_message_headers($attrib, $headers=NULL) 816 816 { 817 global $IMAP, $OUTPUT, $MESSAGE, $PRINT_MODE, $ CONFIG;817 global $IMAP, $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL; 818 818 static $sa_attrib; 819 819 … … 824 824 $attrib = $sa_attrib; 825 825 826 827 826 if (!isset($MESSAGE)) 828 827 return FALSE; … … 832 831 $headers = is_object($MESSAGE->headers) ? get_object_vars($MESSAGE->headers) : $MESSAGE->headers; 833 832 834 $header_count = 0;835 836 // allow the following attributes to be added to the <table> tag837 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));838 $out = '<table' . $attrib_str . ">\n";839 840 833 // show these headers 841 834 $standard_headers = array('subject', 'from', 'to', 'cc', 'bcc', 'replyto', 'date'); 842 843 foreach ($standard_headers as $hkey) 844 {835 $output_headers = array(); 836 837 foreach ($standard_headers as $hkey) { 845 838 if (!$headers[$hkey]) 846 839 continue; 847 840 848 if ($hkey == 'date') 849 { 841 if ($hkey == 'date') { 850 842 if ($PRINT_MODE) 851 $header_value = format_date($headers[$hkey], $ CONFIG['date_long'] ? $CONFIG['date_long'] : 'x');843 $header_value = format_date($headers[$hkey], $RCMAIL->config->get('date_long', 'x')); 852 844 else 853 845 $header_value = format_date($headers[$hkey]); 854 } 855 else if ($hkey == 'replyto') 856 { 846 } 847 else if ($hkey == 'replyto') { 857 848 if ($headers['replyto'] != $headers['from']) 858 $header_value = Q(rcmail_address_string($headers['replyto'], null, true, $attrib['addicon']), 'show');849 $header_value = rcmail_address_string($headers['replyto'], null, true, $attrib['addicon']); 859 850 else 860 851 continue; 861 }852 } 862 853 else if (in_array($hkey, array('from', 'to', 'cc', 'bcc'))) 863 $header_value = Q(rcmail_address_string($headers[$hkey], null, true, $attrib['addicon']), 'show');854 $header_value = rcmail_address_string($headers[$hkey], null, true, $attrib['addicon']); 864 855 else if ($hkey == 'subject' && empty($headers[$hkey])) 865 $header_value = Q(rcube_label('nosubject'));856 $header_value = rcube_label('nosubject'); 866 857 else 867 $header_value = Q(trim($IMAP->decode_header($headers[$hkey]))); 868 869 $out .= "\n<tr>\n"; 870 $out .= '<td class="header-title">'.Q(rcube_label($hkey)).": </td>\n"; 871 $out .= '<td class="'.$hkey.'" width="90%">'.$header_value."</td>\n</tr>"; 872 $header_count++; 873 } 858 $header_value = trim($IMAP->decode_header($headers[$hkey])); 859 860 $output_headers[$hkey] = array('title' => rcube_label($hkey), 'value' => $header_value, 'raw' => $headers[$hkey]); 861 } 862 863 $plugin = $RCMAIL->plugins->exec_hook('message_headers_output', array('output' => $output_headers, 'headers' => $MESSAGE->headers)); 864 865 // compose html table 866 $table = new html_table(array('cols' => 2)); 867 868 foreach ($plugin['output'] as $hkey => $row) { 869 $table->add(array('class' => 'header-title'), Q($row['title'])); 870 $table->add(array('class' => $hkey, 'width' => "90%"), Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show'))); 871 } 874 872 875 873 // all headers division 876 $ out .= "\n".'<tr><td colspan="2" class="more-headers show-headers"877 onclick="return '.JS_OBJECT_NAME.'.command(\'load-headers\', \'\', this)"></td></tr>';878 $ out .= "\n".'<tr id="all-headers"><td colspan="2" class="all"><div id="headers-source"></div></td></tr>';879 874 $table->add(array('colspan' => 2, 'class' => "more-headers show-headers", 'onclick' => "return ".JS_OBJECT_NAME.".command('load-headers','',this)"), ''); 875 $table->add_row(array('id' => "all-headers")); 876 $table->add(array('colspan' => 2, 'class' => "all"), html::div(array('id' => 'headers-source'), '')); 877 880 878 $OUTPUT->add_gui_object('all_headers_row', 'all-headers'); 881 879 $OUTPUT->add_gui_object('all_headers_box', 'headers-source'); 882 880 883 $out .= "\n</table>\n\n"; 884 885 return $header_count ? $out : ''; 881 return $table->show($attrib); 886 882 } 887 883
Note: See TracChangeset
for help on using the changeset viewer.
