Changeset 55 for trunk/instant_messenger/inc/class.db_im.inc.php
- Timestamp:
- 08/16/07 08:06:05 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/class.db_im.inc.php
r41 r55 14 14 var $db_pass; 15 15 var $db_type; 16 var $teste; 16 17 17 18 function db_im(){ … … 27 28 } 28 29 29 function get_contacts_im($pFrom = false, $pTo)30 {31 $result = array();32 $from = explode("/",$pFrom);33 $to = explode("/",$pTo);34 if($pFrom)35 $query = "select im_from, im_to from phpgw_im_auth_user where im_from = '".$from[0]."' and im_to = '".$to[0]."'";36 else37 $query = "select im_from, im_to from phpgw_im_auth_user where im_to = '".$to[0]."' order by im_from";38 39 if (!$this->db->query($query))40 return null;41 42 while($this->db->next_record())43 $result[] = $this->db->row();44 45 return $result;46 }47 48 function insert_contacts($pFrom, $pTo)49 {50 $from = explode("/",$pFrom);51 $to = explode("/",$pTo);52 $query = "insert into phpgw_im_auth_user values('".$from[0]."','".$to[0]."')";53 return $this->query_db($query);54 }55 56 function delete_contacts($pFrom, $pTo)57 {58 $from = explode("/",$pFrom);59 $to = explode("/",$pTo);60 $query = "delete from phpgw_im_auth_user where im_from = '".$from[0]."' and im_to = '".$to[0]."'";61 return $this->query_db($query);62 }63 64 30 function get_accounts_acl() 65 31 { … … 88 54 $preferences = $param['preferences']; 89 55 $user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 90 $app_name = "instant_messenger";56 $app_name = $this->name_app(); 91 57 92 58 $query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')"; 93 59 94 if($this->query_db($query)) {95 return 1;96 }else{60 if($this->query_db($query)) 61 return "true"; 62 else{ 97 63 $query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='".$app_name."' and preference_owner='".$user_id."'"; 98 64 if($this->query_db($query)) 99 return 1;65 return "true"; 100 66 else 101 return 0;67 return "false"; 102 68 } 103 69 } … … 107 73 $result = array(); 108 74 $user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 109 $app_name = "instant_messenger";75 $app_name = $this->name_app(); 110 76 111 77 $query = "select * from phpgw_preferences where preference_owner = '".$user_id."' and preference_app = '".$app_name."'"; … … 120 86 return unserialize($result[0]['preference_value']); 121 87 }else{ 122 return "ch_ time:true;ch_offline:true;ch_contacts:false;rd_nm:true;rd_al:false;rd_ch:false";88 return "ch_offline:true;in_time:1;rd_nm:true;rd_ch:false"; 123 89 } 124 90 } 91 92 function name_app() 93 { 94 return "instant_messenger"; 125 95 } 126 96 }
Note: See TracChangeset
for help on using the changeset viewer.