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']));
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 }
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 have requested a migration of the DHCP setup from server '%s' to the current one."),
104 $this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
105 $warning.= " "._("The migration will be started when you save this system.");
107 if($this->display_warning){
108 msg_dialog::display(_("Warning"), $warning, WARNING_DIALOG);
109 $this->display_warning = FALSE;
110 }
111 return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE, dirname(__FILE__))));
112 }
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= FALSE;
128 }
129 }
131 /* Cancel section creation? */
132 if (isset($_POST['cancel_section']) || isset($_POST['cancel_dhcp'])){
133 $this->dialog= FALSE;
134 }
136 /* Save changes */
137 if (isset($_POST['save_dhcp'])){
138 $this->dialog->save_object();
139 $messages= $this->dialog->check();
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.= " ";
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.= " ";
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= FALSE;
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 msg_dialog::display(_("Permission error"), _("You have no permission to remove DHCP sections!"), ERROR_DIALOG);
222 }
223 $this->dialog= FALSE;
224 }
226 /* Look for post entries */
227 foreach($_POST as $name => $value){
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, dirname(__FILE__))));
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 }
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 }
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(isset($this->dialog) && is_object($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")."'>";
338 $tmp = new dhcpNewSectionDialog(NULL);
339 foreach($this->dhcpSections as $section => $values ){
341 $values = "<a href='?plug=".$_GET['plug']."&act=edit&id=".base64_encode($section)."'>".$values."</a>";
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, dirname(__FILE__)));
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();
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();
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 /* Opdate dhcp option 'server-name' to actual server name */
456 if($this->dn != $this->orig_dn){
457 $fixed = FALSE;
458 foreach(array("dhcpHost","dhcpSubnet","dhcpGroup","dhcpSharedNetwork") as $object){
459 if(in_array($object,$data['objectClass']) && isset($data['dhcpOption'])){
460 foreach($data['dhcpOption'] as $key => $option){
461 if(preg_match("/^server-name /",$option)){
462 $data['dhcpOption'][$key] = "server-name ".$this->cn;
463 $data['MODIFIED'] = TRUE;
464 break;
465 }
466 }
467 }
469 /* Skip next loops if entry is updated */
470 if($fixed){
471 break;
472 }
473 }
474 }
476 /* Modify existing entry? */
477 if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){
479 if($ldap->cat($dn)){
480 $modify= TRUE;
481 } else {
482 $modify= FALSE;
483 }
485 /* Build new entry */
486 $attrs= array();
487 foreach ($data as $attribute => $values){
488 if ($attribute == "MODIFIED" || $attribute == "dn"){
489 continue;
490 }
492 if(in_array($attribute,array("dhcpPrimaryDN","dhcpSecondaryDN","dhcpServerDN","dhcpFailOverPeerDN"))){
493 foreach($values as $v_key => $value){
494 $values[$v_key] = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$value);
495 }
496 }
498 if (count($values)){
500 if($attribute == "dhcpOption"){
501 foreach($values as $key => $value){
502 $option_name = trim(preg_replace("/[^ ]*$/","",$value));
503 $option_value= trim(preg_replace("/^[^ ]*/","",$value));
504 if(in_array($option_name,$this->quote_option)){
505 $values[$key] = $option_name." \"".$option_value."\"";
506 }
507 }
508 }
509 if (count($values) == 1){
510 $attrs[$attribute]= $values[0];
511 } else {
512 $attrs[$attribute]= $values;
513 }
514 } else {
515 if ($modify){
516 $attrs[$attribute]= array();
517 }
518 }
519 }
521 $ldap->cd($dn);
522 if ($modify){
523 $ldap->modify($attrs);
524 show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
526 /* Optionally execute a command after we're done */
527 $this->handle_post_events("modify");
528 } else {
529 $ldap->add($attrs);
530 show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
532 /* Optionally execute a command after we're done */
533 $this->handle_post_events("create");
534 }
535 }
536 }
538 $this->dhcpServiceDN= $this->serviceDN;
539 if($this->dn != $this->orig_dn){
540 $this->dhcpServiceDN= preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$this->dhcpServiceDN);
541 }
543 /* Replace 'new' dn */
544 if(preg_match("/new$/",$this->dhcpServiceDN)){
545 $this->dhcpServiceDN = preg_replace("/new$/",$this->dn,$this->dhcpServiceDN);
546 }
548 plugin::save();
550 /* Save data to LDAP */
551 $ldap->cd($this->dn);
552 $this->cleanup();
553 $ldap->modify ($this->attrs);
555 show_ldap_error($ldap->get_error(), _("Saving DHCP service failed"));
557 /* Optionally execute a command after we're done */
558 if ($this->initially_was_account == $this->is_account){
559 if ($this->is_modified){
560 $this->handle_post_events("modify");
561 }
562 } else {
563 $this->handle_post_events("add");
564 }
566 /* Take over handling
567 * - Remove old dhcp config from source server
568 */
569 if($this->take_over_id != -1){
570 $id = $this->take_over_id;
571 $src = $this->dhcp_server_list['ENTRIES'][$id]['dn'];
572 $tmp = new servdhcp ($this->config, $src);
573 $tmp->remove_from_parent();
574 }
575 }
578 function reload()
579 {
580 /* Init LDAP and load list */
581 $ldap= $this->config->get_ldap_link();
582 $ui= get_userinfo();
583 $me= $this->dn;
585 $filter = "(&(objectClass=dhcpService)(|(dhcpPrimaryDN=$me)(dhcpSecondaryDN=$me)(dhcpServerDN=$me)(dhcpFailOverPeerDN=$me)))";
587 $list= get_list($filter, array("server"), $this->config->current['BASE'], array("cn"),GL_SIZELIMIT | GL_SUBSEARCH);
588 $final= array();
590 foreach ($list as $value){
592 /* Set header */
593 $sortpart= split(",", $value['dn']);
594 $sortpart= array_reverse($sortpart);
595 $tmp= implode(",", $sortpart);
597 $final[$value['dn']]= $tmp."!"._("Global options");
599 /* Read all sub entries to place here */
600 $ldap->cd($value['dn']);
601 $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());
602 $this->serviceDN= $value['dn'];
604 while ($attrs= $ldap->fetch()){
605 $sattrs= array();
606 for ($i= 0; $i<$attrs['count']; $i++){
607 $sattrs[$attrs[$i]]= $attrs[$attrs[$i]];
608 unset($sattrs[$attrs[$i]]['count']);
609 }
610 $sattrs['dn']= $ldap->getDN();
612 foreach($sattrs as $name => $values){
613 if($name == "dhcpOption"){
614 foreach($values as $key => $value){
615 $value_name = trim(preg_replace("/[^ ]*$/","",$value));
616 $value_value= trim(preg_replace("/^[^ ]*/","",$value));
617 if(in_array($value_name,$this->quote_option)){
618 $value_value = preg_replace("/^\"/","",$value_value);
619 $value_value = preg_replace("/\"$/","",$value_value);
620 $sattrs[$name][$key] = $value_name." ".$value_value;
621 }
622 }
623 }
624 }
626 $this->dhcpObjectCache[$ldap->getDN()]= $sattrs;
627 $tmp= preg_replace("/".$this->serviceDN."/", "", $ldap->getDN());
628 $indent= substr_count($tmp, ",");
629 $spaces= "";
630 for ($i= 0; $i<$indent; $i++){
631 $spaces.= " ";
632 }
634 foreach ($this->types as $key => $val){
635 if (in_array("$key", $attrs['objectClass'])){
636 $type= $val;
637 break;
638 }
639 }
641 /* Prepare for sorting... */
642 $sortpart= split(",", $ldap->getDN());
643 $sortpart= array_reverse($sortpart);
644 $tmp= implode(",", $sortpart);
645 $final[$ldap->getDN()]= $tmp."!".$spaces.$type." '".$attrs['cn'][0]."'";
646 }
647 }
649 /* Sort it... */
650 natsort($final);
651 $this->dhcpSections= array();
652 foreach ($final as $key => $val){
653 $this->dhcpSections[$key]= preg_replace('/^[^!]+!(.*)$/', '\\1', $val);
654 }
656 }
659 function objectType($dn)
660 {
661 $type= "";
662 $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
663 "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
665 foreach ($this->dhcpObjectCache[$dn]['objectClass'] as $oc){
666 if (in_array($oc, $types)){
667 $type= $oc;
668 break;
669 }
670 }
672 /* That should not happen... */
673 if ($type == ""){
674 msg_dialog::display(_("Error"), _("The DHCP configuration set is unkown. Please contact your system administrator."), ERROR_DIALOG);
675 }
677 return ($type);
678 }
681 /* Return plugin informations for acl handling */
682 static function plInfo()
683 {
684 return (array(
685 "plShortName" => _("DHCP service"),
686 "plDescription" => _("DHCP service")." ("._("Services").")",
687 "plSelfModify" => FALSE,
688 "plDepends" => array(),
689 "plPriority" => 84,
690 "plSection" => array("administration"),
691 "plCategory" => array("server"),
693 "plProvidedAcls"=> array(
695 )
696 ));
697 }
700 function take_over_service()
701 {
703 }
706 function get_list_of_dhcp_servers()
707 {
708 $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
709 $ldap = $this->config->get_ldap_link();
710 $ldap->cd($this->config->current['BASE']);
711 $ldap->search("(&(objectClass=goServer)(dhcpServiceDN=*))",array("dn","cn","dhcpServiceDN"));
712 while($attrs = $ldap->fetch()){
714 /* Skip own config */
715 if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
716 continue;
717 }
719 $ret['ENTRIES'][] = $attrs;
720 }
721 foreach($ret['ENTRIES'] as $key => $data){
722 $ret['FOR_LIST'][$key] = $data['cn'][0];
723 }
724 return($ret);
725 }
728 function getListEntry()
729 {
730 $fields = goService::getListEntry();
731 $fields['Message'] = _("DHCP service");
732 $fields['AllowEdit'] = true;
733 return($fields);
734 }
736 }
738 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
739 ?>