Code

Shrinked down aclRole class to half size.
[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","goFonHomeServer",
60       "goFonConferenceOption_M","goFonConferenceOption_s","goFonConferenceOption_i","goFonConferenceOption_c","goFonHomeServer",
61       "goFonConferenceOption_D","goFonConferenceOptionFormat","goFonConferenceOptionLifetime","telephoneNumber","goFonConferenceOwner");
63   var $objectclasses= array("top", "goFonConference");
65   function conference ($config, $dn, $plugin= NULL)
66   {
67     plugin::plugin($config, $dn, $plugin);
68     $this->is_account   = TRUE;
69     $this->ui                       = get_userinfo();
70     $this->orig_dn              = $dn;
72     
73     /* Check server configurations
74      * Load all server configuration in $this->goFonHomeServers if available
75      *  and use first server as default if necessary.
76      */
77     $a_SETUP= array();
78     if(array_key_exists('config',$_SESSION) &&
79        array_key_exists('SERVERS',$_SESSION['config']->data) &&
80        array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
81        count($_SESSION['config']->data['SERVERS']['FON']) &&
82        is_callable("mysql_connect")
83        ) {
85       /* Set available server */
86       $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
88       /* Set default server */
89       if($this->dn == "new"){
90         $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
91       }
93       /* Remember inital home server, to be able to remove old entries */
94       $this->init_HomeServer = $this->goFonHomeServer;
96       /* get config */
97       if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
98         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']));
100         $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
101         $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
102       }
103       $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer]; 
104     }
106     /* Set base */
107     if ($this->dn == "new"){
108       $ui= get_userinfo();
109       if(isset($_SESSION['CurrentMainBase'])){
110         $this->base = $_SESSION['CurrentMainBase'];
111       }else{
112         $this->base= dn2base($ui->dn);
113       }
114     } else {
116       /* The base is something like this 
117           "cn=Confis,ou=conferences,ou=asterisk,ou=configs,ou=systems," */
118       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn);
119     }
121     $this->goFonConferenceOwner=$this->ui->dn;
123     /* Parse Options ... 
124      * Parameter|Lifetime|number
125      */
126     if($this->dn!="new"){
127       $tmp1= split("\|",$this->attrs['goFonConferenceOption'][0]);
129       for($i = 0 ; $i < strlen($tmp1[0]);$i++){
130         $varname = "goFonConferenceOption_".$tmp1[0][$i];
131         if($tmp1[0][$i]=="d"){
132           $this->goFonConferenceOption_D = $tmp1[0][$i];    
133         }else{
134           $this->$varname = $tmp1[0][$i];    
135         }
136       }
138       $this->goFonConferenceOptionLifetime  = $tmp1[1];
139       $this->old_tele_number                = $this->telephoneNumber;
140     }
141     $this->old_dn = $this->dn;
142     $this->old_cn = $this->cn;
143   }
146   function execute()
147   {
148     /* Call parent execute */
149     plugin::execute();
151     $smarty= get_smarty();
153     $smarty->assign("bases" ,$this->config->idepartments);
154     $smarty->assign("base"  ,$this->base);
156     $once = true; 
157     foreach($_POST as $name => $value){
158       if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
159         $once = false;
160         $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
161         $this->dialog->setCurrentBase($this->base);
162       }
163     }
165     /* Dialog handling */
166     if(is_object($this->dialog)){
167       /* Must be called before save_object */
168       $this->dialog->save_object();
170       if($this->dialog->isClosed()){
171         $this->dialog = false;
172       }elseif($this->dialog->isSelected()){
173         $tmp = $this->get_allowed_bases();
174         if(isset($tmp[$this->dialog->isSelected()])){
175           $this->base = $this->dialog->isSelected();
176         }
177         $this->dialog= false;
178       }else{
179         return($this->dialog->execute());
180       }
181     }
183     foreach ($this->attributes as $val){
184       $smarty->assign("$val", $this->$val);
185       if(!$this->$val){
186         $smarty->assign($val."CHK", "");
187       }else{
188         $smarty->assign($val."CHK", " checked ");
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("goFonHomeServers",$tmp);
200     $smarty->assign("goFonConferenceOptions",               array("D"=>"Conference ","d"=>"Conference without PIN"));
201     $smarty->assign("goFonConferenceOptionFormats",     array("WAV"=>"Wave","GSM"=>"GSM","WAV49"=>"Wave49"));
202     $smarty->assign("goFonConferenceOption",        $this->goFonConferenceOption_D);
204     $tmp = $this->plInfo();
205     foreach($tmp['plProvidedAcls'] as $name => $translation){
206       $smarty->assign($name."ACL",$this->getacl($name));
207     }
209     if($this->acl_is_writeable("base")){
210       $smarty->assign("baseSelect",true);
211     }else{
212       $smarty->assign("baseSelect",false);
213     }
215     $smarty->assign("bases" ,$this->get_allowed_bases());
216     $smarty->assign("base_select"  ,$this->base);
219     if($_SESSION['js']==1){
220       if($this->goFonConferenceOption_P != "P"){
221         $smarty->assign("goFonPINACL", $this->getacl("goFonPIN",TRUE));
222         $smarty->assign("goFonPIN","");
223       }
224       if($this->goFonConferenceOption_r != "r"){
225         $smarty->assign("goFonConferenceOptionFormatACL", $this->getacl("goFonConferenceOptionr",TRUE));
226       }
227     }
228     return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
229   }
232   function remove_from_parent()
233   {
234     /* Check if 'old' home server is available in gosa FON server configuration 
235      * Try to remove this entry from database and display errors.  
236      */
237     if(isset($this->goFonHomeServers[$this->goFonHomeServer])){
238       $str = $this->SQL_remove_me(true); 
239       if($str){
240         print_red($str);
241         return false;
242       }
243     }else{
244       print_red(_("Could not remove the conference entry from database on home server (%s). Please check your asterisk database configuration."));
245       return false;
246     }
248     /* Remove ldap entry */
249     $ldap= $this->config->get_ldap_link();
250     $ldap->cd ($this->dn);
251     $ldap->recursive_remove();
253     /* Optionally execute a command after we're done */
254     $this->handle_post_events('remove');
255   }
258   /* Save data to object */
259   function save_object()
260   {
261     if(isset($_POST['phoneConferenceGeneric'])){
263       /* Create a base backup and reset the
264          base directly after calling plugin::save_object();
265          Base will be set seperatly a few lines below */
266       $base_tmp = $this->base;
267       plugin::save_object();
268       $this->base = $base_tmp;
270       /* Save base, since this is no LDAP attribute */
271       $tmp = $this->get_allowed_bases();
272       if(isset($_POST['base'])){
273         if(isset($tmp[$_POST['base']])){
274           $this->base= $_POST['base'];
275         }
276       }
277       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
278             "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
280         /* Acl can't contain _ so we remove it here. */
281         $acl_name = preg_replace("/_/","",$attrs);
283         if($this->acl_is_writeable($acl_name)){
285           if(isset($_POST[$attrs])){
286             $this->$attrs = $_POST[$attrs];
287           }else{
288             $this->$attrs = false;
289           }
290         }
291       }
292     }
293   }
296   function check_database_accessibility()
297   {
298     /* Check if mysql extension is available */
299     if(!is_callable("mysql_pconnect")){
300       return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
301     }
303     /********************
304      * Check currently selected home server 
305      ********************/
307     $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer];
308     $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
309     if(!$r_current){
310       gosa_log(@mysql_error($r_current));
311       return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
312             $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
313     }
314     $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
315     if(!$db_current){
316       gosa_log(@mysql_error($r_current));
317       mysql_close($r_current);
318       return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
319     }
321     /********************
322      * Check init home server 
323      ********************/
325     if($this->goFonHomeServers != $this->init_HomeServer){
326       $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
327       $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
328       if(!$r_init){
329         gosa_log(@mysql_error($r_init));
330         return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
331               $cfg_Init['SERVER'],$cfg_Init['LOGIN']));
332       }
333       $db_init  =  @mysql_select_db($cfg_Init['DB'],$r_init);
334       if(!$db_init){
335         gosa_log(@mysql_error($r_init));
336         mysql_close($r_init);
337         return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER']));
338       }
339     }
340   }
342   /* Check values */
343   function check()
344   {
345     /* Call common method to give check the hook */
346     $message= plugin::check();
348     if($this->is_number_used()){
349       $message[] =  $this->is_number_used();
350     }
352     /* Check if previously selected server is still available */
353     if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
354       $message[]= sprintf(_("The previously selected asterisk home server (%s) is no longer available."),preg_replace("/,/",", ",$this->goFonHomeServer));
355       return($message);
356     }
358     if((empty($this->goFonPIN))&&($this->goFonConferenceOption_P=="P")&&($this->goFonConferenceOption_D=="D")){
359       $message[]= _("Please enter a PIN.");
360     }
362     if(empty($this->cn)){
363       $message[] =_("Please enter a name for the conference.");
364     }
366     if(!is_numeric($this->telephoneNumber)){
367       $message[] =_("Only numeric chars are allowed in Number field.");
368     }
370     if(!((is_numeric($this->goFonConferenceOptionLifetime))||(empty($this->goFonConferenceOptionLifetime)))){
371       $message[] =_("Only numbers are allowed in Lifetime.");
372     }
374     /* Check if add could be successful */    
375     $str = $this->SQL_add_me(false);
376     if(!empty($str)){
377       $message[] = $str;
378     }
380     return $message;
381   }
384   function SQL_add_me($save)
385   {
386     /* Check if there is at least on server configuration */
387     if(!count($this->goFonHomeServers)){
388       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."));
389     }
390   
391     /********************
392      * Get configuration and try to connect 
393      ********************/
395     /* Check if databases are reachable, returns an error string if anything fails  */
396     $error_str = $this->check_database_accessibility();
397     if($error_str){
398       return($error_str);
399     }
401     /* Remove old entries, returns an error string if anything fails  */
402     $error_str = $this->SQL_remove_me($save);
403     if($error_str){
404       return($error_str);
405     }
407     /* Connect to current database to be able to add new entries */
408     $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer] ;
409     $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
410     $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
412     /********************
413      * Remove entries that could cause trouble  
414      ********************/
416     /* If the current home server is different to the initial home server,
417      *  there may be already some entries with the given telephoneNumber and/or cn.
418      * We must remove those entries to avoid duplicate use of the same extension name.
419      */
420     if($this->goFonHomeServer != $this->init_HomeServer){
421       $query = "SELECT id FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$this->telephoneNumber."' OR '".$this->cn."';";
422       $res = @mysql_query($query,$res_cur);
423       if(!$res){
424         gosa_log(@mysql_error($res_cur));
425         return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server.").
426             "&nbsp;"._("Please have a look a the gosa logfiles."));
427       }
428       if($save && mysql_affected_rows($res_cur)) {
429         $SQL = "DELETE FROM ".$cfg_Current['EXT_TABLE']." 
430           WHERE   (exten='".$this->telephoneNumber."') 
431           OR    (exten='".$this->cn."')";
433         /* Query and ensure that everything went fine */
434         $res =  @mysql_query($SQL,$res_cur);
435         if(!$res){
436           gosa_log(@mysql_error($res_cur));
437           return(_("Can not remove entries with some telephone number and/or cn from destination home server.").
438               "&nbsp;"._("Please have a look a the gosa logfiles."));
439         }
440       }
441     }
443     /********************
444      * Add new conference entry  
445      ********************/
446     if((!empty($this->telephoneNumber))&&($save==true)){
448       /* Create string out of conference Flags */
449       $parameter  ="";
450       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
451             "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
452         $parameter .= $this->$attrs;
453       }
455       $i=1;
456       $EXT=array();
457       $context="GOsa";
458       // Set Language to German
459       $EXT[$i]['exten']   =$this->telephoneNumber;
460       $EXT[$i]['context'] = $context;
461       $EXT[$i]['priority']= $i;
462       $EXT[$i]['app']     ="SetLanguage";
463       $EXT[$i]['appdata'] ="de";
464       $i++;      
466       if($this->goFonConferenceOption_r == "r"){
468         // Recordingformat for conference
469         $EXT[$i]['exten']   =$this->telephoneNumber;
470         $EXT[$i]['context'] =$context;
471         $EXT[$i]['priority']= $i;
472         $EXT[$i]['app']     ="Setvar";
473         $EXT[$i]['appdata'] ="MEETME_RECORDINGFORMAT=".$this->goFonConferenceOptionFormat;
474         $i++;      
476       }
478       // Answer Call
479       $EXT[$i]['exten']   =$this->telephoneNumber;
480       $EXT[$i]['context'] =$context;
481       $EXT[$i]['priority']=$i;
482       $EXT[$i]['app']     ="answer";
483       $EXT[$i]['appdata'] ="";
484       $i++;      
486       // Start Conference 
487       $EXT[$i]['exten']   =$this->telephoneNumber;
488       $EXT[$i]['context'] =$context;
489       $EXT[$i]['priority']=$i;
490       $EXT[$i]['app']     ="MeetMe";
492       if(empty($this->goFonPIN)) {
493         $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter;
494       }else{
495         $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter."|".$this->goFonPIN;
496       }
497       $i++; 
499       // Start Conference 
500       $EXT[$i]['exten']   =$this->cn;
501       $EXT[$i]['context'] =$context;
502       $EXT[$i]['priority']=1;
503       $EXT[$i]['app']     ="Goto";
504       $EXT[$i]['appdata'] =$this->telephoneNumber."|1";
505       $SQL=array();
507       foreach($EXT as $keytop => $valtop){
508         $s_keys = "";
509         $s_values = ""; 
510         foreach($valtop as $key=>$val){
511           $s_keys   .="`".$key."`,";
512           $s_values .="'".$val."',";
513         }
514         $s_keys   =preg_replace("/\,$/","",$s_keys); 
515         $s_values =preg_replace("/\,$/","",$s_values); 
516         $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$s_keys.") VALUES (".$s_values.");"; 
517       }
518       foreach($SQL as $sqlsyn){
519         mysql_query($sqlsyn,$res_cur);
520       }
521     } 
523     @mysql_close($res_cur);
524   }
527   /* Remove initial entry from database 
528    * This function checks if there is an entry in the 
529    *  initial home server that uses this->old_cn or $this->old_tele_number
530    *  and removes this entries. 
531    * This function is called from save and remove_from parent.
532    * 
533    *  The parameter '$save' is false if we just 
534    *   want to check if a remove is possible. 
535    *  And true if we realy want to remove the entries.   
536    */
537   function SQL_remove_me($save)
538   {
539     /* check database access */
540     $str = $this->check_database_accessibility();
541     if($str){
542       return($str);
543     }
545     /* Connect to old database */
546     $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
547     $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
548     $db_init   =  @mysql_select_db($cfg_Init['DB'],$r_init);
549    
550     /* Check if there is an old entry */
551     $query = "SELECT id FROM ".$cfg_Init['EXT_TABLE']." WHERE exten='".$this->old_tele_number."' OR '".$this->old_cn."';";
552     $res = @mysql_query($query,$r_init);
553     if(!$res){
554       gosa_log(@mysql_error($r_init));
555       return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles."));
556     }
557    
558     /* There are entries using this cn and/or phone number */
559     if($save && mysql_affected_rows($r_init)) {
560       $SQL = "DELETE FROM ".$cfg_Init['EXT_TABLE']." 
561       WHERE   (exten='".$this->old_tele_number."') 
562         OR    (exten='".$this->old_cn."')";
563   
564       /* Query and ensure that everything went fine */
565       $res =  @mysql_query($SQL,$r_init);
566       if(!$res){
567         gosa_log(@mysql_error($r_init));
568         return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles."));
569       }
571     }//ENDE  old num availiable ...
572     @mysql_close($r_init);
573     return(false);
574   }
578   /* This function checks if the given phonenumbers are available or already in use*/
579   function is_number_used()
580   {
581     $ldap= $this->config->get_ldap_link();
582     $ldap->cd($this->config->current['BASE']);
583     $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
584     while($attrs = $ldap->fetch()) {
585       unset($attrs['telephoneNumber']['count']);
586       foreach($attrs['telephoneNumber'] as $tele){
587         if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
588         if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
589         $numbers[$tele]=$attrs;
590       }
591     }
593     $num = $this->telephoneNumber;
594     if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!=$this->old_cn))){
595       if(isset($numbers[$num]['uid'][0])){
596         return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
597       }else{
598         return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
599       }
600     }
601   }
604   /* Save to LDAP */
605   function save()
606   {
608     if((!isset($this->attrs['goFonPIN']))){
609       $pin_use = false;
610     }else{
611       $pin_use = true;
612     }
614     /* Unset PIN if this is a conference without PIN */
615     if((!empty($this->goFonPIN)||($this->goFonConferenceOption_P=="P"))&&($this->goFonConferenceOption_D=="d")){
616       $this->goFonPIN = "";
617     }
619     plugin::save();
621     if(empty($this->old_tele_number)){
622       $this->old_tele_number= $this->telephoneNumber;
623     }
625     $this->SQL_add_me(true);
627     if(empty($this->goFonConferenceOption_P)){
628       if($pin_use){
629         $this->attrs['goFonPIN']=array();
630       }else{
631         unset($this->attrs['goFonPIN']);
632       }
633     }
634     $this->attrs['goFonConferenceOption']="";
635     foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
636           "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonConferenceOptionFormat") as $attrs){
637       $this->attrs['goFonConferenceOption'] .= $this->$attrs;
638       unset($this->attrs[$attrs]);         
639     }
641     $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionLifetime;
642     unset($this->attrs['goFonConferenceOptionLifetime']);
644     /* Write back to ldap */
646     unset($this->attrs['base']);
648     $ldap= $this->config->get_ldap_link();
649     $ldap->cd($this->config->current['BASE']);
650     $ldap->cat($this->dn, array('dn'));
652     if ($ldap->count()){
653       $ldap->cd($this->dn);
654       $this->cleanup();
655       $ldap->modify ($this->attrs); 
656       $this->handle_post_events('modify');
657     } else {
658       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
659       $ldap->cd($this->dn);
660       $ldap->add($this->attrs);
661       $this->handle_post_events('add');
662     }
663     show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonConference/generic with dn '%s' failed."),$this->dn));
665     /* Optionally execute a command after we're done */
666     $this->postcreate();
667   }
669   /* Return plugin informations for acl handling */
670   function plInfo()
671   {
672     return (array(
673           "plShortName"   => _("Conference"),
674           "plDescription" => _("Phone conference management"),
675           "plSelfModify"  => TRUE,
676           "plDepends"     => array(),
677           "plPriority"    => 0,
678           "plSection"     => array("addons" => _("Addons")),
679           "plCategory"    => array("gofonconference" => array("description" => _("GOfon conference"),
680               "objectClass" => "gofonConference")),
682           "plProvidedAcls" => array(
683             "cn"                            => _("Name"),
684             "base"                          => _("Base"),
685             "description"                   => _("Description"),
686             "goFonPIN"                      => _("Conference PIN"),
688             "goFonHomeServer"              => _("Home server"),
689             "goFonConferenceOptionP"       => _("Preset PIN"),
690             "goFonConferenceOptionr"       => _("Record conference"),
691             "goFonConferenceOptionM"       => _("Play music on hold"),
692             "goFonConferenceOptions"       => _("Activate menu"),
693             "goFonConferenceOptioni"       => _("Announce user activity"),
694             "goFonConferenceOptionc"       => _("Count user"),
695             "goFonConferenceOptionD"       => _("Conference type"),
697             "goFonConferenceOptionFormat"   => _("Format"),
698             "goFonConferenceOptionLifetime" => _("Lifetime"),
699             "telephoneNumber"               => _("Telephone number"),
700             "goFonConferenceOwner"          => _("Owner"))
701             ));
702   }
707 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
708 ?>