source: trunk/jabberit_messenger/jmessenger/inc/class.DataBaseIM.inc.php @ 7673

Revision 7673, 19.5 KB checked in by douglasz, 11 years ago (diff)

Ticket #3236 - Correcoes para Performance: Function Within Loop Declaration.

  • Property svn:executable set to *
Line 
1<?php
2  /***************************************************************************\
3  *  Expresso - Expresso Messenger                                            *
4  *     - Alexandre Correia / Rodrigo Souza                                                               *
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
12define('PHPGW_INCLUDE_ROOT','../../'); 
13define('PHPGW_API_INC','../../phpgwapi/inc');
14require_once(PHPGW_API_INC . '/class.db.inc.php');
15//require_once "class.fileDefine.inc.php";
16       
17class DataBaseIM
18{       
19        private $db;
20        private $db_name;
21        private $db_host;
22        private $db_port;
23        private $db_user;
24        private $db_pass;
25        private $db_type;
26        private $user_id;
27        private $fileD;
28       
29        public final function __construct()
30        {
31                //$this->fileD = new fileDefine();
32                $this->db_name = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name'];
33                $this->db_host = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host'];
34                $this->db_port = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port'];
35                $this->db_user = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user'];
36                $this->db_pass = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass'];
37                $this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'];
38                $this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id'];             
39                $this->connectDB();
40        }
41
42        private final function connectDB()
43        {
44                $this->db = new db();
45                $this->db_name = ( !$this->db_name ) ? $_SESSION['phpgwinfo']['db_name'] : $this->db_name;
46                $this->db_host = ( !$this->db_host ) ? $_SESSION['phpgwinfo']['db_host'] : $this->db_host;
47                $this->db_port = ( !$this->db_port ) ? $_SESSION['phpgwinfo']['db_port'] : $this->db_port;
48                $this->db_user = ( !$this->db_user ) ? $_SESSION['phpgwinfo']['db_user'] : $this->db_user;
49                $this->db_pass = ( !$this->db_pass ) ? $_SESSION['phpgwinfo']['db_pass'] : $this->db_pass;
50                $this->db_type = ( !$this->db_type ) ? $_SESSION['phpgwinfo']['db_type'] : $this->db_type;
51               
52                $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);         
53        }       
54
55        public final function editHostJabber($pItem)
56        {
57                $hostsJabber = unserialize($this->getHostsJabber());
58                $findHosts      = explode(":", $pItem['item']);
59                $return = "";
60
61        $hostsJabber_count = count($hostsJabber);
62                for( $i = 0 ; $i < $hostsJabber_count; ++$i )
63                        if( $hostsJabber[$i]['org'] == $findHosts[0] && $hostsJabber[$i]['jabberName'] == $findHosts[1] )
64                        {
65                                $return = "org:" . $hostsJabber[$i]['org'] . ";" .
66                                                  "jabberName:" . $hostsJabber[$i]['jabberName'] . ";" .                                                         
67                                                  "serverLdap:" . $hostsJabber[$i]['serverLdap'] . ";" .
68                                                  "contextLdap:" . $hostsJabber[$i]['contextLdap'] . ";" .
69                                                  "user:" . $hostsJabber[$i]['user'] . ";" .
70                                                  "password:" . $hostsJabber[$i]['password'] ;                                                                                                                                                                                           
71                        }
72
73                return trim($return);
74        }
75       
76        public final function getApplicationsEnabled()
77        {
78               
79                $this->db->query("SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'");
80                if($this->db->num_rows())
81                {
82                        $tmp = "";
83                        while($this->db->next_record())
84                        {
85                                $tmp[]= $this->db->row();
86                        }
87                        return $tmp[0]['config_value'];
88                }
89                return false;
90        }
91       
92        public final function getApplicationsList()
93        {
94                $this->db->query("SELECT * FROM phpgw_applications WHERE app_enabled = '1' order by app_name");
95                if($this->db->num_rows())
96                {
97                        while ($this->db->next_record())
98                        {
99                                $app = $this->db->f('app_name');
100                                $title = @$GLOBALS['phpgw_info']['apps'][$app]['title'];
101                                if (empty($title))
102                                {
103                                        $title = lang($app) == $app.'*' ? $app : lang($app);
104                                }
105                                $apps[$app] = array(
106                                        'title'  => $title,
107                                        'name'   => $app,
108                                        'status' => $this->db->f('app_enabled')
109                                );
110                        }
111                }
112                return $apps;
113        }
114
115        public final function get_accounts_acl()
116        {
117                $query  = "SELECT acl_account FROM phpgw_acl WHERE acl_location IN (SELECT CAST(acl_account AS varchar) FROM phpgw_acl WHERE acl_appname = 'jabberit_messenger') ";
118                $query .= "UNION SELECT acl_account FROM phpgw_acl WHERE acl_appname = 'jabberit_messenger'";
119               
120                if( $this->db->query($query) ) 
121                {
122                        $users = array();
123                        $new_users = array();
124                        while($this->db->next_record())
125                                $users[] = $this->db->row();
126
127                        if(is_array($users))
128                                foreach($users as $tmp)
129                                        $new_users[] = $tmp['acl_account'];
130                       
131                        return $new_users;
132                }
133               
134                return false;
135        }
136       
137        public final function getGroupsBlocked()
138        {
139                $return = "";
140               
141                if( $this->db )
142                {
143                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
144                       
145                        if($this->db->query($query))
146                        {
147
148                                if ( $this->db->query($query) )
149                                {       
150                                        while($this->db->next_record())
151                                                $result[] = $this->db->row();
152                                }
153                               
154                                if( count($result) > 0 )
155                                        $return = $result[0]['config_value'];
156                        }
157                }
158               
159                return $return;
160        }
161       
162        public final function getGroupsSearch()
163        {
164                $return = "";
165       
166                if( $this->db )
167                {
168                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
169                       
170                        if($this->db->query($query))
171                        {
172                                while($this->db->next_record())
173                                        $result[] = $this->db->row();                           
174                        }
175
176                        if( count($result) > 0 )
177                                $return = $result[0]['config_value'];
178                }
179               
180                return $return;
181        }
182       
183        public final function getHostsJabber()
184        {
185                $return = "";
186       
187                if( $this->db )
188                {
189                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
190                       
191                        if($this->db->query($query))
192                        {
193                                while($this->db->next_record())
194                                        $result[] = $this->db->row();                           
195                        }
196
197                        if( count($result) > 0 )
198                                $return = $result[0]['config_value'];
199                }
200               
201                return $return;
202        }
203       
204        public final function getPreferences()
205        {
206                $result = array();
207                $query = "SELECT * FROM phpgw_preferences WHERE preference_owner = '".$this->user_id."' AND preference_app = 'jabberit_messenger'";
208               
209                if ( $this->db->query($query) )
210                {       
211                        while($this->db->next_record())
212                                $result[] = $this->db->row();
213       
214                        if( count($result) > 0 )
215                        {
216                                $_return = unserialize($result[0]['preference_value']);
217                               
218                                if( is_array($_return) )
219                                        return $_return['preferences'];
220                                else
221                                        return $_return;
222                        }
223                }
224
225                return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5";
226        }
227
228        public final function setApplications($pApplications)
229        {
230                $apps = serialize($pApplications);
231               
232                if( $this->db )
233                {
234                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'";
235                               
236                        $this->db->query($query);
237                                       
238                        if(!$this->db->next_record())
239                        {
240                                $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','apps_jabberit','".$apps."')";
241                                $this->db->query($query);
242                                return true;
243                        }
244                        else
245                        {
246                                $query = "UPDATE phpgw_config SET config_value = '".$apps."' WHERE config_app = 'phpgwapi' AND config_name = 'apps_jabberit'";
247                                $this->db->query($query);
248                                return true;
249                        }
250                }
251                return false;   
252        }
253       
254        public final function setAttributesLdap($pAttributes)
255        {
256                $values = $pAttributes['conf'];
257                $attributesOrg = "";           
258
259                if( $this->db )
260                {
261                        $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
262
263                        if ( $this->db->query($query) )
264                        {       
265                                while($this->db->next_record())
266                                        $result[] = $this->db->row();
267               
268                                if(count($result) > 0)
269                                        $attributesOrg = $result[0]['config_value'];
270                        }
271
272                        if( trim($attributesOrg) == "" )
273                        {
274                                $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','attributes_org_ldap_jabberit','".$values."')";
275                                $this->db->query($query);
276                               
277                                $attr = explode(";", $values);
278                                $values = "<return><ou attr='".$attr[1]."'>".$attr[0]."</ou></return>";
279                                return $values;
280                        }
281                        else
282                        {
283                                $org = explode(",", $attributesOrg);
284                                $newValue = explode(";", $values);
285                               
286                                foreach( $org as $tmp )
287                                {
288                                        $attr = explode(";",$tmp);
289                                        if( strtolower(trim($attr[0])) == strtolower(trim($newValue[0])) )
290                                                return false;
291                                }
292
293                                $values = $values . "," . $attributesOrg;
294                                $query = "UPDATE phpgw_config SET config_value = '".$values."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
295                                $this->db->query($query);
296
297                                $return = explode(",",$values);
298                                natcasesort($return);
299
300                                $values = "<return>";
301                               
302                                foreach($return as $tmp)
303                                {
304                                        $attr = explode(";", $tmp);
305                                        $values .= "<ou attr='" . $attr[1] . "'>" . $attr[0] . "</ou>";
306                                }
307                                       
308                                $values .= "</return>";
309                               
310                                return $values;                         
311                        }
312                }
313                return false;
314        }
315
316        public final function setAddGroupsSearch($pData)
317        {
318                if( $pData)
319                {
320                        if( $this->db )
321                        {
322                                $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND  config_name = 'groups_search_jabberit';";
323                               
324                                if( $this->db->query($query) )
325                                {
326                                        while( $this->db->next_record())
327                                                $result[] = $this->db->row();                           
328                                }
329                               
330                                if( count($result) == 0 )
331                                {
332                                        $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_search_jabberit','".serialize($pData)."');";
333                                        $this->db->query($query);
334                                        return true;
335                                }
336                                else
337                                {
338                                        $keyLdap = array_keys($pData);
339                                        $resultQuery = unserialize($result[0]['config_value']);                                 
340                                       
341                                        if( is_array(unserialize($pData[$keyLdap[0]])) )
342                                                $resultQuery[$keyLdap[0]] = $pData[$keyLdap[0]];
343                                        else
344                                                unset($resultQuery[$keyLdap[0]]);
345
346                                        if( count($resultQuery))
347                                                $query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
348                                        else
349                                                $query = "DELETE FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
350                                               
351                                        $this->db->query($query);
352                                        return true;
353                                }
354                        }                       
355                }
356        }
357
358        public final function setGroupsLocked($pGroups)
359        {
360                $groups = "";
361               
362                if( is_array($pGroups) )
363                {
364                        foreach($pGroups as $tmp)               
365                                if(trim($tmp) != "")
366                                        $groups .= $tmp . ";";
367               
368                        $groups = substr($groups, 0, strlen($groups) - 1 );             
369                }
370               
371                if( $this->db )
372                {
373                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
374                       
375                        if($this->db->query($query))
376                        {
377
378                                if ( $this->db->query($query) )
379                                {       
380                                        while($this->db->next_record())
381                                                $result[] = $this->db->row();
382                                }
383
384                                if( count($result) == 0 )
385                                {
386                                        $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_locked_jabberit','".$groups."');";
387                                        $this->db->query($query);
388                                        return true;
389                                }
390                                else
391                                {
392                                        $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
393                                        $this->db->query($query);
394                                        return true;
395                                }
396                        }
397                }
398               
399                return false;
400        }
401       
402        public final function setHostJabber($pParam)
403        {
404                $confHostsJabber =  array();
405
406                foreach($pParam as $key => $itens)
407                        $confHostsJabber[$key] = ( $key === 'org' ) ? strtoupper($itens) : $itens;
408
409                if( $this->db )
410                {
411                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
412                       
413                        if( $this->db->query($query) )
414                        {
415                                while($this->db->next_record())
416                                        $result[] = $this->db->row();                           
417                        }
418                       
419                        if( count($result) == 0 )
420                        {
421                                $return = "<return><confServer ou='".strtoupper($confHostsJabber['org'])."' serverName='".$confHostsJabber['jabberName']."'>".strtoupper($confHostsJabber['org']).":".$confHostsJabber['jabberName']."</confServer></return>";                         
422                                $hostsJabber[0] = $confHostsJabber;
423                               
424                                $this->fileD->ldapExternal($hostsJabber);
425                                 
426                                $query = "INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES('phpgwapi','map_org_realm_jabberit','".serialize($hostsJabber)."')";
427                                $this->db->query($query);                               
428                        }
429                        else
430                        {
431                                $resultQuery = unserialize($result[0]['config_value']);
432                                $foundOrg = false;
433                               
434                                foreach($resultQuery as $key => $itens)
435                                {
436                                        $foundString = array_search($confHostsJabber['org'], $itens);
437                                        if( $foundString )
438                                        {
439                                                $foundOrg = $foundString;
440                                                $ky = $key;
441                                        }
442                                }       
443
444                                if( ! $foundOrg )
445                                        $resultQuery[] = $confHostsJabber;     
446                                else
447                                        $resultQuery[$ky] = $confHostsJabber;
448
449                                $return = "<return>";
450                               
451                                foreach( $resultQuery as $itens )
452                                        $return .= "<confServer ou='".$itens['org']."' serverName='".$itens['jabberName']."'>".$itens['org'].":".$itens['jabberName']."</confServer>";
453                               
454                                $return .= "</return>";
455                               
456                                $this->fileD->ldapExternal($resultQuery);
457                               
458                                $query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_name = 'map_org_realm_jabberit';";
459                                $this->db->query($query);
460                        }
461                        return $return;
462                }       
463                return false;
464        }
465       
466        public final function setOuGroupsLocked($pGroup)
467        {
468               
469                function strallpos($haystack, $needle, $offset = 0)
470                {
471                    $result = array();
472                    for($i = $offset; $i< strlen($haystack); ++$i )
473                    {
474                        $pos = strpos($haystack,$needle,$i);
475                        if($pos !== FALSE)
476                        {
477                            $offset =  $pos;
478                            if($offset >= $i)
479                                $result[] = $i = $offset;
480                        }
481                    }
482               
483                return $result;
484                }
485
486                $group = $pGroup['group'];
487                $gidnumber = $pGroup['gidnumber'];
488                $organization = strtoupper(trim($pGroup['ou']));
489
490                $posAll = strallpos($organization, "OU=" );
491                $orgs = array();
492
493        $posAll_count = count($posAll);
494                for( $i = 0 ; $i < $posAll_count; ++$i )
495                {
496                        $pos = strpos($organization, ",");
497                        $tmpString = substr($organization, $posAll[$i] + 3);
498                        $orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
499                }
500
501                $organization = implode("/", array_reverse($orgs));
502
503                if( $this->db )
504                {
505                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
506                       
507                        if($this->db->query($query))
508                        {
509
510                                if ( $this->db->query($query) )
511                                {       
512                                        while($this->db->next_record())
513                                                $result[] = $this->db->row();
514                                }
515
516                                $groupsLocked = explode(";",$result[0]['config_value']);
517                                       
518                                foreach( $groupsLocked as $tmp )
519                                {
520                                        $aux = explode(":", $tmp);
521                                        if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
522                                        {
523                                                if( $aux[2] )
524                                                {
525                                                        $ou_groups = explode(",",$aux[2]);
526                                                        natcasesort($ou_groups);
527                                                        $key = array_search($organization, $ou_groups);
528                                                       
529                                                        if( $key === false )
530                                                                array_push($ou_groups, $organization);
531                                                       
532                                                        $groups .= $group.":".$gidnumber.":";
533                                                       
534                                                        $return = "<return>";                                           
535                                                       
536                                                        foreach($ou_groups as $tmp)
537                                                        {
538                                                                $return .= "<ou attr='".$tmp."'>".$tmp."</ou>";
539                                                                $groups .= $tmp .",";   
540                                                        }
541                                                       
542                                                        $return .= "</return>";
543                                                       
544                                                        $groups  = substr($groups,0,strlen($groups)-1);
545                                                        $groups .= ";";
546                                                }
547                                                else
548                                                {
549                                                        $groups .= $group.":".$gidnumber.":".$organization.";";
550                                                        $return = "<return><ou attr='".$organization."'>".$organization."</ou></return>";
551                                                }
552                                        }
553                                        else
554                                                $groups .= $tmp . ";" ;
555                                }
556
557                                $groups = substr($groups,0,strlen($groups)-1);
558
559                                $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
560                                $this->db->query($query);
561                               
562                                return $return;
563                        }
564                }
565               
566                return false;
567        }
568       
569        public final function removeAttributesLdap($pOrg)
570        {
571                $organization = $pOrg['org'];
572               
573                if( $this->db )
574                {
575                        $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
576                               
577                        if ( $this->db->query($query) )
578                        {       
579                                while( $this->db->next_record() )
580                                        $result[] = $this->db->row();
581               
582                                if( count($result) > 0 )
583                                        $attributesOrg = $result[0]['config_value'];
584                        }
585
586                        $attributesOrg = explode(",", $attributesOrg);
587                        $newValue = "";
588                        foreach($attributesOrg as $tmp)
589                        {
590                                $attr = explode(";",$tmp);
591                                 
592                                if( strtolower(trim($attr[0])) != strtolower(trim($organization)))
593                                {
594                                        $newValue .= $attr[0] . ";" . $attr[1] . ",";
595                                }
596                        }
597                       
598                        $newValue = substr($newValue, 0,(strlen($newValue) -1 ));
599                       
600                        if( trim($newValue) != "")
601                                $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
602                        else
603                                $query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'";
604                               
605                        if( $this->db->query($query))
606                                return true;
607                        else
608                                return false;
609                }
610                return false;   
611        }
612
613        public final function removeHostsJabber($pItem)
614        {
615                $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
616
617                if( $this->db )
618                {
619                        if($this->db->query($query))
620                        {
621                                while($this->db->next_record())
622                                        $result[] = $this->db->row();
623                                       
624                                if( count($result) > 0 )
625                                {
626                                        $confHostsOrgs = unserialize($result[0]['config_value']);
627                                        $hosts = explode(":", $pItem['item']);
628                                        $key = "";
629
630                                        if( count($confHostsOrgs) > 0 )
631                                        {
632                        $confHostsOrgs_count = count($confHostsOrgs);
633                                                for( $i = 0; $i < $confHostsOrgs_count; ++$i)
634                                                        if( $confHostsOrgs[$i]['org'] == $hosts[0] && $confHostsOrgs[$i]['jabberName'] == $hosts[1])
635                                                                $key = $i;     
636
637                                                array_splice($confHostsOrgs, $key, 1);
638                               
639                                                if(count($confHostsOrgs) > 0)
640                                                {                                       
641                                                        $this->fileD->ldapExternal($confHostsOrgs);
642                                                        $query = "UPDATE phpgw_config SET config_value = '".serialize($confHostsOrgs)."' WHERE config_name = 'map_org_realm_jabberit';";
643                                                }
644                                                else
645                                                {
646                                                        $this->fileD->ldapExternal("");
647                                                        $query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
648                                                }
649                                        }
650                                        else
651                                        {       
652                                                $this->fileD->ldapExternal("");                                         
653                                                $query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
654                                        }
655
656                                        if( $this->db->query($query) )
657                                                return "true";
658                                }               
659                        }                       
660                }
661                return "false";
662        }
663
664        public final function removeOuGroupsLocked($pGroup)
665        {
666                $group = $pGroup['group'];
667                $gidnumber = $pGroup['gidnumber'];
668                $organization = strtoupper($pGroup['ou']);
669                $return = false;
670               
671                if( $this->db )
672                {
673                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
674                       
675                        if($this->db->query($query))
676                        {
677
678                                if ( $this->db->query($query) )
679                                {       
680                                        while($this->db->next_record())
681                                                $result[] = $this->db->row();
682                                }
683
684                                $groupsLocked = explode(";",$result[0]['config_value']);
685                               
686                                foreach( $groupsLocked as $tmp )
687                                {
688                                        $aux = explode(":",$tmp);
689                                       
690                                        if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
691                                        {
692                                                $ous = explode(",", $aux[2]);
693                                                $key = array_search($organization, $ous);
694
695                                                if( $key !== false )
696                                                        unset($ous[$key]);
697
698                                                $groups .= $group.":".$gidnumber.":";
699                                               
700                                                foreach($ous as $ouTmp)
701                                                        $groups .= $ouTmp .",";
702                                               
703                                                $groups  = substr($groups,0,strlen($groups)-1);
704                                                $groups .= ";";
705                                        }
706                                        else
707                                                $groups .= $tmp . ";" ;                                                                 
708                                }
709                                       
710                                $groups  = substr($groups,0,strlen($groups)-1);
711                       
712                                $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
713
714                                if( $this->db->query($query))
715                                        $return = true;
716                        }
717                }       
718               
719                return $return;
720        }
721
722}
723?>
Note: See TracBrowser for help on using the repository browser.