900d1bd2b838fba4d94b53c7ad900e996edb71fb
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 "tabsPartition.inc";
21 require "tabsVariable.inc";
22 require "tabsHook.inc";
23 require "tabsTemplate.inc";
24 require "tabsScript.inc";
25 require "tabsProfile.inc";
26 require "tabsPackage.inc";
29 class faiManagement extends plugin
30 {
31 /* Definitions */
32 var $plHeadline = "FAI";
33 var $plDescription = "Fully Automatic Installation - management";
35 /* CLI vars */
36 var $cli_summary = "Handling of FAI entries";
37 var $cli_description = "This plugin represents a management tool\n
38 which allows us to manage all needed attributes for fully automatic installations (FAI)";
39 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
41 /* Headpage attributes */
42 var $departments= array();
43 var $deptabs= NULL;
45 /* attribute list for save action */
46 var $attributes = array(); // Attributes Managed by this plugin, none,
47 // because this is only an overview over all objects already defined in FAI.
48 var $objectclasses = array(); // ObjectClasses which the attributes are related to
49 var $dialog = array(); // This object contains every dialog we have currently opened
51 var $objects = array(); // This array contains all available objects shown in divlist
52 var $is_dialog = false;
54 /* construction/reconstruction
55 * The Filter ($faifilter stored in $_SESSION['faifilter']) defines the last
56 * selected department and filter options
57 * If it is not defined already we create a new fresh faifilter.
58 */
59 function faiManagement ($config, $ui)
60 {
61 $this->ui = $ui;
63 /* Set current dn to "", */
64 $this->dn = "";
66 /* Assign config */
67 $this->config = $config;
69 /* Get global filter config */
70 if (!is_global("faifilter")){
71 $base = get_base_from_people($ui->dn);
72 $faifilter= array("base" => $base,
73 "regex" => "*");
74 $faifilter['ShowProfiles'] = true;
75 $faifilter['ShowTemplates'] = true;
76 $faifilter['ShowScripts'] = true;
77 $faifilter['ShowHooks'] = true;
78 $faifilter['ShowVariables'] = true;
79 $faifilter['ShowPackages'] = true;
80 $faifilter['ShowPartitions']=true;
81 register_global("faifilter", $faifilter);
82 }
83 }
85 function execute()
86 {
87 $display = "";
88 $smarty = get_smarty();
89 $s_action = "";
90 $s_entry = "";
91 /* filter management
92 * Filter will be changed if POST['regex'] or $_GET['search'] isset
93 * New Filter will be stored in session and is used to generate list contents
94 */
95 $faifilter = $_SESSION['faifilter'];
97 /* Filter is posted by apply button
98 * Check every single chkbox
99 */
100 if(isset($_POST['regex'])){
101 $faifilter['regex'] = $_POST['regex']."*";
102 foreach(array("ShowPartitions","ShowProfiles","ShowTemplates","ShowScripts","ShowHooks","ShowVariables","ShowPackages") as $attrs){
103 if(isset($_POST[$attrs])){
104 $faifilter[$attrs] = true;
105 }else{
106 $faifilter[$attrs] = false;
107 }
108 }
109 }
111 /* Check ImageButton posts
112 * Create new tab ich new_xx is posted
113 */
114 foreach($_POST as $key => $val){
115 if(preg_match("/create_partition/i",$key)){
116 $s_action = "new_partition";
117 }elseif(preg_match("/create_script/i",$key)){
118 $s_action = "new_script";
119 }elseif(preg_match("/create_hook/i",$key)){
120 $s_action = "new_hook";
121 }elseif(preg_match("/create_variable/i",$key)){
122 $s_action = "new_variable";
123 }elseif(preg_match("/create_template/i",$key)){
124 $s_action = "new_template";
125 }elseif(preg_match("/create_package/i",$key)){
126 $s_action = "new_package";
127 }elseif(preg_match("/create_profile/i",$key)){
128 $s_action = "new_profile";
129 }elseif(preg_match("/edit_continue/",$key)){
130 $s_action = "select_class_name_finished";
131 }elseif(preg_match("/^entry_edit_.*/",$key)){
132 $s_entry = preg_replace("/^entry_edit_/","",$key);
133 $s_entry = preg_replace("/_.*$/","",$s_entry);
134 $s_action = "edit";
135 }elseif(preg_match("/^entry_delete_.*/",$key)){
136 $s_entry = preg_replace("/^entry_delete_/","",$key);
137 $s_entry = preg_replace("/_.*$/","",$s_entry);
138 $s_action = "delete";
139 }elseif(preg_match("/dep_back.*/i",$key)){
140 $s_action="back";
141 }elseif(preg_match("/dep_home.*/i",$key)){
142 $s_action="home";
143 }elseif(preg_match("/dep_root.*/i",$key)){
144 $s_action="root";
145 }
147 }
149 if($s_action=="root"){
150 $faifilter['base']=($this->config->current['BASE']);
151 }
153 if($s_action=="home"){
154 $faifilter['base']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
155 $faifilter['base']=(preg_replace("/^[^,]+,/","",$faifilter['base']));
156 }
158 if($s_action=="back"){
159 $base_back = preg_replace("/^[^,]+,/","",$faifilter['base']);
160 $base_back = convert_department_dn($base_back);
162 if(isset($this->config->departments[trim($base_back)])){
163 $faifilter['base']= $this->config->departments[trim($base_back)];
164 }else{
165 $faifilter['base']= $this->config->departments["/"];
166 }
167 }
169 if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
170 $s_action="open";
171 $s_entry = base64_decode($_GET['dep_id']);
172 $faifilter['base']= $this->config->departments[trim($s_entry)];
173 }
175 if(isset($_GET['edit_entry'])){
176 $s_entry = $_GET['edit_entry'];
177 $s_action = "edit";
178 }
180 /* Confirm dialog
181 * Delte object
182 */
183 if ($s_action=="delete"){
185 /* Get 'dn' from posted termlinst */
186 $this->dn= $this->objects[$s_entry]['dn'];
188 /* Load permissions for selected 'dn' and check if
189 we're allowed to remove this 'dn' */
190 $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
191 $this->acl= get_module_permission($acl, "FAIclass", $this->dn);
192 if (chkacl($this->acl, "delete") == ""){
194 /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
195 if (($user= get_lock($this->dn)) != ""){
196 return(gen_locked_message ($user, $this->dn));
197 }
199 /* Lock the current entry, so nobody will edit it during deletion */
200 add_lock ($this->dn, $this->ui->dn);
201 $smarty->assign("warning", sprintf(_("You're about to delete all information about the FAI class at '%s'."), $this->dn));
202 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
203 } else {
205 /* Obviously the user isn't allowed to delete. Show message and
206 clean session. */
207 print_red (_("You are not allowed to delete this component!"));
208 }
209 }
211 /* Delete canceled? */
212 if (isset($_POST['delete_cancel'])){
213 del_lock ($this->dn);
214 }
217 /* Deltetion was confirmed, so delete this entry
218 */
219 if (isset($_POST['delete_terminal_confirm'])){
221 /* Some nice guy may send this as POST, so we've to check
222 for the permissions again. */
223 if (chkacl($this->acl, "delete") == ""){
225 /* Find out more about the object type */
226 $ldap = $this->config->get_ldap_link();
227 $ldap->cat($this->dn);
228 $attrs = $ldap->fetch();
230 $type = $this->get_type($attrs);
232 $this->dialog= new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $this->dn);
233 $this->dialog->set_acl(array($this->acl));
235 $this->dialog->by_object[$type[1]]->remove_from_parent ();
236 unset ($this->dialog);
237 gosa_log ("FAI class '".$this->dn."' has been removed");
238 $this->dialog= NULL;
240 /* Terminal list has changed, reload it. */
241 $this->reload ();
242 } else {
244 /* Normally this shouldn't be reached, send some extra
245 logs to notify the administrator */
246 print_red (_("You are not allowed to delete this component!"));
247 gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
248 "deletion.");
249 }
251 /* Remove lock file after successfull deletion */
252 del_lock ($this->dn);
253 }
255 /* Edit Entry */
256 if($s_action == "edit"){
257 $entry = $this->objects[$s_entry];
259 $a_setup = ($this->get_type($entry));
261 $this->dn = $entry['dn'];
263 $this->dialog= new $a_setup[0]($this->config,
264 $this->config->data['TABS'][$a_setup[2]],$this->dn);
265 $this->is_dialog = true;
266 }
269 /* Dialog handling */
270 if($s_action == "new_partition"){
271 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpartitionTable");
272 }
274 /* Dialog handling */
275 if($s_action == "new_script"){
276 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIscript");
277 }
279 /* Dialog handling */
280 if($s_action == "new_hook"){
281 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIhook");
282 }
284 /* Dialog handling */
285 if($s_action == "new_variable"){
286 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIvariable");
287 }
289 /* Dialog handling */
290 if($s_action == "new_template"){
291 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAItemplate");
292 }
294 /* Dialog handling */
295 if($s_action == "new_package"){
296 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpackageList");
297 }
299 /* New Profile */
300 if($s_action == "new_profile"){
301 $this->dn = "new" ;
302 $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
304 $this->dialog = new $a_setup[0]($this->config,
305 $this->config->data['TABS'][$a_setup[2]],$this->dn);
306 $this->is_dialog = true;
308 }
310 if($s_action == "select_class_name_finished"){
311 $this->dialog->save_object();
312 if(count($this->dialog->check())!=0){
313 foreach($this->dialog->check() as $msg){
314 print_red($msg);
315 }
316 }else{
317 $this->dn = "new" ;
318 $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
319 $name = $this->dialog->save();
321 $this->dialog = new $a_setup[0]($this->config,
322 $this->config->data['TABS'][$a_setup[2]],$this->dn);
323 $this->dialog->by_object[$a_setup[1]]->cn = $name;
324 $this->is_dialog = true;
325 }
326 }
329 /* Search is set */
330 if(isset($_GET['search'])){
331 $faifilter['regex']=$_GET['search']."*";
332 }
334 /* remove double asterisks and save new filter */
335 $faifilter['regex'] = preg_replace("/\*\*/","*",$faifilter['regex']);
336 $_SESSION['faifilter']= $faifilter;
338 /* Edit dialog was canceled
339 * Remove dialog an show management dialog
340 */
341 if(isset($_POST['edit_cancel'])){
342 unset($this->dialog);
343 $this->dialog=NULL;
344 $this->is_dialog = false;
345 }
348 /* This check if the given tab could be saved
349 * If it was possible to save it, remove dialog object.
350 * If it wasn't possible, show errors and keep dialog.
351 */
352 if(isset($_POST['edit_finish'])){
353 $this->dialog->save_object();
354 if(count($this->dialog->check())!=0){
355 foreach($this->dialog->check() as $msg){
356 print_red($msg);
357 }
358 }else{
359 $this->dialog->save();
360 unset($this->dialog);
361 $this->dialog=NULL;
362 $this->is_dialog=false;
363 }
364 }
367 /* If dialog is set, but $this->is_dialog==false, then
368 * only the "abort" button is shown, this are dialogs that must not be saved.
369 * If is_dialog == true, we are currently editing tab objects.
370 * Here we need both, save and cancel
371 */
373 if($this->dialog != NULL){
374 $display .= $this->dialog->execute();
375 /* Don't show buttons if tab dialog requests this */
376 if (((isset($this->dialog->current))&&($this->dialog->by_object[$this->dialog->current]->is_dialog))){
378 }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
379 $display.= "<p style=\"text-align:right\">\n";
380 $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
381 $display.= " \n";
382 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
383 $display.= "</p>";
384 }elseif(!isset($this->dialog->current)){
385 $display.= "<p style=\"text-align:right\">\n";
386 $display.= "<input type=submit name=\"edit_continue\" value=\""._("Continue")."\"> ";
387 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
388 $display.= "</p>";
389 }
390 return($display);
391 }
393 /* Show Management template
394 * The following code will only be reached if no dialog (tabs or dialogs)
395 * are currently opened.
396 * Assign all reguired vars to template engine
397 */
399 /* Create listhead, it will be shown on top of the divlist.
400 * It provides general navigation and object creation
401 */
402 $faihead =
403 "<div style='background:#F0F0F9;padding:5px;'> ".
405 "<input type='image' src='images/list_up.png' align='middle'
406 title='"._("Go up one department")."' name='dep_back' alt='"._("Up"). "'> ".
408 "<input type='image' src='images/list_root.png' align='middle'
409 title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
411 "<input type='image' src='images/list_home.png' align='middle'
412 title='"._("Go to users home department")."' name='dep_home' alt='"._("Home")."'> ".
414 "<img src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\"> ".
416 " <input type='image' src='images/fai_new_profile.png' align='middle'
417 title='"._("New profile")."' name='Create_profile' alt='"._("P")."'> ".
419 "<img src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\"> ".
421 " <input type='image' src='images/fai_new_partitionTable.png' align='middle'
422 title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'> ".
424 " <input type='image' src='images/fai_new_script.png' align='middle'
425 title='"._("New scripts")."' name='Create_script' alt='"._("S")."'> ".
427 " <input type='image' src='images/fai_new_hook.png' align='middle'
428 title='"._("New hooks")."' name='Create_hook' alt='"._("H")."'> ".
430 " <input type='image' src='images/fai_new_variable.png' align='middle'
431 title='"._("New variables")."' name='Create_variable' alt='"._("V")."'> ".
433 " <input type='image' src='images/fai_new_template.png' align='middle'
434 title='"._("New templates")."' name='Create_template' alt='"._("T")."'> ".
436 " <input type='image' src='images/fai_new_packages.png' align='middle'
437 title='"._("New package list")."' name='Create_package' alt='"._("PK")."'> ".
439 "</div>";
441 $this->reload();
443 /* Create list with objects */
444 $divlist = new divlist("faiManagement");
445 $divlist->SetEntriesPerPage(20);
446 $divlist->SetSummary(_("This table displays all systems, in the selected tree."));
448 $divlist->SetHeader(array(
449 array("string" => " "),
450 array("string" => _("Name of FAI class")),
451 array("string" => _("Class type")),
452 array("string" => _("Actions"), "attach"=>"style='border-right:none;width:40px;'")));
455 $action = "<input type='image' src='images/edit.png' alt='"._("edit")."' name='entry_edit_%KEY%' title='"._("Edit class")."'>";
456 $action .= "<input type='image' src='images/edittrash.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete class")."'>";
458 $editlink ="<a href='?plug=".$_GET['plug']."&edit_entry=%KEY%'>%NAME%</a>";
459 $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
461 foreach($this->departments as $key => $val) {
462 if(!isset($this->config->departments[trim($key)])){
463 $this->config->departments[trim($key)]="";
464 }
466 $non_empty="";
467 $keys= str_replace("/","\/",$key);
468 foreach($this->config->departments as $keyd=>$vald ){
469 if(preg_match("/".$keys."\/.*/",$keyd)){
470 $non_empty="full";
471 }
472 }
475 $title = $this->config->departments[$key];
476 $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach"=>"style='width:20px;'");
477 $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "title='".$title."'");
478 $field2 = array("string" => "");
479 $field3 = array("string" => "","attach"=>"style='text-align:right;border-right:none;'");
481 $divlist->AddEntry( array($field0,$field1,$field2,$field3));
483 }
486 /* Attach objects */
487 foreach($this->objects as $key => $value){
488 $info= "";
489 $img = "";
490 $type = $value['type'];
491 $abort=false;
493 switch($type) {
494 case "FAIpartitionTable" :
495 if(!$faifilter['ShowPartitions']){
496 $abort = true;
497 }
498 $img="<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt='PT'>";
499 $info = _("Partition table");
500 break;
501 case "FAIpackageList" :
502 if(!$faifilter['ShowPackages']){
503 $abort = true;
504 }
505 $img="<img src='images/fai_packages.png' title='"._("Package list")."' alt='PL'>";
506 $info = _("Package list");
507 break;
508 case "FAIscript" :
509 if(!$faifilter['ShowScripts']){
510 $abort = true;
511 }
512 $img="<img src='images/fai_script' title='"._("Scripts")."' alt='S'>";
513 $info = _("Scripts");
514 break;
515 case "FAIvariable" :
516 if(!$faifilter['ShowVariables']){
517 $abort = true;
518 }
519 $img="<img src='images/fai_variable.png' title='"._("Variables")."' alt='V'>";
520 $info = _("Variables");
521 break;
522 case "FAIhook" :
523 if(!$faifilter['ShowHooks']){
524 $abort = true;
525 }
526 $img="<img src='images/fai_hook.png' title='"._("Hooks")."' alt='H'>";
527 $info = _("Hooks");
528 break;
529 case "FAIprofile" :
530 if(!$faifilter['ShowProfiles']){
531 $abort = true;
532 }
533 $img="<img src='images/fai_profile.png' title='"._("Profile")."' alt='P'>";
534 $info = _("Profile");
535 break;
536 case "FAItemplate" :
537 if(!$faifilter['ShowTemplates']){
538 $abort = true;
539 }
540 $img="<img src='images/fai_template.png' title='"._("Templates")."' alt='T'>";
541 $info = _("Templates");
542 break;
543 default :
544 $img="<img src='images/empty.png' >";$info = "";break;
546 }
548 if(!$abort) {
549 if((isset($value['description']))&&(!empty($value['description']))){
550 $desc= " [".$value['description']."]";
551 }else{
552 $desc= "";
553 }
555 $field1 = array("string" => $img , "attach" => "style='height:26px;width=20px;'");
556 $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/"),array($key,$value['cn'].$desc),$editlink) , "attach" => "");
557 $field3 = array("string" => $info, "attach" => "");
558 $field4 = array("string" => preg_replace("/%KEY%/",$key,$action) , "attach"=>"style='text-align:right;border:none'");
559 $divlist->AddEntry(array($field1,$field2,$field3,$field4));
561 }
562 }
564 foreach($faifilter as $attrs => $value){
565 if($value){
566 $smarty->assign($attrs."CHK", " checked ");
567 }else{
568 $smarty->assign($attrs."CHK", " ");
569 }
570 }
572 /* Assign all reguired vars to template engine */
573 $smarty->assign("faihead" , $faihead);
574 $smarty->assign("failist" , $divlist->DrawList());
575 $smarty->assign("regex" , $faifilter['regex']);
576 $smarty->assign("infoimage" , get_template_path('images/info.png'));
577 $smarty->assign("launchimage" , get_template_path('images/launch.png'));
578 $smarty->assign("alphabet" , generate_alphabet());
579 $smarty->assign("apply" , apply_filter());
580 $smarty->assign("search_image" , get_template_path('images/search.png'));
582 $display = $smarty->fetch(get_template_path('headpage.tpl', TRUE, dirname(__FILE__)));
583 return ($display);
584 }
587 function reload()
588 {
589 /* Create a new list of FAI object
590 * Object list depends on faifilter['regex']
591 * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ...
592 */
593 $faifilter= get_global('faifilter');
594 // Added for dirlist function...
596 /* Set base for all searches */
597 $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
598 $regex = $faifilter['regex'];
600 /* Array to save objects */
601 $objects = array();
603 $this->objects=array();
605 /* NEW LIST MANAGMENT
606 * We also need to search for the departments
607 * So we are able to navigate like in konquerer
608 */
609 $base2 = $faifilter['base'];
611 $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
612 TRUE, $base2, array("ou", "description"), TRUE);
614 $this->departments= array();
615 $tmp = array();
616 foreach ($res3 as $value){
617 $tmp[strtolower($value['dn']).$value['dn']]=$value;
618 }
619 ksort($tmp);
620 foreach($tmp as $value){
621 if($value["description"][0]!=".."){
622 $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
623 }else{
624 $this->departments[$value['dn']]=$value["description"][0];
625 }
626 }
628 /* END NEW LIST MANAGMENT
629 */
632 $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",
633 FALSE, $base, array("cn","description","objectClass"),TRUE);
635 foreach($res as $objecttypes){
636 $res2 = get_list($this->ui->subtreeACL, "(&(objectClass=*)(cn=".$regex."))",
637 FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
638 foreach($res2 as $object){
639 $type= "";
640 unset($object['objectClass']['count']);
641 if(!isset($object['description'][0])){
642 $object['description'][0]="";
643 }
645 /* Clean up object informations */
646 $obj['cn'] = $object['cn'][0];
647 $obj['dn'] = $object['dn'];
648 $obj['description'] = $object['description'][0];
649 $obj['objectClass'] = $object['objectClass'];
651 if(in_array("FAIpartitionTable",$obj['objectClass'])){
652 $type = "FAIpartitionTable";
653 }elseif(in_array("FAIpackageList",$obj['objectClass'])){
654 $type = "FAIpackageList";
655 }elseif(in_array("FAIscript",$obj['objectClass'])){
656 $type = "FAIscript";
657 }elseif(in_array("FAIvariable",$obj['objectClass'])){
658 $type = "FAIvariable";
659 }elseif(in_array("FAIhook",$obj['objectClass'])){
660 $type = "FAIhook";
661 }elseif(in_array("FAIprofile",$obj['objectClass'])){
662 $obj['FAIclass'] = $object['FAIclass'][0];
663 $type = "FAIprofile";
664 }elseif(in_array("FAItemplate",$obj['objectClass'])){
665 $type = "FAItemplate";
666 }
667 $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
668 $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
670 }
671 }
672 ksort($this->objects);
673 reset ($this->objects);
674 }
676 function remove_lock()
677 {
678 if (isset($this->dn)){
679 del_lock ($this->dn);
680 }
681 }
683 function get_type($array){
684 if(in_array("FAIpartitionTable",$array['objectClass'])){
685 return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
686 }
687 if(in_array("FAIscript",$array['objectClass'])){
688 return(array("tabsScript","faiScript","FAISCRIPTTABS"));
689 }
690 if(in_array("FAItemplate",$array['objectClass'])){
691 return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
692 }
693 if(in_array("FAIhook",$array['objectClass'])){
694 return(array("tabsHook","faiHook","FAIHOOKTABS"));
695 }
696 if(in_array("FAIvariable",$array['objectClass'])){
697 return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
698 }
699 if(in_array("FAIprofile",$array['objectClass'])){
700 return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
701 }
703 if(in_array("FAIpackageList",$array['objectClass'])){
704 return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
705 }
706 }
708 }
710 ?>