PABX da Simples IP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

295 lines
12 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" href="admin/css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="ISO-8859-1" />
<script type="text/javascript" src="admin/js/jquery-1.4.js"></script>
<script type="text/javascript" src="admin/js/jquery.blockUI.js?v2.29"></script>
<script src="admin/js/jquery.min.js" type="text/javascript"></script>
<script src="admin/js/jquery.validationEngine.js" type="text/javascript"></script>
<script src="admin/js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="admin/js/pbxAjax.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#form1").validationEngine({
sucess: function() {
document.form1.submit();
},
failure: function() {}
})
});
</script>
<link href="admin/css/forms.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
$arqNao = 0;
$org_id = GetOrganizacao();
if (isset($_GET["audioIndisp"]) && $_GET["audioIndisp"]) {
$fileExist = 0;
$fileDisp = $_GET["audioIndisp"];
$filepath = ($_GET["dir"]) . '/arquivos_mp3/' . $_GET["audioIndisp"];
$fileExist = @file_exists($filepath);
if (!$fileExist) {
$arqNao = 1;
} else {
ob_clean();
header("Pragma: public");
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Accept-Ranges: bytes');
header('Content-Type: ' . GetMimeContentType($fileDisp));
header('Content-Disposition: attachment; filename="' . $fileDisp . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($filepath));
header('Connection: close');
readfile($filepath);
exit;
}
}
if ($_GET["acao2"] == "salva") {
if (!vai_comando('ls /')) {
echo "<script language=\"JavaScript\" type=\"text/JavaScript\">
alert('N<EFBFBD>o foi poss<EFBFBD>vel realizar a opera<EFBFBD><EFBFBD>o, verifique as configura<EFBFBD><EFBFBD>es padr<EFBFBD>o!');
fecha_popup();
</script>";
exit;
}
}
$acao = $_GET["acao"];
$acao2 = $_GET["acao2"];
$deleta = $_GET["deleta"];
if ($deleta != '') {
$pasta = $_GET["pasta"];
unlink($pasta . '/' . $deleta);
$arq = explode(".", $deleta);
unlink($pasta . '/arquivos_mp3/' . $arq[0] . '.mp3');
CommandAsterisk($dbcon, 'MUSIC');
}
if ($acao2 == "salva") {
$id = trim($_POST["id"]);
$caminho = strtolower($_POST["diretorio"]) . "/";
if (!file_exists($caminho)) {
mkdir($caminho, 0777);
chmod($caminho, 0777);
mkdir($caminho . 'arquivos_mp3/', 0777);
chmod($caminho . 'arquivos_mp3/', 0777);
}
if (is_uploaded_file($_FILES['arquivo']['tmp_name'])) {
$arquivo_minusculo = strtolower($_FILES['arquivo']['name']);
$arquivo_tratado = LimpaString($arquivo_minusculo, false);
$nomeArq = $caminho . $arquivo_tratado;
//echo $nomeArq . "<br>";
$nomeArq = explode('.', $nomeArq);
if (count($nomeArq) > 2) {
$qtd = (count($nomeArq) - 1);
$updArq = aupdArq($nomeArq, $qtd);
$arqName = explode("/", $updArq);
$qtd1 = (count($arqName) - 1);
$extensao = $nomeArq[$qtd];
$arquivo_tratado = $arqName[$qtd1] . '.' . $extensao;
} else {
$updArq = $nomeArq[0];
$extensao = $nomeArq[1];
}
copy($_FILES['arquivo']['tmp_name'], $caminho . $arquivo_tratado);
if (strtolower($extensao) == 'mp3') {
CnvrtMp3ToUlaw($updArq . ".mp3", $updArq . ".ulaw", 30);
}
$nomeArq = $caminho . $arquivo_tratado;
if (strtolower($extensao) == 'mp3') {
$mvFile = ($caminho) . 'arquivos_mp3/' . $arquivo_tratado;
$comando = "/bin/mv -f $nomeArq $mvFile";
vai_comando($comando, $dbcon);
}
echo "<script>javascript:alert('ARQUIVO COPIADO COM SUCESSO!');</script>";
CommandAsterisk($dbcon, 'MUSIC');
gera_arquivos($dbcon, 'MUSICHOLD_GRUPOS');
} else {
echo "<script>javascript:alert('OCORRERAM PROBLEMAS NA COPIA DO ARQUIVO!!');</script>";
}
}
if ($acao == "edita") {
$id = $_GET["id"] ?? "0";
$query = "SELECT * FROM pbx_musichold_grupos where id=$id";
$result = pg_query($dbcon, $query);
} else {
$query = "SELECT * FROM pbx_musichold_grupos where id is null";
}
$result = pg_query($dbcon, $query);
while ($dados = pg_fetch_array($result)) {
$id = trim($dados['id']);
$nome = trim($dados['nome']);
$diretorio = $dados['directory'];
}
?>
<script language="JavaScript" type="text/JavaScript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
var d=document;
if(d.images){
if(!d.MM_p){
d.MM_p = new Array();
}
}
var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
for(i=0; i<a.length; i++){
if (a[i].indexOf("#")!=0){
d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
}
}
}
function MM_findObj(n, d) {
var p,i,x;
if(!d) {
d=document;
}
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all) {
x=d.all[n];
}
for (i=0;!x&&i<d.forms.length;i++) {
x=d.forms[i][n];
}
for(i=0;!x&&d.layers&&i<d.layers.length;i++){
x=MM_findObj(n,d.layers[i].document);
}
if(!x && d.getElementById){
x=d.getElementById(n);
}
return x;
}
function MM_swapImage() {
var i,j=0,x,a=MM_swapImage.arguments;
document.MM_sr=new Array;
for(i=0; i<(a.length-2); i+=3){
if ((x=MM_findObj(a[i]))!=null){
document.MM_sr[j++]=x;
}
if(!x.oSrc){
x.oSrc=x.src;
x.src=a[i+2];
}
}
}
</script>
<form action="index.php?idProg=11122&pbxRequest=1&acao2=salva&acao=edita&id=<?= $id; ?>" method="post" enctype="multipart/form-data" name="form1">
<br />
<table width="90%" class="tabela" align="center" cellpadding="0" cellspacing="0">
<tr class="cabecalho">
<td colspan="2" class="cabecalho">
<div align="center">LISTA DE REPRODU&Ccedil;&Atilde;O :<?= $nome; ?><span class="style9">
<input name="id" type="hidden" id="id2" value="<?= ($acao == 'edita') ? $id : null; ?>" />
<input name="diretorio" type="hidden" id="diretorio" value="<?= $diretorio; ?>" />
</span>
</div>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td colspan="2" class="labels">
<fieldset>
<legend class="labels">Arquivo:</legend>
<input name="arquivo" type="file" class="caixas" id="arquivo2" size="55" />
</fieldset>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td colspan="2">
<div align="center">
<span class="style1">
<input name="Submit2" type="button" class="labels" onclick="fecha_popup();" value="Fechar">
<input name="Submit" type="submit" class="labels" value="Salvar">
</span>
</div>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td colspan="2" bordercolor="#EAEAEA">&nbsp;</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td colspan="2" class="cabecalho">
<div align="center">RELA&Ccedil;&Atilde;O DE ARQUIVOS </div>
</td>
</tr>
<?php
$dir = $diretorio;
if (file_exists($dir)) {
foreach (new DirectoryIterator($dir) as $file) {
$z++;
if ((substr($file, 0, 1) != '.') && (!stripos($file, ".old")) && strpos($file, '.')) { ?>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td colspan="2">
<div align="center" class="style1 style2">
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td>
<div align="left">
<span class="style1">
<a href="index.php?idProg=11122&pbxRequest=1&acao=edita&id=<?= $id; ?>&deleta=<?= $file; ?>&pasta=<?= $diretorio; ?>">
<img src="admin/images/delete_mu.gif" alt="APAGAR O ARQUIVO:<?= $file; ?>" width="16" height="16" border="0">
</a>
</span>
</div>
</td>
<td width="450">
<span class="style3">
<?php
$disp = explode('.', $file);
echo $disp[0]; ?>
</span>
</td>
<td width="18">
<span class="style3">
<a href="index.php?idProg=11122&pbxRequest=1&acao=<?= $acao; ?>&id=<?= $id; ?>&dir=<?= $dir; ?>&audioIndisp=<?= $disp[0] . ".mp3"; ?>">
<img src="imgSite/sound22.png" alt="Arquivo de Som!" width="22" height="22" border="0" align="absmiddle" />
</a>
</span>
</td>
</tr>
</table>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
<?php } ?>
</table>
</form>
<?= ($arqNao) ? "<script language=\"JavaScript\" type=\"text/JavaScript\"> alert('Arquivo n<EFBFBD>o encontrado!!'); </script>" : null; ?>
</body>
</html>