Ignore:
Timestamp:
01/18/08 15:17:58 (16 years ago)
Author:
niltonneto
Message:

Commit da nova versão do módulo, usando agente em C.
Vide Página do módulo do Trac:
http://www.expressolivre.org/dev/wiki/messenger

A versão anterior encontra-se na subpasta bkp (32/64).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/inc/class.db_im.inc.php

    r55 r151  
    1414        var $db_pass; 
    1515        var $db_type; 
     16        var $user_id; 
    1617        var $teste; 
    1718         
    18         function db_im(){ 
     19        function db_im() 
     20        { 
     21                session_start();                 
    1922                $this->db_name = $_SESSION['phpgw_info']['instant_messenger']['server']['db_name']; 
    2023                $this->db_host = $_SESSION['phpgw_info']['instant_messenger']['server']['db_host']; 
     
    2326                $this->db_pass = $_SESSION['phpgw_info']['instant_messenger']['server']['db_pass']; 
    2427                $this->db_type = $_SESSION['phpgw_info']['instant_messenger']['server']['db_type']; 
     28                $this->user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 
    2529                 
    26                 $this->db = new db();            
     30                $this->db = new db(); 
    2731                $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();           
    2833        } 
    2934 
     
    5358        { 
    5459                $preferences = $param['preferences']; 
    55                 $user_id  = $_SESSION['phpgw_info']['instant_messenger']['user_id'];  
     60                $user_id  = $this->user_id; 
    5661                $app_name = $this->name_app(); 
    57  
     62                 
    5863                $query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')"; 
    5964                 
    60                 if($this->query_db($query))       
     65                if($this->query_db($query)) 
     66                {  
    6167                        return "true"; 
    62                 else{ 
     68                } 
     69                else 
     70                { 
    6371                        $query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='".$app_name."' and preference_owner='".$user_id."'"; 
    6472                        if($this->query_db($query)) 
     
    7280        { 
    7381                $result = array(); 
    74                 $user_id  = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 
     82                $user_id  = $this->user_id; 
    7583                $app_name = $this->name_app(); 
    7684                 
     
    8391                        $result[] = $this->db->row(); 
    8492 
    85                 if(count($result) > 0){ 
     93                if(count($result) > 0) 
    8694                        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        }                
    9198         
    9299        function name_app() 
Note: See TracChangeset for help on using the changeset viewer.