Code

Closes #291 Added some debug informations
[gosa.git] / plugins / gofon / conference / class_phoneConferenceGeneric.inc
1 <?php
2 /*
3    This code is part of GOsa (https://gosa.gonicus.de)
4    Copyright (C) 2003  Cajus Pollmeier
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
21 class conference extends plugin
22 {
23   /* department attributes */
24   var $cn                                                 = "";
25   var $description              = "";
26   var $base                               = "";
27   var $ou                                               = "";
28   var $goFonPIN                         = "";
29   var $old_cn         = "";
31   var $goFonConferenceOption    = "";
32   var $goFonConferenceOption_P  = "";   // Set PIN 
33   var $goFonConferenceOption_r  = "";   // record Conference
34   var $goFonConferenceOption_M  = "";   // Play Music opn hold
35   var $goFonConferenceOption_s  = "";   // activate menu
36   var $goFonConferenceOption_i  = "";   // announce new and leaving user
37   var $goFonConferenceOption_c  = "";   // Count User
38   var $goFonConferenceOption_D  = "";   // Conference Type, no PIN/PIN
40   var $goFonConferenceOwner     = "";
41   var $goFonHomeServer          = "0";      // Home server of the conference
42   var $init_HomeServer          = "0";      // Initial home server of the conference
43   var $goFonHomeServers         = array();  // All available home servers
45   var $goFonConferenceOptionFormat              = "";
46   var $goFonConferenceOptionLifetime    = "";
47   var $telephoneNumber          = "";
49   var $old_tele_number          = false;
50   var $old_dn;
52   /* Headpage attributes */
53   var $last_dep_sorting= "invalid";
54   var $departments= array();
56   var $dialog ;
58   /* attribute list for save action */
59   var $attributes= array("cn","base", "description", "goFonPIN","goFonConferenceOption_P","goFonConferenceOption_r",
60       "goFonConferenceOption_M","goFonConferenceOption_s","goFonConferenceOption_i","goFonConferenceOption_c","goFonHomeServer",
61       "goFonConferenceOption_D","goFonConferenceOptionFormat","goFonConferenceOptionLifetime","telephoneNumber","goFonConferenceOwner");
63   var $language  = "de";
64   var $languages = array();
66   var $objectclasses= array("top", "goFonConference");
68   function conference ($config, $dn, $plugin= NULL)
69   {
70     plugin::plugin($config, $dn, $plugin);
71     $this->is_account   = TRUE;
72     $this->ui                       = get_userinfo();
73     $this->orig_dn              = $dn;
75     $this->languages= get_languages(TRUE,TRUE);
78     /* Check server configurations
79      * Load all server configuration in $this->goFonHomeServers if available
80      *  and use first server as default if necessary.
81      */
82     $a_SETUP= array();
83     if(array_key_exists('config',$_SESSION) &&
84        array_key_exists('SERVERS',$_SESSION['config']->data) &&
85        array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
86        count($_SESSION['config']->data['SERVERS']['FON']) &&
87        is_callable("mysql_connect")
88        ) {
90       /* Set available server */
91       $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
93       /* Set default server */
94       if($this->dn == "new"){
95         $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
96       }
98       /* Remember inital home server, to be able to remove old entries */
99       $this->init_HomeServer = $this->goFonHomeServer;
101       /* get config */
102       if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
103         print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."),$this->goFonHomeServer, $this->goFonHomeServers[0]['DN']));
105         $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
106         $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
107       }
108       $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer]; 
109     }
111     /* Set base */
112     if ($this->dn == "new"){
113       $ui= get_userinfo();
114       if(isset($_SESSION['CurrentMainBase'])){
115         $this->base = $_SESSION['CurrentMainBase'];
116       }else{
117         $this->base= dn2base($ui->dn);
118       }
119     } else {
121       /* The base is something like this 
122           "cn=Confis,ou=conferences,ou=asterisk,ou=configs,ou=systems," */
123       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn);
124     }
126     $ui= get_userinfo();
127     $acl= get_permissions ($ui->dn, $this->ui->subtreeACL);
128     $this->acl= get_module_permission($acl, "conference", $ui->dn);
129     $this->goFonConferenceOwner=$this->ui->dn;
131     /* Parse Options ... 
132      * Parameter|Lifetime|number
133      */
134     if($this->dn!="new"){
135       $tmp1= split("\|",$this->attrs['goFonConferenceOption'][0]);
137       for($i = 0 ; $i < strlen($tmp1[0]);$i++){
138         $varname = "goFonConferenceOption_".$tmp1[0][$i];
139         if($tmp1[0][$i]=="d"){
140           $this->goFonConferenceOption_D = $tmp1[0][$i];    
141         }else{
142           $this->$varname = $tmp1[0][$i];    
143         }
144       }
146       $this->goFonConferenceOptionLifetime  = $tmp1[1];
147       if(isset($tmp1[2]) && isset($this->languages[$tmp1[2]])){
148         $this->language = $tmp1[2];
149       }
150   
151       $this->old_tele_number                = $this->telephoneNumber;
152     }
153     $this->old_dn = $this->dn;
154     $this->old_cn = $this->cn;
155   }
158   function execute()
159   {
160     /* Call parent execute */
161     plugin::execute();
163     $smarty= get_smarty();
165     $smarty->assign("bases" ,$this->config->idepartments);
166     $smarty->assign("base"  ,$this->base);
168     $once = true; 
169     foreach($_POST as $name => $value){
170       if(preg_match("/^chooseBase/",$name) && $once){
171         $once = false;
172         $this->dialog = new baseSelectDialog($this->config);
173         $this->dialog->setCurrentBase($this->base);
174       }
175     }
177     /* Dialog handling */
178     if(is_object($this->dialog)){
179       /* Must be called before save_object */
180       $this->dialog->save_object();
182       if($this->dialog->isClosed()){
183         $this->dialog = false;
184       }elseif($this->dialog->isSelected()){
185         $this->base = $this->dialog->isSelected();
186         $this->dialog= false;
187       }else{
188         return($this->dialog->execute());
189       }
190     }
192     /* Create array with goFonHomeServer */
193     $tmp = array();
194     foreach($this->goFonHomeServers as $dn => $val){
195       if(!is_numeric($dn)){
196         $tmp[$dn]  = $val['SERVER'];
197       }
198     }
199     $smarty->assign("language",$this->language);
200     $smarty->assign("languages",$this->languages);
201     $smarty->assign("goFonHomeServers",$tmp);
202     $smarty->assign("goFonConferenceOptions",               array("D"=>"Conference ","d"=>"Conference without PIN"));
203     $smarty->assign("goFonConferenceOptionFormats",     array("WAV"=>"Wave","GSM"=>"GSM","WAV49"=>"Wave49"));
204     $smarty->assign("goFonConferenceOption",        $this->goFonConferenceOption_D);
206     foreach ($this->attributes as $val){
207       $smarty->assign("$val", $this->$val);
208       $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
209       if(!$this->$val){
210         $smarty->assign($val."CHK", "");
211       }else{
212         $smarty->assign($val."CHK", " checked ");
213       }
214     }
216     if($_SESSION['js']==1){
217       if($this->goFonConferenceOption_P != "P"){
218         $smarty->assign("goFonPINACL"," disabled ");
219         $smarty->assign("goFonPIN","");
220       }
221       if($this->goFonConferenceOption_r != "r"){
222         $smarty->assign("goFonConferenceOptionFormatACL"," disabled ");
223       }
224     }
225     return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
226   }
229   function remove_from_parent()
230   {
231     /* Check if 'old' home server is available in gosa FON server configuration 
232      * Try to remove this entry from database and display errors.  
233      */
234     if(isset($this->goFonHomeServers[$this->goFonHomeServer])){
235       $str = $this->SQL_remove_me(true); 
236       if($str){
237         print_red($str);
238         return false;
239       }
240     }else{
241       print_red(_("Could not remove the conference entry from database on home server (%s). Please check your asterisk database configuration."));
242       return false;
243     }
245     /* Remove ldap entry */
246     $ldap= $this->config->get_ldap_link();
247     $ldap->cd ($this->dn);
248     $ldap->recursive_remove();
250     /* Optionally execute a command after we're done */
251     $this->handle_post_events('remove');
252   }
255   /* Save data to object */
256   function save_object()
257   {
258     plugin::save_object();
259     if(isset($_POST['cn'])){
261       /* Get selected language */
262       if(isset($_POST['language']) && isset($this->languages[get_post('language')])){
263         $this->language = get_post('language');
264       }
266       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
267             "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonPIN") as $attrs){
268         if(isset($_POST[$attrs])){
269           $this->$attrs = $_POST[$attrs];
270         }else{
271           $this->$attrs = false;
272         }
273       }
274     }
275   }
278   function check_database_accessibility()
279   {
280     /* Check if mysql extension is available */
281     if(!is_callable("mysql_pconnect")){
282       return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
283     }
285     /********************
286      * Check currently selected home server 
287      ********************/
289     $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer];
290     $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
291     if(!$r_current){
292       gosa_log(@mysql_error($r_current));
293       return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
294             $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
295     }
296     $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
297     if(!$db_current){
298       gosa_log(@mysql_error($r_current));
299       mysql_close($r_current);
300       return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
301     }
303     /********************
304      * Check init home server 
305      ********************/
307     if($this->goFonHomeServers != $this->init_HomeServer){
308       $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
309       $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
310       if(!$r_init){
311         gosa_log(@mysql_error($r_init));
312         return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
313               $cfg_Init['SERVER'],$cfg_Init['LOGIN']));
314       }
315       $db_init  =  @mysql_select_db($cfg_Init['DB'],$r_init);
316       if(!$db_init){
317         gosa_log(@mysql_error($r_init));
318         mysql_close($r_init);
319         return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER']));
320       }
321     }
322   }
324   /* Check values */
325   function check()
326   {
327     /* Call common method to give check the hook */
328     $message= plugin::check();
330     if($this->is_number_used()){
331       $message[] =  $this->is_number_used();
332     }
334     /* Check if previously selected server is still available */
335     if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
336       $message[]= sprintf(_("The previously selected asterisk home server (%s) is no longer available."),preg_replace("/,/",", ",$this->goFonHomeServer));
337       return($message);
338     }
340     if((!empty($this->goFonPIN)||($this->goFonConferenceOption_P=="P"))&&($this->goFonConferenceOption_D=="d")){
341       $message[] =_("You have specified a conference 'without PIN' ... please leave the PIN fields empty.");
342     }
344     if((empty($this->goFonPIN))&&($this->goFonConferenceOption_P=="P")&&($this->goFonConferenceOption_D=="D")){
345       $message[]= _("Please enter a PIN.");
346     }
348     if(empty($this->cn)){
349       $message[] =_("Please enter a name for the conference.");
350     }
352     if(!is_numeric($this->telephoneNumber)){
353       $message[] =_("Only numeric chars are allowed in Number field.");
354     }
356     if(!((is_numeric($this->goFonConferenceOptionLifetime))||(empty($this->goFonConferenceOptionLifetime)))){
357       $message[] =_("Only numbers are allowed in Lifetime.");
358     }
360     /* Check if add could be successful */    
361     $str = $this->SQL_add_me(false);
362     if(!empty($str)){
363       $message[] = $str;
364     }
366     return $message;
367   }
370   function SQL_add_me($save)
371   {
372     /* Check if there is at least on server configuration */
373     if(!count($this->goFonHomeServers)){
374       return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
375     }
376   
377     /********************
378      * Get configuration and try to connect 
379      ********************/
381     /* Check if databases are reachable, returns an error string if anything fails  */
382     $error_str = $this->check_database_accessibility();
383     if($error_str){
384       return($error_str);
385     }
387     /* Remove old entries, returns an error string if anything fails  */
388     $error_str = $this->SQL_remove_me($save);
389     if($error_str){
390       return($error_str);
391     }
393     /* Connect to current database to be able to add new entries */
394     $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer] ;
395     $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
396     $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
398     /********************
399      * Remove entries that could cause trouble  
400      ********************/
402     /* If the current home server is different to the initial home server,
403      *  there may be already some entries with the given telephoneNumber and/or cn.
404      * We must remove those entries to avoid duplicate use of the same extension name.
405      */
406     if($this->goFonHomeServer != $this->init_HomeServer){
407       $query = "SELECT id FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$this->telephoneNumber."' OR '".$this->cn."';";
408       $res = @mysql_query($query,$res_cur);
409       @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
410       if(!$res){
411         gosa_log(@mysql_error($res_cur));
412         return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server.").
413             "&nbsp;"._("Please have a look a the gosa logfiles."));
414       }
415       if($save && mysql_affected_rows($res_cur)) {
416         $SQL = "DELETE FROM ".$cfg_Current['EXT_TABLE']." 
417           WHERE   (exten='".$this->telephoneNumber."') 
418           OR    (exten='".$this->cn."')";
420         /* Query and ensure that everything went fine */
421         $res =  @mysql_query($SQL,$res_cur);
422         @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query");
423         if(!$res){
424           gosa_log(@mysql_error($res_cur));
425           return(_("Can not remove entries with some telephone number and/or cn from destination home server.").
426               "&nbsp;"._("Please have a look a the gosa logfiles."));
427         }
428       }
429     }
431     /********************
432      * Add new conference entry  
433      ********************/
434     if((!empty($this->telephoneNumber))&&($save==true)){
436       /* Create string out of conference Flags */
437       $parameter  ="";
438       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
439             "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
440         $parameter .= $this->$attrs;
441       }
443       $i=1;
444       $EXT=array();
445       $context="GOsa";
446       // Set Language to German
447       $EXT[$i]['exten']   =$this->telephoneNumber;
448       $EXT[$i]['context'] = $context;
449       $EXT[$i]['priority']= $i;
450       $EXT[$i]['app']     ="SetLanguage";
451       $EXT[$i]['appdata'] =$this->language;
452       $i++;      
454       if($this->goFonConferenceOption_r == "r"){
456         // Recordingformat for conference
457         $EXT[$i]['exten']   =$this->telephoneNumber;
458         $EXT[$i]['context'] =$context;
459         $EXT[$i]['priority']= $i;
460         $EXT[$i]['app']     ="Setvar";
461         $EXT[$i]['appdata'] ="MEETME_RECORDINGFORMAT=".$this->goFonConferenceOptionFormat;
462         $i++;      
464       }
466       // Answer Call
467       $EXT[$i]['exten']   =$this->telephoneNumber;
468       $EXT[$i]['context'] =$context;
469       $EXT[$i]['priority']=$i;
470       $EXT[$i]['app']     ="answer";
471       $EXT[$i]['appdata'] ="";
472       $i++;      
474       // Start Conference 
475       $EXT[$i]['exten']   =$this->telephoneNumber;
476       $EXT[$i]['context'] =$context;
477       $EXT[$i]['priority']=$i;
478       $EXT[$i]['app']     ="MeetMe";
480       if(empty($this->goFonPIN)) {
481         $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter;
482       }else{
483         $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter."|".$this->goFonPIN;
484       }
485       $i++; 
487       // Start Conference 
488       $EXT[$i]['exten']   =$this->cn;
489       $EXT[$i]['context'] =$context;
490       $EXT[$i]['priority']=1;
491       $EXT[$i]['app']     ="Goto";
492       $EXT[$i]['appdata'] =$this->telephoneNumber."|1";
493       $SQL=array();
495       foreach($EXT as $keytop => $valtop){
496         $s_keys = "";
497         $s_values = ""; 
498         foreach($valtop as $key=>$val){
499           $s_keys   .="`".$key."`,";
500           $s_values .="'".$val."',";
501         }
502         $s_keys   =preg_replace("/\,$/","",$s_keys); 
503         $s_values =preg_replace("/\,$/","",$s_values); 
504         $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$s_keys.") VALUES (".$s_values.");"; 
505       }
506       foreach($SQL as $sqlsyn){
507         mysql_query($sqlsyn,$res_cur);
508         @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$sqlsyn, "Database query");
509       }
510     } 
512     @mysql_close($res_cur);
513   }
516   /* Remove initial entry from database 
517    * This function checks if there is an entry in the 
518    *  initial home server that uses this->old_cn or $this->old_tele_number
519    *  and removes this entries. 
520    * This function is called from save and remove_from parent.
521    * 
522    *  The parameter '$save' is false if we just 
523    *   want to check if a remove is possible. 
524    *  And true if we realy want to remove the entries.   
525    */
526   function SQL_remove_me($save)
527   {
528     /* check database access */
529     $str = $this->check_database_accessibility();
530     if($str){
531       return($str);
532     }
534     /* Connect to old database */
535     $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
536     $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
537     $db_init   =  @mysql_select_db($cfg_Init['DB'],$r_init);
538    
539     /* Check if there is an old entry */
540     $query = "SELECT id FROM ".$cfg_Init['EXT_TABLE']." WHERE exten='".$this->old_tele_number."' OR '".$this->old_cn."';";
541     $res = @mysql_query($query,$r_init);
542     @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
543     if(!$res){
544       gosa_log(@mysql_error($r_init));
545       return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles."));
546     }
547    
548     /* There are entries using this cn and/or phone number */
549     if($save && mysql_affected_rows($r_init)) {
550       $SQL = "DELETE FROM ".$cfg_Init['EXT_TABLE']." 
551       WHERE   (exten='".$this->old_tele_number."') 
552         OR    (exten='".$this->old_cn."')";
553   
554       /* Query and ensure that everything went fine */
555       $res =  @mysql_query($SQL,$r_init);
556       @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query");
557       if(!$res){
558         gosa_log(@mysql_error($r_init));
559         return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles."));
560       }
562     }//ENDE  old num availiable ...
563     @mysql_close($r_init);
564     return(false);
565   }
569   /* This function checks if the given phonenumbers are available or already in use*/
570   function is_number_used()
571   {
572     $ldap= $this->config->get_ldap_link();
573     $ldap->cd($this->config->current['BASE']);
574     $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
575     while($attrs = $ldap->fetch()) {
576       unset($attrs['telephoneNumber']['count']);
577       foreach($attrs['telephoneNumber'] as $tele){
578         if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
579         if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
580         $numbers[$tele]=$attrs;
581       }
582     }
584     $num = $this->telephoneNumber;
585     if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!=$this->old_cn))){
586       if(isset($numbers[$num]['uid'][0])){
587         return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
588       }else{
589         return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
590       }
591     }
592   }
595   /* Save to LDAP */
596   function save()
597   {
599     if((!isset($this->attrs['goFonPIN']))){
600       $pin_use = false;
601     }else{
602       $pin_use = true;
603     }
605     plugin::save();
607     if(empty($this->old_tele_number)){
608       $this->old_tele_number= $this->telephoneNumber;
609     }
611     $this->SQL_add_me(true);
613     if(empty($this->goFonConferenceOption_P)){
614       if($pin_use){
615         $this->attrs['goFonPIN']=array();
616       }else{
617         unset($this->attrs['goFonPIN']);
618       }
619     }
620     $this->attrs['goFonConferenceOption']="";
621     foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
622           "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonConferenceOptionFormat") as $attrs){
623       $this->attrs['goFonConferenceOption'] .= $this->$attrs;
624       unset($this->attrs[$attrs]);         
625     }
627     $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionLifetime;
628     $this->attrs['goFonConferenceOption'].="|".$this->language;
629     unset($this->attrs['goFonConferenceOptionLifetime']);
631     /* Write back to ldap */
633     unset($this->attrs['base']);
635     foreach($this->attributes as $atr){
636       if(chkacl($this->acl, $atr)!=""){
637         unset($this->attrs[$atr]);
638       }
639     }
641     $ldap= $this->config->get_ldap_link();
642     $ldap->cd($this->config->current['BASE']);
643     $ldap->cat($this->dn, array('dn'));
645     if ($ldap->count()){
646       $ldap->cd($this->dn);
647       $this->cleanup();
648       $ldap->modify ($this->attrs); 
649       $this->handle_post_events('modify');
650     } else {
651       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
652       $ldap->cd($this->dn);
653       $ldap->add($this->attrs);
654       $this->handle_post_events('add');
655     }
656     show_ldap_error($ldap->get_error(), _("Saving phone conference failed"));
658     /* Optionally execute a command after we're done */
659     $this->postcreate();
660   }
664 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
665 ?>