source: trunk/expressoMail1_2/inc/class.db_functions.inc.php @ 5509

Revision 5509, 22.7 KB checked in by gustavo, 12 years ago (diff)

Ticket #2488 - Adicionar cabecalho de licenca em arquivos que nao o possuem

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2                /***************************************************************************
3                * Expresso Livre                                                           *
4                * http://www.expressolivre.org                                             *
5                * --------------------------------------------                             *
6                *  This program is free software; you can redistribute it and/or modify it *
7                *  under the terms of the GNU General Public License as published by the   *
8                *  Free Software Foundation; either version 2 of the License, or (at your  *
9                *  option) any later version.                                              *
10                \**************************************************************************/
11               
12if(!isset($_SESSION['phpgw_info']['expressomail']['server']['db_name'])) {
13        include_once('../header.inc.php');
14        $_SESSION['phpgw_info']['expressomail']['server']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name']; 
15        $_SESSION['phpgw_info']['expressomail']['server']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
16        $_SESSION['phpgw_info']['expressomail']['server']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
17        $_SESSION['phpgw_info']['expressomail']['server']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
18        $_SESSION['phpgw_info']['expressomail']['server']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass'];
19        $_SESSION['phpgw_info']['expressomail']['server']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];
20}
21else{
22        define('PHPGW_INCLUDE_ROOT','../');     
23        define('PHPGW_API_INC','../phpgwapi/inc');       
24        include_once(PHPGW_API_INC.'/class.db.inc.php');
25}
26include_once('class.dynamic_contacts.inc.php');
27       
28class db_functions
29{       
30       
31        var $db;
32        var $user_id;
33        var $related_ids;
34       
35        function db_functions(){
36                $this->db = new db();           
37                $this->db->Halt_On_Error = 'no';
38                $this->db->connect(
39                                $_SESSION['phpgw_info']['expressomail']['server']['db_name'],
40                                $_SESSION['phpgw_info']['expressomail']['server']['db_host'],
41                                $_SESSION['phpgw_info']['expressomail']['server']['db_port'],
42                                $_SESSION['phpgw_info']['expressomail']['server']['db_user'],
43                                $_SESSION['phpgw_info']['expressomail']['server']['db_pass'],
44                                $_SESSION['phpgw_info']['expressomail']['server']['db_type']
45                );             
46                $this -> user_id = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];       
47        }
48
49        // BEGIN of functions.
50        function get_cc_contacts()
51        {                               
52                $result = array();
53                $stringDropDownContacts = '';           
54               
55                $query_related = $this->get_query_related('A.id_owner'); // field name for owner
56                       
57                // Traz os contatos pessoais e compartilhados
58                $query = 'select A.names_ordered, C.connection_value from phpgw_cc_contact A, '.
59                        'phpgw_cc_contact_conns B, phpgw_cc_connections C where '.
60                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '.
61                        'and B.id_typeof_contact_connection = 1 and ('.$query_related.') group by '.
62                        'A.names_ordered,C.connection_value     order by lower(A.names_ordered)';
63               
64        if (!$this->db->query($query))
65                return null;
66                while($this->db->next_record())
67                        $result[] = $this->db->row();
68
69                if (count($result) != 0)
70                {
71                        // Monta string                         
72                        foreach($result as $contact)
73                                $stringDropDownContacts = $stringDropDownContacts . urldecode(urldecode($contact['names_ordered'])). ';' . $contact['connection_value'] . ',';
74                        //Retira ultima virgula.
75                        $stringDropDownContacts = substr($stringDropDownContacts,0,(strlen($stringDropDownContacts) - 1));
76                }
77                else
78                        return null;
79
80                return $stringDropDownContacts;
81        }
82        // Get Related Ids for sharing contacts or groups.
83        function get_query_related($field_name){               
84                $query_related = $field_name .'='.$this -> user_id;
85                // Only at first time, it gets all related ids...
86                if(!$this->related_ids) {
87                        $query = 'select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1';         
88                        if (!$this->db->query($query)){
89                return $query_related;
90                        }
91                       
92                        $result = array( );
93                        while($this->db->next_record()){
94                                $row = $this->db->row();
95                                $result[] = $row['id_related'];
96                        }
97                        if($result)
98                                $this->related_ids = implode(",",$result);
99                }
100                if($this->related_ids)
101                        $query_related .= ' or '.$field_name.' in ('.$this->related_ids.')';
102               
103                return $query_related;
104        }
105        function get_cc_groups()
106        {
107                // Pesquisa no CC os Grupos Pessoais.
108                $stringDropDownContacts = '';                   
109                $result = array();
110                $query_related = $this->get_query_related('owner'); // field name for 'owner'           
111                $query = 'select title, short_name, owner from phpgw_cc_groups where '.$query_related.' order by lower(title)';
112
113                // Executa a query
114                if (!$this->db->query($query))
115                return null;
116                // Retorna cada resultado               
117                while($this->db->next_record())
118                        $result[] = $this->db->row();
119
120                // Se houver grupos ....                               
121                if (count($result) != 0)
122                {
123                        // Create Ldap Object, if exists related Ids for sharing groups.
124                        if($this->related_ids){
125                                $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids']= array();
126                                include_once("class.ldap_functions.inc.php");
127                                $ldap = new ldap_functions();
128                        }
129                        $owneruid = '';
130                        foreach($result as $group){
131                                // Searching uid (LDAP), if exists related Ids for sharing groups.
132                                // Save into user session. It will used before send mail (verify permission).
133                                if(!isset($_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']]) && isset($ldap)){                                 
134                                        $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']] = $ldap -> uidnumber2uid($group['owner']);
135                                }
136                                if($this->user_id != $group['owner'])
137                                        $owneruid = "::".$_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']];
138                                else
139                                        $owneruid = '';
140
141                                $stringDropDownContacts .=  $group['title']. ';' . ($group['short_name'].$owneruid) . ',';
142                        }
143                        //Retira ultima virgula.
144                        $stringDropDownContacts = substr($stringDropDownContacts,0,(strlen($stringDropDownContacts) - 1));
145                }
146                else
147                        return null;           
148                return $stringDropDownContacts;
149        }
150       
151        function getContactsByGroupAlias($alias)
152        {
153                list($alias,$uid) = explode("::",$alias);               
154                $cc_related_ids = $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'];           
155                // Explode personal group, If exists related ids (the user has permission to send email).
156                if(is_array($cc_related_ids) && $uid){
157                        $owner =  array_search($uid,$cc_related_ids);                   
158                }
159               
160                $query = "select C.id_connection, A.names_ordered, C.connection_value from phpgw_cc_contact A, ".
161                "phpgw_cc_contact_conns B, phpgw_cc_connections C,phpgw_cc_contact_grps D,phpgw_cc_groups E where ".
162                "A.id_contact = B.id_contact and B.id_connection = C.id_connection ".
163                "and B.id_typeof_contact_connection = 1 and ".
164                "A.id_owner =".($owner ? $owner : $this->user_id)." and ".                     
165                "D.id_group = E.id_group and ".
166                "D.id_connection = C.id_connection and E.short_name = '".$alias."'";
167
168                if (!$this->db->query($query))
169                {
170                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__);
171                }
172
173                $return = false;
174
175                while($this->db->next_record())
176                {
177                        $return[] = $this->db->row();
178                }
179
180                return $return;
181        }
182
183        function getAddrs($array_addrs) {
184                $array_addrs_final = array();                           
185
186                for($i = 0; $i < count($array_addrs); $i++){
187                        $j = count($array_addrs_final);
188
189                        if(preg_replace('/\s+/', '', $array_addrs[$i]) != ""){
190                                if(strchr($array_addrs[$i],'@') == "") {               
191                                        if(strpos($array_addrs[$i],'<') && strpos($array_addrs[$i],'>')){
192                                                $alias = substr($array_addrs[$i], strpos($array_addrs[$i],'<'), strpos($array_addrs[$i],'>'));
193                                                $alias = str_replace('<','', str_replace('>','',$alias));
194                                        }
195                                        else{
196                                                $alias = $array_addrs[$i];                     
197                                                $alias = preg_replace('/\s/', '', $alias);
198                                        }       
199                                        $arrayContacts = $this -> getContactsByGroupAlias($alias);
200
201                                        if($arrayContacts) {
202                                                foreach($arrayContacts as $index => $contact){
203                                                        if($contact['names_ordered']) {
204                                                                $array_addrs_final[$j] = '"'.$contact['names_ordered'].'" <'.$contact['connection_value'].'>';
205                                                        }
206                                                        else
207                                                                $array_addrs_final[$j] = $contact['connection_value'];
208
209                                                        $j++;
210                                                }
211                                        }else{
212                                                return array("False" => "$alias");
213                                        }
214                                }
215                                else{
216                                        $array_addrs_final[$j] = $array_addrs[$i];
217                                }
218                        }else{
219                                $array_addrs_final[$j] = $array_addrs[$i];
220                        }
221                }
222                return $array_addrs_final;
223        }
224
225        //Gera lista de contatos para ser gravado e acessado pelo expresso offline.
226        function get_dropdown_contacts_to_cache() {
227                return $this->get_dropdown_contacts();
228        }
229       
230        function get_dropdown_contacts(){
231                $contacts = $this->get_cc_contacts();
232                $groups = $this->get_cc_groups();
233               
234                if(($contacts) && ($groups))
235                        $stringDropDownContacts = $contacts . ',' . $groups;
236                elseif ((!$contacts) && (!$groups))
237                        $stringDropDownContacts = '';
238                elseif (($contacts) && (!$groups))
239                        $stringDropDownContacts = $contacts;
240                elseif ((!$contacts) && ($groups))
241                        $stringDropDownContacts = $groups;
242                                       
243                if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) {
244                        // Free others requests
245                        session_write_close();
246                        $dynamic_contact = new dynamic_contacts();
247                        $dynamic = $dynamic_contact->dynamic_contact_toString();
248                        if ($dynamic)
249                                $stringDropDownContacts .= ($stringDropDownContacts ? ',' : '') . $dynamic;
250                }
251                return $stringDropDownContacts;
252        }
253        function getUserByEmail($params){       
254                // Follow the referral
255                $email = $params['email'];
256                $query = 'select A.names_ordered, C.connection_name, C.connection_value, A.photo'.
257                                ' from phpgw_cc_contact A, phpgw_cc_contact_conns B, '.
258                                'phpgw_cc_connections C where A.id_contact = B.id_contact'.
259                                ' and B.id_connection = C.id_connection and A.id_contact ='.
260                                '(select A.id_contact from phpgw_cc_contact A, phpgw_cc_contact_conns B,'.
261                                'phpgw_cc_connections C where A.id_contact = B.id_contact'.
262                                ' and B.id_connection = C.id_connection and A.id_owner = '.$this -> user_id.
263                                ' and C.connection_value = \''.$email.'\') and '.
264                                'C.connection_is_default = true and B.id_typeof_contact_connection = 2';
265
266        if (!$this->db->query($query))
267                return null;
268
269
270                if($this->db->next_record()) {
271                        $result = $this->db->row();
272
273                        $obj =  array("cn" => $result['names_ordered'],
274                                          "email" => $email,
275                                          "type" => "personal",
276                                          "telefone" =>  $result['connection_value']);
277
278                        if($result['photo'])
279                                $_SESSION['phpgw_info']['expressomail']['contact_photo'] =  array($result['photo']);                           
280
281                        return $obj;
282                }
283                return $result;
284        }
285       
286        function get_dynamic_contacts()
287        {                               
288                // Pesquisa os emails e ultima inserção nos contatos dinamicos.
289                if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__))
290                {
291                return $this->db->Error;
292}
293                while($this->db->next_record())
294                {
295                        $result[] = $this->db->row();
296                }
297                if($result) foreach($result as $item)
298                {
299                        $contacts = unserialize($item['data']);
300                }
301                if (count($contacts) == 0)
302                {                       
303                        return null;
304                }       
305                //Sort by email
306                function cmp($a, $b) { return strcmp($a["email"], $b["email"]);}
307                usort($contacts,"cmp");
308                return $contacts;
309        }
310        function update_contacts($contacts=array())
311        {                       
312               
313       
314                if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__))
315        {
316            $result['dberr1'] = $this->db->Error;
317        }
318                $regs = array();
319                while($this->db->next_record())
320        {
321            $regs[] = $this->db->row();
322        }
323                $old_contatacts = array();
324                foreach($regs as $old){
325                        $old_contatacts = unserialize($old['data']);
326                }
327                 
328                foreach($old_contatacts as $i => $v)
329                        foreach($contacts as $ii => $vv)
330                                if(trim($v['email']) == trim($vv['email']))
331                                        unset($old_contatacts[$i]);
332               
333                 
334                 $old_contatacts = array_merge( $old_contatacts , $contacts);           
335                // Atualiza um email nos contatos dinamicos.
336                if(!$this->db->update('phpgw_expressomail_contacts ','data=\''.serialize($old_contatacts).'\'','id_owner ='.$this->user_id,__LINE__,__FILE__))
337                {
338                        return $this->db->Error;
339                }
340                return $contacts;
341        }       
342        function update_preferences($params){
343                $string_serial = urldecode($params['prefe_string']);                           
344                $string_serial = get_magic_quotes_gpc() ? $string_serial : addslashes($string_serial);
345                $query = "update phpgw_preferences set preference_value = '".$string_serial."' where preference_app = 'expressoMail'".
346                        " and preference_owner = '".$this->user_id."'";
347
348                if (!$this->db->query($query))
349                        return $this->db->error;
350                else
351                        return array("success" => true);
352        }
353       
354        function insert_contact($contact)       
355        {
356                $contacts[] = array( 'timestamp'        => time(),
357                                                                'email'         => $contact );
358
359                // Insere um email nos contatos dinamicos.     
360                $query = 'INSERT INTO phpgw_expressomail_contacts (data, id_owner)  ' .
361                                        'values ( \''.serialize($contacts).'\', '.$this->user_id.')';
362               
363                if(!$this->db->query($query,__LINE__,__FILE__))
364                return $this->db->Error;
365        return $contacts;
366        }
367       
368        function remove_dynamic_contact($user_id,$line,$file)
369        {
370                $where = $user_id.' = id_owner';
371                $this->db->delete('phpgw_expressomail_contacts',$where,$line,$file);   
372        }
373       
374        function import_vcard($params){
375            include_once('class.imap_functions.inc.php');
376            $objImap = new imap_functions();
377            $msg_number = $params['msg_number'];
378            $idx_file = $params['idx_file'];
379            $msg_part = $params['msg_part'];
380            $msg_folder = $params['msg_folder'];
381            $from_ajax = $params['from_ajax'];
382            $encoding = strtolower($params['encoding']);
383            $fileContent = "";
384            $cirus_delimiter = $params['cirus_delimiter'];
385            $expFolder = explode($cirus_delimiter, $msg_folder);
386
387            if($msg_number != null && $msg_part != null && $msg_folder != null && (intval($idx_file == '0' ? '1' : $idx_file)))
388            {
389                require_once PHPGW_INCLUDE_ROOT.'/expressoMail1_2/inc/class.attachment.inc.php';
390                $attachmentObj = new attachment();
391                $attachmentObj->setStructureFromMail($msg_folder,$msg_number);
392                $fileContent = $attachmentObj->getAttachment($msg_part);
393                $info = $attachmentObj->getAttachmentInfo($msg_part);
394                $filename = $info['name'];
395            }
396            else
397                    $filename = $idx_file;
398                   
399            // It's necessary to access calendar method.
400            $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
401            $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
402            $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar';
403            include_once(PHPGW_INCLUDE_ROOT.'/header.inc.php');
404            $uiicalendar = CreateObject("calendar.uiicalendar");
405                        if($params['selected'] || $params['readable']){
406                                $user = $params['id_user'];
407                               
408                                $_REQUEST['data'] = $fileContent;
409                                $_REQUEST['type'] = 'iCal';
410                                $_REQUEST['params']['calendar'] = $params['selected'];
411                                $_REQUEST['readable'] = $params['readable'] ? true : false;
412                                $_REQUEST['analize'] = isset($params['readable']) ? true : false;
413                                $_REQUEST['params']['status'] = $params['status'];
414                                $_REQUEST['params']['owner'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];
415                                ob_start();
416                                include_once(PHPGW_INCLUDE_ROOT.'/prototype/converter.php');
417                                $output = ob_get_clean();                       
418                                $valid = json_decode($output, true);
419                                if($_REQUEST['readable']){     
420                                        if(!is_array($valid))
421                                        {
422                                                $output = unserialize($output);
423                                                foreach($output as $key => $value)
424                                                    return $value;
425                                        }
426                                        return false;
427                                }
428
429                                if(empty($valid))
430                                        return "error";
431                                return "ok";
432                        }
433            if(strtoupper($expFolder[0]) == 'USER' && $expFolder[1]) // IF se a conta o ical estiver em uma conta compartilhada
434            {
435                include_once('class.ldap_functions.inc.php');
436                $ldap = new ldap_functions();
437                $account['uid'] = $expFolder[1];
438                $account['uidnumber']  = $ldap->uid2uidnumber($expFolder[1]);
439                $account['mail']  = $ldap->getMailByUid($expFolder[1]);
440
441                return $uiicalendar->import_from_mail($fileContent, $from_ajax,$account);
442            }
443            else
444                return $uiicalendar->import_from_mail($fileContent, $from_ajax);
445
446        }
447
448    function insert_certificate($email,$certificate,$serialnumber,$authoritykeyidentifier=null)
449        {
450                if(!$email || !$certificate || !$serialnumber || !$authoritykeyidentifier)
451                        return false;
452                // Insere uma chave publica na tabela phpgw_certificados.
453                $data = array   ('email' => $email,
454                                                 'chave_publica' => $certificate,
455                                                 'serialnumber' => $serialnumber,
456                                                 'authoritykeyidentifier' => $authoritykeyidentifier);
457
458                if(!$this->db->insert('phpgw_certificados',$data,array(),__LINE__,__FILE__)){
459                return $this->db->Error;
460        }
461        return true;
462        }
463
464        function get_certificate($email=null)
465        {
466                if(!$email) return false;
467                $result = array();
468
469                $where = array ('email' => $email,
470                                                'revogado' => 0,
471                                                'expirado' => 0);
472
473                if(!$this->db->select('phpgw_certificados','chave_publica', $where, __LINE__,__FILE__))
474        {
475            $result['dberr1'] = $this->db->Error;
476            return $result;
477        }
478                $regs = array();
479                while($this->db->next_record())
480        {
481            $regs[] = $this->db->row();
482        }
483                if (count($regs) == 0)
484        {
485            $result['dberr2'] = ' Certificado nao localizado.';
486            return $result;
487        }
488                $result['certs'] = $regs;
489                return $result;
490        }
491
492        function update_certificate($serialnumber=null,$email=null,$authoritykeyidentifier,$expirado,$revogado)
493        {
494                if(!$email || !$serialnumber) return false;
495                if(!$expirado)
496                        $expirado = 0;
497                if(!$revogado)
498                        $revogado = 0;
499
500                $data = array   ('expirado' => $expirado,
501                                                 'revogado' => $revogado);
502
503                $where = array  ('email' => $email,
504                                                 'serialnumber' => $serialnumber,
505                                                 'authoritykeyidentifier' => $authoritykeyidentifier);
506
507                if(!$this->db->update('phpgw_certificados',$data,$where,__LINE__,__FILE__))
508                {
509                        return $this->db->Error;
510                }
511                return true;
512        }
513
514       
515        /**
516     * @abstract Recupera o valor da regra padrão.
517     * @return retorna o valor da regra padrão.
518     */
519        function get_default_max_size_rule()
520        {
521                $query = "SELECT config_value FROM phpgw_config WHERE config_name = 'expressoAdmin_default_max_size'";
522                if(!$this->db->query($query))
523            return false;
524
525        $return = array();
526                       
527                while($this->db->next_record())
528            array_push($return, $this->db->row());
529                       
530                return $return;
531        }
532       
533        /**
534     * @abstract Recupera a regra de um usuário.
535     * @return retorna a regra que o usuário pertence. Caso o usuário não participe de nenhuma regra, retorna false.
536     */
537        function get_rule_by_user($id_user)
538        {
539                $return = array();     
540                $query = "SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE email_user='$id_user' AND configuration_type='MessageMaxSize'";
541               
542                if(!$this->db->query($query))
543            return false;
544               
545                while($this->db->next_record())
546            array_push($return, $this->db->row());
547                       
548                return $return;
549        }
550       
551       
552        function get_rule_by_user_in_groups($id_group)
553        {
554                $return = array();
555                $query = "SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE configuration_type='MessageMaxSize' AND email_user_type='G' AND email_user='".$id_group."'";
556
557                if(!$this->db->query($query))   
558                        return false;   
559                       
560                while($this->db->next_record())
561                        array_push($return, $this->db->row());
562
563                return $return;
564        }
565        function getMaximumRecipientsUser($pUserUID)
566        {
567
568           $query = 'SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE email_user = \''.$pUserUID.'\' AND configuration_type = \'LimitRecipient\' AND email_user_type = \'U\' ';
569           $this->db->query($query);
570
571           $return = array();
572
573            while($this->db->next_record())
574              $return =  $this->db->row();
575
576            return $return['email_max_recipient'];
577        }
578
579        function getMaximumRecipientsGroup($pGroupsGuidnumbers)
580        {
581           $groupsGuidNumbers = '';
582
583           foreach ($pGroupsGuidnumbers as $guidNumber => $cn)
584             $groupsGuidNumbers .= $guidNumber.', ';
585
586           $groupsGuidNumbers = substr($groupsGuidNumbers,0,-2);
587
588           $query = 'SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE email_user IN ('.$groupsGuidNumbers.') AND configuration_type = \'LimitRecipient\' AND email_user_type = \'G\' ';
589           $this->db->query($query);
590
591           $return = array();
592
593            while($this->db->next_record())
594              $return[] =  $this->db->row();
595
596            $maxSenderReturn = 0;
597
598            foreach ($return as $maxSender)
599            {
600                if($maxSender['email_max_recipient'] > $maxSenderReturn)
601                    $maxSenderReturn = $maxSender['email_max_recipient'];
602            }
603
604            return $maxSenderReturn;
605        }
606
607        function validadeSharedAccounts($user,$grups,$accountsMails)
608        {
609
610             $arrayMailsBlocked = array();
611
612             $query = 'SELECT * FROM phpgw_expressoadmin_configuration WHERE email_user = \''.$user.'\' AND email_recipient = \'*\'  AND configuration_type = \'InstitutionalAccountException\' AND email_user_type = \'U\' ';
613             $this->db->query($query);
614             $this->db->next_record();
615                 if($this->db->row())
616                   return $arrayMailsBlocked;
617
618            foreach ($grups as $guidNumber => $cn)
619            {
620                 $query = 'SELECT * FROM phpgw_expressoadmin_configuration WHERE email_user = \''.$guidNumber.'\' AND email_recipient = \'*\'  AND configuration_type = \'InstitutionalAccountException\' AND email_user_type = \'G\' ';
621                 $this->db->query($query);
622                 $this->db->next_record();
623                 if($this->db->row())
624                     return $arrayMailsBlocked;
625
626            }
627
628            foreach ($accountsMails as $mail)
629            {
630               
631               $blocked = true;
632
633               $query = 'SELECT * FROM phpgw_expressoadmin_configuration WHERE email_recipient = \''.$mail.'\' AND configuration_type = \'InstitutionalAccountException\' ';
634               $this->db->query($query);
635           
636                while($this->db->next_record())
637                {
638                    $row =  $this->db->row();
639                   
640                    if(($row['email_user'] == '*' ||  $row['email_user'] == $user) && ($row['email_user_type'] == 'T' || $row['email_user_type'] == 'U'))
641                        $blocked = false;
642                    else if(array_key_exists($row['email_user'], $grups) && $row['email_user_type'] == 'G')
643                         $blocked = false;
644
645                }
646
647                if($blocked == true)
648                    array_push ($arrayMailsBlocked, $mail);
649            }
650
651            return $arrayMailsBlocked;
652        }
653
654}
655?>
Note: See TracBrowser for help on using the repository browser.