Code

Closes #288 Made conferences language selectable
[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       if(!$res){
410         gosa_log(@mysql_error($res_cur));
411         return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server.").
412             "&nbsp;"._("Please have a look a the gosa logfiles."));
413       }
414       if($save && mysql_affected_rows($res_cur)) {
415         $SQL = "DELETE FROM ".$cfg_Current['EXT_TABLE']." 
416           WHERE   (exten='".$this->telephoneNumber."') 
417           OR    (exten='".$this->cn."')";
419         /* Query and ensure that everything went fine */
420         $res =  @mysql_query($SQL,$res_cur);
421         if(!$res){
422           gosa_log(@mysql_error($res_cur));
423           return(_("Can not remove entries with some telephone number and/or cn from destination home server.").
424               "&nbsp;"._("Please have a look a the gosa logfiles."));
425         }
426       }
427     }
429     /********************
430      * Add new conference entry  
431      ********************/
432     if((!empty($this->telephoneNumber))&&($save==true)){
434       /* Create string out of conference Flags */
435       $parameter  ="";
436       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
437             "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
438         $parameter .= $this->$attrs;
439       }
441       $i=1;
442       $EXT=array();
443       $context="GOsa";
444       // Set Language to German
445       $EXT[$i]['exten']   =$this->telephoneNumber;
446       $EXT[$i]['context'] = $context;
447       $EXT[$i]['priority']= $i;
448       $EXT[$i]['app']     ="SetLanguage";
449       $EXT[$i]['appdata'] =$this->language;
450       $i++;      
452       if($this->goFonConferenceOption_r == "r"){
454         // Recordingformat for conference
455         $EXT[$i]['exten']   =$this->telephoneNumber;
456         $EXT[$i]['context'] =$context;
457         $EXT[$i]['priority']= $i;
458         $EXT[$i]['app']     ="Setvar";
459         $EXT[$i]['appdata'] ="MEETME_RECORDINGFORMAT=".$this->goFonConferenceOptionFormat;
460         $i++;      
462       }
464       // Answer Call
465       $EXT[$i]['exten']   =$this->telephoneNumber;
466       $EXT[$i]['context'] =$context;
467       $EXT[$i]['priority']=$i;
468       $EXT[$i]['app']     ="answer";
469       $EXT[$i]['appdata'] ="";
470       $i++;      
472       // Start Conference 
473       $EXT[$i]['exten']   =$this->telephoneNumber;
474       $EXT[$i]['context'] =$context;
475       $EXT[$i]['priority']=$i;
476       $EXT[$i]['app']     ="MeetMe";
478       if(empty($this->goFonPIN)) {
479         $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter;
480       }else{
481         $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter."|".$this->goFonPIN;
482       }
483       $i++; 
485       // Start Conference 
486       $EXT[$i]['exten']   =$this->cn;
487       $EXT[$i]['context'] =$context;
488       $EXT[$i]['priority']=1;
489       $EXT[$i]['app']     ="Goto";
490       $EXT[$i]['appdata'] =$this->telephoneNumber."|1";
491       $SQL=array();
493       foreach($EXT as $keytop => $valtop){
494         $s_keys = "";
495         $s_values = ""; 
496         foreach($valtop as $key=>$val){
497           $s_keys   .="`".$key."`,";
498           $s_values .="'".$val."',";
499         }
500         $s_keys   =preg_replace("/\,$/","",$s_keys); 
501         $s_values =preg_replace("/\,$/","",$s_values); 
502         $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$s_keys.") VALUES (".$s_values.");"; 
503       }
504       foreach($SQL as $sqlsyn){
505         mysql_query($sqlsyn,$res_cur);
506       }
507     } 
509     @mysql_close($res_cur);
510   }
513   /* Remove initial entry from database 
514    * This function checks if there is an entry in the 
515    *  initial home server that uses this->old_cn or $this->old_tele_number
516    *  and removes this entries. 
517    * This function is called from save and remove_from parent.
518    * 
519    *  The parameter '$save' is false if we just 
520    *   want to check if a remove is possible. 
521    *  And true if we realy want to remove the entries.   
522    */
523   function SQL_remove_me($save)
524   {
525     /* check database access */
526     $str = $this->check_database_accessibility();
527     if($str){
528       return($str);
529     }
531     /* Connect to old database */
532     $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
533     $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
534     $db_init   =  @mysql_select_db($cfg_Init['DB'],$r_init);
535    
536     /* Check if there is an old entry */
537     $query = "SELECT id FROM ".$cfg_Init['EXT_TABLE']." WHERE exten='".$this->old_tele_number."' OR '".$this->old_cn."';";
538     $res = @mysql_query($query,$r_init);
539     if(!$res){
540       gosa_log(@mysql_error($r_init));
541       return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles."));
542     }
543    
544     /* There are entries using this cn and/or phone number */
545     if($save && mysql_affected_rows($r_init)) {
546       $SQL = "DELETE FROM ".$cfg_Init['EXT_TABLE']." 
547       WHERE   (exten='".$this->old_tele_number."') 
548         OR    (exten='".$this->old_cn."')";
549   
550       /* Query and ensure that everything went fine */
551       $res =  @mysql_query($SQL,$r_init);
552       if(!$res){
553         gosa_log(@mysql_error($r_init));
554         return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles."));
555       }
557     }//ENDE  old num availiable ...
558     @mysql_close($r_init);
559     return(false);
560   }
564   /* This function checks if the given phonenumbers are available or already in use*/
565   function is_number_used()
566   {
567     $ldap= $this->config->get_ldap_link();
568     $ldap->cd($this->config->current['BASE']);
569     $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
570     while($attrs = $ldap->fetch()) {
571       unset($attrs['telephoneNumber']['count']);
572       foreach($attrs['telephoneNumber'] as $tele){
573         if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
574         if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
575         $numbers[$tele]=$attrs;
576       }
577     }
579     $num = $this->telephoneNumber;
580     if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!=$this->old_cn))){
581       if(isset($numbers[$num]['uid'][0])){
582         return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
583       }else{
584         return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
585       }
586     }
587   }
590   /* Save to LDAP */
591   function save()
592   {
594     if((!isset($this->attrs['goFonPIN']))){
595       $pin_use = false;
596     }else{
597       $pin_use = true;
598     }
600     plugin::save();
602     if(empty($this->old_tele_number)){
603       $this->old_tele_number= $this->telephoneNumber;
604     }
606     $this->SQL_add_me(true);
608     if(empty($this->goFonConferenceOption_P)){
609       if($pin_use){
610         $this->attrs['goFonPIN']=array();
611       }else{
612         unset($this->attrs['goFonPIN']);
613       }
614     }
615     $this->attrs['goFonConferenceOption']="";
616     foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
617           "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonConferenceOptionFormat") as $attrs){
618       $this->attrs['goFonConferenceOption'] .= $this->$attrs;
619       unset($this->attrs[$attrs]);         
620     }
622     $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionLifetime;
623     $this->attrs['goFonConferenceOption'].="|".$this->language;
624     unset($this->attrs['goFonConferenceOptionLifetime']);
626     /* Write back to ldap */
628     unset($this->attrs['base']);
630     foreach($this->attributes as $atr){
631       if(chkacl($this->acl, $atr)!=""){
632         unset($this->attrs[$atr]);
633       }
634     }
636     $ldap= $this->config->get_ldap_link();
637     $ldap->cd($this->config->current['BASE']);
638     $ldap->cat($this->dn, array('dn'));
640     if ($ldap->count()){
641       $ldap->cd($this->dn);
642       $this->cleanup();
643       $ldap->modify ($this->attrs); 
644       $this->handle_post_events('modify');
645     } else {
646       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
647       $ldap->cd($this->dn);
648       $ldap->add($this->attrs);
649       $this->handle_post_events('add');
650     }
651     show_ldap_error($ldap->get_error(), _("Saving phone conference failed"));
653     /* Optionally execute a command after we're done */
654     $this->postcreate();
655   }
659 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
660 ?>