"; //print "".$thisfile.""; print "".$thisfile.""; print ""._("Delete").""; print "
"; } } } function process_mohfile($mohfile,$onlywav=false) { global $path_to_dir; $output = 0; $returncode = 0; $mohfile = escapeshellcmd($mohfile); $origmohfile=$path_to_dir."/orig_".$mohfile; $newname = strtr($mohfile,"&", "_"); if(strstr($newname,".mp3")) { $onlywav = false; } if(!$onlywav) { $newmohfile=$path_to_dir."/". ((strpos($newname,'.mp3') === false) ? $newname.".mp3" : $newname); $lamecmd="lame --cbr -m m -t -F \"".$origmohfile."\" \"".$newmohfile."\" 2>&1 "; if (strpos($newmohfile,'.mp3') !== false) exec($lamecmd, $output, $returncode); } else { $newmohfile = $path_to_dir."/wav_".$newname; $soxcmd = "sox \"".$origmohfile."\" -r 8000 -c 1 \"".$newmohfile."\" "; $soxresample = "resample -ql "; exec($soxcmd.$soxresample."2>&1", $output, $returncode); if ($returncode != 0) { // try it again without the resample in case the input sample rate was the same // exec("rm -rf \"".$newmohfile."\""); exec($soxcmd."2>&1", $output, $returncode); } } if ($returncode != 0) { return join("
\n", $output); } $rmcmd="rm -f \"". $origmohfile."\""; exec($rmcmd); return null; } /*function kill_mpg123() { $killcmd="killall -9 mpg123"; exec($killcmd); }*/ ?>









"> " onclick="document.upload.submit(upload);alert('');"/>

"> ">

PHP "._("Error Processing")."! "._("No file provided")." "._("Please select a file to upload").""; } else { echo "
PHP "._("Error Processing")." ".htmlentities($_FILES['mohfile']['name'])."! "._("Check")." upload_max_filesize "._("in")." /etc/php.ini
"; } } if (isset($_FILES['mohfile']['tmp_name']) && is_uploaded_file($_FILES['mohfile']['tmp_name'])) { //echo $_FILES['mohfile']['name']." uploaded OK"; move_uploaded_file($_FILES['mohfile']['tmp_name'], $path_to_dir."/orig_".$_FILES['mohfile']['name']); $process_err = process_mohfile($_FILES['mohfile']['name'],($_REQUEST['onlywav'] != '')); if (isset($process_err)) { echo "
"._("Error Processing").": \"$process_err\" for ".htmlentities($_FILES['mohfile']['name'])."!
\n"; echo "
"._("This is not a fatal error, your Music on Hold may still work.")."
\n"; } else { echo "
"._("Completed processing")." ".htmlentities($_FILES['mohfile']['name'])."!
"; } needreload(); //kill_mpg123(); } //build the array of files $file_array = build_list(); $numf = count($file_array); if (isset($_REQUEST['del'])) { $del = $_REQUEST['del']; if (strpos($del, "\"") || strpos($del, "\'") || strpos($del, "\;")) { print "You're trying to use an invalid character. Please don't.\n"; exit; } if (($numf == 1) && ($category == "default") ){ echo "
"._("You must have at least one file for On Hold Music. Please upload one before deleting this one.")."
"; } else { if (@unlink($path_to_dir."/".$del)) { echo "
"._("Deleted")." ".$del."!
"; } else { echo "
".sprintf(_("Error Deleting %s"),$del)."!
"; } //kill_mpg123(); needreload(); } } $file_array = build_list(); draw_list($file_array, $path_to_dir, $category); ?>