diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index 64c5da6638..13b364cc63 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -57,7 +57,7 @@ $streams = $database->select($sql, $parameters, 'all'); //get the http post data - if (is_array($_POST['moh']) || is_array($_POST['moh_files'])) { + if (is_array($_POST['moh'])) { $action = $_POST['action']; $moh = $_POST['moh']; } @@ -287,63 +287,6 @@ exit; } -/* -//delete the music on hold file - if ($_GET['action'] == "delete" - && is_uuid($_GET['id']) - && is_array($streams) - && @sizeof($streams) != 0) { - - //get submitted values - $stream_uuid = $_GET['id']; - $stream_file = $_GET['file']; - - //get the record - foreach($streams as $row) { - if ($stream_uuid == $row['music_on_hold_uuid']) { - $stream_domain_uuid = $row['domain_uuid']; - $stream_name = $row['music_on_hold_name']; - $stream_path = $row['music_on_hold_path']; - $stream_rate = $row['music_on_hold_rate']; - break; - } - } - - //replace the sounds_dir variable in the path - $stream_path = str_replace('$${sounds_dir}', $_SESSION['switch']['sounds']['dir'], $stream_path); - - //check permissions - if (($stream_domain_uuid == '' && permission_exists('music_on_hold_domain')) || - ($stream_domain_uuid != '' && permission_exists('music_on_hold_delete'))) { - - //remove specified file - if ($stream_file != '') { - //define path - $stream_full_path = path_join($stream_path, $stream_file); - //sanitize path - $stream_full_path = str_replace('../', '', $stream_full_path); - //delete file - @unlink($stream_full_path); - } - //remove all audio files - else { - array_map('unlink', glob(path_join($stream_path, '*.wav'))); - array_map('unlink', glob(path_join($stream_path, '*.mp3'))); - array_map('unlink', glob(path_join($stream_path, '*.ogg'))); - } - //reload moh - $music = new switch_music_on_hold; - $music->reload(); - //set message - message::add($text['message-delete']); - } - - //redirect - header("Location: music_on_hold.php"); - exit; - } -*/ - //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -412,25 +355,32 @@ } echo " \n"; } - if (permission_exists('music_on_hold_domain')) { - echo " \n"; - } + $local_found = false; foreach ($streams as $row) { - if (strlen($row['domain_uuid']) > 0) { - if (strlen($row['music_on_hold_rate']) == 0) { $option_name = $row['music_on_hold_name']; } - if (strlen($row['music_on_hold_rate']) > 0) { $option_name = $row['music_on_hold_name'] .'/'.$row['music_on_hold_rate']; } - echo " \n"; + if (is_uuid($row['domain_uuid'])) { + $local_found = true; + break; } } - if (permission_exists('music_on_hold_domain')) { - echo " \n"; + if ($local_found) { + if (permission_exists('music_on_hold_domain')) { + echo " \n"; + } + foreach ($streams as $row) { + if (strlen($row['domain_uuid']) > 0) { + if (strlen($row['music_on_hold_rate']) == 0) { $option_name = $row['music_on_hold_name']; } + if (strlen($row['music_on_hold_rate']) > 0) { $option_name = $row['music_on_hold_name'] .'/'.$row['music_on_hold_rate']; } + echo " \n"; + } + } + if (permission_exists('music_on_hold_domain')) { + echo " \n"; + } } - echo " "; echo ""; //rate echo "