Update recur_sounds_dir to return an array rather than using a global variable.

This commit is contained in:
markjcrane
2016-08-04 09:49:57 -06:00
parent 5a8fd35e48
commit f5959516ed
8 changed files with 35 additions and 45 deletions
+3 -5
View File
@@ -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 "<optgroup label=".$text["sounds"].">\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);
@@ -372,11 +372,10 @@ else {
echo "</optgroup>\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 "<optgroup label='Sounds'>\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);
+5 -4
View File
@@ -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']."<br>\n"; }
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($value) == 0) { $msg .= $text['message-required']." ".$text['label-value']."<br>\n"; }
+3 -4
View File
@@ -747,11 +747,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</optgroup>\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 "<optgroup label='Sounds'>\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);
+12 -16
View File
@@ -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 "<optgroup label='Sounds'>\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 "<optgroup label='Sounds'>\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 "</optgroup>\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 "<optgroup label='Sounds'>\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 "</optgroup>\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 "<optgroup label='Sounds'>\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);
+3 -4
View File
@@ -427,11 +427,10 @@
echo "</optgroup>\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 "<optgroup label='Sounds'>\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);
+3 -4
View File
@@ -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";