e18bf2409d5411060e8d21610f33d79b226a341f
1 <?php
3 class printgeneric extends plugin
4 {
5 /* CLI vars */
6 var $cli_summary = "Manage terminal base objects";
7 var $cli_description = "Some longer text\nfor help";
8 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10 /* Generic terminal attributes */
11 var $interfaces = array();
12 var $ignore_account = FALSE;
14 /* Needed values and lists */
15 var $base = "";
16 var $cn = "";
17 var $l = "";
18 var $description = "";
19 var $labeledURI = "";
20 var $gotoPrinterPPD = "";
21 var $orig_dn = "";
23 var $UserMember ="";
24 var $UserMembers =array();
25 var $UserMemberKeys =array();
27 var $AdminMember ="";
28 var $AdminMembers =array();
29 var $AdminMemberKeys =array();
31 var $gotoUserPrinter ;
32 var $PPDdialogToSave = NULL;
33 var $BelongsTo = "unknown"; // Specifies if this is a standalone printer, or belongs to a terminal / WS
35 var $member =array();
36 var $strings = "";
37 var $dialog =NULL;
39 var $netConfigDNS;
40 var $baseSelection = false;
41 var $macAddress = "";
43 /* attribute list for save action */
44 var $attributes = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","gotoUserPrinter", "macAddress");
45 var $objectclasses = array("top", "gotoPrinter");
47 function printgeneric ($config, $dn= NULL,$parent = NULL)
48 {
49 $this->config = $config;
50 $this->dn = $dn;
52 /* If parent was posted(the tabs object) we can detect the printer type. */
53 if($parent){
54 $this->parent = $parent;
55 $this->getTypeOfPrinter();
56 }else{
57 $this->BelongsTo = "unknown";
58 return;
59 }
61 /* Update dn, to ensure storing as printer instead of WS / terminal */
62 if($this->BelongsTo == "Terminal"){
63 $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
64 }
66 if($this->BelongsTo == "Workstation"){
67 $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
68 }
70 $this->orig_dn = $this->dn;
72 /* Get printer settings, possibly dn has changed */
73 plugin::plugin ($config, $this->dn);
75 /* Get is_account initially_was_account status */
76 $this->getTypeOfPrinter(true);
78 /* set orig dn to new if object is new */
79 $ldap= $this->config->get_ldap_link();
80 $ldap->cat($this->dn);
81 if(!$ldap->count()){
82 $this->orig_dn = "new";
83 }
85 /* create dns object */
86 $this->netConfigDNS = new termDNS($this->config, $this->dn,$this->objectclasses);
88 /* Set base */
89 if ($this->dn == "new"){
90 $ui= get_userinfo();
91 $this->base= dn2base($ui->dn);
92 $this->cn= "";
93 } else {
94 $this->base= dn2base($this->dn);
95 }
97 /* Extract selected ppd */
98 if(isset($this->gotoPrinterPPD)){
99 $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD);
100 }
102 /* Prepare different member types */
103 foreach(array("AddUser" =>"gotoUserPrinter",
104 "AddGroup" =>"gotoGroupPrinter",
105 "AddAdminUser" =>"gotoUserAdminPrinter",
106 "AddAdminGroup" =>"gotoGroupAdminPrinter") as $type => $attr){
108 /* $this->members contains all members */
109 $this->member[$type]=array();
111 if (isset($this->attrs[$attr]['count'])) {
112 unset($this->attrs[$attr]['count']);
113 }
115 if(isset($this->attrs[$attr])){
116 foreach($this->attrs[$attr] as $mem){
117 if(preg_match("/Group/",$type)){
118 $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
119 $entry = $ldap->fetch();
120 if(isset($entry['description'])){
121 $this->member[$type][$entry['cn'][0]]=$entry;
122 }
123 }else{
124 $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
125 $entry = $ldap->fetch();
126 if(isset($entry['uid'])){
127 $this->member[$type][$entry['uid'][0]]=$entry;
128 }
129 }
130 }
131 }
132 }
133 }
136 /* Detect type of printer.
137 * Printer can be stand alone, belong to a workstation or belong to a terminal.
138 * We can detect the type printer type when comparing the tabs objects
139 */
140 function getTypeOfPrinter($UpdateAccountStatus = false)
141 {
142 /* Disable account as default
143 */
144 $this->is_account = $this->initially_was_account = false;
146 /* Detect type of printer via parent tabs.
147 */
148 if(isset($this->parent->by_object['workgeneric'])){
150 /* Exclude templates
151 */
152 $this->cn = $this->parent->by_object['workgeneric']->cn;
153 if($this->parent->by_object['workgeneric']->cn == "wdefault"){
154 $this->BelongsTo = "WorkstationTemplate";
155 }else{
156 $this->BelongsTo = "Workstation";
157 }
158 }elseif(isset($this->parent->by_object['termgeneric'])){
160 /* Exclude templates
161 */
162 $this->cn = $this->parent->by_object['termgeneric']->cn;
163 if($this->parent->by_object['termgeneric']->cn == "default"){
164 $this->BelongsTo = "TerminalTemplate";
165 }else{
166 $this->BelongsTo = "Terminal";
167 }
168 }elseif(isset($this->parent->by_name['printgeneric'])){
169 $this->BelongsTo = "Printer";
170 }
172 if($UpdateAccountStatus){
174 /* Set is_account / was account
175 */
176 if($this->dn == "new"){
177 $this->initially_was_account = false;
178 }
180 /* If is printer it must be a true account.
181 */
182 if($this->BelongsTo == "Printer"){
183 $this->is_account = true;
184 }
186 /* Update dn, to ensure storing as printer instead of WS / terminal
187 */
188 if($this->BelongsTo == "Terminal"){
189 $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
190 }
192 if($this->BelongsTo == "Workstation"){
193 $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
194 }
196 /* Detect if this is a valid printer account;
197 */
198 $ldap = $this->config->get_ldap_link();
199 $ldap->cd($this->config->current['BASE']);
200 $ldap->cat($this->dn);
202 if($ldap->count()){
203 $attrs = $ldap->fetch();
204 if(in_array("gotoPrinter",$attrs['objectClass'])){
205 $this->initially_was_account = true;
206 $this->is_account = true;
207 }else{
208 $this->is_account = false;
209 }
210 }
211 }
212 }
214 function execute()
215 {
216 /* Call parent execute */
217 plugin::execute();
219 /* If type of printer couldn't be detected (because of missing parent object in construcktion)
220 * hide this tab.
221 */
222 if($this->BelongsTo == "unknown"){
223 $display= $this->show_header(_("Add printer extension"),
224 _("Could not intialize printer tab, parameter parent was missing while construcktion."),TRUE,TRUE);
225 return($display);
226 }
228 /* Templates can't have printer extensions
229 */
230 if($this->BelongsTo == "WorkstationTemplate"){
231 $display= $this->show_header(_("Add printer extension"),
232 _("This is a workstation template, printer tab is disabled."),TRUE,TRUE);
233 return($display);
234 }
235 if($this->BelongsTo == "TerminalTemplate"){
236 $display= $this->show_header(_("Add printer extension"),
237 _("This is a terminal template, printer tab is disabled."),TRUE,TRUE);
238 return($display);
239 }
241 /* Get cn from base object */
242 if($this->BelongsTo == "Workstation"){
243 $this->cn = $this->parent->by_object['workgeneric']->cn;
244 }
245 if($this->BelongsTo == "Terminal"){
246 $this->cn = $this->parent->by_object['termgeneric']->cn;
247 }
249 $smarty= get_smarty();
250 $display="";
252 /* Tell smarty if this is a standalone object or a terminal / WS depending printer */
253 if($this->BelongsTo == "Printer"){
254 $smarty->assign("StandAlone",true);
255 }else{
256 $smarty->assign("StandAlone",false);
257 }
259 /* Do we need to flip is_account state? */
260 if (isset($_POST['modify_state'])){
261 $this->is_modified = true;
262 $this->is_account= !$this->is_account;
263 }
265 /* Do we represent a valid printer? */
266 if (!$this->is_account && $this->parent == NULL){
267 $display= "<img alt=\"\" src=\"images/stop.png\" align=middle> <b>".
268 _("This 'dn' has no printer features.")."</b>";
269 return($display);
270 }
272 /* If this is a WS / Terminal depending printer, display account state button */
273 if($this->BelongsTo != "Printer"){
274 if((empty($this->cn)) && ($this->dn != "new")){
275 $display= $this->show_header(_("Add printer extension"),
276 _("This object has printer extension disabled. You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template"),TRUE,TRUE);
277 $this->is_account= false;
278 return $display;
279 }
281 if (($this->is_account)){
282 if($this->BelongsTo=="Workstation"){
283 $display= $this->show_header(_("Remove printer extension"),
284 _("This workstation has printer extension enabled.You can disable it by clicking below."));
285 }elseif($this->BelongsTo=="Terminal"){
286 $display= $this->show_header(_("Remove printer extension"),
287 _("This terminal has printer extension enabled. You can disable it by clicking below."));
288 }
289 }else{
290 if($this->BelongsTo=="Workstation"){
291 $display= $this->show_header(_("Add printer extension"),
292 _("This workstation has printer extension disabled. You can enable it by clicking below."));
293 }elseif($this->BelongsTo=="Terminal"){
294 $display= $this->show_header(_("Add printer extension"),
295 _("This terminal has printer extension disabled. You can enable it by clicking below."));
296 }
297 return ($display);
298 }
299 }
301 /* Base select dialog */
302 $once = true;
303 foreach($_POST as $name => $value){
304 if(preg_match("/^chooseBase/",$name) && $once){
305 $once = false;
306 $this->dialog = new baseSelectDialog($this->config);
307 $this->dialog->setCurrentBase($this->base);
308 $this->baseSelection = true;
309 }
310 }
312 /* Dialog handling for base select dialog
313 * Check if base was selected, dialog aborted etc */
314 if(is_object($this->dialog)){
316 $this->dialog->save_object();
317 if($this->baseSelection){
318 if($this->dialog->isClosed()){
319 $this->dialog = false;
320 $this->baseSelection = false;
321 }elseif($this->dialog->isSelected()){
322 $this->base = $this->dialog->isSelected();
323 $this->dialog= false;
324 $this->baseSelection = false;
325 }else{
326 return($this->dialog->execute());
327 }
328 }
329 }
331 /* Fill templating stuff */
332 $smarty->assign("bases", $this->config->idepartments);
333 $smarty->assign("base_select", $this->base);
335 /* Assign attributes */
336 foreach ($this->attributes as $attr){
337 $smarty->assign($attr."ACL", chkacl($this->acl, $attr));
338 $smarty->assign("$attr", $this->$attr);
339 }
341 if(isset($_POST['AddUser'])){
342 $this->dialog = new selectUserToPrinterDialog($this->config, get_userinfo(),"AddUser");
343 }
344 if(isset($_POST['AddGroup'])){
345 $this->dialog = new selectUserToPrinterDialog($this->config, get_userinfo(),"AddGroup");
346 }
347 if(isset($_POST['AddAdminUser'])){
348 $this->dialog = new selectUserToPrinterDialog($this->config, get_userinfo(),"AddAdminUser");
349 }
350 if(isset($_POST['AddAdminGroup'])){
351 $this->dialog = new selectUserToPrinterDialog($this->config, get_userinfo(),"AddAdminGroup");
352 }
354 /* Display ppd configure/select dialog */
355 if(isset($_POST['EditDriver'])){
356 if($this->PPDdialogToSave){
357 $this->dialog = $this->PPDdialogToSave;
358 }else{
359 $this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
360 }
361 }
363 /* remove ppd */
364 if(isset($_POST['RemoveDriver'])){
365 $this->gotoPrinterPPD = array();
366 $this->PPDdialogToSave = NULL;
367 }
369 /* Close ppd dialog */
370 if(isset($_POST['ClosePPD'])){
371 unset($this->dialog);
372 $this->dialog=NULL;
373 }
375 /* Save selected ppd */
376 if(isset($_POST['SavePPD'])){
377 $this->dialog->save_object();
378 if(count($this->dialog->check())){
379 foreach($this->dialog->check() as $msg){
380 print_red($msg);
381 }
382 }else{
383 $this->gotoPrinterPPD = array();
384 $this->gotoPrinterPPD = $this->dialog->save();
385 $this->PPDdialogToSave = $this->dialog;
386 unset($this->dialog);
387 $this->dialog=NULL;
388 }
389 }
391 /* Member management, delete user / group / admin ..*/
392 if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
393 if(isset($this->member['AddUser'][$_POST['UserMember']])){
394 unset($this->member['AddUser'][$_POST['UserMember']]);
395 }
396 }
398 if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
399 if(isset($this->member['AddGroup'][$_POST['UserMember']])){
400 unset($this->member['AddGroup'][$_POST['UserMember']]);
401 }
402 }
404 if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
405 if(isset($this->member['AddAdminUser'][$_POST['AdminMember']])){
406 unset($this->member['AddAdminUser'][$_POST['AdminMember']]);
407 }
408 }
410 if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
411 if(isset($this->member['AddAdminGroup'][$_POST['AdminMember']])){
412 unset($this->member['AddAdminGroup'][$_POST['AdminMember']]);
413 }
414 }
416 /* Abort user / group adding dialog */
417 if(isset($_POST['PrinterCancel'])){
418 unset($this->dialog);
419 $this->dialog= NULL;
420 }
422 /* Save selected users / groups */
423 if(isset($_POST['PrinterSave'])){
424 $this->dialog->save_object();
425 if(count($this->dialog->check())){
426 foreach($this->dialog->check() as $msg){
427 print_red($msg);
428 }
429 }else{
430 $new = $this->dialog->save();
431 $data = $new;
432 unset($data['type']);
434 if(preg_match("/User/",$new['type'])){
435 $use = "uid";
436 }else{
437 $use = "cn";
438 }
440 foreach($data as $mem){
441 $this->member[$new['type']][$mem[$use][0]]=$mem;
442 }
443 unset($this->dialog);
444 $this->dialog=NULL;
445 }
446 }
448 /* Display dialog, if there is currently one open*/
449 if($this->dialog != NULL){
450 $this->dialog->save_object();
451 $display = $this->dialog->execute();
452 return $display;
453 }
455 /* Parse selected ppd file */
456 require_once ("class_ppdManager.inc");
457 if((isset($_SESSION['config']->data['MAIN']['PPD_PATH']))&&(is_dir($_SESSION['config']->data['MAIN']['PPD_PATH']))){
459 $path = $_SESSION['config']->data['MAIN']['PPD_PATH'];
460 if(!preg_match("/\/$/",$path)){
461 $path = $path."/";
462 }
464 $ppdManager= new ppdManager($path);
465 if(!empty($this->gotoPrinterPPD)){
466 if((!file_exists($path.$this->gotoPrinterPPD))){
467 $smarty->assign("driverInfo", "<b>".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$this->gotoPrinterPPD))."</b>";
468 }else{
469 $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD));
470 }
471 }else{
472 $smarty->assign("driverInfo", _("not defined"));
473 }
474 }else{
475 $smarty->assign("driverInfo",_("can't get ppd informations."));
476 }
478 /* Create user & admin user list */
479 $list=$this->generateList();
480 $userlist = array_merge($list['AddUser'],$list['AddGroup']);
481 $adminlist = array_merge($list['AddAdminUser'],$list['AddAdminGroup']);
483 asort($userlist);
484 asort($adminlist);
486 if($this->BelongsTo != "Printer"){
487 if($this->BelongsTo == "Terminal"){
488 $smarty->assign("desc" ,sprintf(_("This printer belongs to terminal %s. You can't rename this printer."),"<b>".$this->cn."</b>"));
489 }else{
490 $smarty->assign("desc" ,sprintf(_("This printer belongs to workstation %s. You can't rename this printer."),"<b>".$this->cn."</b>"));
491 }
492 $smarty->assign("cnACL" ," disabled ");
493 }else{
494 $smarty->assign("desc" ,"");
495 }
496 $smarty->assign("UserMember" ,$this->UserMember);
497 $smarty->assign("UserMembers" ,$userlist);
498 $smarty->assign("UserMemberKeys",array_flip($userlist));
500 $smarty->assign("AdminMember" ,$this->AdminMember);
501 $smarty->assign("AdminMembers" ,$adminlist);
502 $smarty->assign("AdminMemberKeys",array_flip($adminlist));
503 $smarty->assign("netconfig", $this->netConfigDNS->execute());
505 return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
506 }
508 function remove_from_parent()
509 {
510 /* Only remove if there was initially an account */
511 if($this->initially_was_account){
513 /* Update dn, to ensure storing as printer instead of WS / terminal
514 */
515 if($this->BelongsTo == "Terminal"){
516 $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
517 }
519 if($this->BelongsTo == "Workstation"){
520 $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
521 }
523 /* Check if this dn points to a printer, to avoid deleting something else */
524 $ldap= $this->config->get_ldap_link();
525 $ldap->cat($this->dn);
526 if(!$ldap->count()){
527 print_red("Trying to remove printer obejct which isn't a printer. Aborted to avoid data loss.");
528 return;
529 }
531 /* Check if obejct is a printer */
532 $CheckPrinter = $ldap->fetch();
533 if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){
534 print_red("Trying to remove printer obejct which isn't a printer. Aborted to avoid data loss.");
535 return;
536 }
538 /* Remove account & dns extension */
539 $this->netConfigDNS->remove_from_parent();
540 $ldap->rmdir($this->dn);
541 show_ldap_error($ldap->get_error());
542 $this->handle_post_events("remove");
544 /* Delete references to object groups */
545 $ldap->cd ($this->config->current['BASE']);
546 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
547 while ($ldap->fetch()){
548 $og= new ogroup($this->config, $ldap->getDN());
549 unset($og->member[$this->dn]);
550 $og->save ();
551 }
552 }
553 }
556 /* Save data to object */
557 function save_object()
558 {
559 plugin::save_object();
560 $this->netConfigDNS->save_object();
561 /* Save base, since this is no LDAP attribute */
562 if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
563 $this->base= $_POST['base'];
564 }
565 }
567 /* Check supplied data */
568 function check()
569 {
570 /* Call common method to give check the hook */
571 $message= plugin::check();
572 $message= array_merge($message, $this->netConfigDNS->check());
574 /* Don't display check messages if this is a template object */
575 if(isset($this->parent->by_object['workgeneric'])){
576 if($this->parent->by_object['workgeneric']->cn == "wdefault"){
577 return $message;
578 }
579 }elseif(isset($this->parent->by_object['termgeneric'])){
580 if($this->parent->by_object['termgeneric']->cn == "default"){
581 return $message;
582 }
583 }
585 $dn= "cn=".$this->cn.",ou=printers,ou=systems,".$this->base;
587 /* must: cn */
588 if(($this->BelongsTo == "Printer") && (empty($this->cn))){
589 $message[]= "The required field 'Printer name' is not set.";
590 }
592 /* Check if there is already an entry with this cn*/
593 if (($this->orig_dn != $dn)&&($this->BelongsTo == "Printer")){
594 $ldap= $this->config->get_ldap_link();
595 $ldap->cd ($this->base);
596 $ldap->ls("(cn=".$this->cn.")","ou=printers,ou=systems,".$this->base, array("cn"));
597 if ($ldap->count() != 0){
598 while ($attrs= $ldap->fetch()){
599 if ($attrs['dn'] != $this->orig_dn){
600 $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
601 break;
602 }
603 }
604 }
605 }
607 return ($message);
608 }
611 /* Save to LDAP */
612 function save()
613 {
614 /* Update dn, to ensure storing as printer instead of WS / terminal
615 */
616 if($this->BelongsTo == "Terminal"){
617 $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
618 }
620 if($this->BelongsTo == "Workstation"){
621 $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
622 }
624 if(!$this->is_account) return;
625 if(isset($this->parent->by_object['workgeneric'])){
626 if($this->parent->by_object['workgeneric']->cn == "wdefault"){
627 return;
628 }
629 }elseif(isset($this->parent->by_object['termgeneric'])){
630 if($this->parent->by_object['termgeneric']->cn == "default"){
631 return;
632 }
633 }
635 /* If type is still unknown, the initialisation of this printer failed, abort. */
636 if($this->BelongsTo == "unknown"){
637 return;
638 }
640 /* save ppd configuration */
641 if($this->PPDdialogToSave){
642 $this->PPDdialogToSave->save_ppd();
643 }
645 $dn= $this->dn;
646 plugin::save();
647 $ldap= $this->config->get_ldap_link();
649 /* reduce objectClasses to minimun */
650 $this->attrs['objectClass']= $this->objectclasses;
652 /* Remove all empty values */
653 if ($this->orig_dn == 'new'){
654 $attrs= array();
655 foreach ($this->attrs as $key => $val){
656 if (is_array($val) && count($val) == 0){
657 continue;
658 }
659 $attrs[$key]= $val;
660 }
661 $this->attrs= $attrs;
662 }
664 if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
665 $method="https://";
666 }else{
667 $method="http://";
668 }
670 $this->attrs['gotoPrinterPPD'] = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
672 /* Append printer user
673 */
674 if((isset($this->attrs['gotoUserPrinter'])) && (is_string($this->attrs['gotoUserPrinter']))){
675 $this->attrs['gotoUserPrinter']=array();
676 }
677 foreach($this->member['AddUser'] as $mem){
678 $this->attrs['gotoUserPrinter'][]=$mem['uid'][0];
679 }
681 /* Append printer group
682 */
683 foreach($this->member['AddGroup'] as $mem){
684 $this->attrs['gotoGroupPrinter'][]=$mem['cn'][0];
685 }
687 /* Append printer admin user
688 */
689 foreach($this->member['AddAdminUser'] as $mem){
690 $this->attrs['gotoUserAdminPrinter'][]=$mem['uid'][0];
691 }
693 /* Append printer admin group
694 */
695 foreach($this->member['AddAdminGroup'] as $mem){
696 $this->attrs['gotoGroupAdminPrinter'][]=$mem['cn'][0];
697 }
699 /* Write back to ldap */
700 $ldap= $this->config->get_ldap_link();
701 if ($this->orig_dn == 'new'){
702 $ldap->cd($this->config->current['BASE']);
703 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
704 $ldap->cd($this->dn);
705 $ldap->add($this->attrs);
706 $this->handle_post_events("add");
707 } else {
708 if ($this->orig_dn != $this->dn){
709 $this->move($this->orig_dn, $this->dn);
710 }
712 $ldap->cd($this->dn);
713 $this->cleanup();
714 $ldap->modify ($this->attrs);
716 $this->handle_post_events("modify");
717 }
718 show_ldap_error($ldap->get_error());
720 $this->netConfigDNS->cn = $this->cn;
721 $this->netConfigDNS->dn = $this->dn;
722 $this->netConfigDNS->save($this->dn);
724 /* Optionally execute a command after we're done */
725 $this->postcreate();
726 }
728 function generateList(){
729 $a_return=array();
730 foreach($this->member as $type => $values){
731 $a_return[$type]=array();
732 foreach($values as $value){
733 if((preg_match("/Group/i",$type))){
734 if(!isset($value['description'])){
735 $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0];
736 }else{
737 $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]." [".$value['description'][0]."]";
738 }
739 }else{
740 $a_return[$type][$value['uid'][0]]=_("User")." : ".$value['cn'][0];
741 }
742 }
743 }
744 return($a_return);
745 }
746 }
750 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
751 ?>