Code

0eeb89220cc556f29d8aca27d424eefff726e52d
[gosa.git] / plugins / admin / systems / class_workstationStartup.inc
1 <?php
2 class workstartup extends plugin
3 {
4   /* CLI vars */
5   var $cli_summary= "Manage terminal startup options";
6   var $cli_description= "Some longer text\nfor help";
7   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9   /* Generic terminal attributes */
10   var $bootmode             = "G";
11   var $goLdapServerList     = array("default");
12   var $gotoBootKernel       = "default";
13   var $gotoKernelParameters = "";
14   var $gotoLdapServer       = "";
15   var $gotoModules          = array();
16   var $gotoAutoFs           = array();
17   var $gotoFilesystem       = array();
18   var $gotoTerminalPath     = "";
19   var $FAIstatus            = "";
20   var $FAIclass             = array();
21   var $FAIclasses           = array();
22   var $FAIclassInfo         = array();
23   var $FAIdebianMirror      = "auto";
26   /* attribute list for save action */
27   var $attributes     = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror");
28   var $objectclasses  = array("GOhard", "FAIobject");
30   /* Share */
31   var $gotoShares         = array();// Currently Share Option
32   var $gotoShare          = "";     // currently selected Share Option
33   var $gotoShareSelections= array();// Available Shares for this account in Listbox format
34   var $gotoAvailableShares= array();// Available Shares for this account
36   /* Helper */
37   var $customParameters   = "";
38   var $orig_dn            = "";
39   var $ignore_account     = TRUE;
40   var $FAIdebianMirrors   = array();
42   function workstartup ($config, $dn= NULL)
43   {
44     plugin::plugin ($config, $dn);
46     /* Creating a list of valid Mirrors 
47      * none will not be saved to ldap.
48      */
49     $this->FAIdebianMirrors   = array();
50     $ldap   = $this->config->get_ldap_link();
51     $ldap->cd($this->config->current['BASE']);
52     $ldap->search("(objectClass=FAIrepositoryServer)",array("FAIrepository"));
53     
54     /* attach all attributes with "index => cn" to avoid multiple entries */
55     $ret = array();
56     while($attr = $ldap->fetch()){
57       if(isset($attr['FAIrepository'])){
58         
59         unset($attr['FAIrepository']['count']);
61         foreach($attr['FAIrepository'] as $rep){
62           $tmp = split("\|",$rep);
63           $str = "";
64           if(count($tmp)==4){
65             $sections = split(",",$tmp[3]);
66             $str = $tmp[0];
67             $ret[$str]=$sections;
68           }
69         }
70       }
71     }
72     ksort($ret);
73     $this->FAIdebianMirrors = $ret;
75     /* Get arrays */
76     foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
77       if (isset($this->attrs["$val"]["count"])){
78         for ($i= 0; $i<$this->attrs["count"]; $i++){
79           if (isset($this->attrs["$val"][$i])){
80             array_push($this->$val, $this->attrs["$val"][$i]);
81           }
82         }
83       }
84       sort ($this->$val);
85       $this->$val= array_unique($this->$val);
86     }
88     /* Parse Kernel Parameters to decide what boot mode is enabled */
89     if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){
90       $this->bootmode= "G";
91     } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){
92       $this->bootmode= "D";
93     } elseif ($this->gotoKernelParameters == "") {
94       $this->bootmode= "G";
95     } else {
96       $this->bootmode= "T";
97     }
98     if (preg_match("/ o /", $this->gotoKernelParameters)){
99       $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters);
100     } else {
101       $this->customParameters= "";
102     }
104     /* Prepare Shares */
105     if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
106       unset($this->attrs['gotoShare']['count']);
107       foreach($this->attrs['gotoShare'] as $share){
108         $tmp = $tmp2 = array();
109         $tmp = split("\|",$share);
110         $tmp2['server']      =$tmp[0];
111         $tmp2['name']        =$tmp[1];
112         $tmp2['mountPoint']  =$tmp[2];
113         $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
114       }
115     }
117     $this->gotoShareSelections= $config->getShareList(true);
118     $this->gotoAvailableShares= $config->getShareList(false);
119     $tmp2 = array();
120   
121     $ldap   = $this->config->get_ldap_link();
122     $ldap->cd($this->config->current['BASE']);
124     /* Search all FAI objects */
125     $ldap->search("(| (objectClass=FAIpackageList)(objectClass=FAItemplate)
126                       (objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)
127                       (objectClass=FAIpartitionTable))",array("*"),true);
128     /* Sort all entries, and attach elementtype.
129      * To be able to show the types in the listbox.
130      */
131     while($attr = $ldap->fetch()){
132       $cn = $attr['cn'][0];
133       if(in_array('FAIpackageList',$attr['objectClass'])){
134         $tmp2[$cn]['FAIpackageList']['obj']   = 'FAIpackageList'; 
135         $tmp2[$cn]['FAIpackageList']['kzl']   = 'Pl';
136         $tmp2[$cn]['FAIpackageList']['sec']   = $attr['FAIdebianSection'];
137         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
138       }
139       if(in_array('FAItemplate',$attr['objectClass'])){
140         $tmp2[$cn]['FAItemplate']['obj']      = 'FAItemplate'; 
141         $tmp2[$cn]['FAItemplate']['kzl']      = 'T'; 
142         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
143       }
144       if(in_array('FAIvariable',$attr['objectClass'])){
145         $tmp2[$cn]['FAIvariable']['obj']      = 'FAIvariable'; 
146         $tmp2[$cn]['FAIvariable']['kzl']      = 'V'; 
147         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
148       }
149       if(in_array('FAIscript',$attr['objectClass'])){
150         $tmp2[$cn]['FAIscript']['obj']        = 'FAIscript'; 
151         $tmp2[$cn]['FAIscript']['kzl']        = 'S'; 
152         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
153       }
154       if(in_array('FAIhook',$attr['objectClass'])){
155         $tmp2[$cn]['FAIhook']['obj']          = 'FAIhook'; 
156         $tmp2[$cn]['FAIhook']['kzl']          = 'H'; 
157         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
158       }
159       if(in_array('FAIpartitionTable',$attr['objectClass'])){
160         $tmp2[$cn]['FAIpartitionTable']['obj']= 'FAIpartitionTable'; 
161         $tmp2[$cn]['FAIpartitionTable']['kzl']= 'Pt'; 
162         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
163       }
164       if(in_array('FAIprofile',$attr['objectClass'])){
165         $tmp2[$cn]['FAIprofile']['obj']= 'FAIprofile'; 
166         $tmp2[$cn]['FAIprofile']['kzl']= 'P'; 
167         $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
168       }
169     }
170     if(is_array($this->FAIclasses)){
171       natcasesort($this->FAIclasses);
172     }
174     $this->FAIclassInfo = $tmp2;
176     if((isset($this->FAIclass))&&(!is_array($this->FAIclass))){
177       $tmp = array();
178       $tmp = split(" ",$this->FAIclass);
179       $tmp2 =array();  
180     
181       foreach($tmp as $class){
182         $tmp2[$class] = $class;
183       }
184       $this->FAIclass = $tmp2;
185     }
187     if(!is_array($this->FAIclass)){
188       $this->FAIclass =array();
189     }
191     $this->orig_dn= $this->dn;
192   }
194   /* Create array to display available classes/profiles in a selectbox */
195   function selectFriendlyClasses(){
196     $tmp=array();
197     foreach($this->FAIclasses as $class){
198       $str    = "";
199       $skip = false;
201       if(isset($this->FAIclassInfo[$class])){
202         foreach($this->FAIclassInfo[$class] as $objs){
203           $str .= $objs['kzl']." "; 
204         }
205       }
206       $tmp[$class] = $class."&nbsp; [".$str."]";
207     }
208     return($tmp);
209   }
211   function check()
212   {
213     $messages = array();
214     /* If there are packages selected, but no mirror show error */   
215     if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){
216       $messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'.");
217     }
218     return($messages);
219   }
221   function execute()
222   {
223         /* Call parent execute */
224         plugin::execute();
226     /* Do we need to flip is_account state? */
227     if (isset($_POST['modify_state'])){
228       $this->is_account= !$this->is_account;
229     }
231     /* Do we represent a valid terminal? */
232     if (!$this->is_account && $this->parent == NULL){
233       $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
234         _("This 'dn' has no terminal features.")."</b>";
235       return ($display);
236     }
238     /* Add module */
239     if (isset ($_POST['add_module'])){
240       if ($_POST['module'] != "" && chkacl ($this->acl, "gotoModule") == ""){
241         $this->add_list ($this->gotoModules, $_POST['module']);
242       }
243     }
245     /* Delete module */
246     if (isset ($_POST['delete_module'])){
247       if (count($_POST['modules_list']) && chkacl ($this->acl, "gotoModule") == ""){
248         $this->del_list ($this->gotoModules, $_POST['modules_list']);
249       }
250     }
252     /* FAI class management */
253     if((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))){
254       $found = 0 ; 
256       /* If this new class/profile will attach a second partition table
257        * to our list of classes, abort and show a message.
258        */
259       foreach($this->FAIclass as $name){
260         if(isset($this->FAIclassInfo[$name])){
261           foreach($this->FAIclassInfo[$name] as $atr){
262             if($atr['obj'] == "FAIpartitionTable"){
263               $found ++ ; 
264             }
265           }
266         }
267       }
269       if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
270         print_red(_("There is already a profile in your selection that contain partition table configurations."));
271       }else{
272         $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
273       }
274     }
276     $sort = false;
277     foreach($_POST as $name => $val){
278       
279       $sort_type = false;
280       if((preg_match("/sort_up/",$name))&&(!$sort)){
281         $sort_type = "sort_up_";
282       }
283       if((preg_match("/sort_down/",$name))&&(!$sort)){
284         $sort_type = "sort_down_";
285       }
286     
287       if(($sort_type)&&(!$sort)){
288         $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
289         $sort = true;
290         
291         $last = -1;
292         $change_down  = -1;
293  
294         /* Create array with numeric index */ 
295         $tmp = array();
296         foreach($this->FAIclass as $class){
297           $tmp [] = $class;
298         }
300         /* Walk trough array */
301         foreach($tmp as $key => $faiName){
302           if($faiName == $value){
303             if($sort_type == "sort_up_"){
304               if($last != -1){
305                  $change_down= $last;
306               }
307             }else{
308               if(isset($tmp[$key+1])){
309                 $change_down = $key;
310               }
311             }
312           }
313           $last = $key;
314         }
315  
316         $tmp2 = array();
317         $skip = false;    
318   
319         foreach($tmp as $ky => $vl){
321           if($ky == $change_down){
322             $skip = $vl;
323           }else{
324             $tmp2[$vl] = $vl;
325           }
326           if(($skip != false)&&($ky != $change_down)){
327             $tmp2[$skip]  = $skip;
328             $skip =false;
329           }
330         }   
331         $this->FAIclass = $tmp2; 
332       }
333   
335       if(preg_match("/fai_remove/i",$name)){
336         $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)));
337         unset($this->FAIclass[$value]);
338       }
339     }
341     /* Delete selected class from our list */
342     if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
343       if(isset($this->FAIclass[$_POST['FAIclassSel']])){
344         unset($this->FAIclass[$_POST['FAIclassSel']]);
345       }
346     }
348     /* Show main page */
349     $smarty= get_smarty();
351     /* In this section server shares will be defined
352      * A user can select one of the given shares and a mount point
353      *  and attach this combination to his setup.
354      */
355     $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
356     $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
358     /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
359      * This entry will be, a combination of mountPoint and sharedefinitions
360      */
361     if(isset($_POST['gotoShareAdd'])){
362       /* We assign a share to this user, if we don't know where to mount the share */
363       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
364         print_red(_("You must specify a valid mount point."));
365       }else{
366         $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
367         $s_mount = $_POST['gotoShareMountPoint'];
368         /* Preparing the new assignment */
369         $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
370         $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
371       }
372     }
374     /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
375      * If there is no defined share selected, we will abort the deletion without any message
376      */
377     if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
378       unset($this->gotoShares[$_POST['gotoShare']]);
379     }
381     $smarty->assign("gotoShares",$this->printOutAssignedShares());
382     $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
384     /* Arrays */
385     $smarty->assign("ldapservers", $this->config->data['SERVERS']['LDAP']);
386     $smarty->assign("gotoLdapServer_select", $this->gotoLdapServer);
387     $smarty->assign("gotoLdapServerACL", chkacl($this->acl, "gotoLdapServer"));
388     foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
389       $smarty->assign("$val", $this->$val);
390     }
392     /* Values */
393     foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror") as $val){
394       $smarty->assign($val, $this->$val);
395       $smarty->assign($val."ACL", chkacl($this->acl, $val));
396     }
398     $div = new divSelectBox("WSFAIscriptClasses");
399     
400     $div -> SetHeight("110");
402     $str_up     = " &nbsp;<input type='image' src='images/sort_up.png'    name='sort_up_%s'    value='%s'>";
403     $str_down   = " &nbsp;<input type='image' src='images/sort_down.png'  name='sort_down_%s'  value='%s'>";
404     $str_remove = " &nbsp;<input type='image' src='images/edittrash.png'  name='fai_remove_%s' value='%s'>";
405     $str_empty  = " &nbsp;<img src='images/empty.png' alt=\"\" width='7'>"; 
407     $i = 1;
409     foreach($this->FAIclass as $class){
410       if($i==1){
411         $str = $str_empty.$str_down.$str_remove;
412       }elseif($i == count($this->FAIclass)){
413         $str = $str_up.$str_empty.$str_remove;
414       }else{
415         $str = $str_up.$str_down.$str_remove;
416       }
417       $i ++ ; 
418     
419       $div->AddEntry(array(
420                             array("string"=>$class),
421                             array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
422                           ));
423     }  
425     $smarty->assign("FAIScriptlist",$div->DrawList()); 
426     $smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
427     $smarty->assign("FAIclasses",$this->selectFriendlyClasses());
428     $smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
429     $smarty->assign("FAIclassKeys",$this->FAIclass);
431     /* Radio button group */
432     if (preg_match("/G/", $this->bootmode)) {
433       $smarty->assign("graphicalbootup", "checked");
434     } else {
435       $smarty->assign("graphicalbootup", "");
436     }
437     if (preg_match("/T/", $this->bootmode)) {
438       $smarty->assign("textbootup", "checked");
439     } else {
440       $smarty->assign("textbootup", "");
441     }
442     if (preg_match("/D/", $this->bootmode)) {
443       $smarty->assign("debugbootup", "checked");
444     } else {
445       $smarty->assign("debugbootup", "");
446     }
448     /* ACL's */
449     foreach (array("gotoKernelParameters", "gotoModules", "gotoFilesystem","FAIclass") as $value){
450       $smarty->assign($value."ACL", chkacl($this->acl, "$value"));
451     }
453     /* Show main page */
454     return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
455   }
457   function remove_from_parent()
458   {
459     $this->handle_post_events("remove");
460   }
463   function getFAIdebianMirrors()
464   {
465     $ret = array();
466     $ret['auto']=_("automatic");
467     $secs  = array();
468     if(is_array($this->FAIclass)){
469       foreach($this->FAIclass as $classes){
470         if(isset($this->FAIclassInfo[ $classes]['FAIpackageList']['sec'])){
471           if(isset($this->FAIclassInfo[ $classes]['FAIpackageList']['sec']['count'])){
472             unset($this->FAIclassInfo[ $classes]['FAIpackageList']['sec']['count']);
473           }
474           if(is_array($this->FAIclassInfo[ $classes]['FAIpackageList']['sec'])){
475             foreach($this->FAIclassInfo[ $classes]['FAIpackageList']['sec'] as $sec => $value){
476               $secs[$value]= $value;
477             }
478           }
479         }
480       }
481     }
482     if(is_array($this->FAIdebianMirrors)){
483       foreach($this->FAIdebianMirrors as $mirr=>$sections){
484         $allok = true;
485         foreach($secs as $sec){
486           if(!in_array($sec,$sections)){
487             $allok = false;
488           }
489         }
490         if($allok){
491           $ret[$mirr]=$mirr;
492         }
493       }
494     }
495     return($ret);
496   }
498   /* Save data to object */
499   function save_object()
500   {
501     plugin::save_object();
503     /* Save group radio buttons */
504     if (chkacl ($this->acl, "bootmode") == "" && isset($_POST["bootmode"])){
505       $this->bootmode= $_POST["bootmode"];
506     }
508     /* Save kernel parameters */
509     if (chkacl ($this->acl, "gotoKernelParameters") == "" && isset($_POST["customParameters"])){
510       $this->customParameters= $_POST["customParameters"];
511     }
512   }
515   /* Save to LDAP */
516   function save()
517   {
519     /* Depending on the baseobject (Ogroup / WS) we
520      *  use another set of objectClasses
521      * In case of WS itself, we use  "array("GOhard", "FAIobject");"
522      * if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject"))
523      */
524     if(isset($this->parent->by_object['ogroup'])){
525       $this->objectclasses = array("gotoWorkstationTemplate","GOhard", "FAIobject");
526     }elseif(isset($this->parent->by_object['workgeneric'])){
527       $this->objectclasses = array("GOhard", "FAIobject");
528     }else{
529       print "unknown";
530       exit();
531     }
533     /* Find proper terminal path for tftp configuration
534        FIXME: This is suboptimal when the default has changed to
535        another location! */
536     if ($this->gotoTerminalPath == "default"){
537       $ldap= $this->config->get_ldap_link();
539       /* Strip relevant part from dn, keep trailing ',' */
540       $tmp= preg_replace("/^cn=[^,]+,ou=terminals,ou=systems,/i", "", $this->dn);
541       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
543       /* Walk from top to base and try to load default values for
544          'gotoTerminalPath'. Abort when an entry is found. */
545       while (TRUE){
546         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
548         $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
549             $this->config->current['BASE']);
550         $attrs= $ldap->fetch();
551         if (isset($attrs['gotoTerminalPath'])){
552           $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
553           break;
554         }
556         /* Nothing left? */
557         if ($tmp == ""){
558           break;
559         }
560       }
561     }
563     /* Add semi automatic values */
564     // FIXME: LDAP Server may not be set here...
565     $this->gotoKernelParameters= "root=/dev/nfs nfsroot=".
566       $this->gotoTerminalPath.
567       ",ro,hard,nolock,fg,rsize=8192 ".
568       "ip=::::::dhcp LDAP=".$this->gotoLdapServer;
570     switch ($this->bootmode){
571       case "D":
572         $this->gotoKernelParameters.= " debug";
573       break;
574       case "G":
575         $this->gotoKernelParameters.= " splash=silent";
576       break;
577     }
578     if ($this->customParameters != ""){
579       $this->gotoKernelParameters.= " o ".$this->customParameters;
580     }
582     plugin::save();
583     
584     $str = "";
585     foreach($this->FAIclass as $class){
586       $str .= $class." ";
587     }
588     $this->attrs['FAIclass']= "";
589     $this->attrs['FAIclass']= trim($str);
591     if(empty($this->attrs['FAIclass'])){
592       $this->attrs['FAIclass'] = array();
593     }
595     /* Add missing arrays */
596     foreach (array("gotoFilesystem", "gotoAutoFs", "gotoModules") as $val){
597       if (isset ($this->$val) && count ($this->$val) != 0){
598     
599         $this->attrs["$val"]= array_unique($this->$val);
600       }
601       if(!isset($this->attrs["$val"])) $this->attrs["$val"]=array();
602     }
603     /* Strip out 'default' values */
604     if ($this->attrs['gotoLdapServer'] == "default"){
605       unset ($this->attrs['gotoLdapServer']);
606     }
608     /* if mirror == none stop saving this attribute */
609     if($this->FAIdebianMirror == "none"){
610       $this->FAIdebianMirror = "";
611     }
612     
613     if((count($this->attrs['FAIclass'])==0)&&(empty($this->FAIdebianMirror))){
614       $tmp = array();
615       foreach($this->attrs['objectClass'] as $class){
616         if($class != "FAIobject"){
617           $tmp[] = $class;
618         }
619       }
620       $this->attrs['objectClass']     = $tmp;
621       $this->attrs['FAIclass']        = array();
622       $this->attrs['FAIdebianMirror'] = array();
623     }
625     /* prepare share settings */
626     $tmp = array();
627     foreach($this->gotoShares as $name => $settings){
628       $tmp2= split("\|",$name);
629       $name = $tmp2[0];
630       $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
631     }
632     $this->attrs['gotoShare']=$tmp;
634     $ldap= $this->config->get_ldap_link();
635     $ldap->cd($this->dn);
636     $this->cleanup();
637 $ldap->modify ($this->attrs); 
639     show_ldap_error($ldap->get_error());
640     $this->handle_post_events("modify");
641   }
643   /* Add value to array, check if unique */
644   function add_list (&$array, $value)
645   {
646     if ($value != ""){
647       $array[]= $value;
648       sort($array);
649       array_unique ($array);
650     }
651   }
654   /* Delete value to array, check if unique */
655   function del_list (&$array, $list)
656   {
657     $tmp= array();
658     foreach ($array as $mod){
659       if (!in_array($mod, $list)){
660         $tmp[]= $mod;
661       }
662     }
663     $array= $tmp;
664   }
666   /* Generate ListBox frindly output for the defined shares
667    * Possibly Add or remove an attribute here,
668    */
669   function printOutAssignedShares()
670   {
671     $a_return = array();
672     if(is_array($this->gotoShares)){
673       foreach($this->gotoShares as $share){
674         $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
675       }
676     }
677     return($a_return);
678   }
682 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
683 ?>