';
$templateVideo = '
';
//Building non-system directories list
$skippingDirectory = [];
array_push($skippingDirectory,$infoFolder);
$skipItems = file_get_contents($infoFolder."/non-system_list.txt") or die("Missing $infoFolder/non-system_list.txt");
$skipItems = explode("\n",$skipItems);
foreach ($skipItems as $dir){
if (substr($dir,0,2) != "//" && $dir != ""){
//Not commented items
array_push($skippingDirectory,trim($dir));
}
}
//Generating System List
$systems = array_filter(glob('*'), 'is_dir');
foreach ($systems as $system){
if (in_array($system,$skippingDirectory) == false){
if (file_exists($system . "/msb/card.mp4") == false){
$box = str_replace("%REDIRECT%",$system . "/",$templateNormal);
if (file_exists($system . "/msb/card.png") == true){
//Module msb supporting profile pic found
$box = str_replace("%MODULE_PIC%",$system . "/msb/card.png",$box);
}else{
//Module msb supporting profile pic not found, use default
$box = str_replace("%MODULE_PIC%","$infoFolder/unknown_module.png",$box);
}
}else{
//Video found, use video as profile pic
$box = str_replace("%REDIRECT%",$system . "/",$templateVideo);
$box = str_replace("%VIDEO_PATH%",$system . "/msb/card.mp4",$box);
}
if (file_exists($system . "/msb/") == true){
//This system support multiple system booting
if (file_exists($system . "/msb/bootConfig.txt")){
//Config exists, use config's data as template
$content = file_get_contents($system . "/msb/bootConfig.txt");
$content = explode("\n",$content);
$btarget = "index.php";
$displayName = $system;
$desc = "N/A";
foreach ($content as $setting){
if (strpos($setting,"bootTarget=") !== false){
$btarget = $system . "/" . str_replace("bootTarget=","",$setting);
}else if (strpos($setting,"displayName=") !== false){
$displayName = str_replace("displayName=","",$setting);
}else if (strpos($setting,"description=") !== false){
$desc = str_replace("description=","",$setting);
}
}
$box = str_replace('href="'.$system.'/"','href="'.$btarget.'"',$box);
$box = str_replace("%MODULE_NAME%",$displayName,$box);
$box = str_replace("%MODULE_DESC%",$desc,$box);
echo $box;
}else{
//Config not exists, use default values
$box = str_replace("%MODULE_NAME%","$system",$box);
$box = str_replace("%MODULE_DESC%","This module has no information readable by Multi System Booting Interface Utilities.",$box);
echo $box;
}
}else{
//This system do not support multiple system booting
$box = str_replace("%REDIRECT%",$system . "/",$templateNormal);
$box = str_replace("%MODULE_PIC%","$infoFolder/unknown_module.png",$box);
$box = str_replace("%MODULE_NAME%","$system",$box);
$box = str_replace("%MODULE_DESC%","This module has no information readable by Multi System Booting Interface Utilities.",$box);
echo $box;
}
}
}
?>