Changeset 325 in subversion
- Timestamp:
- Aug 25, 2006 7:51:11 AM (7 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 3 added
- 12 edited
-
CHANGELOG (modified) (2 diffs)
-
INSTALL (modified) (2 diffs)
-
SQL/mysql.initial.sql (modified) (2 diffs)
-
SQL/mysql.update-0.1a.sql (added)
-
SQL/mysql.update.sql (modified) (1 diff)
-
SQL/mysql5.initial.sql (modified) (6 diffs)
-
SQL/postgres.initial.sql (modified) (1 diff)
-
SQL/postgres.update.sql (added)
-
SQL/sqlite.initial.sql (modified) (2 diffs)
-
SQL/sqlite.update.sql (added)
-
UPGRADING (modified) (2 diffs)
-
program/include/rcube_imap.inc (modified) (12 diffs)
-
program/lib/imap.inc (modified) (5 diffs)
-
program/steps/mail/func.inc (modified) (3 diffs)
-
program/steps/mail/get.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r323 r325 1 1 CHANGELOG RoundCube Webmail 2 2 --------------------------- 3 4 2006/08/25 (thomasb) 5 ---------- 6 - Fixed folder renaming: unsubscribe before rename (Bug #1483920) 7 - Finalized new message parsing (+ chaching) 8 - Updated SQL scripts and UPGRADING instructions 9 3 10 4 11 2006/08/23 (thomasb) … … 17 24 ---------- 18 25 - Re-built message parsing (Bug #1327068) 26 Now based on the message structure delivered by the IMAP server. 19 27 - Fixed some XSS and SQL injection issues 20 28 -
trunk/roundcubemail/INSTALL
r297 r325 41 41 42 42 # mysql 43 > CREATE DATABASE 'roundcubemail';43 > CREATE DATABASE roundcubemail; 44 44 > GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost 45 45 IDENTIFIED BY 'password'; … … 54 54 55 55 # mysql 56 > CREATE DATABASE 'roundcubemail'DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;56 > CREATE DATABASE roundcubemail DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 57 57 > GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost 58 58 IDENTIFIED BY 'password'; -
trunk/roundcubemail/SQL/mysql.initial.sql
r313 r325 1 1 -- RoundCube Webmail initial database structure 2 -- Version 0.1 beta22 -- Version 0.1-beta2 3 3 -- 4 4 … … 117 117 `size` int(11) unsigned NOT NULL default '0', 118 118 `headers` text NOT NULL, 119 ` body` longtext,119 `structure` text, 120 120 PRIMARY KEY (`message_id`), 121 121 KEY `user_id` (`user_id`), 122 KEY `cache_key` (`cache_key`),123 122 KEY `idx` (`idx`), 124 KEY `uid` (`uid`) 123 KEY `uid` (`uid`), 124 UNIQUE `uniqueness` (`cache_key`, `uid`) 125 125 ); 126 126 -
trunk/roundcubemail/SQL/mysql.update.sql
r313 r325 1 1 -- RoundCube Webmail update script for MySQL databases 2 -- Updates from version 0.1- 200510072 -- Updates from version 0.1-beta and 0.1-beta2 3 3 4 ALTER TABLE `messages` 5 DROP `body`, 6 DROP INDEX `cache_key`, 7 ADD `structure` TEXT, 8 ADD UNIQUE `uniqueness` (`cache_key`, `uid`); 4 9 5 ALTER TABLE `session` ADD `ip` VARCHAR(15) NOT NULL AFTER changed;6 ALTER TABLE `users` ADD `alias` VARCHAR(128) NOT NULL AFTER mail_host;7 8 9 10 -- RoundCube Webmail update script for MySQL databases11 -- Updates from version 0.1-2005102112 13 ALTER TABLE `session` CHANGE `sess_id` `sess_id` VARCHAR(40) NOT NULL;14 15 ALTER TABLE `contacts` CHANGE `del` `del` TINYINT(1) NOT NULL;16 ALTER TABLE `contacts` ADD `changed` DATETIME NOT NULL AFTER `user_id`;17 18 UPDATE `contacts` SET `del`=0 WHERE `del`=1;19 UPDATE `contacts` SET `del`=1 WHERE `del`=2;20 21 ALTER TABLE `identities` CHANGE `default` `standard` TINYINT(1) NOT NULL;22 ALTER TABLE `identities` CHANGE `del` `del` TINYINT(1) NOT NULL;23 24 UPDATE `identities` SET `del`=0 WHERE `del`=1;25 UPDATE `identities` SET `del`=1 WHERE `del`=2;26 UPDATE `identities` SET `standard`=0 WHERE `standard`=1;27 UPDATE `identities` SET `standard`=1 WHERE `standard`=2;28 29 CREATE TABLE `messages` (30 `message_id` int(11) unsigned NOT NULL auto_increment,31 `user_id` int(11) unsigned NOT NULL default '0',32 `del` tinyint(1) NOT NULL default '0',33 `cache_key` varchar(128) NOT NULL default '',34 `created` datetime NOT NULL default '0000-00-00 00:00:00',35 `idx` int(11) unsigned NOT NULL default '0',36 `uid` int(11) unsigned NOT NULL default '0',37 `subject` varchar(255) NOT NULL default '',38 `from` varchar(255) NOT NULL default '',39 `to` varchar(255) NOT NULL default '',40 `cc` varchar(255) NOT NULL default '',41 `date` datetime NOT NULL default '0000-00-00 00:00:00',42 `size` int(11) unsigned NOT NULL default '0',43 `headers` text NOT NULL,44 `body` longtext,45 PRIMARY KEY (`message_id`),46 KEY `user_id` (`user_id`),47 KEY `cache_key` (`cache_key`),48 KEY `idx` (`idx`),49 KEY `uid` (`uid`)50 ) TYPE=MyISAM;51 52 53 54 -- RoundCube Webmail update script for MySQL databases55 -- Updates from version 0.1-2005121656 57 ALTER TABLE `messages` ADD `created` DATETIME NOT NULL AFTER `cache_key` ; -
trunk/roundcubemail/SQL/mysql5.initial.sql
r297 r325 1 1 -- RoundCube Webmail initial database structure 2 -- Version 0.1 beta22 -- Version 0.1-beta2 3 3 -- 4 4 … … 17 17 `vars` text NOT NULL, 18 18 PRIMARY KEY(`sess_id`) 19 ) TYPE=MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;19 ) TYPE=MYISAM CHARACTER SET ascii COLLATE ascii_general_ci; 20 20 21 21 … … 32 32 `preferences` text NOT NULL, 33 33 PRIMARY KEY(`user_id`) 34 ) TYPE=MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;34 ) TYPE=MYISAM CHARACTER SET ascii COLLATE ascii_general_ci; 35 35 36 36 … … 39 39 CREATE TABLE `messages` ( 40 40 `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 41 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 41 42 `del` tinyint(1) NOT NULL DEFAULT '0', 42 `cache_key` varchar(128) NOT NULL,43 `cache_key` varchar(128) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, 43 44 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 44 45 `idx` int(11) UNSIGNED NOT NULL DEFAULT '0', … … 51 52 `size` int(11) UNSIGNED NOT NULL DEFAULT '0', 52 53 `headers` text NOT NULL, 53 `body` longtext, 54 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 54 `structure` text, 55 55 PRIMARY KEY(`message_id`), 56 INDEX `cache_key`(`cache_key`),57 56 INDEX `idx`(`idx`), 58 57 INDEX `uid`(`uid`), 58 UNIQUE `uniqueness` (`cache_key`, `uid`), 59 59 CONSTRAINT `User_ID_FK_messages` FOREIGN KEY (`user_id`) 60 60 REFERENCES `users`(`user_id`) … … 68 68 CREATE TABLE `cache` ( 69 69 `cache_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, 70 `session_id` varchar(40) ,71 `cache_key` varchar(128) NOT NULL,70 `session_id` varchar(40) CHARACTER SET ascii COLLATE ascii_general_ci, 71 `cache_key` varchar(128) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, 72 72 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 73 73 `data` longtext NOT NULL, -
trunk/roundcubemail/SQL/postgres.initial.sql
r140 r325 164 164 size integer DEFAULT 0 NOT NULL, 165 165 headers text NOT NULL, 166 bodytext166 structure text 167 167 ); 168 168 169 ALTER TABLE "messages" ADD UNIQUE (cache_key, uid); -
trunk/roundcubemail/SQL/sqlite.initial.sql
r131 r325 1 1 -- RoundCube Webmail initial database structure 2 -- Version 0.1 a2 -- Version 0.1-beta2 3 3 -- 4 4 … … 119 119 size integer NOT NULL default '0', 120 120 headers text NOT NULL, 121 bodytext121 structure text 122 122 ); 123 123 -
trunk/roundcubemail/UPGRADING
r297 r325 6 6 7 7 8 from version 1.0-beta2 9 ---------------------------------------- 10 * replace index.php 11 * replace all files in folder /program/ 12 * replace all files in folder /skins/default/ 13 * run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql 14 15 16 17 form version 0.1-beta 18 ---------------------------------------- 19 * replace index.php 20 * replace all files in folder /program/ 21 * replace all files in folder /skins/default/ 22 * run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql 23 * add these line to /config/db.inc.php 24 $rcmail_config['db_persistent'] = TRUE; 25 * add these lines to /config/main.inc.php 26 $rcmail_config['drafts_mbox'] = 'Drafts'; 27 $rcmail_config['junk_mbox'] = 'Junk'; 28 $rcmail_config['product_name'] = 'RoundCube Webmail'; 29 $rcmail_config['read_when_deleted'] = TRUE; 30 $rcmail_config['enable_spellcheck'] = TRUE; 31 $rcmail_config['protect_default_folders'] = TRUE; 32 * replace the following line from /config/main.inc.php 33 @include($_SERVER['HTTP_HOST'].'.inc.php'); 34 with 35 $rcmail_config['include_host_config'] = TRUE; 36 37 38 39 from version 0.1-20051021 40 ---------------------------------------- 41 * replace index.php 42 * replace all files in folder /program/ 43 * replace all files in folder /skins/default/ 44 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 45 * add these lines to /config/main.inc.php 46 $rcmail_config['skip_deleted'] = FALSE; 47 $rcmail_config['message_sort_col'] = 'date'; 48 $rcmail_config['message_sort_order'] = 'DESC'; 49 $rcmail_config['log_dir'] = 'logs/'; 50 $rcmail_config['temp_dir'] = 'temp/'; 51 $rcmail_config['message_cache_lifetime'] = '10d'; 52 $rcmail_config['drafts_mbox'] = 'Drafts'; 53 $rcmail_config['product_name'] = 'RoundCube Webmail'; 54 $rcmail_config['read_when_deleted'] = TRUE; 55 $rcmail_config['enable_spellcheck'] = TRUE; 56 * add these lines to /config/db.inc.php 57 $rcmail_config['db_max_length'] = 512000; 58 $rcmail_config['db_sequence_user_ids'] = 'user_ids'; 59 $rcmail_config['db_sequence_identity_ids'] = 'identity_ids'; 60 $rcmail_config['db_sequence_contact_ids'] = 'contact_ids'; 61 $rcmail_config['db_sequence_cache_ids'] = 'cache_ids'; 62 $rcmail_config['db_sequence_message_ids'] = 'message_ids'; 63 $rcmail_config['db_persistent'] = TRUE; 64 65 66 67 from version 0.1-20051007 68 ---------------------------------------- 69 * replace index.php 70 * replace all files in folder /program/ 71 * replace all files in folder /skins/default/ 72 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 73 * add these lines to /config/main.inc.php 74 $rcmail_config['smtp_auth_type'] = ''; // if you need to specify an auth method for SMTP 75 $rcmail_config['session_lifetime'] = 20; // to specify the session lifetime in minutes 76 $rcmail_config['skip_deleted'] = FALSE; 77 $rcmail_config['message_sort_col'] = 'date'; 78 $rcmail_config['message_sort_order'] = 'DESC'; 79 $rcmail_config['log_dir'] = 'logs/'; 80 $rcmail_config['temp_dir'] = 'temp/'; 81 $rcmail_config['message_cache_lifetime'] = '10d'; 82 $rcmail_config['drafts_mbox'] = 'Drafts'; 83 $rcmail_config['product_name'] = 'RoundCube Webmail'; 84 $rcmail_config['read_when_deleted'] = TRUE; 85 $rcmail_config['enable_spellcheck'] = TRUE; 86 * add these lines to /config/db.inc.php 87 $rcmail_config['db_max_length'] = 512000; 88 $rcmail_config['db_sequence_user_ids'] = 'user_ids'; 89 $rcmail_config['db_sequence_identity_ids'] = 'identity_ids'; 90 $rcmail_config['db_sequence_contact_ids'] = 'contact_ids'; 91 $rcmail_config['db_sequence_cache_ids'] = 'cache_ids'; 92 $rcmail_config['db_sequence_message_ids'] = 'message_ids'; 93 $rcmail_config['db_persistent'] = TRUE; 94 95 96 97 from version 0.1-20050820 98 ---------------------------------------- 99 * replace index.php 100 * replace all files in folder /program/ 101 * replace all files in folder /skins/default/ 102 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 103 * add these line to /config/main.inc.php 104 $rcmail_config['prettydate'] = TRUE; 105 $rcmail_config['smtp_port'] = 25; 106 $rcmail_config['default_port'] = 143; 107 $rcmail_config['session_lifetime'] = 20; 108 $rcmail_config['skip_deleted'] = FALSE; 109 $rcmail_config['message_sort_col'] = 'date'; 110 $rcmail_config['message_sort_order'] = 'DESC'; 111 $rcmail_config['log_dir'] = 'logs/'; 112 $rcmail_config['temp_dir'] = 'temp/'; 113 $rcmail_config['message_cache_lifetime'] = '10d'; 114 * replace database properties (db_type, db_host, db_user, db_pass, $d_name) 115 in /config/db.inc.php with the following line: 116 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail'; 117 * add these lines to /config/db.inc.php 118 $rcmail_config['db_max_length'] = 512000; 119 120 121 8 122 from versions 0.1-alpha and 0.1-20050811 9 123 ---------------------------------------- 10 -replace index.php11 -replace all files in folder /program/12 -replace all files in folder /skins/default/13 - run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql14 -add these line to /config/main.inc.php124 * replace index.php 125 * replace all files in folder /program/ 126 * replace all files in folder /skins/default/ 127 * run all commands in SQL/*.update-0.1a.sql or re-initalize database with *.initial.sql 128 * add these line to /config/main.inc.php 15 129 $rcmail_config['trash_mbox'] = 'Trash'; 16 130 $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); … … 26 140 $rcmail_config['temp_dir'] = 'temp/'; 27 141 $rcmail_config['message_cache_lifetime'] = '10d'; 28 -replace database properties (db_type, db_host, db_user, db_pass, $d_name)142 * replace database properties (db_type, db_host, db_user, db_pass, $d_name) 29 143 in /config/db.inc.php with the following line: 30 144 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail'; 31 -add these lines to /config/db.inc.php145 * add these lines to /config/db.inc.php 32 146 $rcmail_config['db_max_length'] = 512000; 33 147 34 35 from version 0.1-2005082036 ----------------------------------------37 - replace index.php38 - replace all files in folder /program/39 - replace all files in folder /skins/default/40 - run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql41 - add these line to /config/main.inc.php42 $rcmail_config['prettydate'] = TRUE;43 $rcmail_config['smtp_port'] = 25;44 $rcmail_config['default_port'] = 143;45 $rcmail_config['session_lifetime'] = 20;46 $rcmail_config['skip_deleted'] = FALSE;47 $rcmail_config['message_sort_col'] = 'date';48 $rcmail_config['message_sort_order'] = 'DESC';49 $rcmail_config['log_dir'] = 'logs/';50 $rcmail_config['temp_dir'] = 'temp/';51 $rcmail_config['message_cache_lifetime'] = '10d';52 - replace database properties (db_type, db_host, db_user, db_pass, $d_name)53 in /config/db.inc.php with the following line:54 $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';55 - add these lines to /config/db.inc.php56 $rcmail_config['db_max_length'] = 512000;57 58 59 from version 0.1-2005100760 ----------------------------------------61 - replace index.php62 - replace all files in folder /program/63 - replace all files in folder /skins/default/64 - run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql65 - add these lines to /config/main.inc.php66 $rcmail_config['smtp_auth_type'] = ''; // if you need to specify an auth method for SMTP67 $rcmail_config['session_lifetime'] = 20; // to specify the session lifetime in minutes68 $rcmail_config['skip_deleted'] = FALSE;69 $rcmail_config['message_sort_col'] = 'date';70 $rcmail_config['message_sort_order'] = 'DESC';71 $rcmail_config['log_dir'] = 'logs/';72 $rcmail_config['temp_dir'] = 'temp/';73 $rcmail_config['message_cache_lifetime'] = '10d';74 $rcmail_config['drafts_mbox'] = 'Drafts';75 $rcmail_config['product_name'] = 'RoundCube Webmail';76 $rcmail_config['read_when_deleted'] = TRUE;77 $rcmail_config['enable_spellcheck'] = TRUE;78 - add these lines to /config/db.inc.php79 $rcmail_config['db_max_length'] = 512000;80 $rcmail_config['db_sequence_user_ids'] = 'user_ids';81 $rcmail_config['db_sequence_identity_ids'] = 'identity_ids';82 $rcmail_config['db_sequence_contact_ids'] = 'contact_ids';83 $rcmail_config['db_sequence_cache_ids'] = 'cache_ids';84 $rcmail_config['db_sequence_message_ids'] = 'message_ids';85 $rcmail_config['db_persistent'] = TRUE;86 87 from version 0.1-2005102188 ----------------------------------------89 - replace index.php90 - replace all files in folder /program/91 - replace all files in folder /skins/default/92 - run all commands in SQL/*.update.sql or re-initalize database with *.initial.sql93 - add these lines to /config/main.inc.php94 $rcmail_config['skip_deleted'] = FALSE;95 $rcmail_config['message_sort_col'] = 'date';96 $rcmail_config['message_sort_order'] = 'DESC';97 $rcmail_config['log_dir'] = 'logs/';98 $rcmail_config['temp_dir'] = 'temp/';99 $rcmail_config['message_cache_lifetime'] = '10d';100 $rcmail_config['drafts_mbox'] = 'Drafts';101 $rcmail_config['product_name'] = 'RoundCube Webmail';102 $rcmail_config['read_when_deleted'] = TRUE;103 $rcmail_config['enable_spellcheck'] = TRUE;104 - add these lines to /config/db.inc.php105 $rcmail_config['db_max_length'] = 512000;106 $rcmail_config['db_sequence_user_ids'] = 'user_ids';107 $rcmail_config['db_sequence_identity_ids'] = 'identity_ids';108 $rcmail_config['db_sequence_contact_ids'] = 'contact_ids';109 $rcmail_config['db_sequence_cache_ids'] = 'cache_ids';110 $rcmail_config['db_sequence_message_ids'] = 'message_ids';111 $rcmail_config['db_persistent'] = TRUE;112 113 114 form version 0.1-beta115 ----------------------------------------116 - replace index.php117 - replace all files in folder /program/118 - replace all files in folder /skins/default/119 - add these line to /config/db.inc.php120 $rcmail_config['db_persistent'] = TRUE;121 - add these lines to /config/main.inc.php122 $rcmail_config['drafts_mbox'] = 'Drafts';123 $rcmail_config['junk_mbox'] = 'Junk';124 $rcmail_config['product_name'] = 'RoundCube Webmail';125 $rcmail_config['read_when_deleted'] = TRUE;126 $rcmail_config['enable_spellcheck'] = TRUE;127 $rcmail_config['protect_default_folders'] = TRUE;128 - replace the following line from /config/main.inc.php129 @include($_SERVER['HTTP_HOST'].'.inc.php');130 with131 $rcmail_config['include_host_config'] = TRUE;132 133 -
trunk/roundcubemail/program/include/rcube_imap.inc
r321 r325 36 36 * @package RoundCube Webmail 37 37 * @author Thomas Bruederli <roundcube@gmail.com> 38 * @version 1.3 138 * @version 1.34 39 39 * @link http://ilohamail.org 40 40 */ … … 133 133 } 134 134 135 // get account namespace135 // get server properties 136 136 if ($this->conn) 137 137 { 138 138 $this->_parse_capability($this->conn->capability); 139 iil_C_NameSpace($this->conn);140 139 141 140 if (!empty($this->conn->delimiter)) … … 884 883 885 884 // get cached headers 886 if ($uid && ($headers = $this->get_cached_message($mailbox.'.msg', $uid)))885 if ($uid && ($headers = &$this->get_cached_message($mailbox.'.msg', $uid))) 887 886 return $headers; 888 887 889 $msg_id = $is_uid ? $this->_uid2id($id) : $id; 890 $headers = iil_C_FetchHeader($this->conn, $mailbox, $msg_id); 888 $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, $is_uid); 891 889 892 890 // write headers cache 893 891 if ($headers) 894 $this->add_message_cache($mailbox.'.msg', $msg_id, $headers); 892 { 893 if ($is_uid) 894 $this->uid_id_map[$mbox_name][$uid] = $headers->id; 895 896 $this->add_message_cache($mailbox.'.msg', $headers->id, $headers); 897 } 895 898 896 899 return $headers; … … 907 910 function &get_structure($uid) 908 911 { 912 $cache_key = $this->mailbox.'.msg'; 913 $headers = &$this->get_cached_message($cache_key, $uid, true); 914 915 // return cached message structure 916 if (is_object($headers) && is_object($headers->structure)) 917 return $headers->structure; 918 919 // resolve message sequence number 909 920 if (!($msg_id = $this->_uid2id($uid))) 910 921 return FALSE; … … 930 941 list($struct->ctype_primary, $struct->ctype_secondary) = explode('/', $struct->mimetype); 931 942 } 943 944 // write structure to cache 945 if ($this->caching_enabled) 946 $this->add_message_cache($cache_key, $msg_id, $headers, $struct); 932 947 } 933 948 … … 1110 1125 1111 1126 // convert charset (if text or message part) 1112 if (!empty($o_part->charset) && ($o_part->ctype_primary=='text' || $o_part->ctype_primary=='message') && !stristr($body, 'charset=')) 1127 if ($o_part->ctype_primary=='text' || $o_part->ctype_primary=='message') 1128 { 1129 // assume ISO-8859-1 if no charset specified 1130 if (empty($o_part->charset)) 1131 $o_part->charset = 'ISO-8859-1'; 1132 1113 1133 $body = rcube_charset_convert($body, $o_part->charset); 1134 } 1114 1135 } 1115 1136 … … 1534 1555 $mailbox = $this->_mod_mailbox($mbox_name); 1535 1556 $abs_name = $this->_mod_mailbox($name); 1557 1558 // check if mailbox is subscribed 1559 $a_subscribed = $this->_list_mailboxes(); 1560 $subscribed = in_array($mailbox, $a_subscribed); 1561 1562 // unsubscribe folder 1563 if ($subscribed) 1564 iil_C_UnSubscribe($this->conn, $mailbox); 1536 1565 1537 1566 if (strlen($abs_name)) … … 1542 1571 { 1543 1572 $this->clear_message_cache($mailbox.'.msg'); 1544 $this->clear_cache('mailboxes'); 1545 } 1546 1573 $this->clear_cache('mailboxes'); 1574 } 1575 1547 1576 // try to subscribe it 1548 $this->subscribe($name); 1577 if ($result && $subscribed) 1578 iil_C_Subscribe($this->conn, $abs_name); 1549 1579 1550 1580 return $result ? $name : FALSE; … … 1843 1873 1844 1874 1845 function &get_cached_message($key, $uid, $ body=FALSE)1875 function &get_cached_message($key, $uid, $struct=false) 1846 1876 { 1847 1877 if (!$this->caching_enabled) … … 1849 1879 1850 1880 $internal_key = '__single_msg'; 1851 if ($this->caching_enabled && (!isset($this->cache[$internal_key][$uid]) || $body)) 1852 { 1853 $sql_select = "idx, uid, headers"; 1854 if ($body) 1855 $sql_select .= ", body"; 1856 1881 if ($this->caching_enabled && (!isset($this->cache[$internal_key][$uid]) || 1882 ($struct && empty($this->cache[$internal_key][$uid]->structure)))) 1883 { 1884 $sql_select = "idx, uid, headers" . ($struct ? ", structure" : ''); 1857 1885 $sql_result = $this->db->query( 1858 1886 "SELECT $sql_select … … 1864 1892 $key, 1865 1893 $uid); 1866 1894 1867 1895 if ($sql_arr = $this->db->fetch_assoc($sql_result)) 1868 1896 { 1869 $headers = unserialize($sql_arr['headers']); 1870 if (is_object($headers) && !empty($sql_arr['body'])) 1871 $headers->body = $sql_arr['body']; 1872 1873 $this->cache[$internal_key][$uid] = $headers; 1897 $this->cache[$internal_key][$uid] = unserialize($sql_arr['headers']); 1898 if (is_object($this->cache[$internal_key][$uid]) && !empty($sql_arr['structure'])) 1899 $this->cache[$internal_key][$uid]->structure = unserialize($sql_arr['structure']); 1874 1900 } 1875 1901 } … … 1907 1933 1908 1934 1909 function add_message_cache($key, $index, $headers )1910 { 1911 if ( !$key|| !is_object($headers) || empty($headers->uid))1935 function add_message_cache($key, $index, $headers, $struct=null) 1936 { 1937 if (empty($key) || !is_object($headers) || empty($headers->uid)) 1912 1938 return; 1913 1914 $this->db->query( 1915 "INSERT INTO ".get_table_name('messages')." 1916 (user_id, del, cache_key, created, idx, uid, subject, ".$this->db->quoteIdentifier('from').", ".$this->db->quoteIdentifier('to').", cc, date, size, headers) 1917 VALUES (?, 0, ?, now(), ?, ?, ?, ?, ?, ?, ".$this->db->fromunixtime($headers->timestamp).", ?, ?)", 1918 $_SESSION['user_id'], 1919 $key, 1920 $index, 1921 $headers->uid, 1922 (string)substr($this->decode_header($headers->subject, TRUE), 0, 128), 1923 (string)substr($this->decode_header($headers->from, TRUE), 0, 128), 1924 (string)substr($this->decode_header($headers->to, TRUE), 0, 128), 1925 (string)substr($this->decode_header($headers->cc, TRUE), 0, 128), 1926 (int)$headers->size, 1927 serialize($headers)); 1939 1940 // check for an existing record (probly headers are cached but structure not) 1941 $sql_result = $this->db->query( 1942 "SELECT message_id 1943 FROM ".get_table_name('messages')." 1944 WHERE user_id=? 1945 AND cache_key=? 1946 AND uid=? 1947 AND del<>1", 1948 $_SESSION['user_id'], 1949 $key, 1950 $headers->uid); 1951 1952 // update cache record 1953 if ($sql_arr = $this->db->fetch_assoc($sql_result)) 1954 { 1955 $this->db->query( 1956 "UPDATE ".get_table_name('messages')." 1957 SET idx=?, headers=?, structure=? 1958 WHERE message_id=?", 1959 $index, 1960 serialize($headers), 1961 is_object($struct) ? serialize($struct) : NULL, 1962 $sql_arr['message_id'] 1963 ); 1964 } 1965 else // insert new record 1966 { 1967 $this->db->query( 1968 "INSERT INTO ".get_table_name('messages')." 1969 (user_id, del, cache_key, created, idx, uid, subject, ".$this->db->quoteIdentifier('from').", ".$this->db->quoteIdentifier('to').", cc, date, size, headers, structure) 1970 VALUES (?, 0, ?, now(), ?, ?, ?, ?, ?, ?, ".$this->db->fromunixtime($headers->timestamp).", ?, ?, ?)", 1971 $_SESSION['user_id'], 1972 $key, 1973 $index, 1974 $headers->uid, 1975 (string)substr($this->decode_header($headers->subject, TRUE), 0, 128), 1976 (string)substr($this->decode_header($headers->from, TRUE), 0, 128), 1977 (string)substr($this->decode_header($headers->to, TRUE), 0, 128), 1978 (string)substr($this->decode_header($headers->cc, TRUE), 0, 128), 1979 (int)$headers->size, 1980 serialize($headers), 1981 is_object($struct) ? serialize($struct) : NULL 1982 ); 1983 } 1928 1984 } 1929 1985 -
trunk/roundcubemail/program/lib/imap.inc
r282 r325 47 47 - Also acceppt LIST responses in iil_C_ListSubscribed() 48 48 - Sanity check of $message_set in iil_C_FetchHeaders(), iil_C_FetchHeaderIndex(), iil_C_FetchThreadHeaders() 49 - Implemented UID FETCH in iil_C_FetchHeaders() 49 50 - Removed some debuggers (echo ...) 50 51 … … 1196 1197 } 1197 1198 1198 function iil_C_FetchHeaders(&$conn, $mailbox, $message_set ){1199 function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ 1199 1200 global $IMAP_USE_INTERNAL_DATE; 1200 1201 … … 1232 1233 /* FETCH date,from,subject headers */ 1233 1234 $key="fh".($c++); 1234 $request=$key." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCE)])\r\n"; 1235 $prefix=$uidfetch?" UID":""; 1236 $request=$key.$prefix." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCE)])\r\n"; 1235 1237 1236 1238 if (!fputs($fp, $request)) return false; … … 1310 1312 */ 1311 1313 $command_key="fh".($c++); 1312 $request= $command_key. " FETCH $message_set (UID RFC822.SIZE FLAGS INTERNALDATE)\r\n";1314 $request= $command_key.$prefix." FETCH $message_set (UID RFC822.SIZE FLAGS INTERNALDATE)\r\n"; 1313 1315 if (!fputs($fp, $request)) return false; 1314 1316 do{ … … 1402 1404 1403 1405 1404 function iil_C_FetchHeader(&$conn, $mailbox, $id ){1405 $fp = $conn->fp; 1406 $a=iil_C_FetchHeaders($conn, $mailbox, $id );1407 if (is_array($a)) return $a[$id];1406 function iil_C_FetchHeader(&$conn, $mailbox, $id, $uidfetch=false){ 1407 $fp = $conn->fp; 1408 $a=iil_C_FetchHeaders($conn, $mailbox, $id, $uidfetch); 1409 if (is_array($a)) return array_shift($a); 1408 1410 else return false; 1409 1411 } -
trunk/roundcubemail/program/steps/mail/func.inc
r320 r325 672 672 if ($part->ctype_secondary=='html') 673 673 { 674 // remove charset specification in HTML message 675 $body = preg_replace('/charset=[a-z0-9\-]+/i', '', $body); 676 674 677 if (!$safe) // remove remote images and scripts 675 678 { … … 1248 1251 1249 1252 1250 // get source code of a specific message and cache it1251 // deprecated1252 function rcmail_message_source($uid)1253 {1254 global $IMAP, $DB, $CONFIG;1255 1256 // get message ID if uid is given1257 $cache_key = $IMAP->mailbox.'.msg';1258 $cached = $IMAP->get_cached_message($cache_key, $uid, FALSE);1259 1260 // message is cached in database1261 if ($cached && !empty($cached->body))1262 return $cached->body;1263 1264 if (!$cached)1265 $headers = $IMAP->get_headers($uid);1266 else1267 $headers = &$cached;1268 1269 // create unique identifier based on message_id1270 if (!empty($headers->messageID))1271 $message_id = md5($headers->messageID);1272 else1273 $message_id = md5($headers->uid.'@'.$_SESSION['imap_host']);1274 1275 $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '');1276 $cache_dir = $temp_dir.$_SESSION['client_id'];1277 $cache_path = $cache_dir.'/'.$message_id;1278 1279 // message is cached in temp dir1280 if ($CONFIG['enable_caching'] && is_dir($cache_dir) && is_file($cache_path))1281 {1282 if ($fp = fopen($cache_path, 'r'))1283 {1284 $msg_source = fread($fp, filesize($cache_path));1285 fclose($fp);1286 return $msg_source;1287 }1288 }1289 1290 1291 // get message from server1292 $msg_source = $IMAP->get_raw_body($uid);1293 1294 // return message source without caching1295 if (!$CONFIG['enable_caching'])1296 return $msg_source;1297 1298 1299 // let's cache the message body within the database1300 if ($cached && ($CONFIG['db_max_length'] -300) > $headers->size)1301 {1302 $DB->query("UPDATE ".get_table_name('messages')."1303 SET body=?1304 WHERE user_id=?1305 AND cache_key=?1306 AND uid=?",1307 $msg_source,1308 $_SESSION['user_id'],1309 $cache_key,1310 $uid);1311 1312 return $msg_source;1313 }1314 1315 1316 // create dir for caching1317 if (!is_dir($cache_dir))1318 $dir = mkdir($cache_dir);1319 else1320 $dir = true;1321 1322 // attempt to write a file with the message body1323 if ($dir && ($fp = fopen($cache_path, 'w')))1324 {1325 fwrite($fp, $msg_source);1326 fclose($fp);1327 }1328 else1329 {1330 raise_error(array('code' => 403, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,1331 'message' => "Failed to write to temp dir"), TRUE, FALSE);1332 }1333 1334 return $msg_source;1335 }1336 1337 1338 1253 // decode address string and re-format it as HTML links 1339 1254 function rcmail_address_string($input, $max=NULL, $addicon=NULL) … … 1413 1328 $out .= sprintf('<tr><td class="title">%s</td><td>%s</td><td>[<a href="./?%s">%s</a>]</tr>'."\n", 1414 1329 rcube_label('filename'), 1415 rep_specialchars_output( $filename),1330 rep_specialchars_output(rcube_imap::decode_mime_string($filename)), 1416 1331 str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), 1417 1332 rcube_label('download')); -
trunk/roundcubemail/program/steps/mail/get.inc
r320 r325 70 70 header("Content-Type: application/octet-stream"); 71 71 header(sprintf('Content-Disposition: attachment; filename="%s"', 72 $filename ? $filename: "roundcube.$ctype_secondary"));72 $filename ? rcube_imap::decode_mime_string($filename) : "roundcube.$ctype_secondary")); 73 73 } 74 74 else 75 75 { 76 76 header("Content-Type: $mimetype"); 77 header(sprintf('Content-Disposition: inline; filename="%s"', $filename));77 header(sprintf('Content-Disposition: inline; filename="%s"', rcube_imap::decode_mime_string($filename))); 78 78 } 79 79 … … 90 90 // get part body if not available 91 91 if (!$part->body) 92 $part->body = $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part); 92 $part->body = $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part); 93 93 94 94 list($MESSAGE['parts']) = rcmail_parse_message($part, … … 97 97 'get_url' => $GET_URL.'&_part=%s')); 98 98 99 print rcmail_print_body($MESSAGE['parts'][0], (bool)$_GET['_safe']); 99 $OUTPUT = new rcube_html_page(); 100 $OUTPUT->write(rcmail_print_body($MESSAGE['parts'][0], (bool)$_GET['_safe'])); 100 101 } 101 102 else
Note: See TracChangeset
for help on using the changeset viewer.
