source: trunk/jabberit_messenger/inc/class.db_im.inc.php @ 382

Revision 382, 1.8 KB checked in by niltonneto, 16 years ago (diff)

Inclusão do módulo JabberIt? Messenger, novo módulo de mensagens
instantâneas do Expresso. É uma customização do projeto original
Jeti, e foi desenvolvido em Java.

  • Property svn:executable set to *
Line 
1<?php
2
3define('PHPGW_INCLUDE_ROOT','../');     
4define('PHPGW_API_INC','../phpgwapi/inc');
5require_once(PHPGW_API_INC . '/class.db.inc.php');
6       
7class db_im
8{       
9       
10        private $db;
11        private $db_name;
12        private $db_host;
13        private $db_port;
14        private $db_user;
15        private $db_pass;
16        private $db_type;
17        private $user_id;
18       
19        public final function __construct()
20        {
21                $this->db_name = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name'];
22                $this->db_host = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host'];
23                $this->db_port = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port'];
24                $this->db_user = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user'];
25                $this->db_pass = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass'];
26                $this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'];
27                $this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id'];
28        }
29
30        public final function get_accounts_acl()
31        {
32                       
33                $this->db = new db();
34                $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);         
35               
36                $query  = "select acl_account from phpgw_acl where acl_location in (select acl_account from phpgw_acl where acl_appname = 'jabberit_messenger') ";
37                $query .= "union select acl_account from phpgw_acl where acl_appname = 'jabberit_messenger'";
38               
39                if( $this->db->query($query) ) 
40                {
41                        $users = array();
42                        $new_users = array();
43                        while($this->db->next_record())
44                                $users[] = $this->db->row();
45
46                        if(is_array($users))
47                                foreach($users as $tmp)
48                                        $new_users[] = $tmp['acl_account'];
49                       
50                        return $new_users;
51                }
52               
53                return false;
54        }
55       
56        private final function query_db($pQuery)
57        {
58                if (!$this->db->query($pQuery))
59                return false;
60                else
61                        return true;
62        }
63}
64
65?>
Note: See TracBrowser for help on using the repository browser.