function DirsRecursive($ID, $path = "", $depth = 0, $maxDepth = 1) { $arRes = array(); $depth++; GetDirList(BX_PERSONAL_ROOT . "/templates/" . $ID . "/" . $path, $arDirsTmp, $arResTmp); foreach ($arResTmp as $file) { switch ($file["NAME"]) { case "chain_template.php": $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_NAV"); break; case "": $file["DESCRIPTION"] = ""; break; default: if (($p = strpos($file["NAME"], ".menu_template.php")) !== false) { $file["DESCRIPTION"] = str_replace("#MENU_TYPE#", substr($file["NAME"], 0, $p), GetMessage("MAIN_TEMPLATE_MENU")); } elseif (($p = strpos($file["NAME"], "authorize_registration.php")) !== false) { $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_AUTH_REG"); } elseif (($p = strpos($file["NAME"], "forgot_password.php")) !== false) { $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_SEND_PWD"); } elseif (($p = strpos($file["NAME"], "change_password.php")) !== false) { $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_CHN_PWD"); } elseif (($p = strpos($file["NAME"], "authorize.php")) !== false) { $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_AUTH"); } elseif (($p = strpos($file["NAME"], "registration.php")) !== false) { $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_REG"); } } $arRes[] = $file; } $nTemplateLen = strlen(BX_PERSONAL_ROOT . "/templates/" . $ID . "/"); foreach ($arDirsTmp as $dir) { $arDir = $dir; $arDir["DEPTH_LEVEL"] = $depth; $arRes[] = $arDir; if ($depth < $maxDepth) { $dirPath = substr($arDir["ABS_PATH"], $nTemplateLen); $arRes = array_merge($arRes, CSiteTemplate::DirsRecursive($ID, $dirPath, $depth, $maxDepth)); } } return $arRes; }