Get the list of installed languages

This commit is contained in:
FusionPBX 2024-01-10 16:12:32 -07:00 committed by GitHub
parent eb11cbbeed
commit 5b022623c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -1045,6 +1045,20 @@
//change toll allow delimiter
$toll_allow = str_replace(':',',', $toll_allow ?? '');
//get installed languages
$language_paths = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*");
foreach ($language_paths as $key => $path) {
$path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path);
$path_array = explode('/', $path);
if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) {
unset($language_paths[$key]);
}
$language_paths[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$language_paths[$key] ?? '');
if (empty($language_paths[$key])) {
unset($language_paths[$key]);
}
}
//set the defaults
if (empty($user_context)) { $user_context = $_SESSION['domain_name']; }
if (empty($max_registrations)) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric'] ?? ''; }