20060318.
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
$action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
// Lite weight popup code here, don't need everything else below
//
switch ($action) {
case 'popup':
case 'audio':
include_once("$action.php");
exit;
break;
default:
break;
}
$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';
$notes = isset($_REQUEST['notes'])?$_REQUEST['notes']:'';
$rname = isset($_REQUEST['rname'])?$_REQUEST['rname']:'';
$usersnum = isset($_REQUEST['usersnum'])?$_REQUEST['usersnum']:'';
$sysrec = isset($_REQUEST['sysrec'])?$_REQUEST['sysrec']:'';
$suffix = isset($_REQUEST['suffix']) && trim($_REQUEST['suffix'] != "") ? $_REQUEST['suffix'] : 'wav';
$fcode = isset($_REQUEST['fcode']) && $_REQUEST['fcode'] != '' ? 1 : 0;
$fcode_pass = isset($_REQUEST['fcode_pass'])?$_REQUEST['fcode_pass']:'';
$fcbase = '*29';
$default_pos = 0;
$astsnd = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk';
$astsnd .= "/sounds/";
// check ctype_digit() to avoid very obscure vulnerability that can be made if certain proxy's are used
// with the PBX system
if (empty($usersnum) || !ctype_digit($usersnum)) {
$dest = "unnumbered-";
} else {
$dest = "{$usersnum}-";
}
// get feature codes for diplay purposes
$fcc = new featurecode('recordings', 'record_save');
$fc_save = $fcc->getCodeActive();
unset($fcc);
$fcc = new featurecode('recordings', 'record_check');
$fc_check = $fcc->getCodeActive();
unset($fcc);
$fc_save = ($fc_save != '' ? $fc_save : _('** MISSING FEATURE CODE **'));
$fc_check = ($fc_check != '' ? $fc_check : _('** MISSING FEATURE CODE **'));
switch ($action) {
case "system":
recording_sidebar(-1, null);
recording_sysfiles();
break;
case "newsysrec":
$sysrecs = recordings_readdir($astsnd, strlen($astsnd)+1);
if (recordings_add($sysrecs[$sysrec], $sysrecs[$sysrec])) {
$id = recordings_get_id($sysrecs[$sysrec]);
} else {
$id = 0;
}
recording_sidebar($id, null);
recording_editpage($id, null);
break;
case "recorded":
// Clean up the filename, take out any nasty characters
$filename = escapeshellcmd(strtr($rname, '/ ', '__'));
if (!file_exists($astsnd."custom")) {
if (!mkdir($astsnd."custom", 0775)) {
echo '
'._("Failed to create").' '.$astsnd.'custom'.'
';
}
} else {
// can't rename a file from one partition to another, must use mv or cp
// rename($recordings_save_path."{$dest}ivrrecording.wav",$recordings_astsnd_path."custom/{$filename}.wav");
if (!file_exists($recordings_save_path."{$dest}ivrrecording.$suffix")) {
echo "
"._("[ERROR] The Recorded File Does Not exists:")."
';
needreload();
break;
case "delete";
recordings_del($id);
needreload();
default:
recording_sidebar($id, $usersnum);
recording_addpage($usersnum);
break;
}
function recording_addpage($usersnum) {
global $fc_save;
global $fc_check;
global $recordings_save_path;
?>
"._("dial")." ".$fc_save." ";
echo _("Start speaking at the tone. Hangup when finished.")."";
echo _("and speak the message you wish to record.")."\n";
} else { ?>
must be PCM Encoded, 16 Bits, at 8000Hz")?>:
" onclick="document.upload.submit(upload);alert('');" tabindex=""/>
"._("Successfully uploaded")." ".$_FILES['ivrfile']['name']."";
$rname = rtrim(basename($_FILES['ivrfile']['name'], $suffix), '.');
} ?>