Update functions.php

This commit is contained in:
FusionPBX 2016-08-13 14:12:58 -06:00 committed by GitHub
parent 1eb1413b35
commit ae3fda4c60
1 changed files with 1 additions and 54 deletions

View File

@ -1134,59 +1134,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) {
$dir_list = opendir($dir);
while ($file = readdir ($dir_list)) {
if ($file != '.' && $file != '..') {
$newpath = $dir.'/'.$file;
$level = explode('/',$newpath);
if (substr($newpath, -4) == ".svn" ||
substr($newpath, -4) == ".git") {
//ignore .svn and .git dir and subdir
}
else {
if (is_dir($newpath)) { //directories
$files = recur_sounds_dir($newpath);
}
else { //files
if (strlen($newpath) > 0) {
//make the path relative
$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);
$relative_path = str_replace("/32000/", "/", $relative_path);
$relative_path = str_replace("/48000/", "/", $relative_path);
//remove the default_language, default_dialect, and default_voice (en/us/callie) from the path
$file_array = explode( "/", $relative_path );
$x = 1;
$relative_path = '';
foreach( $file_array as $tmp) {
if ($x == 5) { $relative_path .= $tmp; }
if ($x > 5) { $relative_path .= '/'.$tmp; }
$x++;
}
//add the file if it does not exist in the array
if (isset($dir_array[$relative_path])) {
//already exists
}
else {
//add the new path
if (strlen($relative_path) > 0) { $dir_array[$relative_path] = '0'; }
}
}
}
}
}
}
if (isset($dir_array)) ksort($dir_array, SORT_STRING);
closedir($dir_list);
return $dir_array;
}
}
//function to convert hexidecimal color value to rgb string/array value
if (!function_exists('hex_to_rgb')) {
function hex_to_rgb($hex, $delim = '') {
@ -1976,4 +1923,4 @@ function number_pad($number,$n) {
return false;
}
?>
?>