Code

Added a first set of reference changes - nearly untested
[gosa.git] / plugins / admin / systems / class_servDHCP.inc
1 <?php
3 class servdhcp extends goService
4 {
5   /* attribute list for save action */
6   var $attributes= array("dhcpServiceDN");
7   var $objectclasses= array("dhcpServer");
8   var $conflicts        = array("servdhcp");
9   var $dhcpServiceDN= "";
11   /* Section storage */
12   var $dhcpSections= array();
13   var $dhcpObjectCache= array();
14   var $current_object= "";
15   var $types= array();
16   var $serviceDN= "";
18         var $quote_option = array("domain-name");
20   var $orig_dn = "";
22   var $dhcp_server_list   = array("ENTRIES"=> array(),"FOR_LIST"=> array());
23   var $take_over_id       = -1;
24   var $display_warning  = TRUE;
26   function servdhcp (&$config, $dn= NULL, $parent= NULL)
27   {
28     plugin::plugin ($config, $dn, $parent);
30     $this->serviceDN = "cn=dhcp,".$dn;
31     $this->orig_dn = $dn;
33     $this->DisplayName = _("DHCP service");
35     $this->types= array(  "dhcpLog" => _("Logging"),
36             "dhcpService" => _("Global options"),
37             "dhcpClass" => _("Class"),
38             "dhcpSubClass" => _("Subclass"),
39             "dhcpHost" => _("Host"),
40             "dhcpGroup" => _("Group"),
41             "dhcpPool" => _("Pool"),
42             "dhcpSubnet" => _("Subnet"),
43             "dhcpFailOverPeer" => _("Failover peer"),
44             "dhcpSharedNetwork" => _("Shared network"));
47     /* Backport: PHP4 compatibility  */
48     foreach($this->types as $type => $translation){
49             $this->types[strtolower($type)] = $translation;
50     }
52     /* Load information about available services */
53     $this->reload(); 
54     if (!count($this->dhcpSections)){
55       $this->is_account= FALSE;
56       $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
57     }
58   }
61   function execute()
62   {
63     /* Call parent execute */
64     plugin::execute();
66     /* Fill templating stuff */
67     $smarty= get_smarty();
68     $smarty->assign("dns_take_over",FALSE);
69     $display= "";
72     /*****************/
73     /* Handle Take Over Actions 
74     /*****************/
76     /* Give smarty the required informations */
77     $smarty->assign("dhcp_server_list", $this->dhcp_server_list['FOR_LIST']);
78     $smarty->assign("dhcp_server_list_cnt", count($this->dhcp_server_list['FOR_LIST']));
79     
80     /* Take over requested, save id */
81     if(isset($_POST['take_over_src']) && isset($_POST['take_over'])){
82       $id = $_POST['take_over_src'];
83       if(isset($this->dhcp_server_list['ENTRIES'][$id])){
84         $this->take_over_id = $id;      
85       }
86     }
87  
88     /* Abort take over action */ 
89     if(isset($_POST['cancel_take_over'])){
90       $this->dialog =false;
91       $this->take_over_id = -1;
92       $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
93     }
95     /* Display informartion about take over that will be started when saving this server 
96      *  and hide default dhcp output
97      */
98     if($this->take_over_id != -1){
100       $this->dialog = FALSE;
101       $id = $this->take_over_id;
102       $smarty->assign("dns_take_over",TRUE);
103       $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),
104         $this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
105       $warning.= "&nbsp;"._("The migration will be started when you save this system. To cancel this action, use the cancel button below.");
107       if($this->display_warning){
108         print_red($warning);
109         $this->display_warning = FALSE;
110       }
111       return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE)));
112     }
114     
115     /*****************/
116     /* List handling  
117     /*****************/
119     /* Section Creation? */
120     if (isset($_POST['create_section']) && isset($_POST['section'])){
121       $section= $_POST['section'];
122       $tmp = new dhcpNewSectionDialog(NULL);
123       if (isset($tmp->sectionMap[$section])){
124         $this->dialog= new $section($this->current_object);
125         $this->current_object= "";
126       } else {
127         $this->dialog= NULL;
128       }
129     }
131     /* Cancel section creation? */
132     if (isset($_POST['cancel_section']) || isset($_POST['cancel_dhcp'])){
133       $this->dialog= NULL;
134     }
136     /* Save changes */
137     if (isset($_POST['save_dhcp'])){
138       $this->dialog->save_object();
139       $messages= $this->dialog->check($this->dhcpObjectCache);
140       if (count($messages)){
141         show_errors($messages);
142       } else {
143         $dn= $this->dialog->dn;
144         $class= get_class($this->dialog);
145         $type= $this->types[$class];
146                 if(empty($this->serviceDN)){
147                         $indent= substr_count(preg_replace("/".$this->dn."/", '', $dn), ",") -1;
148                 }else{
149                         $indent= substr_count(preg_replace("/".$this->serviceDN."/", '', $dn), ",");
150                 }
151                 $spaces= "";
152                 for ($i= 0; $i<$indent; $i++){
153           $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
154         }
155         $data= $this->dialog->save();
156         if ($this->current_object == ""){
157           /* New object */
158           $newsects= array();
159           foreach ($this->dhcpSections as $key => $dsc){
160             $newsects[$key]= $dsc;
161             if ($key == $dn){
162               $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
163               $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
164             }
165           }
166           $this->dhcpObjectCache[$data['dn']]= $data;
167           $this->dhcpSections= $newsects;
168         } else {
169           if ($dn != $data['dn']){
170             /* Old object, new name */
171             $this->dhcpObjectCache[$dn]= array();
172             $this->dhcpObjectCache[$data['dn']]= $data;
174             /* If we renamed a section, we've to rename a couple of objects, too */
175             foreach ($this->dhcpObjectCache as $key => $dsc){
176               if (preg_match("/,$dn$/", $key)){
177                 $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
178                 $dsc['MODIFIED']= TRUE;
179                 $this->dhcpObjectCache[$new_dn]= $dsc;
180                 unset($this->dhcpObjectCache[$key]);
181               }
182             }
183             $newsects= array();
184             foreach ($this->dhcpSections as $key => $dsc){
185               if ($key == $dn){
186                 $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
187                 continue;
188               }
189               if (preg_match("/,$dn$/", $key)){
190                 $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
191                 $newsects[$new_dn]= $dsc;
192               } else {
193                 $newsects[$key]= $dsc;
194               }
195             }
196             $this->dhcpSections= $newsects;
198           } else {
199             /* Old object, old name */
200             $this->dhcpObjectCache[$data['dn']]= $data;
201           }
202         }
203         $this->dialog= NULL;
204       }
205     }
207     /* Remove section? */
208     if (isset($_POST['delete_dhcp_confirm'])){
209       if ($this->acl_is_removeable()){
210         unset($this->dhcpSections[$this->current_object]);
211         unset($this->dhcpObjectCache[$this->current_object]);
212         $this->dhcpObjectCache[$this->current_object]= array();
213         foreach ($this->dhcpSections as $key => $value){
214           if (preg_match("/".$this->current_object."$/", $key)){
215             unset($this->dhcpSections[$key]);
216             unset($this->dhcpObjectCache[$key]);
217             $this->dhcpObjectCache[$key]= array();
218           }
219         }
220       } else {
221         print_red(_("You're not allowed to remove DHCP sections!"));
222       }
223       $this->dialog= NULL;
224     }
226     /* Look for post entries */
227     foreach($_POST as $name => $value){
228       
229       /* Insert new section? */
230       if (preg_match('/^insertDhcp_.*_x$/', $name)){
231         $dn= base64_decode(preg_replace('/^insertDhcp_([^_]+)_x$/', '\1', $name));
232         if (isset($this->dhcpObjectCache[$dn])){
233           $this->dialog= new dhcpNewSectionDialog($this->objectType($dn));
234           $this->current_object= $dn;
235           $this->dialog->acl= $this->acl;
236         }
237       }
239       /* Edit section? */
240       if (preg_match('/^editDhcp_.*_x$/', $name)){
241         $dn= base64_decode(preg_replace('/^editDhcp_([^_]+)_x$/', '\1', $name));
242         if (isset($this->dhcpObjectCache[$dn])){
243           $section= $this->objectType($dn);
244           $this->current_object= $dn;
245           $this->dialog= new $section($this->dhcpObjectCache[$dn]);
246         }
247       }
249       /* Remove section? */
250       if (preg_match('/^delDhcp_.*_x$/', $name)){
251         $dn= base64_decode(preg_replace('/^delDhcp_([^_]+)_x$/', '\1', $name));
252         if (isset($this->dhcpObjectCache[$dn])){
253           $this->current_object= $dn;
254           $this->dialog= 1;
255           $smarty->assign("warning", sprintf(_("You're about to delete the DHCP section '%s'."), $dn));
256           return($smarty->fetch(get_template_path('remove_dhcp.tpl', TRUE)));
257         }
258       }
260     }
262     if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
263       $dn = base64_decode($_GET['id']);
264       if (isset($this->dhcpObjectCache[$dn])){
265         $section= $this->objectType($dn);
266         $this->current_object= $dn;
267         $this->dialog= new $section($this->dhcpObjectCache[$dn]);
268       }
269     }
270     
272     if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
273       $dn = base64_decode($_GET['id']);
274       if (isset($this->dhcpObjectCache[$dn])){
275         $section= $this->objectType($dn);
276         $this->current_object= $dn;
277         $this->dialog= new $section($this->dhcpObjectCache[$dn]);
278       }
279     }
280     
282     /* Do we need to flip is_account state? */
283     if (isset($_POST['modify_state'])){
284       $this->is_account= !$this->is_account;
285     }
287     /* Show tab dialog headers */
288     if ($this->is_account){
289 #      $display= $this->show_header(_("Remove DHCP service"),
290 #          _("This server has DHCP features enabled. You can disable them by clicking below."));
292       if (!count($this->dhcpObjectCache)){
293         $attrs= array();
294         $attrs['dn']= 'cn=dhcp,'.$this->dn;
295         $attrs['cn']= array('dhcp');
296         $attrs['objectClass']= array('top', 'dhcpService');
297         $attrs['dhcpPrimaryDN']= array($this->dn);
298         $attrs['dhcpStatements']= array("default-lease-time 600",
299                                         "max-lease-time 1200",
300                                         "authoritative",
301                                         "ddns-update-style none");
302         $attrs['MODIFIED']= TRUE;
303         $this->dhcpSections['cn=dhcp,'.$this->dn]= _("Global options");
304         $this->dhcpObjectCache['cn=dhcp,'.$this->dn]= $attrs;
305       }
307     } else {
308 #      $display= $this->show_header(_("Add DHCP service"),
310 #          _("This server has DHCP features disabled. You can enable them by clicking below."));
311       return ($display);
312     }
315     /* Show dialog
316      */
317     if($this->dialog != NULL && !is_int($this->dialog)){
318       $this->dialog->save_object();
319       $this->dialog->parent = $this;
320       return($this->dialog->execute());
321     }
323     /* Create Listbox with existing Zones
324      */
325     $DhcpList = new divSelectBox("dhcpSections");
326     $DhcpList->SetHeight(400);
328     /* Add entries to divlist
329      */
330     $editImgIns = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
331       "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
332       "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
333     $editImgInsNoDel = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
334       "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>";
335     $editImg = "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
336       "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
337         
338     $tmp = new dhcpNewSectionDialog(NULL);
339     foreach($this->dhcpSections as $section => $values ){
340     
341       $values = "<a href='?plug=".$_GET['plug']."&act=edit&id=".base64_encode($section)."'>".$values."</a>";
342         
343       if (count($tmp->sectionMap[$this->objectType($section)])){
344         if ($this->objectType($section) == "dhcpService"){
345           $DhcpList->AddEntry(array(
346               array("string" => $values),
347               array("string" => str_replace("%s",base64_encode($section),$editImgInsNoDel), "attach" => "style='text-align:right;'")
348               ));
349         } else {
350           $DhcpList->AddEntry(array(
351               array("string" => $values),
352               array("string" => str_replace("%s",base64_encode($section),$editImgIns), "attach" => "style='text-align:right;'")
353               ));
354         }
355       } else {
356         $DhcpList->AddEntry(array(
357               array("string" => $values),
358               array("string" => str_replace("%s",base64_encode($section),$editImg), "attach" => "style='text-align:right;'")
359               ));
360       }
361     }
363     /* Display tempalte */
364     $smarty->assign("DhcpList",$DhcpList->DrawList());
365     $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE));
366     return($display);
367   }
370   function remove_from_parent()
371   {
372     /* Cancel if there's nothing to do here */
373     if (!$this->initially_was_account){
374       return;
375     }
377     /* Remove subtrees */
378     $ldap= $this->config->get_ldap_link();
379     foreach ($this->dhcpObjectCache as $dn => $content){
380       if ($this->objectType($dn) == 'dhcpService'){
381         $ldap->rmdir_recursive($dn);
382         show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
383       }
384     }
386     /* Remove from self */
387     $ldap= $this->config->get_ldap_link();
389     /* Remove and write to LDAP */
390     plugin::remove_from_parent();
391     
392     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save");
393     $ldap->cd($this->dn);
394     $this->cleanup();
395     $ldap->modify ($this->attrs);
397     show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
399     /* Optionally execute a command after we're done */
400     $this->handle_post_events("remove");
401   }
404   /* Save data to object */
405   function save_object()
406   {
407     plugin::save_object();
408   }
411   /* Check supplied data */
412   function check()
413   {
414     /* Call common method to give check the hook */
415     $message= plugin::check();
416     
417     return ($message);
418   }
421   /* Save to LDAP */
422   function save()
423   {
424     /* Take over handling 
425      * - Load servdhcp class and dhcpObjectCache for the source dhcp setup.
426      * - Assign dhcpObjectCache to this configuration. 
427      * - Save this setup and remove source setup from ldap.
428      */
429     if($this->take_over_id != -1){
430       $id = $this->take_over_id;
431       $src = preg_replace("/cn=dhcp,/","",$this->dhcp_server_list['ENTRIES'][$id]['dn']);
432       $tmp = new servdhcp ($this->config, $src);
433       $this->orig_dn = $src;
434       $this->dhcpObjectCache =  $tmp->dhcpObjectCache;
435     }
437     /* Save dhcp setttings */
438     $ldap= $this->config->get_ldap_link();
439     foreach ($this->dhcpObjectCache as $dn => $data){
441       if($this->dn != $this->orig_dn){
442         $dn = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$dn);
443       }
445       /* Remove entry? */
446       if (count($data) == 0){
447         /* Check if exists, then remove... */
448         if($ldap->cat($dn)){
449           $ldap->rmdir_recursive($dn);
450           show_ldap_error($ldap->get_error(), _("Can't remove DHCP object!"));
451         }
452         continue;
453       }
455       /* Modify existing entry? */
456       if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){
458         if($ldap->cat($dn)){
459           $modify= TRUE;
460         } else {
461           $modify= FALSE;
462         }
464         /* Build new entry */
465         $attrs= array();
466         foreach ($data as $attribute => $values){
467           if ($attribute == "MODIFIED" || $attribute == "dn"){
468             continue;
469           }
470       
471           if(in_array($attribute,array("dhcpPrimaryDN","dhcpSecondaryDN","dhcpServerDN","dhcpFailOverPeerDN"))){
472             foreach($values as $v_key => $value){
473               $values[$v_key] = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$value);
474             }
475           }
477           if (count($values)){
479             if($attribute == "dhcpOption"){
480               foreach($values as $key => $value){
481                 $option_name = trim(preg_replace("/[^ ]*$/","",$value));
482                 $option_value= trim(preg_replace("/^[^ ]*/","",$value));
483                 if(in_array($option_name,$this->quote_option)){
484                   $values[$key] = $option_name." \"".$option_value."\"";
485                 }
486               }
487             }
488             if (count($values) == 1){
489               $attrs[$attribute]= $values[0];
490             } else {
491               $attrs[$attribute]= $values;
492             }
493           } else {
494             if ($modify){
495               $attrs[$attribute]= array();
496             }
497           }
498         }
500         $ldap->cd($dn);
501         if ($modify){
502           $ldap->modify($attrs);
503           show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
504         } else {
505           $ldap->add($attrs);
506           show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
507         }
508       }
509     }
511     $this->dhcpServiceDN= $this->serviceDN;
512     if($this->dn != $this->orig_dn){
513       $this->dhcpServiceDN= preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$this->dhcpServiceDN);
514     }
516     /* Replace 'new' dn */ 
517     if(preg_match("/new$/",$this->dhcpServiceDN)){
518       $this->dhcpServiceDN = preg_replace("/new$/",$this->dn,$this->dhcpServiceDN);
519     }
521     plugin::save();
522     
523     /* Save data to LDAP */
524     $ldap->cd($this->dn);
525     $this->cleanup();
526     $ldap->modify ($this->attrs);
528     show_ldap_error($ldap->get_error(), _("Saving DHCP service failed"));
530     /* Optionally execute a command after we're done */
531     if ($this->initially_was_account == $this->is_account){
532       if ($this->is_modified){
533         $this->handle_post_events("modify");
534       }
535     } else {
536       $this->handle_post_events("add");
537     }
539     /* Take over handling
540      * - Remove old dhcp config from source server 
541      */
542     if($this->take_over_id != -1){
543       $id = $this->take_over_id;
544       $src = $this->dhcp_server_list['ENTRIES'][$id]['dn'];
545       $tmp = new servdhcp ($this->config, $src);
546       $tmp->remove_from_parent();
547     }
548   }
551   function reload()
552   {
553     /* Init LDAP and load list */
554     $ldap= $this->config->get_ldap_link();
555     $ui= get_userinfo();
556     $me= $this->dn;
558     $filter = "(&(objectClass=dhcpService)(|(dhcpPrimaryDN=$me)(dhcpSecondaryDN=$me)(dhcpServerDN=$me)(dhcpFailOverPeerDN=$me)))";
560     $list= get_list($filter, array("server"), $this->config->current['BASE'], array("cn"),GL_SIZELIMIT | GL_SUBSEARCH);
561     $final= array();
563     foreach ($list as $value){
565       /* Set header */
566       $sortpart= split(",", $value['dn']);
567       $sortpart= array_reverse($sortpart);
568       $tmp= implode(",", $sortpart);
570       $final[$value['dn']]= $tmp."!"._("Global options");
572       /* Read all sub entries to place here */
573       $ldap->cd($value['dn']);
574       $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpLog)(objectClass=dhcpClass)(objectClass=dhcpSubClass)(objectClass=dhcpHost)(objectClass=dhcpGroup)(objectClass=dhcpPool)(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork)(objectClass=dhcpOptions)(objectClass=dhcpTSigKey)(objectClass=dhcpDnsZone)(objectClass=dhcpFailOverPeer))", array());
575       $this->serviceDN= $value['dn'];
577       while ($attrs= $ldap->fetch()){
578         $sattrs= array();
579         for ($i= 0; $i<$attrs['count']; $i++){
580           $sattrs[$attrs[$i]]= $attrs[$attrs[$i]];
581           unset($sattrs[$attrs[$i]]['count']);
582         }
583         $sattrs['dn']= $ldap->getDN();
585         foreach($sattrs as $name => $values){
586           if($name == "dhcpOption"){
587             foreach($values as $key => $value){
588               $value_name = trim(preg_replace("/[^ ]*$/","",$value));
589               $value_value= trim(preg_replace("/^[^ ]*/","",$value));
590               if(in_array($value_name,$this->quote_option)){
591                 $value_value = preg_replace("/^\"/","",$value_value);
592                 $value_value = preg_replace("/\"$/","",$value_value);
593                 $sattrs[$name][$key] = $value_name." ".$value_value;
594               }
595             }
596           }
597         }
599         $this->dhcpObjectCache[$ldap->getDN()]= $sattrs;
600         $tmp= preg_replace("/".$this->serviceDN."/", "", $ldap->getDN());
601         $indent= substr_count($tmp, ",");
602         $spaces= "";
603         for ($i= 0; $i<$indent; $i++){
604           $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
605         }
607         foreach ($this->types as $key => $val){
608           if (in_array("$key", $attrs['objectClass'])){
609             $type= $val;
610             break;
611           }
612         }
614         /* Prepare for sorting... */
615         $sortpart= split(",", $ldap->getDN());
616         $sortpart= array_reverse($sortpart);
617         $tmp= implode(",", $sortpart);
618         $final[$ldap->getDN()]= $tmp."!".$spaces.$type." '".$attrs['cn'][0]."'";
619       }
620     }
622     /* Sort it... */
623     natsort($final);
624     $this->dhcpSections= array();
625     foreach ($final as $key => $val){
626       $this->dhcpSections[$key]= preg_replace('/^[^!]+!(.*)$/', '\\1', $val);
627     }
629   }
632   function objectType($dn)
633   {
634     $type= "";
635     $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
636                   "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
638     foreach ($this->dhcpObjectCache[$dn]['objectClass'] as $oc){
639       if (in_array($oc, $types)){
640         $type= $oc;
641         break;
642       }
643     }
645     /* That should not happen... */
646     if ($type == ""){
647       print_red(_("DHCP configuration set is unknown. Please contact your system administrator."));
648     }
649     
650     return ($type);
651   }
654   /* Return plugin informations for acl handling */
655   function plInfo()
656   {
657     return (array(
658           "plShortName"   => _("DHCP service"),
659           "plDescription" => _("DHCP service")." ("._("Services").")",
660           "plSelfModify"  => FALSE,
661           "plDepends"     => array(),
662           "plPriority"    => 84,
663           "plSection"     => array("administration"),
664           "plCategory"    => array("server"),
666           "plProvidedAcls"=> array(
667             
668           )     
669     ));
670   }
673   function take_over_service()
674   {
676   }
679   function get_list_of_dhcp_servers()
680   {
681     $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
682     $ldap = $this->config->get_ldap_link();
683     $ldap->cd($this->config->current['BASE']);
684     $ldap->search("(&(objectClass=goServer)(dhcpServiceDN=*))",array("dn","cn","dhcpServiceDN"));
685     while($attrs = $ldap->fetch()){
687       /* Skip own config */
688       if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
689         continue;
690       }
692       $ret['ENTRIES'][] = $attrs;
693     }
694     foreach($ret['ENTRIES'] as $key => $data){
695       $ret['FOR_LIST'][$key] = $data['cn'][0];
696     }
697     return($ret);
698   }
701   function getListEntry()
702   {
703     $fields               = goService::getListEntry();
704     $fields['Message']    = _("DHCP service");
705     $fields['AllowEdit']  = true;
706     return($fields);
707   }
711 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
712 ?>