diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index a43f3d2aff..e7cb59859d 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -527,12 +527,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //sounds if ($load_sound) { - global $dir_path, $dir_array; - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($var, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $var = substr($var, 71); diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 8e6d272dc1..9c99ab67af 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -372,11 +372,10 @@ else { echo "\n"; } //sounds - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($conference_center_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $conference_center_greeting = substr($conference_center_greeting, 71); diff --git a/app/devices/device_vendor_function_edit.php b/app/devices/device_vendor_function_edit.php index 1a8f7f25ea..f7b9ea37c8 100644 --- a/app/devices/device_vendor_function_edit.php +++ b/app/devices/device_vendor_function_edit.php @@ -67,12 +67,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $device_vendor_function_uuid = check_str($_POST["device_vendor_function_uuid"]); - } + //get the uuid + if ($action == "update") { + $device_vendor_function_uuid = check_str($_POST["device_vendor_function_uuid"]); + } //check for all required data + $msg = ''; //if (strlen($label) == 0) { $msg .= $text['message-required']." ".$text['label-label']."
\n"; } if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."
\n"; } if (strlen($value) == 0) { $msg .= $text['message-required']." ".$text['label-value']."
\n"; } diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 125e781b69..c4bc836b9b 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -747,11 +747,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; } //sounds - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($fax_send_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $fax_send_greeting = substr($fax_send_greeting, 71); diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index a350ac447d..32e187bd26 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -479,11 +479,10 @@ } //sounds /* - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($ivr_menu_greet_long, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $ivr_menu_greet_long = substr($ivr_menu_greet_long, 71); @@ -576,11 +575,10 @@ //sounds /* - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($ivr_menu_greet_short, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $ivr_menu_greet_short = substr($ivr_menu_greet_short, 71); @@ -879,11 +877,10 @@ echo "\n"; } //sounds - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($ivr_menu_invalid_sound, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $ivr_menu_invalid_sound = substr($ivr_menu_invalid_sound, 71); @@ -975,11 +972,10 @@ echo "\n"; } //sounds - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($ivr_menu_exit_sound, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $ivr_menu_exit_sound = substr($ivr_menu_exit_sound, 71); diff --git a/app/music_on_hold/music_on_hold_edit.php b/app/music_on_hold/music_on_hold_edit.php index 747ffdd085..6cd89072f6 100644 --- a/app/music_on_hold/music_on_hold_edit.php +++ b/app/music_on_hold/music_on_hold_edit.php @@ -427,11 +427,10 @@ echo "\n"; } //sounds - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if (substr($music_on_hold_chime_list, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { $music_on_hold_chime_list = substr($music_on_hold_chime_list, 71); diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index a15792f34c..dc57eaae39 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -322,12 +322,11 @@ } unset($sql, $prep_statement, $recordings); //sounds - $dir_path = $_SESSION['switch']['sounds']['dir']; - recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - if (count($dir_array) > 0) { + $files = recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + if (count($files) > 0) { echo "var opt_group = document.createElement('optgroup');\n"; echo "opt_group.label = \"".$text['label-sounds']."\";\n"; - foreach ($dir_array as $key => $value) { + foreach ($files as $key => $value) { if (strlen($value) > 0) { if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { echo "opt_group.appendChild(new Option(\"".$key."\", \"lua(streamfile.lua ".$key.")\"));\n"; diff --git a/resources/functions.php b/resources/functions.php index 67f5477e3a..6806f0138d 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -1137,8 +1137,6 @@ function number_pad($number,$n) { //function to show the list of sound files if (!function_exists('recur_sounds_dir')) { function recur_sounds_dir($dir) { - global $dir_array; - global $dir_path; $dir_list = opendir($dir); while ($file = readdir ($dir_list)) { if ($file != '.' && $file != '..') { @@ -1150,12 +1148,12 @@ function number_pad($number,$n) { } else { if (is_dir($newpath)) { //directories - recur_sounds_dir($newpath); + $files = recur_sounds_dir($newpath); } else { //files if (strlen($newpath) > 0) { //make the path relative - $relative_path = substr($newpath, strlen($dir_path), strlen($newpath)); + $relative_path = substr($newpath, strlen($_SESSION['switch']['sounds']['dir']), strlen($newpath)); //remove the 8000-48000 khz from the path $relative_path = str_replace("/8000/", "/", $relative_path); $relative_path = str_replace("/16000/", "/", $relative_path); @@ -1185,6 +1183,7 @@ function number_pad($number,$n) { } if (isset($dir_array)) ksort($dir_array, SORT_STRING); closedir($dir_list); + return $dir_array; } }