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

Revision 1756, 19.8 KB checked in by alexandrecorreia, 14 years ago (diff)

Ticket #808 - Busca implementada utilizando somente os grupos cadastrados.

  • Property svn:executable set to *
Line 
1<?php
2  /***************************************************************************\
3  *  Expresso - Expresso Messenger                                            *
4  *     - Alexandre Correia / Rodrigo Souza                                                               *
5  *     - JETI - http://jeti-im.org/                                                                              *
6  * ------------------------------------------------------------------------- *
7  *  This program is free software; you can redistribute it and/or modify it  *
8  *  under the terms of the GNU General Public License as published by the    *
9  *  Free Software Foundation; either version 2 of the License, or (at your   *
10  *  option) any later version.                                               *
11  \***************************************************************************/
12
13define('PHPGW_INCLUDE_ROOT','../');     
14define('PHPGW_API_INC','../phpgwapi/inc');
15require_once(PHPGW_API_INC . '/class.db.inc.php');
16require_once "class.fileDefine.inc.php";
17       
18class db_im
19{       
20        private $db;
21        private $db_name;
22        private $db_host;
23        private $db_port;
24        private $db_user;
25        private $db_pass;
26        private $db_type;
27        private $user_id;
28        private $fileD;
29       
30        public final function __construct()
31        {
32                $this->fileD = new fileDefine();
33                $this->db_name = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_name'];
34                $this->db_host = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_host'];
35                $this->db_port = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_port'];
36                $this->db_user = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_user'];
37                $this->db_pass = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_pass'];
38                $this->db_type = $_SESSION['phpgw_info']['jabberit_messenger']['server']['db_type'];
39                $this->user_id = $_SESSION['phpgw_info']['jabberit_messenger']['user_id'];             
40                $this->connectDB();
41        }
42
43        private final function connectDB()
44        {
45                $this->db = new db();
46                $this->db_name = ( !$this->db_name ) ? $_SESSION['phpgwinfo']['db_name'] : $this->db_name;
47                $this->db_host = ( !$this->db_host ) ? $_SESSION['phpgwinfo']['db_host'] : $this->db_host;
48                $this->db_port = ( !$this->db_port ) ? $_SESSION['phpgwinfo']['db_port'] : $this->db_port;
49                $this->db_user = ( !$this->db_user ) ? $_SESSION['phpgwinfo']['db_user'] : $this->db_user;
50                $this->db_pass = ( !$this->db_pass ) ? $_SESSION['phpgwinfo']['db_pass'] : $this->db_pass;
51                $this->db_type = ( !$this->db_type ) ? $_SESSION['phpgwinfo']['db_type'] : $this->db_type;
52               
53                $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);         
54        }       
55
56        public final function editHostJabber($pItem)
57        {
58                $hostsJabber = unserialize($this->getHostsJabber());
59                $findHosts      = explode(":", $pItem['item']);
60                $return = "";   
61               
62                for( $i = 0 ; $i < count($hostsJabber); $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                                return unserialize($result[0]['preference_value']);
216                }
217
218                return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5";
219        }
220
221        public final function setPreferences($pParam)
222        {
223                $preferences = $pParam['preferences1'];
224               
225                if(isset($pParam['preferences2']))
226                        $preferences .= ";". $pParam['preferences2'];
227               
228                if(isset($pParam['preferences3']))
229                        $preferences .= ";". $pParam['preferences3'];
230               
231                $user_id  = $this->user_id;
232               
233                $query = "insert into phpgw_preferences values('".$user_id."','jabberit_messenger','".serialize($preferences)."')";
234                               
235                if($this->db->query($query))
236                {
237                        return "true";
238                }
239                else
240                {
241                        $query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='jabberit_messenger' and preference_owner='".$user_id."'";
242
243                        if($this->db->query($query))
244                                return "true";
245                        else
246                                return "false";                 
247                }               
248        }
249       
250        public final function setApplications($pApplications)
251        {
252                $apps = serialize($pApplications);
253               
254                if( $this->db )
255                {
256                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' and config_name ='apps_jabberit'";
257                               
258                        $this->db->query($query);
259                                       
260                        if(!$this->db->next_record())
261                        {
262                                $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','apps_jabberit','".$apps."')";
263                                $this->db->query($query);
264                                return true;
265                        }
266                        else
267                        {
268                                $query = "UPDATE phpgw_config SET config_value = '".$apps."' WHERE config_app = 'phpgwapi' AND config_name = 'apps_jabberit'";
269                                $this->db->query($query);
270                                return true;
271                        }
272                }
273                return false;   
274        }
275       
276        public final function setAttributesLdap($pAttributes)
277        {
278                $values = $pAttributes['conf'];
279                $attributesOrg = "";           
280
281                if( $this->db )
282                {
283                        $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
284
285                        if ( $this->db->query($query) )
286                        {       
287                                while($this->db->next_record())
288                                        $result[] = $this->db->row();
289               
290                                if(count($result) > 0)
291                                        $attributesOrg = $result[0]['config_value'];
292                        }
293
294                        if( trim($attributesOrg) == "" )
295                        {
296                                $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','attributes_org_ldap_jabberit','".$values."')";
297                                $this->db->query($query);
298                               
299                                $attr = explode(";", $values);
300                                $values = "<return><ou attr='".$attr[1]."'>".$attr[0]."</ou></return>";
301                                return $values;
302                        }
303                        else
304                        {
305                                $org = explode(",", $attributesOrg);
306                                $newValue = explode(";", $values);
307                               
308                                foreach( $org as $tmp )
309                                {
310                                        $attr = explode(";",$tmp);
311                                        if( strtolower(trim($attr[0])) == strtolower(trim($newValue[0])) )
312                                                return false;
313                                }
314
315                                $values = $values . "," . $attributesOrg;
316                                $query = "UPDATE phpgw_config SET config_value = '".$values."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
317                                $this->db->query($query);
318
319                                $return = explode(",",$values);
320                                natcasesort($return);
321
322                                $values = "<return>";
323                               
324                                foreach($return as $tmp)
325                                {
326                                        $attr = explode(";", $tmp);
327                                        $values .= "<ou attr='" . $attr[1] . "'>" . $attr[0] . "</ou>";
328                                }
329                                       
330                                $values .= "</return>";
331                               
332                                return $values;                         
333                        }
334                }
335                return false;
336        }
337
338        public final function setAddGroupsSearch($pData)
339        {
340                if( $pData)
341                {
342                        if( $this->db )
343                        {
344                                $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND  config_name = 'groups_search_jabberit';";
345                               
346                                if( $this->db->query($query) )
347                                {
348                                        while( $this->db->next_record())
349                                                $result[] = $this->db->row();                           
350                                }
351                               
352                                if( count($result) == 0 )
353                                {
354                                        $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_search_jabberit','".serialize($pData)."');";
355                                        $this->db->query($query);
356                                        return true;
357                                }
358                                else
359                                {
360                                        $resultQuery = unserialize($result[0]['config_value']);
361                                        $keys = array_keys($pData);
362
363                                        $resultQuery[$keys[0]] = $pData[$keys[0]];
364
365                                        $query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_search_jabberit';";
366                                        $this->db->query($query);
367                                        return true;
368                                }
369                        }                       
370                }
371        }
372
373        public final function setGroupsLocked($pGroups)
374        {
375                $groups = "";
376               
377                if( is_array($pGroups) )
378                {
379                        foreach($pGroups as $tmp)               
380                                if(trim($tmp) != "")
381                                        $groups .= $tmp . ";";
382               
383                        $groups = substr($groups, 0, strlen($groups) - 1 );             
384                }
385               
386                if( $this->db )
387                {
388                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
389                       
390                        if($this->db->query($query))
391                        {
392
393                                if ( $this->db->query($query) )
394                                {       
395                                        while($this->db->next_record())
396                                                $result[] = $this->db->row();
397                                }
398
399                                if( count($result) == 0 )
400                                {
401                                        $query = "INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES('phpgwapi','groups_locked_jabberit','".$groups."');";
402                                        $this->db->query($query);
403                                        return true;
404                                }
405                                else
406                                {
407                                        $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
408                                        $this->db->query($query);
409                                        return true;
410                                }
411                        }
412                }
413               
414                return false;
415        }
416       
417        public final function setHostJabber($pParam)
418        {
419                $confHostsJabber =  array();
420
421                foreach($pParam as $key => $itens)
422                        $confHostsJabber[$key] = ( $key === 'org' ) ? strtoupper($itens) : $itens;
423
424                if( $this->db )
425                {
426                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
427                       
428                        if( $this->db->query($query) )
429                        {
430                                while($this->db->next_record())
431                                        $result[] = $this->db->row();                           
432                        }
433                       
434                        if( count($result) == 0 )
435                        {
436                                $return = "<return><confServer ou='".strtoupper($confHostsJabber['org'])."' serverName='".$confHostsJabber['jabberName']."'>".strtoupper($confHostsJabber['org']).":".$confHostsJabber['jabberName']."</confServer></return>";                         
437                                $hostsJabber[0] = $confHostsJabber;
438                               
439                                $this->fileD->ldapExternal($hostsJabber);
440                                 
441                                $query = "INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES('phpgwapi','map_org_realm_jabberit','".serialize($hostsJabber)."')";
442                                $this->db->query($query);                               
443                        }
444                        else
445                        {
446                                $resultQuery = unserialize($result[0]['config_value']);
447                                $foundOrg = false;
448                               
449                                foreach($resultQuery as $key => $itens)
450                                {
451                                        $foundString = array_search($confHostsJabber['org'], $itens);
452                                        if( $foundString )
453                                        {
454                                                $foundOrg = $foundString;
455                                                $ky = $key;
456                                        }
457                                }       
458
459                                if( ! $foundOrg )
460                                        $resultQuery[] = $confHostsJabber;     
461                                else
462                                        $resultQuery[$ky] = $confHostsJabber;
463
464                                $return = "<return>";
465                               
466                                foreach( $resultQuery as $itens )
467                                        $return .= "<confServer ou='".$itens['org']."' serverName='".$itens['jabberName']."'>".$itens['org'].":".$itens['jabberName']."</confServer>";
468                               
469                                $return .= "</return>";
470                               
471                                $this->fileD->ldapExternal($resultQuery);
472                               
473                                $query = "UPDATE phpgw_config SET config_value = '".serialize($resultQuery)."' WHERE config_name = 'map_org_realm_jabberit';";
474                                $this->db->query($query);
475                        }
476                        return $return;
477                }       
478                return false;
479        }
480       
481        public final function setOuGroupsLocked($pGroup)
482        {
483               
484                function strallpos($haystack, $needle, $offset = 0)
485                {
486                    $result = array();
487                    for($i = $offset; $i< strlen($haystack); $i++ )
488                    {
489                        $pos = strpos($haystack,$needle,$i);
490                        if($pos !== FALSE)
491                        {
492                            $offset =  $pos;
493                            if($offset >= $i)
494                                $result[] = $i = $offset;
495                        }
496                    }
497               
498                return $result;
499                }
500
501                $group = $pGroup['group'];
502                $gidnumber = $pGroup['gidnumber'];
503                $organization = strtoupper(trim($pGroup['ou']));
504
505                $posAll = strallpos($organization, "OU=" );
506                $orgs = array();
507
508                for( $i = 0 ; $i < count($posAll); $i++ )
509                {
510                        $pos = strpos($organization, ",");
511                        $tmpString = substr($organization, $posAll[$i] + 3);
512                        $orgs[] = substr($tmpString, 0, strpos($tmpString, ","));
513                }
514
515                $organization = implode("/", array_reverse($orgs));
516
517                if( $this->db )
518                {
519                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
520                       
521                        if($this->db->query($query))
522                        {
523
524                                if ( $this->db->query($query) )
525                                {       
526                                        while($this->db->next_record())
527                                                $result[] = $this->db->row();
528                                }
529
530                                $groupsLocked = explode(";",$result[0]['config_value']);
531                                       
532                                foreach( $groupsLocked as $tmp )
533                                {
534                                        $aux = explode(":", $tmp);
535                                        if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
536                                        {
537                                                if( $aux[2] )
538                                                {
539                                                        $ou_groups = explode(",",$aux[2]);
540                                                        natcasesort($ou_groups);
541                                                        $key = array_search($organization, $ou_groups);
542                                                       
543                                                        if( $key === false )
544                                                                array_push($ou_groups, $organization);
545                                                       
546                                                        $groups .= $group.":".$gidnumber.":";
547                                                       
548                                                        $return = "<return>";                                           
549                                                       
550                                                        foreach($ou_groups as $tmp)
551                                                        {
552                                                                $return .= "<ou attr='".$tmp."'>".$tmp."</ou>";
553                                                                $groups .= $tmp .",";   
554                                                        }
555                                                       
556                                                        $return .= "</return>";
557                                                       
558                                                        $groups  = substr($groups,0,strlen($groups)-1);
559                                                        $groups .= ";";
560                                                }
561                                                else
562                                                {
563                                                        $groups .= $group.":".$gidnumber.":".$organization.";";
564                                                        $return = "<return><ou attr='".$organization."'>".$organization."</ou></return>";
565                                                }
566                                        }
567                                        else
568                                                $groups .= $tmp . ";" ;
569                                }
570
571                                $groups = substr($groups,0,strlen($groups)-1);
572
573                                $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
574                                $this->db->query($query);
575                               
576                                return $return;
577                        }
578                }
579               
580                return false;
581        }
582       
583        public final function removeAttributesLdap($pOrg)
584        {
585                $organization = $pOrg['org'];
586               
587                if( $this->db )
588                {
589                        $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'";
590                               
591                        if ( $this->db->query($query) )
592                        {       
593                                while( $this->db->next_record() )
594                                        $result[] = $this->db->row();
595               
596                                if( count($result) > 0 )
597                                        $attributesOrg = $result[0]['config_value'];
598                        }
599
600                        $attributesOrg = explode(",", $attributesOrg);
601                        $newValue = "";
602                        foreach($attributesOrg as $tmp)
603                        {
604                                $attr = explode(";",$tmp);
605                                 
606                                if( strtolower(trim($attr[0])) != strtolower(trim($organization)))
607                                {
608                                        $newValue .= $attr[0] . ";" . $attr[1] . ",";
609                                }
610                        }
611                       
612                        $newValue = substr($newValue, 0,(strlen($newValue) -1 ));
613                       
614                        if( trim($newValue) != "")
615                                $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'";
616                        else
617                                $query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'";
618                               
619                        if( $this->db->query($query))
620                                return true;
621                        else
622                                return false;
623                }
624                return false;   
625        }
626
627        public final function removeHostsJabber($pItem)
628        {
629                $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';";
630
631                if( $this->db )
632                {
633                        if($this->db->query($query))
634                        {
635                                while($this->db->next_record())
636                                        $result[] = $this->db->row();
637                                       
638                                if( count($result) > 0 )
639                                {
640                                        $confHostsOrgs = unserialize($result[0]['config_value']);
641                                        $hosts = explode(":", $pItem['item']);
642                                        $key = "";
643
644                                        if( count($confHostsOrgs) > 0 )
645                                        {
646                                                for( $i = 0; $i < count($confHostsOrgs); $i++)
647                                                        if( $confHostsOrgs[$i]['org'] == $hosts[0] && $confHostsOrgs[$i]['jabberName'] == $hosts[1])
648                                                                $key = $i;     
649
650                                                array_splice($confHostsOrgs, $key, 1);
651                               
652                                                if(count($confHostsOrgs) > 0)
653                                                {                                       
654                                                        $this->fileD->ldapExternal($confHostsOrgs);
655                                                        $query = "UPDATE phpgw_config SET config_value = '".serialize($confHostsOrgs)."' WHERE config_name = 'map_org_realm_jabberit';";
656                                                }
657                                                else
658                                                {
659                                                        $this->fileD->ldapExternal("");
660                                                        $query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
661                                                }
662                                        }
663                                        else
664                                        {       
665                                                $this->fileD->ldapExternal("");                                         
666                                                $query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';";
667                                        }
668
669                                        if( $this->db->query($query) )
670                                                return "true";
671                                }               
672                        }                       
673                }
674                return "false";
675        }
676
677        public final function removeOuGroupsLocked($pGroup)
678        {
679                $group = $pGroup['group'];
680                $gidnumber = $pGroup['gidnumber'];
681                $organization = strtoupper($pGroup['ou']);
682                $return = false;
683               
684                if( $this->db )
685                {
686                        $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";       
687                       
688                        if($this->db->query($query))
689                        {
690
691                                if ( $this->db->query($query) )
692                                {       
693                                        while($this->db->next_record())
694                                                $result[] = $this->db->row();
695                                }
696
697                                $groupsLocked = explode(";",$result[0]['config_value']);
698                               
699                                foreach( $groupsLocked as $tmp )
700                                {
701                                        $aux = explode(":",$tmp);
702                                       
703                                        if(($group.":".$gidnumber) == ($aux[0].":".$aux[1]))
704                                        {
705                                                $ous = explode(",", $aux[2]);
706                                                $key = array_search($organization, $ous);
707
708                                                if( $key !== false )
709                                                        unset($ous[$key]);
710
711                                                $groups .= $group.":".$gidnumber.":";
712                                               
713                                                foreach($ous as $ouTmp)
714                                                        $groups .= $ouTmp .",";
715                                               
716                                                $groups  = substr($groups,0,strlen($groups)-1);
717                                                $groups .= ";";
718                                        }
719                                        else
720                                                $groups .= $tmp . ";" ;                                                                 
721                                }
722                                       
723                                $groups  = substr($groups,0,strlen($groups)-1);
724                       
725                                $query = "UPDATE phpgw_config SET config_value = '".trim($groups)."' WHERE config_app = 'phpgwapi' AND config_name = 'groups_locked_jabberit';";
726
727                                if( $this->db->query($query))
728                                        $return = true;
729                        }
730                }       
731               
732                return $return;
733        }
734
735}
736?>
Note: See TracBrowser for help on using the repository browser.