Changeset 151 for trunk/instant_messenger/inc/class.db_im.inc.php
- Timestamp:
- 01/18/08 15:17:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/class.db_im.inc.php
r55 r151 14 14 var $db_pass; 15 15 var $db_type; 16 var $user_id; 16 17 var $teste; 17 18 18 function db_im(){ 19 function db_im() 20 { 21 session_start(); 19 22 $this->db_name = $_SESSION['phpgw_info']['instant_messenger']['server']['db_name']; 20 23 $this->db_host = $_SESSION['phpgw_info']['instant_messenger']['server']['db_host']; … … 23 26 $this->db_pass = $_SESSION['phpgw_info']['instant_messenger']['server']['db_pass']; 24 27 $this->db_type = $_SESSION['phpgw_info']['instant_messenger']['server']['db_type']; 28 $this->user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 25 29 26 $this->db = new db(); 30 $this->db = new db(); 27 31 $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type); 32 session_write_close(); 28 33 } 29 34 … … 53 58 { 54 59 $preferences = $param['preferences']; 55 $user_id = $ _SESSION['phpgw_info']['instant_messenger']['user_id'];60 $user_id = $this->user_id; 56 61 $app_name = $this->name_app(); 57 62 58 63 $query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')"; 59 64 60 if($this->query_db($query)) 65 if($this->query_db($query)) 66 { 61 67 return "true"; 62 else{ 68 } 69 else 70 { 63 71 $query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='".$app_name."' and preference_owner='".$user_id."'"; 64 72 if($this->query_db($query)) … … 72 80 { 73 81 $result = array(); 74 $user_id = $ _SESSION['phpgw_info']['instant_messenger']['user_id'];82 $user_id = $this->user_id; 75 83 $app_name = $this->name_app(); 76 84 … … 83 91 $result[] = $this->db->row(); 84 92 85 if(count($result) > 0) {93 if(count($result) > 0) 86 94 return unserialize($result[0]['preference_value']); 87 }else{ 88 return "ch_offline:true;in_time:1;rd_nm:true;rd_ch:false"; 89 } 90 } 95 else 96 return "ch_offline:true;time_xa_im:1;rd_nm:true;rd_ch:false"; 97 } 91 98 92 99 function name_app()
Note: See TracChangeset
for help on using the changeset viewer.