"; print "".$thisfile.""; $delURL = $_SERVER['SCRIPT_NAME']."?display=".(isset($display)?$display:'')."&del=".urlencode($thisfile)."&category=".$category; $tlabel = _("Delete"); $label = ''.$tlabel.' '; echo "".$label."
"; } } } function process_mohfile($mohfile,$onlywav=false,$volume=false) { global $path_to_dir; global $amp_conf; $output = 0; $returncode = 0; $mohfile = escapeshellcmd($mohfile); $origmohfile=$path_to_dir."/orig_".$mohfile; if ($amp_conf['AMPMPG123']) { if($onlywav) { $newname = substr($mohfile,0,strrpos($mohfile,".")); // If we are dealing with an MP3, we need to decode it to a wav file. mpg123 -w writes the converted output to $origmohfile.wav if (strtoupper(substr($origmohfile,-4)) == '.MP3') { $mpg123cmd = "mpg123 -w \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\" \"".$origmohfile."\" 2>&1 "; exec($mpg123cmd, $output, $returncode); } $newmohfile = $path_to_dir."/wav_".$newname.".wav"; //We need to take the output of mpg123 to use in the sox conversion. If we used $origmohfile directly then we would be bypassing mpg123. The mpg123 might not be needed on some systems if we had the sox version with mp3 compiled in. The standard rpmforge sox rpm does not have mp3 included. //$soxcmd = "sox \"".$origmohfile."\""; $soxcmd = "sox \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\""; $soxcmd .= " -r 8000 -c 1 \"".$newmohfile."\""; if($volume){ $soxcmd .= " vol ".$volume; } $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); } } } else { // AMPMPG123 $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); } } } // AMPMPG123 if ($returncode != 0) { return join("
\n", $output); } $rmcmd="rm -f \"". $origmohfile."\""; exec($rmcmd); if ($amp_conf['AMPMPG123']) { // If this started as an mp3, we converted it to a wav and then transcoded it from there, // so we have two "original" files to delete // if (strpos($origmohfile,'.mp3') | strpos($origmohfile,'.MP3') !== false) { $rmcmd="rm -f \"". substr($origmohfile,0,strrpos($origmohfile,".")).".wav\""; exec($rmcmd); } } // AMPMPG123 return null; } ?>















 '.$tlabel.''; ?>









"> " onclick="document.upload.submit(upload);alert('');" tabindex=""/>
AMPMPG123=false in your amportal.conf file") ?>

"> ">

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']); if ($amp_conf['AMPMPG123']) { $process_err = process_mohfile($_FILES['mohfile']['name'],true,$volume); } else { $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(); } //build the array of files $file_array = build_list(); $numf = count($file_array); } // normal moh dir 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(); } } if ($application === false) { $file_array = build_list(); draw_list($file_array, $path_to_dir, $category); } ?>