arraypos=-1; $MenuEntry->menuitem=null; $pos=0; foreach($menuList as $menuItem){ if($option==$menuItem->id){ $MenuEntry->arraypos=$pos; $MenuEntry->menuitem=$menuItem; echo ("_pos_".$pos."\n"); } $pos=$pos+1; } return $MenuEntry; } // Is there any specific boot for MAC? $specificBoot=getClientSpecificBoot($MAC); if ($specificBoot==null) error_log("Mac unregistered"); else error_log($specificBoot); // Write Menu $timeout=getBootTimeOut(); if ($specificBoot!=null) $timeout="1"; // Set to minimum write_header($timeout); // Getting boot order $bootorder=getBootOrder(); // Setting bootlist $bootlist=array(); // Setting menu entries $menuList=array(); // Setting rescue menu entries $rescueMenu=array(); // Include all files in pxemenu.d menu to $menulist foreach (glob("pxemenu.d/*.php") as $filename) { $MenuEntryListObject=null; // $ filename should define $MenuEntryListObject include $filename; if($MenuEntryListObject!=null){ foreach($MenuEntryListObject as $entry){ $current_label=explode("\n", str_replace("label ", "",$entry->menuString))[0]; // If there's not default boot or it exists and is current, let's add. error_log("specific boot:".$specificBoot."*"); error_log("Current Label:".$current_label."*"); array_push($rescueMenu, $entry); // Filling rescue menu if (($specificBoot==null)||($specificBoot==$current_label)) array_push($menuList, $entry); } // If menulist is empty, overwrite by rescuemenu if (count($menuList)==0) { error_log("[LLXBootmanager Warning] Entry ".$specificBoot." does not exists."); $menuList=$rescueMenu; } } } // Ordering menu list foreach ($bootorder as $option){ $entry=findMenuEntry($menuList, $option); // find option in menu list if ($entry->menuitem!=null){ //echo "Adding: ".$entry->menuitem->id." Removing: ".$entry->arraypos."\n"; array_push($bootlist, $entry->menuitem); // Adding menu entry to boot list unset($menuList[$entry->arraypos]); $menuList=array_values($menuList); } } /* REMOVED: * If menu entries are not in list them won't be shown. * // Adding options that are not in the list foreach ($menuList as $entry) array_push($bootlist, $entry); // Adding menu entry to boot list */ foreach ($bootlist as $opt){ //echo $opt->id; echo $opt->menuString."\n"; } ?>