Changeset 1126fc6 in github
- Timestamp:
- Jun 2, 2010 6:23:06 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- ae8a2a55
- Parents:
- 7d43f89
- File:
-
- 1 edited
-
program/include/rcube_contacts.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcube_contacts.php
r982e0b0 r1126fc6 565 565 566 566 $added = 0; 567 $exists = array(); 568 569 // get existing assignments ... 570 $sql_result = $this->db->query( 571 "SELECT contact_id FROM ".get_table_name($this->db_groupmembers). 572 " WHERE contactgroup_id=?". 573 " AND contact_id IN (".$this->db->array2list($ids, 'integer').")", 574 $group_id 575 ); 576 while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { 577 $exists[] = $sql_arr['contact_id']; 578 } 579 // ... and remove them from the list 580 $ids = array_diff($ids, $exists); 567 581 568 582 foreach ($ids as $contact_id) { 569 $ sql_result = $this->db->query(570 " SELECT 1 FROM".get_table_name($this->db_groupmembers).571 " WHERE contactgroup_id=?".572 " AND contact_id=?",583 $this->db->query( 584 "INSERT INTO ".get_table_name($this->db_groupmembers). 585 " (contactgroup_id, contact_id, created)". 586 " VALUES (?, ?, ".$this->db->now().")", 573 587 $group_id, 574 588 $contact_id 575 589 ); 576 590 577 if (!$this->db->num_rows($sql_result)) { 578 $this->db->query( 579 "INSERT INTO ".get_table_name($this->db_groupmembers). 580 " (contactgroup_id, contact_id, created)". 581 " VALUES (?, ?, ".$this->db->now().")", 582 $group_id, 583 $contact_id 584 ); 585 586 if (!$this->db->db_error) 587 $added++; 588 } 591 if (!$this->db->db_error) 592 $added++; 589 593 } 590 594
Note: See TracChangeset
for help on using the changeset viewer.
