Changeset 5712 in subversion


Ignore:
Timestamp:
Jan 5, 2012 3:50:07 AM (17 months ago)
Author:
alec
Message:
  • Applied fixes from trunk up to r5711
Location:
branches/release-0.7
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/release-0.7/CHANGELOG

    r5683 r5712  
    22=========================== 
    33 
     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) 
    47- Fix so editor selector is hidden when 'htmleditor' is listed in 'dont_override' 
    58- Fix wrong (long) label usage (#1488283) 
  • branches/release-0.7/SQL/mssql.initial.sql

    r5481 r5712  
    4141        [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL , 
    4242        [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 , 
    4444        [firstname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , 
    4545        [surname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , 
  • branches/release-0.7/SQL/mssql.upgrade.sql

    r5481 r5712  
    245245GO 
    246246 
     247-- Updates from version 0.7 
     248 
     249ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [text] COLLATE Latin1_General_CI_AI NOT NULL 
     250GO 
     251 
  • branches/release-0.7/SQL/mysql.initial.sql

    r5481 r5712  
    4141 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 
    4242 `data` longtext NOT NULL, 
    43  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 
     43 `user_id` int(10) UNSIGNED NOT NULL, 
    4444 PRIMARY KEY(`cache_id`), 
    4545 CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`) 
     
    5353 
    5454CREATE TABLE `cache_index` ( 
    55  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 
     55 `user_id` int(10) UNSIGNED NOT NULL, 
    5656 `mailbox` varchar(255) BINARY NOT NULL, 
    5757 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 
     
    6868 
    6969CREATE TABLE `cache_thread` ( 
    70  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 
     70 `user_id` int(10) UNSIGNED NOT NULL, 
    7171 `mailbox` varchar(255) BINARY NOT NULL, 
    7272 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 
     
    8282 
    8383CREATE TABLE `cache_messages` ( 
    84  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 
     84 `user_id` int(10) UNSIGNED NOT NULL, 
    8585 `mailbox` varchar(255) BINARY NOT NULL, 
    8686 `uid` int(11) UNSIGNED NOT NULL DEFAULT '0', 
     
    102102 `del` tinyint(1) NOT NULL DEFAULT '0', 
    103103 `name` varchar(128) NOT NULL DEFAULT '', 
    104  `email` varchar(255) NOT NULL, 
     104 `email` text NOT NULL DEFAULT '', 
    105105 `firstname` varchar(128) NOT NULL DEFAULT '', 
    106106 `surname` varchar(128) NOT NULL DEFAULT '', 
    107107 `vcard` longtext NULL, 
    108108 `words` text NULL, 
    109  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', 
     109 `user_id` int(10) UNSIGNED NOT NULL, 
    110110 PRIMARY KEY(`contact_id`), 
    111111 CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) 
    112112   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`) 
    114114) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */; 
    115115 
     
    118118CREATE TABLE `contactgroups` ( 
    119119  `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, 
    121121  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 
    122122  `del` tinyint(1) NOT NULL DEFAULT '0', 
     
    130130CREATE TABLE `contactgroupmembers` ( 
    131131  `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, 
    133133  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 
    134134  PRIMARY KEY (`contactgroup_id`, `contact_id`), 
     
    145145CREATE TABLE `identities` ( 
    146146 `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, 
    148148 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 
    149149 `del` tinyint(1) NOT NULL DEFAULT '0', 
     
    179179CREATE TABLE `searches` ( 
    180180 `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, 
    182182 `type` int(3) NOT NULL DEFAULT '0', 
    183183 `name` varchar(128) NOT NULL, 
  • branches/release-0.7/SQL/mysql.update.sql

    r5481 r5712  
    213213 
    214214ALTER TABLE `session` CHANGE `sess_id` `sess_id` varchar(128) NOT NULL; 
     215 
     216-- Updates from version 0.7 
     217 
     218ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`; 
     219ALTER TABLE `contacts` DROP INDEX `user_contacts_index`; 
     220ALTER TABLE `contacts` MODIFY `email` text NOT NULL DEFAULT ''; 
     221ALTER TABLE `contacts` ADD INDEX `user_contacts_index` (`user_id`,`del`); 
     222ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) 
     223   REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; 
     224 
     225ALTER TABLE `cache` ALTER `user_id` DROP DEFAULT; 
     226ALTER TABLE `cache_index` ALTER `user_id` DROP DEFAULT; 
     227ALTER TABLE `cache_thread` ALTER `user_id` DROP DEFAULT; 
     228ALTER TABLE `cache_messages` ALTER `user_id` DROP DEFAULT; 
     229ALTER TABLE `contacts` ALTER `user_id` DROP DEFAULT; 
     230ALTER TABLE `contactgroups` ALTER `user_id` DROP DEFAULT; 
     231ALTER TABLE `contactgroupmembers` ALTER `contact_id` DROP DEFAULT; 
     232ALTER TABLE `identities` ALTER `user_id` DROP DEFAULT; 
     233ALTER TABLE `searches` ALTER `user_id` DROP DEFAULT; 
  • branches/release-0.7/SQL/postgres.initial.sql

    r5481 r5712  
    108108    del smallint DEFAULT 0 NOT NULL, 
    109109    name varchar(128) DEFAULT '' NOT NULL, 
    110     email varchar(255) DEFAULT '' NOT NULL, 
     110    email text DEFAULT '' NOT NULL, 
    111111    firstname varchar(128) DEFAULT '' NOT NULL, 
    112112    surname varchar(128) DEFAULT '' NOT NULL, 
     
    115115); 
    116116 
    117 CREATE INDEX contacts_user_id_idx ON contacts (user_id, email); 
     117CREATE INDEX contacts_user_id_idx ON contacts (user_id, del); 
    118118 
    119119-- 
  • branches/release-0.7/SQL/postgres.update.sql

    r5629 r5712  
    170170 
    171171ALTER TABLE "session" ALTER sess_id TYPE varchar(128); 
     172 
     173-- Updates from version 0.7 
     174 
     175DROP INDEX contacts_user_id_idx; 
     176CREATE INDEX contacts_user_id_idx ON contacts USING btree (user_id, del); 
     177ALTER TABLE contacts ALTER email TYPE text; 
  • branches/release-0.7/SQL/sqlite.initial.sql

    r5616 r5712  
    2525CREATE TABLE contacts ( 
    2626  contact_id integer NOT NULL PRIMARY KEY, 
    27   user_id integer NOT NULL default '0', 
     27  user_id integer NOT NULL, 
    2828  changed datetime NOT NULL default '0000-00-00 00:00:00', 
    2929  del tinyint NOT NULL default '0', 
    3030  name varchar(128) NOT NULL default '', 
    31   email varchar(255) NOT NULL default '', 
     31  email text NOT NULL default '', 
    3232  firstname varchar(128) NOT NULL default '', 
    3333  surname varchar(128) NOT NULL default '', 
     
    3636); 
    3737 
    38 CREATE INDEX ix_contacts_user_id ON contacts(user_id, email); 
     38CREATE INDEX ix_contacts_user_id ON contacts(user_id, del); 
    3939 
    4040 
  • branches/release-0.7/SQL/sqlite.update.sql

    r5616 r5712  
    294294  vars text NOT NULL 
    295295); 
    296  
    297296CREATE INDEX ix_session_changed ON session (changed); 
     297 
     298-- Updates from version 0.7 
     299 
     300CREATE 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 
     313INSERT 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 
     316DROP TABLE contacts; 
     317 
     318CREATE 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 
     331INSERT 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 
     334CREATE INDEX ix_contacts_user_id ON contacts(user_id, del); 
     335DROP TABLE contacts_tmp; 
  • branches/release-0.7/plugins/managesieve/Changelog

    r5481 r5712  
    11- Fixed setting test type to :is when none is specified 
    22- Fixed javascript error in IE8 
     3- Fix possible ID duplication when adding filter rules very fast (#1488288) 
    34 
    45* version 5.0-rc1 [2011-11-17] 
  • branches/release-0.7/plugins/managesieve/managesieve.php

    r5452 r5712  
    15431543    private function genid() 
    15441544    { 
    1545         $result = intval(rcube_timer()); 
     1545        $result = preg_replace('/[^0-9]/', '', microtime(true)); 
    15461546        return $result; 
    15471547    } 
  • branches/release-0.7/program/include/rcube_contacts.php

    r5415 r5712  
    6363      'birthday', 'anniversary', 'website', 'im', 'notes', 'photo'); 
    6464 
     65    const SEPARATOR = ','; 
     66 
    6567 
    6668    /** 
     
    233235            if ($read_vcard) 
    234236                $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            } 
    237241 
    238242            // make sure we have a name to display 
     
    288292        $where = $and_where = array(); 
    289293        $mode = intval($mode); 
     294        $WS = ' '; 
     295        $AS = self::SEPARATOR; 
    290296 
    291297        foreach ($fields as $idx => $col) { 
    292298            // direct ID search 
    293299            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; 
    295301                $ids     = $this->db->array2list($ids, 'integer'); 
    296302                $where[] = 'c.' . $this->primary_key.' IN ('.$ids.')'; 
     
    300306            else if ($col == '*') { 
    301307                $words = array(); 
    302                 foreach (explode(" ", self::normalize_string($value)) as $word) { 
     308                foreach (explode($WS, self::normalize_string($value)) as $word) { 
    303309                    switch ($mode) { 
    304310                    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) . ')'; 
    308314                        break; 
    309315                    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 . '%') . ')'; 
    312318                        break; 
    313319                    default: // partial 
    314                         $words[] = $this->db->ilike('words', '%'.$word.'%'); 
     320                        $words[] = $this->db->ilike('words', '%' . $word . '%'); 
    315321                    } 
    316322                } 
     
    323329                    switch ($mode) { 
    324330                    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) . ')'; 
    326335                        break; 
    327336                    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 . '%') . ')'; 
    329339                        break; 
    330340                    default: // partial 
    331                         $where[] = $this->db->ilike($col, '%'.$val.'%'); 
     341                        $where[] = $this->db->ilike($col, '%' . $val . '%'); 
    332342                    } 
    333343                } 
     
    338348                            switch ($mode) { 
    339349                            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) . ')'; 
    343353                                break; 
    344354                            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 . '%') . ')'; 
    347357                                break; 
    348358                            default: // partial 
    349                                 $words[] = $this->db->ilike('words', '%'.$word.'%'); 
     359                                $words[] = $this->db->ilike('words', '%' . $word . '%'); 
    350360                            } 
    351361                        } 
     
    688698        else { 
    689699            $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']); 
    691702        } 
    692703 
     
    721732            if (!isset($save_data[$key])) 
    722733                $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            } 
    725740        } 
    726741 
    727742        // save all e-mails in database column 
    728         $out['email'] = join(", ", $vcard->email); 
     743        $out['email'] = join(self::SEPARATOR, $vcard->email); 
    729744 
    730745        // join words for fulltext search 
     
    744759    { 
    745760        if (!is_array($ids)) 
    746             $ids = explode(',', $ids); 
     761            $ids = explode(self::SEPARATOR, $ids); 
    747762 
    748763        $ids = $this->db->array2list($ids, 'integer'); 
     
    771786    { 
    772787        if (!is_array($ids)) 
    773             $ids = explode(',', $ids); 
     788            $ids = explode(self::SEPARATOR, $ids); 
    774789 
    775790        $ids = $this->db->array2list($ids, 'integer'); 
     
    888903    { 
    889904        if (!is_array($ids)) 
    890             $ids = explode(',', $ids); 
     905            $ids = explode(self::SEPARATOR, $ids); 
    891906 
    892907        $added = 0; 
     
    933948    { 
    934949        if (!is_array($ids)) 
    935             $ids = explode(',', $ids); 
     950            $ids = explode(self::SEPARATOR, $ids); 
    936951 
    937952        $ids = $this->db->array2list($ids, 'integer'); 
  • branches/release-0.7/program/steps/addressbook/save.inc

    r5541 r5712  
    8282// do input checks (delegated to $CONTACTS instance) 
    8383if (!$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'); 
    8686    $GLOBALS['EDIT_RECORD'] = $a_record;  // store submitted data to be used in edit form 
    8787    rcmail_overwrite_action($return_action); 
Note: See TracChangeset for help on using the changeset viewer.