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 */
20 require "tabs_terminal.inc";
21 require "tabs_workstation.inc";
22 require "tabs_printers.inc";
23 require "tabs_phone.inc";
24 require "tabs_server.inc";
25 require "tabs_component.inc";
26 require "tabs_winstation.inc";
29 class systems extends plugin
30 {
31 /* Definitions */
32 var $plHeadline= "Systems";
33 var $plDescription= "This does something";
35 /* Dialog attributes */
36 var $systab= NULL;
37 var $terminals= array();
38 var $ui= NULL;
39 var $acl= "";
41 function systems ($config, $ui)
42 {
43 /* Save configuration for internal use */
44 $this->config= $config;
45 $this->ui= $ui;
47 /* Get global filter config */
48 if (!is_global("terminalfilter")){
49 $ui= get_userinfo();
50 $base= get_base_from_people($ui->dn);
51 $terminalfilter= array("workstations" => "checked",
52 "thins" => "checked",
53 "winstations" => "checked",
54 "servers" => "checked",
55 "printers" => "checked",
56 "phones" => "checked",
57 "netdev" => "checked",
58 "user" => "*",
59 "depselect" => $base,
60 "regex" => "*");
61 register_global("terminalfilter", $terminalfilter);
62 }
63 }
65 function execute()
66 {
67 /* Save data */
68 $terminalfilter= get_global("terminalfilter");
69 foreach( array("depselect", "user", "regex") as $type){
70 if (isset($_POST[$type])){
71 $terminalfilter[$type]= $_POST[$type];
72 }
73 }
74 if (isset($_POST['depselect'])){
75 foreach( array("workstations", "thins", "winstations", "printers", "phones", "servers", "netdev") as $type){
77 if (isset($_POST[$type])) {
78 $terminalfilter[$type]= "checked";
79 } else {
80 $terminalfilter[$type]= "";
81 }
82 }
83 }
84 if (isset($_GET['search'])){
85 $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
86 if ($s == "**"){
87 $s= "*";
88 }
89 $terminalfilter['regex']= $s;
90 }
91 register_global("terminalfilter", $terminalfilter);
93 /* Check sorting variable */
94 if (!isset($this->systab) &&
95 !isset($_POST['new_terminal']) &&
96 !isset($_POST['delete_terminal']) &&
97 !isset($_POST['set_password']) &&
98 !isset($_POST['select_terminal'])){
99 $this->reload();
100 }
101 $smarty= get_smarty();
103 /* Check for exeeded sizelimit */
104 if (($message= check_sizelimit()) != ""){
105 return($message);
106 }
108 /* Try to get informations about what kind of system to create */
109 if (isset($_POST['new_terminal'])) {
110 return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
111 }
113 /* Create new default terminal */
114 if (isset($_POST['create_system'])) {
115 $this->dn= "new";
116 $this->acl= array(":all");
118 switch ($_POST['system']){
119 case 'terminal':
120 $this->systab= new termtabs($this->config,
121 $this->config->data['TABS']['TERMTABS'], $this->dn);
122 $this->systab->set_acl ($this->acl);
123 $this->systab->by_object['termgeneric']->cn= "default";
124 $this->systab->by_object['termservice']->cn= "default";
125 break;
127 case 'workstation':
128 $this->systab= new worktabs($this->config,
129 $this->config->data['TABS']['WORKTABS'], $this->dn);
130 $this->systab->set_acl ($this->acl);
131 $this->systab->by_object['workgeneric']->cn= "wdefault";
132 $this->systab->by_object['termservice']->cn= "default";
133 break;
135 case 'server':
136 $this->systab= new servtabs($this->config,
137 $this->config->data['TABS']['SERVTABS'], $this->dn);
138 $this->systab->set_acl ($this->acl);
139 break;
141 case 'printer':
142 $this->systab= new printtabs($this->config,
143 $this->config->data['TABS']['PRINTTABS'], $this->dn);
144 $this->systab->set_acl ($this->acl);
145 break;
147 case 'phone':
148 $this->systab= new phonetabs($this->config,
149 $this->config->data['TABS']['PHONETABS'], $this->dn);
150 $this->systab->set_acl ($this->acl);
151 break;
153 case 'component':
154 $this->systab= new componenttabs($this->config,
155 $this->config->data['TABS']['COMPONENTTABS'], $this->dn);
156 $this->systab->set_acl ($this->acl);
157 break;
158 }
159 }
161 /* User wants to edit data? */
162 if ((isset($_POST['select_terminal']) || (isset($_POST['edit_helper']) && $_POST['edit_helper'] == "1")) && isset($_POST['termlist']) &&
163 $_POST['termlist'] != ""){
165 /* Get 'dn' from posted 'cn', must be unique */
166 $this->dn= trim($_POST['termlist']);
168 /* Check locking, save current plugin in 'back_plugin', so
169 the dialog knows where to return. */
170 if (($user= get_lock($this->dn)) != ""){
171 return(gen_locked_message ($user, $this->dn));
172 }
174 /* Set up the users ACL's for this 'dn' */
175 $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
177 /* Find out more about the object type */
178 $ldap= $this->config->get_ldap_link();
179 $ldap->cat($this->dn);
180 $attrs= $ldap->fetch();
181 $type= $this->get_system_type($attrs['objectClass']);
183 /* Lock the current entry, so everyone will get the
184 above dialog */
185 add_lock ($this->dn, $this->ui->dn);
187 switch ($type){
188 case "terminal":
189 /* Register systab to trigger edit dialog */
190 $this->systab= new termtabs($this->config,
191 $this->config->data['TABS']['TERMTABS'], $this->dn);
192 $this->systab->set_acl($acl);
193 $_SESSION['objectinfo']= $this->dn;
194 break;
196 case "server":
197 /* Register systab to trigger edit dialog */
198 $this->systab= new servtabs($this->config,
199 $this->config->data['TABS']['SERVTABS'], $this->dn);
200 $this->systab->set_acl($acl);
201 $_SESSION['objectinfo']= $this->dn;
202 break;
204 case "workstation":
205 /* Register systab to trigger edit dialog */
206 $this->systab= new worktabs($this->config,
207 $this->config->data['TABS']['WORKTABS'], $this->dn);
208 $this->systab->set_acl($acl);
209 $_SESSION['objectinfo']= $this->dn;
210 break;
212 case "printer":
213 /* Register systab to trigger edit dialog */
214 $this->systab= new printtabs($this->config,
215 $this->config->data['TABS']['PRINTTABS'], $this->dn);
216 $this->systab->set_acl($acl);
217 $_SESSION['objectinfo']= $this->dn;
218 break;
220 case "phone":
221 /* Register systab to trigger edit dialog */
222 $this->systab= new phonetabs($this->config,
223 $this->config->data['TABS']['PHONETABS'], $this->dn);
224 $this->systab->set_acl($acl);
225 $_SESSION['objectinfo']= $this->dn;
226 break;
228 case "component":
229 /* Register systab to trigger edit dialog */
230 $this->systab= new componenttabs($this->config,
231 $this->config->data['TABS']['COMPONENTTABS'], $this->dn);
232 $this->systab->set_acl($acl);
233 $_SESSION['objectinfo']= $this->dn;
234 break;
236 case "winstation":
237 /* Register systab to trigger edit dialog */
238 $this->systab= new wintabs($this->config,
239 $this->config->data['TABS']['WINTABS'], $this->dn);
240 $this->systab->set_acl($acl);
241 $_SESSION['objectinfo']= $this->dn;
242 break;
245 default:
246 print_red (_("You can't edit this object type yet!"));
247 del_lock($this->dn);
248 break;
249 }
250 }
252 /* Set terminals root password */
253 if (isset($_POST['set_password']) && isset($_POST['termlist'])){
254 $this->dn= trim($_POST['termlist']);
255 $_SESSION['objectinfo']= $this->dn;
256 return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
257 }
259 /* Correctly specified? */
260 if (isset($_POST['password_finish'])){
261 if ($_POST['new_password'] != $_POST['repeated_password']){
262 print_red (_("Passwords entered as new and repeated do not match!"));
263 return($smarty->fetch(get_template_path('password.tpl', TRUE)));
264 }
265 }
267 /* Change terminal password */
268 if (isset($_POST['password_finish']) &&
269 $_POST['new_password'] == $_POST['repeated_password']){
271 /* Check if user is allowed to set password */
272 $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
273 $acl= get_module_permission($acl, "terminal", $this->dn);
274 if (chkacl($acl, "password") != ""){
275 print_red (_("You are not allowed to set this systems password!"));
276 } else {
277 $ldap= $this->config->get_ldap_link();
278 $ldap->cd($this->dn);
280 $attrs= array();
281 if ($_POST['new_password'] == ""){
282 $attrs['gotoRootPasswd']= array();
283 } else {
284 $attrs['gotoRootPasswd']= crypt($_POST['new_password'],
285 substr(session_id(),0,2));
286 }
287 $ldap->modify($attrs);
288 gosa_log ("Password for '".$this->dn."' has been changed");
289 }
290 unset($_SESSION['objectinfo']);
291 }
293 /* Delete terminal canceled? */
294 if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
295 del_lock ($this->dn);
296 unset($_SESSION['objectinfo']);
297 }
299 /* Remove terminal was requested */
300 if (isset($_POST['delete_terminal']) && isset($_POST['termlist'])){
302 /* Get 'dn' from posted termlinst */
303 $this->dn= $_POST['termlist'];
305 /* Load permissions for selected 'dn' and check if
306 we're allowed to remove this 'dn' */
307 $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
308 $this->acl= get_module_permission($acl, "terminal", $this->dn);
309 if (chkacl($this->acl, "delete") == ""){
311 /* Check locking, save current plugin in 'back_plugin', so
312 the dialog knows where to return. */
313 if (($user= get_lock($this->dn)) != ""){
314 return(gen_locked_message ($user, $this->dn));
315 }
317 /* Lock the current entry, so nobody will edit it during deletion */
318 add_lock ($this->dn, $this->ui->dn);
319 $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), $this->dn));
320 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
321 } else {
323 /* Obviously the user isn't allowed to delete. Show message and
324 clean session. */
325 print_red (_("You are not allowed to delete this component!"));
326 }
327 }
329 /* Confirmation for deletion has been passed. Terminal should be deleted. */
330 if (isset($_POST['delete_terminal_confirm'])){
332 /* Some nice guy may send this as POST, so we've to check
333 for the permissions again. */
334 if (chkacl($this->acl, "delete") == ""){
336 /* Find out more about the object type */
337 $ldap= $this->config->get_ldap_link();
338 $ldap->cat($this->dn);
339 $attrs= $ldap->fetch();
340 $type= $this->get_system_type($attrs['objectClass']);
342 switch ($type){
343 case "terminal":
344 $tabtype= "termtabs";
345 break;
347 case "workstation":
348 $tabtype= "worktabs";
349 break;
351 case "server":
352 $tabtype= "servtabs";
353 break;
355 default:
356 #print_red (_("You can't remove this object type yet!"));
357 #del_lock($this->dn);
358 #return;
359 $tabtype= "termtabs";
360 break;
361 }
363 /* Delete request is permitted, perform LDAP action */
364 $this->systab= new $tabtype($this->config,
365 $this->config->data['TABS']['TERMTABS'], $this->dn);
366 $this->systab->set_acl(array($this->acl));
367 $this->systab->by_object['termgeneric']->remove_from_parent ();
368 unset ($this->systab);
369 gosa_log ("System object'".$this->dn."' has been removed");
370 $this->systab= NULL;
372 /* Terminal list has changed, reload it. */
373 $this->reload ();
374 } else {
376 /* Normally this shouldn't be reached, send some extra
377 logs to notify the administrator */
378 print_red (_("You are not allowed to delete this component!"));
379 gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
380 "deletion.");
381 }
383 /* Remove lock file after successfull deletion */
384 del_lock ($this->dn);
385 }
387 /* Finish user edit is triggered by the tabulator dialog, so
388 the user wants to save edited data. Check and save at this
389 point. */
390 if (isset($_POST['edit_finish'])){
392 /* Check tabs, will feed message array */
393 $message= $this->systab->check(TRUE);
395 /* Save, or display error message? */
396 if (count($message) == 0){
398 /* Save terminal data to ldap */
399 gosa_log ("System object'".$this->dn."' has been saved");
400 $this->systab->save();
402 /* Terminal has been saved successfully, remove lock from
403 LDAP. */
404 if ($this->dn != "new"){
405 del_lock ($this->dn);
406 }
408 /* There's no page reload so we have to read new terminals at
409 this point. */
410 $this->reload ();
411 unset ($this->systab);
412 $this->systab= NULL;
413 unset($_SESSION['objectinfo']);
415 } else {
416 /* Ok. There seem to be errors regarding to the tab data,
417 show message and continue as usual. */
418 show_errors($message);
419 }
421 }
423 /* Cancel dialogs */
424 if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
425 del_lock ($this->systab->dn);
426 unset ($this->systab);
427 $this->systab= NULL;
428 unset($_SESSION['objectinfo']);
429 }
431 /* Show tab dialog if object is present */
432 if ($this->systab){
433 $display= $this->systab->execute();
435 /* Don't show buttons if tab dialog requests this */
436 if (!$this->systab->by_object[$this->systab->current]->dialog){
437 $display.= "<p style=\"text-align:right\">\n";
438 $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
439 $display.= " \n";
440 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
441 $display.= "</p>";
442 }
443 return ($display);
444 }
446 /* Show main page */
447 $smarty->assign("terminals", $this->convert_list($this->terminals));
448 $smarty->assign("search_image", get_template_path('images/search.png'));
449 $smarty->assign("tree_image", get_template_path('images/tree.png'));
450 $smarty->assign("infoimage", get_template_path('images/info.png'));
451 $smarty->assign("launchimage", get_template_path('images/launch.png'));
452 foreach( array("depselect", "user", "regex", "workstations", "thins", "servers",
453 "winstations", "printers", "phones", "netdev") as $type){
455 $smarty->assign("$type", $terminalfilter[$type]);
456 }
457 $smarty->assign("deplist", $this->config->idepartments);
459 /* Extend if we are not using javascript */
460 $smarty->assign("apply", apply_filter());
461 $smarty->assign("alphabet", generate_alphabet());
462 $smarty->assign("hint", print_sizelimit_warning());
464 return($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
465 }
468 function convert_list($input)
469 {
470 $temp= "";
471 $conv= array( "D" => "select_default.png",
472 "T" => "select_terminal.png",
473 "L" => "select_workstation.png",
474 "F" => "select_phone.png",
475 "S" => "select_server.png",
476 "NT" => "select_new_terminal.png",
477 "NL" => "select_new_workstation.png",
478 "W" => "select_winstation.png",
479 "C" => "select_component.png",
480 "P" => "select_printer.png");
482 foreach ($input as $key => $value){
483 $mode= preg_replace('/^.*(.)$/', '\\1', $value);
484 if ($mode == "D"){
485 $temp= "<option value=\"$key\" class=\"select\" style=\"background-image:url('".get_template_path('images/select_default.png')."');\">".preg_replace('/.$/', '', $value)."</option>\n".$temp;
486 } else {
487 if (preg_match('/^\+/', $value)){
488 $value= preg_replace('/^\+ /', '', $value);
489 $new= "N";
490 } else {
491 $new= "";
492 }
493 $temp.= "<option value=\"$key\" class=\"select\" style=\"background-image:url('".get_template_path('images/'.$conv["$new$mode"])."');\">".preg_replace('/.$/', '', $value)."</option>\n";
494 }
495 }
497 return ($temp);
498 }
500 function remove_from_parent()
501 {
502 /* Optionally execute a command after we're done */
503 $this->postremove();
504 }
507 /* Save data to object */
508 function save_object()
509 {
510 }
513 /* Check values */
514 function check()
515 {
516 }
519 /* Save to LDAP */
520 function save()
521 {
522 }
524 function adapt_from_template($dn)
525 {
526 }
528 function password_change_needed()
529 {
530 }
532 function show_header($button_text, $text, $disabled= FALSE)
533 {
534 }
536 function reload()
537 {
538 /* Load terminal shortcuts */
539 $responsible= array();
540 foreach ($this->config->departments as $key => $value){
541 if (get_module_permission(get_permissions ($value, $this->ui->subtreeACL),
542 "terminal", $value) == "#all#"){
543 $responsible[$key]= $value;
544 }
545 }
547 /* Get config */
548 $terminalfilter= get_global('terminalfilter');
549 $filter= "";
551 /* Set base for all searches */
552 $base= $terminalfilter['depselect'];
554 /* Regex filter? */
555 if ($terminalfilter['regex'] != ""){
556 $regex= $terminalfilter['regex'];
557 } else {
558 $regex= "*";
559 }
561 /* Get list of terminals to be shown */
562 if ($terminalfilter['thins'] == "checked"){
563 $termfilter= "(&(objectClass=gotoTerminal)(cn=$regex))";
564 } else {
565 $termfilter= "";
566 }
567 if ($terminalfilter['workstations'] == "checked"){
568 $workfilter= "(&(objectClass=gotoWorkstation)(cn=$regex))";
569 } else {
570 $workfilter= "";
571 }
572 if ($terminalfilter['winstations'] == "checked"){
573 if ($this->config->current['SAMBAVERSION'] == "3"){
574 $samba= "sambaSamAccount";
575 } else {
576 $samba= "sambaAccount";
577 }
578 $winfilter= "(&(objectClass=$samba)(cn=$regex\$))";
579 } else {
580 $winfilter= "";
581 }
582 if ($terminalfilter['printers'] == "checked"){
583 $printfilter= "(&(objectClass=gotoPrinter)(cn=$regex))";
584 } else {
585 $printfilter= "";
586 }
587 if ($terminalfilter['phones'] == "checked"){
588 $phonefilter= "(&(objectClass=goFonHardware)(cn=$regex))";
589 } else {
590 $phonefilter= "";
591 }
592 if ($terminalfilter['netdev'] == "checked"){
593 $netfilter= "(&(objectClass=ieee802Device)(cn=$regex))";
594 } else {
595 $netfilter= "";
596 }
597 if ($terminalfilter['servers'] == "checked"){
598 $serverfilter= "(&(objectClass=goServer)(cn=$regex))";
599 } else {
600 $serverfilter= "";
601 }
603 /* User filter? */
604 if ($terminalfilter['user'] != "" && $terminalfilter['user'] != "*"){
605 $filter.= "(gotoLastUser=".$terminalfilter['user'].")";
606 }
608 /* Get all gotoTerminal's */
609 $this->terminals= array();
611 $res= get_list($this->ui->subtreeACL, "(|$termfilter$workfilter$winfilter$printfilter$phonefilter$serverfilter$netfilter)", TRUE, $base, array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), TRUE);
612 foreach ($res as $value){
614 /* Look for new terminals and mark them with '+' */
615 $tmp= "";
616 if (preg_match('/,ou=terminals,ou=systems,/i', $value["dn"])){
617 $tmp= preg_replace("/^[^,]+,[^o]*ou=terminals,ou=systems,/i", "", $value["dn"]);
618 }
619 if (preg_match('/,ou=workstations,ou=systems,/i', $value["dn"])){
620 $tmp= preg_replace("/^[^,]+,[^o]*ou=workstations,ou=systems,/i", "", $value["dn"]);
621 }
622 if (preg_match('/,ou=servers,ou=systems,/i', $value["dn"])){
623 $tmp= preg_replace("/^[^,]+,[^o]*ou=servers,ou=systems,/i", "", $value["dn"]);
624 }
625 if (preg_match('/,'.get_winstations_ou().'/i', $value["dn"])){
626 $tmp= preg_replace("/^[^,]+,[^o]*".get_winstations_ou()."/i", "", $value["dn"]);
627 }
628 if (preg_match('/,ou=printers,ou=systems,/i', $value["dn"])){
629 $tmp= preg_replace("/^[^,]+,[^o]*ou=printers,ou=systems,/i", "", $value["dn"]);
630 }
631 if (preg_match('/,ou=phones,ou=systems,/i', $value["dn"])){
632 $tmp= preg_replace("/^[^,]+,[^o]*ou=phones,ou=systems,/i", "", $value["dn"]);
633 }
634 if (preg_match('/,ou=netdevices,ou=systems,/i', $value["dn"])){
635 $tmp= preg_replace("/^[^,]+,[^o]*ou=netdevices,ou=systems,/i", "", $value["dn"]);
636 }
637 if ($tmp == ""){
638 $tmp= $value["dn"];
639 }
640 if (preg_match ("/,ou=incoming,/i", $tmp)){
641 if (in_array('gotoTerminal', $value['objectClass'])){
642 $add= "+ "._("New terminal");
643 }
644 if (in_array('gotoWorkstation', $value['objectClass'])){
645 $add= "+ "._("New workstation");
646 }
647 } else {
648 $add= "";
649 }
651 if (in_array ($tmp, $responsible) || $add != ""){
652 if (in_array('gotoTerminal', $value["objectClass"])){
653 if (isset($value["macAddress"][0]) &&
654 $value["macAddress"][0] != "-"){
656 $this->terminals[$value["dn"]]= $add." ".
657 $value["cn"][0].
658 " [".$value["macAddress"][0]."]T";
659 } else {
660 $location= array_search($tmp, $this->config->departments);
661 $this->terminals[$value["dn"]]= _("Thin client template for").
662 " $location"."D";
663 }
664 } elseif (in_array('gotoWorkstation', $value["objectClass"])){
665 if (isset($value["macAddress"][0]) &&
666 $value["macAddress"][0] != "-"){
668 $this->terminals[$value["dn"]]= $add." ".
669 $value["cn"][0].
670 " [".$value["macAddress"][0]."]L";
671 } else {
672 $location= array_search($tmp, $this->config->departments);
673 $this->terminals[$value["dn"]]= _("Workstation template for").
674 " $location"."D";
675 }
676 } elseif (in_array('gotoPrinter', $value["objectClass"])){
677 if (isset($value['description'][0])){
678 $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]P";
679 } else {
680 $this->terminals[$value['dn']]= $value['cn'][0]."P";
681 }
682 } elseif (in_array('goServer', $value["objectClass"])){
683 if (isset($value['description'][0])){
684 $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]S";
685 } else {
686 $this->terminals[$value['dn']]= $value['cn'][0]."S";
687 }
688 } elseif (in_array('goFonHardware', $value["objectClass"])){
690 if (isset($value['description'][0])){
691 $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]F";
692 } else {
693 $this->terminals[$value['dn']]= $value['cn'][0]."F";
694 }
695 } elseif (in_array('ieee802Device', $value["objectClass"])){
697 if (isset($value['description'][0])){
698 $this->terminals[$value['dn']]= $value['cn'][0]." [".$value['description'][0]."]C";
699 } else {
700 $this->terminals[$value['dn']]= $value['cn'][0]."C";
701 }
702 } else{
703 $name= preg_replace('/\$$/', '', $value['cn'][0]);
704 if (isset($value['sambaDomainName'])){
705 $domain= " [".$value['sambaDomainName'][0]."]";
706 } else {
707 $domain= "";
708 }
709 $this->terminals[$value['dn']]= $name.$domain."W";
710 }
711 }
712 }
713 natcasesort ($this->terminals);
714 reset ($this->terminals);
715 }
717 function remove_lock()
718 {
719 if (isset($this->systab->dn)){
720 del_lock ($this->systab->dn);
721 }
722 }
725 function get_system_type($classes)
726 {
727 $type= "";
729 if (in_array('ieee802Device', $classes)){
730 $type= "component";
731 }
732 if (in_array('gotoTerminal', $classes)){
733 $type= "terminal";
734 }
735 if (in_array('gotoWorkstation', $classes)){
736 $type= "workstation";
737 }
738 if (in_array('gotoPrinter', $classes)){
739 $type= "printer";
740 }
741 if (in_array('goFonHardware', $classes)){
742 $type= "phone";
743 }
744 if (in_array('goServer', $classes)){
745 $type= "server";
746 }
747 if (in_array('sambaAccount', $classes) ||
748 in_array('sambaSamAccount', $classes)){
749 $type= "winstation";
750 }
752 return ($type);
753 }
755 }
757 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
758 ?>