Changeset 3668 in subversion
- Timestamp:
- May 26, 2010 5:25:24 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_contacts.php
r3615 r3668 29 29 { 30 30 // protected for backward compat. with some plugins 31 // maybe changed in the future31 // deprecated: re-implement $this->get_table_name() instead 32 32 protected $db_name = ''; 33 protected $db_groups = ''; 34 protected $db_groupmembers = ''; 35 33 36 private $db = null; 34 37 private $user_id = 0; … … 59 62 { 60 63 $this->db = $dbconn; 61 $this->db_name = get_table_name('contacts'); 64 $this->db_name = $this->get_table_name('contacts'); 65 $this->db_groups = $this->get_table_name('contactgroups'); 66 $this->db_groupmembers = $this->get_table_name('contactgroupmembers'); 67 62 68 $this->user_id = $user; 63 69 $this->ready = $this->db && !$this->db->is_error(); … … 128 134 129 135 $sql_result = $this->db->query( 130 "SELECT * FROM ". get_table_name('contactgroups').136 "SELECT * FROM ".$this->db_groups. 131 137 " WHERE del<>1". 132 138 " AND user_id=?". … … 166 172 167 173 if ($this->group_id) 168 $join = " LEFT JOIN ". get_table_name('contactgroupmembers')." AS m".174 $join = " LEFT JOIN ".$this->db_groupmembers." AS m". 169 175 " ON (m.contact_id = c.".$this->primary_key.")"; 170 176 … … 283 289 { 284 290 if ($this->group_id) 285 $join = " LEFT JOIN ". get_table_name('contactgroupmembers')." AS m".291 $join = " LEFT JOIN ".$this->db_groupmembers." AS m". 286 292 " ON (m.contact_id=c.".$this->primary_key.")"; 287 293 … … 380 386 ); 381 387 382 $insert_id = $this->db->insert_id( 'contacts');388 $insert_id = $this->db->insert_id($this->get_sequence_name('contacts')); 383 389 } 384 390 … … 494 500 495 501 $this->db->query( 496 "INSERT INTO ". get_table_name('contactgroups').502 "INSERT INTO ".$this->db_groups. 497 503 " (user_id, changed, name)". 498 504 " VALUES (".intval($this->user_id).", ".$this->db->now().", ".$this->db->quote($name).")" 499 505 ); 500 506 501 if ($insert_id = $this->db->insert_id( 'contactgroups'))507 if ($insert_id = $this->db->insert_id($this->get_sequence_name('contactgroups'))) 502 508 $result = array('id' => $insert_id, 'name' => $name); 503 509 … … 516 522 // flag group record as deleted 517 523 $sql_result = $this->db->query( 518 "UPDATE ". get_table_name('contactgroups').524 "UPDATE ".$this->db_groups. 519 525 " SET del=1, changed=".$this->db->now(). 520 526 " WHERE contactgroup_id=?", … … 541 547 542 548 $sql_result = $this->db->query( 543 "UPDATE ". get_table_name('contactgroups').549 "UPDATE ".$this->db_groups. 544 550 " SET name=?, changed=".$this->db->now(). 545 551 " WHERE contactgroup_id=?", … … 567 573 foreach ($ids as $contact_id) { 568 574 $sql_result = $this->db->query( 569 "SELECT 1 FROM ". get_table_name('contactgroupmembers').575 "SELECT 1 FROM ".$this->db_groupmembers. 570 576 " WHERE contactgroup_id=?". 571 577 " AND contact_id=?", … … 576 582 if (!$this->db->num_rows($sql_result)) { 577 583 $this->db->query( 578 "INSERT INTO ". get_table_name('contactgroupmembers').584 "INSERT INTO ".$this->db_groupmembers. 579 585 " (contactgroup_id, contact_id, created)". 580 586 " VALUES (?, ?, ".$this->db->now().")", … … 607 613 608 614 $sql_result = $this->db->query( 609 "DELETE FROM ". get_table_name('contactgroupmembers').615 "DELETE FROM ".$this->db_groupmembers. 610 616 " WHERE contactgroup_id=?". 611 617 " AND contact_id IN ($ids)", … … 630 636 do { 631 637 $sql_result = $this->db->query( 632 "SELECT 1 FROM ". get_table_name('contactgroups').638 "SELECT 1 FROM ".$this->db_groups. 633 639 " WHERE del<>1". 634 640 " AND user_id=?". … … 645 651 } 646 652 653 654 /** 655 * Wrapper for global get_table_name() which can be re-implemented 656 * by a derived class 657 */ 658 protected function get_table_name($table) 659 { 660 return get_table_name($table); 661 } 662 663 /** 664 * Wrapper for global get_sequence_name() which can be re-implemented 665 * by a derived class 666 */ 667 protected function get_sequence_name($table) 668 { 669 return get_sequence_name($table); 670 } 671 647 672 }
Note: See TracChangeset
for help on using the changeset viewer.
