385004292505a6e3d1e6a335937ecc160acd91d7
1 <?php
2 class appgroup extends plugin
3 {
4 /* CLI vars */
5 var $cli_summary= "Manage application groups";
6 var $cli_description= "Some longer text\nfor help";
7 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9 /* Appgroup attributes */
10 var $gosaMemberApplication= array();
12 /* Helpers */
13 var $departments = ""; // All departments within $this->curbase;
14 var $apps = array(); // All available applications
15 var $used_apps = array(); // Specifies which applications are currently assigned
17 var $option_name = array();
18 var $option_value = array();
19 var $appoption = array();
21 var $table = "";
22 var $curbase = "";
23 var $curCatDir ;
24 var $curCatDepth =0; //
26 /* attribute list for save action */
27 var $attributes= array();
28 var $objectclasses= array("gosaApplicationGroup");
30 function appgroup ($config, $dn= NULL)
31 {
32 plugin::plugin ($config, $dn);
34 /* Load member applications */
35 if (isset ($this->attrs["gosaMemberApplication"][0])){
36 for ($i= 0; $i<$this->attrs["gosaMemberApplication"]["count"]; $i++){
37 $this->gosaMemberApplication[]=
38 $this->attrs["gosaMemberApplication"][$i];
39 }
40 }
42 /* Load application options */
43 if (isset($this->attrs['gosaApplicationParameter'])){
44 for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
45 $option= preg_replace('/^[^:]+:/', '',
46 $this->attrs['gosaApplicationParameter'][$i]);
47 $name= preg_replace('/:.*$/', '',
48 $this->attrs['gosaApplicationParameter'][$i]);
49 $this->appoption[$name]= $option;
50 }
51 }
53 /* Parse MemberApplication*/
54 $tmp = array();
55 $tmp2 = array();
56 $prios = array();
57 $cats = array();
59 foreach($this->gosaMemberApplication as $memberApp){
60 if(preg_match("/\|/i",$memberApp)){
62 $tmp = split("\|",$memberApp);
64 if(!empty($tmp[0])){
65 $tmp2[$tmp[1]][$tmp[2]] = array("App"=>$tmp[0]);
66 }
67 if(!empty($tmp[1])){
68 $n = split("/",$tmp[1]);
69 $c = count($n);
70 $cats [$tmp[1]] = $n[$c-1];
71 }
72 $prios[$tmp[1]][$tmp[2]] = $tmp[2];
73 }else{
74 $tmp2[]['App'] = $memberApp;
75 }
76 }
78 $this->Categories = $cats;
80 $this->gosaMemberApplication = $tmp2;
81 $cats[""]="";
82 foreach($cats as $cat ){
83 if((isset($prios[$cat]))&&(count($prios[$cat]))){
84 $max = max($prios[$cat]);
85 $min = 1;//min($prios[$cat]);
86 $last = false;
87 for($i = $min ; $i < $max ; $i++){
88 if(!isset($prios[$cat][$i])){
89 if($last == false){
90 $this->gosaMemberApplication[$cat][$i]['App'] = "__SEPARATOR__".$i;
92 $last = true;
93 }
94 }else{
95 $last = false;
96 }
97 }
98 }
99 }
101 $tmp = array();
102 foreach($this->gosaMemberApplication as $key => $entries){
103 ksort ($entries);
104 foreach($entries as $entry){
105 $tmp[$key][]= $entry;
106 }
107 }
108 $this->gosaMemberApplication = $tmp;
109 $this->curbase = $this->config->current['BASE'];
110 }
112 function catDown($id){
114 /* Get all cats depinding on current dir */
115 $cats = $this->GetSubdirs($this->curCatDir);
117 $ret = array();
119 if((in_array($id,array_flip($cats)))&&(count($cats)>1)){
120 if(count($cats) == 2){
121 $ret = array_reverse($cats);
122 }else{
123 $cnt = 0;
124 $hit = 0;
125 foreach($cats as $cat=>$name){
126 if($cat == $id){
127 $hit = $cnt;
128 }
129 $cnt ++;
130 }
133 if($hit == 0){
134 $first = array_slice($cats,0,0);
135 $middle = array_slice($cats,0,2);
136 $last = array_slice($cats,$hit+2,$cnt);
137 }else{
138 $first = array_slice($cats,0,$hit);
139 $middle = array_slice($cats,$hit,2);
140 $last = array_slice($cats,$hit+2,$cnt);
141 }
142 /* print "first";
143 print_a($first);
144 print "middle";
145 print_a($middle);
146 print "last";
147 print_a($last);
148 */
149 foreach($first as $cat => $name){
150 $ret[$cat]=$name;
151 }
152 foreach(array_reverse($middle) as $cat => $name){
153 $ret[$cat]=$name;
154 }
155 foreach($last as $cat => $name){
156 $ret[$cat]=$name;
157 }
158 }
161 foreach($cats as $cat => $name){
162 unset($this->Categories[$cat]);
163 }
164 foreach($ret as $cat => $name){
165 $this->Categories[$cat]=$name;
166 }
168 }
169 }
171 function catUp($id)
172 {
173 /* Get all cats depinding on current dir */
174 $cats = $this->GetSubdirs($this->curCatDir);
176 $ret = array();
178 if((in_array($id,array_flip($cats)))&&(count($cats)>1)){
179 if(count($cats) == 2){
180 $ret = array_reverse($cats);
181 }else{
182 $cnt = 0;
183 $hit = 0;
184 foreach($cats as $cat => $name){
185 $cnt ++;
186 if($cat == $id){
187 $hit = $cnt;
188 }
189 }
191 if($hit>1){
192 if($hit == 2){
193 $first = array_slice($cats,0,$hit-2);
194 $middle = array_slice($cats,$hit-2,$hit);
195 $last = array_slice($cats,$hit,$cnt);
196 }else{
197 $first = array_slice($cats,0,$hit-2);
198 $middle = array_slice($cats,$hit-2,2);
199 $last = array_slice($cats,$hit,$cnt);
200 }
201 foreach($first as $cat => $name){
202 $ret[$cat]=$name;
203 }
204 foreach(array_reverse($middle) as $cat => $name){
205 $ret[$cat]=$name;
206 }
207 foreach($last as $cat => $name){
208 $ret[$cat]=$name;
209 }
210 }
211 }
213 foreach($cats as $cat => $name){
214 unset($this->Categories[$cat]);
215 }
216 foreach($ret as $cat => $name){
217 $this->Categories[$cat]=$name;
218 }
219 }
222 }
224 function getOneUp($appl)
225 {
226 $cat = $this->curCatDir;
227 if(!isset($this->gosaMemberApplication[$cat][($appl-1)])) return;
228 $f = 1;
229 if($appl == 1 ){
230 $f = 0;
231 }
232 $first = array_slice($this->gosaMemberApplication[$cat],0,($appl-1));
233 $middle = array_slice($this->gosaMemberApplication[$cat],$appl-1,(($appl+1)-$f));
234 $last = array_slice($this->gosaMemberApplication[$cat],($appl+1));
235 $tmp = array();
236 foreach($first as $entry){
237 $tmp[] = $entry;
238 }
239 foreach(array_reverse($middle) as $entry){
240 $tmp[] = $entry;
241 }
242 foreach($last as $entry){
243 $tmp[] = $entry;
244 }
245 $this->gosaMemberApplication[$cat] =$tmp;
246 }
248 function getOneDown($appl){
249 $cat = $this->curCatDir;
250 if(!isset($this->gosaMemberApplication[$cat][($appl+1)])) return;
251 $f = 0;
252 if($appl == 0 ){
253 $f = 1;
254 }
255 $first = array_slice($this->gosaMemberApplication[$cat],0,($appl));
256 $middle = array_slice($this->gosaMemberApplication[$cat],$appl,(($appl+1+$f)));
257 $last = array_slice($this->gosaMemberApplication[$cat],($appl+2));
259 $tmp = array();
260 foreach($first as $entry){
261 $tmp[] = $entry;
262 }
263 foreach(array_reverse($middle) as $entry){
264 $tmp[] = $entry;
265 }
266 foreach($last as $entry){
267 $tmp[] = $entry;
268 }
269 $this->gosaMemberApplication[$cat] =$tmp;
270 }
272 function AddSeperator()
273 {
274 $cat = $this->curCatDir;
275 $cnt = count($this->gosaMemberApplication[$cat]);
276 $tmp = array("App" => "__SEPARATOR__".($cnt+1));
277 $this->gosaMemberApplication[$cat][] = $tmp;
278 }
280 function execute()
281 {
282 /* Call parent execute */
283 plugin::execute();
285 if((isset($_GET['act']))&&($_GET['act']=="depopen")){
286 $dep = base64_decode($_GET['depid']);
287 if(isset($this->config->idepartments[$dep])){
288 $this->curbase = $dep;
289 }
290 }
292 if(isset($_POST['AddSeperator'])){
293 $this->AddSeperator();
294 }
296 if((isset($_GET['act']))&&($_GET['act']=="open")){
297 $this->curCatDir = $_GET['id'];
298 }
300 /* Do we need to flip is_account state? */
301 if (isset($_POST['modify_state'])){
302 $this->is_account= !$this->is_account;
303 }
305 /* Do we represent a valid group? */
306 if (!$this->is_account && $this->parent == NULL){
307 $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
308 _("This 'dn' is no appgroup.")."</b>";
309 return ($display);
310 }
312 /* Show tab dialog headers */
313 $display= "";
314 if ($this->parent != NULL){
315 if ($this->is_account){
316 $display= $this->show_header(_("Remove applications"),
317 _("This group has application features enabled. You can disable them by clicking below."));
318 } else {
319 $display.= $this->show_header(_("Create applications"),
320 _("This group has application features disabled. You can enable them by clicking below."));
321 return ($display);
322 }
323 }
326 /* Add Categorie */
329 if((isset($_POST['AddCat']))&&(isset($_POST['CatName']))&&(!empty($_POST['CatName']))){
331 if(preg_match("/[^0-9a-z,\.-;:_#\+\- ]/i",$_POST['CatName'])){
332 print_red(_("Invalid character in category name."));
333 }elseif(!in_array($_POST['CatName'],$this->Categories)){
334 if(empty($this->curCatDir)){
335 $this->Categories[$_POST['CatName']]=$_POST['CatName'];
336 }else{
337 $this->Categories[$this->curCatDir."/".$_POST['CatName']]=$_POST['CatName'];
338 }
339 }else{
340 print_red(_("The specified category already exists."));
341 }
342 }
345 $this->reload();
346 foreach($_POST as $name => $value){
347 if(preg_match("/DelApp_/",$name)){
348 $app = $value;
350 foreach($this->gosaMemberApplication as $key => $cat){
351 foreach($cat as $key2 => $app){
352 if($app['App'] == $value){
353 unset($this->gosaMemberApplication[$key][$key2]);
354 if(isset($this->used_apps[$value])){
355 unset($this->used_apps[$value]);
356 }
357 }
358 }
359 }
360 }
361 if(preg_match("/DelCat_/",$name)){
362 $app = $value;
363 foreach($this->Categories as $key => $cat){
364 if($cat == $value){
365 unset($this->Categories[$key]);
366 }
367 }
368 }
369 if(preg_match("/EdiApp_/",$name)){
370 $appname = $value;
371 /* We've got the appname, get parameters from ldap */
372 $ldap= $this->config->get_ldap_link();
373 $ldap->cd($this->config->current['BASE']);
374 $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))");
375 if ($ldap->count() != 1){
376 print_red (_("The selected application name is not uniq. Please check your LDAP."));
377 } else {
378 $attrs= $ldap->fetch();
379 if(isset($attrs['gosaApplicationParameter'])){
380 $this->dialog= TRUE;
382 /* Fill name and value arrays */
383 for ($i= 0; $i<$attrs['gosaApplicationParameter']['count']; $i++){
384 $option= preg_replace('/^[^:]+:/', '',
385 $attrs['gosaApplicationParameter'][$i]);
386 $name= preg_replace('/:.*$/', '',
387 $attrs['gosaApplicationParameter'][$i]);
388 $this->option_name[$i]= $name;
390 /* Fill with values from application, default should be
391 loaded by the external scripts */
392 if (isset($this->appoption[$name])){
393 $this->option_value[$i]= $this->appoption[$name];
394 }
395 }
397 /* Create edit field */
398 $table= "<table summary=\"\">";
399 for ($i= 0; $i < count($this->option_name); $i++){
400 if (isset($this->option_value[$i])){
401 $value= $this->option_value[$i];
402 } else {
403 $value= "";
404 }
405 $table.="<tr><td>".$this->option_name[$i]."</td><td>".
406 "<input name=\"value$i\" size=60 maxlength=250 ".
407 "value=\"".$value."\"><br></td></tr>";
408 }
409 $table.= "</table>";
410 $this->table= $table;
411 } else {
412 print_red (_("The selected application has no options."));
413 }
414 }
415 }
416 }
417 $this->reload();
419 /* Add group with post */
420 if((isset($_GET['act']))&&($_GET['act']=="add")){
421 $this->used_apps[$_GET['id']]= $_GET['id'];
422 asort($this->used_apps);
423 $this->addApp($_GET['id']);
424 }
426 /* Add multiple */
427 if(isset($_POST['AddApps'])){
428 foreach($_POST as $name => $value){
429 if(preg_match("/AddApp_/",$name)){
430 $app = preg_replace("/AddApp_/","",$name);
431 $this->addApp($app);
432 }
433 }
434 }
437 /* Cancel edit options? */
438 if (isset($_POST['edit_options_cancel'])){
439 $this->dialog= FALSE;
440 }
442 /* Finish edit options? */
443 if (isset($_POST['edit_options_finish'])){
444 $this->dialog= FALSE;
446 /* Save informations passed by the user */
447 $this->option_value= array();
448 for ($i= 0; $i<count($this->option_name); $i++){
449 $this->appoption[$this->option_name[$i]]= $_POST["value$i"];
450 $this->is_modified= TRUE;
451 }
452 }
454 /* Prepare templating stuff */
455 $smarty= get_smarty();
456 $smarty->assign("used_apps", $this->used_apps);
457 $apps= array();
458 foreach ($this->apps as $key => $value){
459 if (!array_key_exists($key, $this->used_apps)){
460 $apps["$key"]= "$value";
461 }
462 }
464 $div = new DivSelectBox("appgroup");
466 $div->SetHeight(300);
468 /* NEW LIST MANAGMENT
469 * We also need to search for the departments
470 * So we are able to navigate like in konquerer
471 */
473 $ldap = $this->config->get_ldap_link();
474 $ldap->cd($this->curbase) ;
475 $ldap->ls("(objectClass=gosaDepartment)");
476 $departments= array();
477 $tmp = array();
478 while ($value = $ldap->fetch()){
479 $tmp[strtolower($value['dn']).$value['dn']]=$value;
480 }
481 ksort($tmp);
482 foreach($tmp as $value){
483 if($value["description"][0]!=".."){
484 $departments[$value['dn']]=convert_department_dn($value['dn'])." - [".$value["description"][0]."]";
485 }else{
486 $departments[$value['dn']]=convert_department_dn($value['dn']);
487 }
488 }
490 /* END NEW LIST MANAGMENT
491 */
493 $linkopen = "<a href='?plug=".$_GET['plug']."&act=depopen&depid=%s'>%s</a>";
494 $linkadd = "<a href='?plug=".$_GET['plug']."&act=add&id=%s'>%s</a>";
496 $base_back = preg_replace("/^[^,]+,/","",$this->curbase);
497 if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($this->curbase!=$this->config->current['BASE'])){
498 $div->AddEntry(array(
499 array("string"=>sprintf($linkopen,base64_encode($base_back),".. ["._("back")."]"),
500 "attach"=>"style='border:0px;'")
501 ));
502 }
503 foreach($departments as $key => $app){
504 $div->AddEntry(array(
505 array("string"=>"<img src='images/folder.png' alt='"._("department")."'> ".sprintf($linkopen,base64_encode($key),$app),
506 "attach"=>"style='border:0px;'")
507 ));
508 }
510 foreach($apps as $key => $app){
511 $div->AddEntry(array(
512 array("string"=>sprintf("<input type='checkbox' value='1' name='AddApp_%s'>",$key).
513 "<img src='images/select_application.png' alt='"._("application")."'> ".sprintf($linkadd,$key,$app),
514 "attach"=>"style='border:0px;'")
515 ));
516 }
518 if((isset($_GET['act']))&&(($_GET['act'] == "cat_up")||($_GET['act']=="cat_down"))){
519 if($_GET['act']=="cat_up"){
520 $this->catUp($_GET['id']);
521 }
522 if($_GET['act']=="cat_down"){
523 $this->catDown($_GET['id']);
524 }
525 }
527 if((isset($_GET['act']))&&(($_GET['act'] == "one_up")||($_GET['act']=="one_down"))){
528 if(isset($_GET['id'])){
529 $id = $_GET['id'];
530 $act = $_GET['act'];
531 $found = -1;
532 if(isset($this->gosaMemberApplication[$this->curCatDir])){
533 foreach($this->gosaMemberApplication[$this->curCatDir] as $key => $member){
534 if($id == $member['App']){
535 $found = $key;
536 }
537 }
538 }
540 if($found != -1){
541 if($act == "one_up"){
542 $this->getOneUp($found);
543 }elseif($act == "one_down") {
544 $this->getOneDown($found);
545 }
546 }
547 }
548 }
550 $div2 = new DivSelectBox("appgroup");
551 $div2->SetHeight(300);
553 $linkopen = "<img src='images/folder.png'> <a href='?plug=".$_GET['plug']."&act=open&id=%s'>%s</a>";
554 $catremove = " <input type='image' src='images/edittrash.png' name='DelCat_%s' value='%s'>";
555 $app = "<img src='images/select_application.png'> %s";
557 $catupdown = "<a href='?plug=".$_GET['plug']."&act=cat_up&id=%s'>
558 <img src='images/sort_up.png' border=0></a> <a href='?plug=".$_GET['plug']."&act=cat_down&id=%s'>
559 <img src='images/sort_down.png' border=0></a>";
561 if(empty($this->curCatDir)){
562 $cnt =0;
563 }else{
564 $cnt = count(split("/",$this->curCatDir));
565 $tmp = split("/",$this->curCatDir);
566 $bbk = "";
567 for($i = 0 ; $i < ($cnt -1 ) ; $i++){
568 $bbk .= $tmp[$i];
569 }
570 $div2 ->AddEntry(array(array("string"=>sprintf($linkopen,$bbk,"..")),array("string"=>" ","attach"=>"style='border-right:0px;'")));
571 }
573 $this->GetSubdirs($this->curCatDir);
575 foreach($this->GetSubdirs($this->curCatDir) as $path => $name){
576 $div2 ->AddEntry(array(
577 array("string"=>sprintf($linkopen,$path,$name)),
578 array("string"=>preg_replace("/%s/",$path,$catupdown.$catremove).
579 "<img src='images/empty.png' width='19px'>",
580 "attach"=>"align='right' style='width:80px;border-right:0px;'")));
581 }
583 /* Append entries */
585 $separator ="<hr height=1 size=1></hr>";
587 $upudown = "<a href='?plug=".$_GET['plug']."&act=one_up&id=%s'> <img src='images/sort_up.png' border=0></a>".
588 " <a href='?plug=".$_GET['plug']."&act=one_down&id=%s'> <img src='images/sort_down.png' border=0></a>".
589 " <input type='image' src='images/edittrash.png' name='DelApp_%s' value='%s'>";
590 $edit= " <input type='image' src='images/edit.png' name='EdiApp_%s' value='%s'>";
592 if(isset($this->gosaMemberApplication[$this->curCatDir])){
593 foreach($this->gosaMemberApplication[$this->curCatDir] as $cat => $entry){
594 if(preg_match("/__SEPARATOR__/",$entry['App'])){
595 $div2 ->AddEntry(array(array("string"=>$separator),
596 array("string"=>preg_replace("/\%s/",$entry['App'],$upudown."<img src='images/empty.png' width='19px'>"),"attach"=>"align='right' style='border-right:0px;'")));
597 }else{
598 $div2 ->AddEntry(array(array("string"=>sprintf($app,$entry['App'])),
599 array("string"=>preg_replace("/\%s/",$entry['App'],$upudown.$edit),"attach"=>"align='right' style='border-right:0px;'")));
600 }
601 }
602 }
604 $smarty->assign("UsedApps", $div2->DrawList());
605 $smarty->assign("List", $div->DrawList());
606 $smarty->assign("apps", $apps);
608 /* Show main page */
609 if ($this->dialog){
610 $smarty->assign("table", $this->table);
611 $display.= $smarty->fetch (get_template_path('application_options.tpl', TRUE));
612 } else {
613 $display.= $smarty->fetch (get_template_path('application.tpl', TRUE));
614 }
615 return ($display);
616 }
619 function remove_from_parent()
620 {
621 plugin::remove_from_parent();
623 $this->attrs["gosaMemberApplication"]= array();
625 $ldap= $this->config->get_ldap_link();
626 $ldap->cd($this->dn);
627 $ldap->modify($this->attrs);
628 show_ldap_error($ldap->get_error());
630 /* Optionally execute a command after we're done */
631 $this->handle_post_events("remove");
632 }
635 /* Save to LDAP */
636 function save()
637 {
638 plugin::save();
640 /* Copy members */
641 $this->Categories[""]="";
642 $this->attrs["gosaMemberApplication"]= array();
643 $cats = array();
644 foreach($this->Categories as $name => $cats){
645 $cats[$name] =0;
646 if(isset($this->gosaMemberApplication[$name])){
647 foreach($this->gosaMemberApplication[$name] as $entry){
648 if(!preg_match("/__SEPARATOR__/",$entry['App'])){
649 $this->attrs["gosaMemberApplication"][]= $entry['App']."|".$name."|".$cats[$name];
650 }
651 $cats[$name] = $cats[$name] + 1;
652 }
653 }
654 if(($cats[$name]==0)&&(!empty($name))){
655 $this->attrs["gosaMemberApplication"][]= "|".$name."|".$cats[$name];
656 }
657 }
659 /* Are there application parameters to be saved */
660 $this->attrs['gosaApplicationParameter']= array();
661 foreach($this->appoption as $name => $value){
662 if ($value != ""){
663 $this->attrs['gosaApplicationParameter'][]= "$name:$value";
664 }
665 }
667 /* Write back to LDAP */
668 $ldap= $this->config->get_ldap_link();
669 $ldap->cd($this->dn);
670 $ldap->modify($this->attrs);
671 show_ldap_error($ldap->get_error());
673 /* Optionally execute a command after we're done */
674 if ($this->initially_was_account == $this->is_account){
675 if ($this->is_modified){
676 $this->handle_post_events("mofify");
677 }
678 } else {
679 $this->handle_post_events("add");
680 }
682 }
684 function check()
685 {
686 $message= array();
687 return ($message);
688 }
691 function reload()
692 {
693 /* Generate applist */
694 $this->apps= array();
695 $ldap= $this->config->get_ldap_link();
696 $ldap->cd ("ou=apps,".$this->curbase);
698 $ldap->ls ("(objectClass=gosaApplication)","ou=apps,".$this->curbase);
699 while ($attrs= $ldap->fetch()){
700 if (isset($attrs["description"][0])){
701 $this->apps[$attrs["cn"][0]]=
702 $attrs["cn"][0]." (".
703 $attrs["description"][0].")";
704 } else {
705 $this->apps[$attrs["cn"][0]]=
706 $attrs["cn"][0];
707 }
708 }
709 natcasesort ($this->apps);
710 reset ($this->apps);
712 if(is_array($this->gosaMemberApplication))
713 foreach ($this->gosaMemberApplication as $cat){
714 if(is_array($cat))
715 foreach($cat as $entry){
716 $this->used_apps[$entry['App']]= $entry['App'];
717 }
718 }
719 }
722 function addApp($cn)
723 {
724 if((isset($this->gosaMemberApplication[$this->curCatDir]))&&(is_array($this->gosaMemberApplication[$this->curCatDir]))){
725 foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
726 if($entry['App'] == $cn) return;
727 }
728 }
729 $this->gosaMemberApplication[$this->curCatDir][]= array("App"=>$cn);
730 $this->used_apps[$cn]=$cn;
731 $this->is_modified= TRUE;
732 }
735 function removeApp($cn)
736 {
737 $temp= array();
738 foreach ($this->gosaMemberApplication as $value){
739 if ($value != $cn){
740 $temp[]= $value;
741 }
742 }
743 $this->gosaMemberApplication= $temp;
744 $this->is_modified= TRUE;
745 }
747 function GetSubdirs($dir)
748 {
749 $ret = array();
750 $tmp1 = split("/",$this->curCatDir);
752 foreach($this->Categories as $path=>$cat){
753 $tmp2 = split("/",$path);
755 if((empty($this->curCatDir))&&(!preg_match("/\//",$path))){
756 $abort = false;
757 }elseif(((count($tmp1))+1) == (count($tmp2))){
758 $abort = false;
759 for($i = 0 ; $i < count($tmp1) ; $i++){
760 if($tmp1[$i] != $tmp2[$i]){
761 $abort = true;
762 }
763 }
764 }else{
765 $abort= true;
766 }
767 if(!$abort){
768 $ret[$path]=$cat;
769 }
770 }
771 return($ret);
772 }
774 }
776 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
777 ?>