Changeset 5712 in subversion
- Timestamp:
- Jan 5, 2012 3:50:07 AM (17 months ago)
- Location:
- branches/release-0.7
- Files:
-
- 13 edited
-
CHANGELOG (modified) (1 diff)
-
SQL/mssql.initial.sql (modified) (1 diff)
-
SQL/mssql.upgrade.sql (modified) (1 diff)
-
SQL/mysql.initial.sql (modified) (9 diffs)
-
SQL/mysql.update.sql (modified) (1 diff)
-
SQL/postgres.initial.sql (modified) (2 diffs)
-
SQL/postgres.update.sql (modified) (1 diff)
-
SQL/sqlite.initial.sql (modified) (2 diffs)
-
SQL/sqlite.update.sql (modified) (1 diff)
-
plugins/managesieve/Changelog (modified) (1 diff)
-
plugins/managesieve/managesieve.php (modified) (1 diff)
-
program/include/rcube_contacts.php (modified) (12 diffs)
-
program/steps/addressbook/save.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-0.7/CHANGELOG
r5683 r5712 2 2 =========================== 3 3 4 - Fix SQL Error when saving a contact with many email addresses (#1488286) 5 - Fix strict email address searching if contact has more than one address 6 - Remove duplicated 'organization' label (#1488287) 4 7 - Fix so editor selector is hidden when 'htmleditor' is listed in 'dont_override' 5 8 - Fix wrong (long) label usage (#1488283) -
branches/release-0.7/SQL/mssql.initial.sql
r5481 r5712 41 41 [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL , 42 42 [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , 43 [email] [ varchar] (255)COLLATE Latin1_General_CI_AI NOT NULL ,43 [email] [text] COLLATE Latin1_General_CI_AI NOT NULL , 44 44 [firstname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , 45 45 [surname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , -
branches/release-0.7/SQL/mssql.upgrade.sql
r5481 r5712 245 245 GO 246 246 247 -- Updates from version 0.7 248 249 ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [text] COLLATE Latin1_General_CI_AI NOT NULL 250 GO 251 -
branches/release-0.7/SQL/mysql.initial.sql
r5481 r5712 41 41 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 42 42 `data` longtext NOT NULL, 43 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',43 `user_id` int(10) UNSIGNED NOT NULL, 44 44 PRIMARY KEY(`cache_id`), 45 45 CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`) … … 53 53 54 54 CREATE TABLE `cache_index` ( 55 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',55 `user_id` int(10) UNSIGNED NOT NULL, 56 56 `mailbox` varchar(255) BINARY NOT NULL, 57 57 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', … … 68 68 69 69 CREATE TABLE `cache_thread` ( 70 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',70 `user_id` int(10) UNSIGNED NOT NULL, 71 71 `mailbox` varchar(255) BINARY NOT NULL, 72 72 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', … … 82 82 83 83 CREATE TABLE `cache_messages` ( 84 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',84 `user_id` int(10) UNSIGNED NOT NULL, 85 85 `mailbox` varchar(255) BINARY NOT NULL, 86 86 `uid` int(11) UNSIGNED NOT NULL DEFAULT '0', … … 102 102 `del` tinyint(1) NOT NULL DEFAULT '0', 103 103 `name` varchar(128) NOT NULL DEFAULT '', 104 `email` varchar(255) NOT NULL,104 `email` text NOT NULL DEFAULT '', 105 105 `firstname` varchar(128) NOT NULL DEFAULT '', 106 106 `surname` varchar(128) NOT NULL DEFAULT '', 107 107 `vcard` longtext NULL, 108 108 `words` text NULL, 109 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',109 `user_id` int(10) UNSIGNED NOT NULL, 110 110 PRIMARY KEY(`contact_id`), 111 111 CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) 112 112 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE, 113 INDEX `user_contacts_index` (`user_id`,` email`)113 INDEX `user_contacts_index` (`user_id`,`del`) 114 114 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; 115 115 … … 118 118 CREATE TABLE `contactgroups` ( 119 119 `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, 120 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',120 `user_id` int(10) UNSIGNED NOT NULL, 121 121 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 122 122 `del` tinyint(1) NOT NULL DEFAULT '0', … … 130 130 CREATE TABLE `contactgroupmembers` ( 131 131 `contactgroup_id` int(10) UNSIGNED NOT NULL, 132 `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',132 `contact_id` int(10) UNSIGNED NOT NULL, 133 133 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 134 134 PRIMARY KEY (`contactgroup_id`, `contact_id`), … … 145 145 CREATE TABLE `identities` ( 146 146 `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, 147 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',147 `user_id` int(10) UNSIGNED NOT NULL, 148 148 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 149 149 `del` tinyint(1) NOT NULL DEFAULT '0', … … 179 179 CREATE TABLE `searches` ( 180 180 `search_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, 181 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',181 `user_id` int(10) UNSIGNED NOT NULL, 182 182 `type` int(3) NOT NULL DEFAULT '0', 183 183 `name` varchar(128) NOT NULL, -
branches/release-0.7/SQL/mysql.update.sql
r5481 r5712 213 213 214 214 ALTER TABLE `session` CHANGE `sess_id` `sess_id` varchar(128) NOT NULL; 215 216 -- Updates from version 0.7 217 218 ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`; 219 ALTER TABLE `contacts` DROP INDEX `user_contacts_index`; 220 ALTER TABLE `contacts` MODIFY `email` text NOT NULL DEFAULT ''; 221 ALTER TABLE `contacts` ADD INDEX `user_contacts_index` (`user_id`,`del`); 222 ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) 223 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; 224 225 ALTER TABLE `cache` ALTER `user_id` DROP DEFAULT; 226 ALTER TABLE `cache_index` ALTER `user_id` DROP DEFAULT; 227 ALTER TABLE `cache_thread` ALTER `user_id` DROP DEFAULT; 228 ALTER TABLE `cache_messages` ALTER `user_id` DROP DEFAULT; 229 ALTER TABLE `contacts` ALTER `user_id` DROP DEFAULT; 230 ALTER TABLE `contactgroups` ALTER `user_id` DROP DEFAULT; 231 ALTER TABLE `contactgroupmembers` ALTER `contact_id` DROP DEFAULT; 232 ALTER TABLE `identities` ALTER `user_id` DROP DEFAULT; 233 ALTER TABLE `searches` ALTER `user_id` DROP DEFAULT; -
branches/release-0.7/SQL/postgres.initial.sql
r5481 r5712 108 108 del smallint DEFAULT 0 NOT NULL, 109 109 name varchar(128) DEFAULT '' NOT NULL, 110 email varchar(255)DEFAULT '' NOT NULL,110 email text DEFAULT '' NOT NULL, 111 111 firstname varchar(128) DEFAULT '' NOT NULL, 112 112 surname varchar(128) DEFAULT '' NOT NULL, … … 115 115 ); 116 116 117 CREATE INDEX contacts_user_id_idx ON contacts (user_id, email);117 CREATE INDEX contacts_user_id_idx ON contacts (user_id, del); 118 118 119 119 -- -
branches/release-0.7/SQL/postgres.update.sql
r5629 r5712 170 170 171 171 ALTER TABLE "session" ALTER sess_id TYPE varchar(128); 172 173 -- Updates from version 0.7 174 175 DROP INDEX contacts_user_id_idx; 176 CREATE INDEX contacts_user_id_idx ON contacts USING btree (user_id, del); 177 ALTER TABLE contacts ALTER email TYPE text; -
branches/release-0.7/SQL/sqlite.initial.sql
r5616 r5712 25 25 CREATE TABLE contacts ( 26 26 contact_id integer NOT NULL PRIMARY KEY, 27 user_id integer NOT NULL default '0',27 user_id integer NOT NULL, 28 28 changed datetime NOT NULL default '0000-00-00 00:00:00', 29 29 del tinyint NOT NULL default '0', 30 30 name varchar(128) NOT NULL default '', 31 email varchar(255)NOT NULL default '',31 email text NOT NULL default '', 32 32 firstname varchar(128) NOT NULL default '', 33 33 surname varchar(128) NOT NULL default '', … … 36 36 ); 37 37 38 CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);38 CREATE INDEX ix_contacts_user_id ON contacts(user_id, del); 39 39 40 40 -
branches/release-0.7/SQL/sqlite.update.sql
r5616 r5712 294 294 vars text NOT NULL 295 295 ); 296 297 296 CREATE INDEX ix_session_changed ON session (changed); 297 298 -- Updates from version 0.7 299 300 CREATE TABLE contacts_tmp ( 301 contact_id integer NOT NULL PRIMARY KEY, 302 user_id integer NOT NULL, 303 changed datetime NOT NULL default '0000-00-00 00:00:00', 304 del tinyint NOT NULL default '0', 305 name varchar(128) NOT NULL default '', 306 email text NOT NULL default '', 307 firstname varchar(128) NOT NULL default '', 308 surname varchar(128) NOT NULL default '', 309 vcard text NOT NULL default '', 310 words text NOT NULL default '' 311 ); 312 313 INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words) 314 SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words FROM contacts; 315 316 DROP TABLE contacts; 317 318 CREATE TABLE contacts ( 319 contact_id integer NOT NULL PRIMARY KEY, 320 user_id integer NOT NULL, 321 changed datetime NOT NULL default '0000-00-00 00:00:00', 322 del tinyint NOT NULL default '0', 323 name varchar(128) NOT NULL default '', 324 email text NOT NULL default '', 325 firstname varchar(128) NOT NULL default '', 326 surname varchar(128) NOT NULL default '', 327 vcard text NOT NULL default '', 328 words text NOT NULL default '' 329 ); 330 331 INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words) 332 SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words FROM contacts_tmp; 333 334 CREATE INDEX ix_contacts_user_id ON contacts(user_id, del); 335 DROP TABLE contacts_tmp; -
branches/release-0.7/plugins/managesieve/Changelog
r5481 r5712 1 1 - Fixed setting test type to :is when none is specified 2 2 - Fixed javascript error in IE8 3 - Fix possible ID duplication when adding filter rules very fast (#1488288) 3 4 4 5 * version 5.0-rc1 [2011-11-17] -
branches/release-0.7/plugins/managesieve/managesieve.php
r5452 r5712 1543 1543 private function genid() 1544 1544 { 1545 $result = intval(rcube_timer());1545 $result = preg_replace('/[^0-9]/', '', microtime(true)); 1546 1546 return $result; 1547 1547 } -
branches/release-0.7/program/include/rcube_contacts.php
r5415 r5712 63 63 'birthday', 'anniversary', 'website', 'im', 'notes', 'photo'); 64 64 65 const SEPARATOR = ','; 66 65 67 66 68 /** … … 233 235 if ($read_vcard) 234 236 $sql_arr = $this->convert_db_data($sql_arr); 235 else 236 $sql_arr['email'] = preg_split('/,\s*/', $sql_arr['email']); 237 else { 238 $sql_arr['email'] = explode(self::SEPARATOR, $sql_arr['email']); 239 $sql_arr['email'] = array_map('trim', $sql_arr['email']); 240 } 237 241 238 242 // make sure we have a name to display … … 288 292 $where = $and_where = array(); 289 293 $mode = intval($mode); 294 $WS = ' '; 295 $AS = self::SEPARATOR; 290 296 291 297 foreach ($fields as $idx => $col) { 292 298 // direct ID search 293 299 if ($col == 'ID' || $col == $this->primary_key) { 294 $ids = !is_array($value) ? explode( ',', $value) : $value;300 $ids = !is_array($value) ? explode(self::SEPARATOR, $value) : $value; 295 301 $ids = $this->db->array2list($ids, 'integer'); 296 302 $where[] = 'c.' . $this->primary_key.' IN ('.$ids.')'; … … 300 306 else if ($col == '*') { 301 307 $words = array(); 302 foreach (explode( " ", self::normalize_string($value)) as $word) {308 foreach (explode($WS, self::normalize_string($value)) as $word) { 303 309 switch ($mode) { 304 310 case 1: // strict 305 $words[] = '(' . $this->db->ilike('words', $word .'%')306 . ' OR ' . $this->db->ilike('words', '% '.$word.'%')307 . ' OR ' . $this->db->ilike('words', '% '.$word) . ')';311 $words[] = '(' . $this->db->ilike('words', $word . '%') 312 . ' OR ' . $this->db->ilike('words', '%' . $WS . $word . $WS . '%') 313 . ' OR ' . $this->db->ilike('words', '%' . $WS . $word) . ')'; 308 314 break; 309 315 case 2: // prefix 310 $words[] = '(' . $this->db->ilike('words', $word .'%')311 . ' OR ' . $this->db->ilike('words', '% '.$word.'%') . ')';316 $words[] = '(' . $this->db->ilike('words', $word . '%') 317 . ' OR ' . $this->db->ilike('words', '%' . $WS . $word . '%') . ')'; 312 318 break; 313 319 default: // partial 314 $words[] = $this->db->ilike('words', '%' .$word.'%');320 $words[] = $this->db->ilike('words', '%' . $word . '%'); 315 321 } 316 322 } … … 323 329 switch ($mode) { 324 330 case 1: // strict 325 $where[] = $this->db->quoteIdentifier($col).' = '.$this->db->quote($val); 331 $where[] = '(' . $this->db->quoteIdentifier($col) . ' = ' . $this->db->quote($val) 332 . ' OR ' . $this->db->ilike($col, $val . $AS . '%') 333 . ' OR ' . $this->db->ilike($col, '%' . $AS . $val . $AS . '%') 334 . ' OR ' . $this->db->ilike($col, '%' . $AS . $val) . ')'; 326 335 break; 327 336 case 2: // prefix 328 $where[] = $this->db->ilike($col, $val.'%'); 337 $where[] = '(' . $this->db->ilike($col, $val . '%') 338 . ' OR ' . $this->db->ilike($col, $AS . $val . '%') . ')'; 329 339 break; 330 340 default: // partial 331 $where[] = $this->db->ilike($col, '%' .$val.'%');341 $where[] = $this->db->ilike($col, '%' . $val . '%'); 332 342 } 333 343 } … … 338 348 switch ($mode) { 339 349 case 1: // strict 340 $words[] = '(' . $this->db->ilike('words', $word .'%')341 . ' OR ' . $this->db->ilike('words', '% '.$word.'%')342 . ' OR ' . $this->db->ilike('words', '% '.$word) . ')';350 $words[] = '(' . $this->db->ilike('words', $word . $WS . '%') 351 . ' OR ' . $this->db->ilike('words', '%' . $AS . $word . $WS .'%') 352 . ' OR ' . $this->db->ilike('words', '%' . $AS . $word) . ')'; 343 353 break; 344 354 case 2: // prefix 345 $words[] = '(' . $this->db->ilike('words', $word .'%')346 . ' OR ' . $this->db->ilike('words', ' '.$word.'%') . ')';355 $words[] = '(' . $this->db->ilike('words', $word . '%') 356 . ' OR ' . $this->db->ilike('words', $AS . $word . '%') . ')'; 347 357 break; 348 358 default: // partial 349 $words[] = $this->db->ilike('words', '%' .$word.'%');359 $words[] = $this->db->ilike('words', '%' . $word . '%'); 350 360 } 351 361 } … … 688 698 else { 689 699 $record += $sql_arr; 690 $record['email'] = preg_split('/,\s*/', $record['email']); 700 $record['email'] = explode(self::SEPARATOR, $record['email']); 701 $record['email'] = array_map('trim', $record['email']); 691 702 } 692 703 … … 721 732 if (!isset($save_data[$key])) 722 733 $key .= ':home'; 723 if (isset($save_data[$key])) 724 $out[$col] = is_array($save_data[$key]) ? join(',', $save_data[$key]) : $save_data[$key]; 734 if (isset($save_data[$key])) { 735 if (is_array($save_data[$key])) 736 $out[$col] = join(self::SEPARATOR, $save_data[$key]); 737 else 738 $out[$col] = $save_data[$key]; 739 } 725 740 } 726 741 727 742 // save all e-mails in database column 728 $out['email'] = join( ", ", $vcard->email);743 $out['email'] = join(self::SEPARATOR, $vcard->email); 729 744 730 745 // join words for fulltext search … … 744 759 { 745 760 if (!is_array($ids)) 746 $ids = explode( ',', $ids);761 $ids = explode(self::SEPARATOR, $ids); 747 762 748 763 $ids = $this->db->array2list($ids, 'integer'); … … 771 786 { 772 787 if (!is_array($ids)) 773 $ids = explode( ',', $ids);788 $ids = explode(self::SEPARATOR, $ids); 774 789 775 790 $ids = $this->db->array2list($ids, 'integer'); … … 888 903 { 889 904 if (!is_array($ids)) 890 $ids = explode( ',', $ids);905 $ids = explode(self::SEPARATOR, $ids); 891 906 892 907 $added = 0; … … 933 948 { 934 949 if (!is_array($ids)) 935 $ids = explode( ',', $ids);950 $ids = explode(self::SEPARATOR, $ids); 936 951 937 952 $ids = $this->db->array2list($ids, 'integer'); -
branches/release-0.7/program/steps/addressbook/save.inc
r5541 r5712 82 82 // do input checks (delegated to $CONTACTS instance) 83 83 if (!$CONTACTS->validate($a_record)) { 84 $err = (array)$CONTACTS->get_error() + array('message' => 'formincomplete', 'type' => 'warning');85 $OUTPUT->show_message($err['message'] , $err['type']);84 $err = (array)$CONTACTS->get_error(); 85 $OUTPUT->show_message($err['message'] ? $err['message'] : 'formincomplete', 'warning'); 86 86 $GLOBALS['EDIT_RECORD'] = $a_record; // store submitted data to be used in edit form 87 87 rcmail_overwrite_action($return_action);
Note: See TracChangeset
for help on using the changeset viewer.
