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.
 
 
 
 
 
 

203 lines
7.6 KiB

<?php
include "funcoes.php";
$opcao = isset($_POST['opcao']) ? $_POST['opcao'] : '';
$opcaoDestino = isset($_POST['acaoDest']) ? $_POST['acaoDest'] : '';
$musica = isset($_POST['audio_msg']) ? $_POST['audio_msg'] : '';
$ajax = isset($_GET['ajax']) ? $_GET['ajax'] : '';
$sound = isset($_GET['sound']) ? $_GET['sound'] : '';
$myIP = $_SERVER[HTTP_HOST];
$diretorio = $_SESSION['path_som'] . 'arquivos_mp3/';
if ($ajax) {
if ($sound) {
if (file_exists($diretorio . $sound)) {
echo 'OK';
} else {
echo 'FAIL';
}
exit();
}
$_SESSION['SSopcao'] = $opcao;
$_SESSION['SSopcaoDestino'] = $opcaoDestino;
$_SESSION['SSmusica'] = $musica;
}
function ___GetAnuncio() {
$query = "SELECT * FROM pbx_anuncios WHERE nome = 'LIGUE_GRATIS_MENSAGEM'";
$res = pg_fetch_assoc(pg_query($query));
return $res;
}
function ___GetAudios() {
$select = ___GetAnuncio();
$select = $_SESSION['SSmusica'] ? $_SESSION['SSmusica'] : $select['musica'];
$dir = $_SESSION['path_som'];
$opt = '<option>SEM SOM</option>';
foreach (new DirectoryIterator($dir) as $file) {
$sel = '';
if ((substr($file, 0, 1) != '.') && !stripos($file, ".old") && (stripos($file, "arquivos_mp3") === false)) {
if (trim($select) == trim($file)) {
$sel = "selected";
}
$ext = explode('.', $file);
$opt .= "<option value='$file' $sel>{$ext[0]}</option>";
}
}
return $opt;
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="admin/css/formliguemegratis.css" type="text/css" media="screen" title="no title" charset="ISO-8859-1" >
<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 src="admin/js/jquery_3.3.1.js"></script>
<script>
$(function () {
$('#opcao').change(function () {
if ($(this).val()) {
$('#acaoDest').fadeIn('slow', function () {
$(this).show();
});
} else {
$('#acaoDest').fadeOut()('slow', function () {
$(this).hide();
});
}
GetSSAjax("http://<?php echo $myIP; ?>" + "/index.php?idProg=313&ajax=1", 'formAnuncio');
});
$('#audio_msg').change(function () {
GetSSAjax("http://<?php echo $myIP; ?>" + "/index.php?idProg=313&ajax=1", 'formAnuncio');
if ($(this).val()) {
$('#sound_prop').fadeIn('slow', function () {
$(this).show();
var string = $('#audio_msg').val().split('.');
var arquivo = string[0] + ".mp3";
$.ajax({
url: "http://<?php echo $myIP; ?>" + "/index.php?idProg=313&ajax=1&sound=" + arquivo,
type: 'GET',
success: function (data) {
if (data.trim() === 'OK') {
$('#sound').attr('src', "http://<?php echo $myIP; ?>/audios/" + arquivo);
$('#sound_msg').text("");
} else {
$('#sound').attr('src', '');
$('#sound_msg').text("Arquivo de <EFBFBD>udio n<EFBFBD>o encontrado!");
}
}
});
});
}
});
GetSSAjax("http://<?php echo $myIP; ?>" + "/index.php?idProg=313&ajax=1", 'formAnuncio');
});
function GetSSAjax(url, form) {
$.ajax({
url: url,
type: 'POST',
data: $('#' + form).serialize(),
});
}
</script>
<style type="text/css" media="screen">
.alert-error {
padding: 17px;
background-color: #f44336;
color: white;
}
.alert-success{
padding: 17px;
background-color: #33cc33;
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
</style>
</head>
<body>
<div class = "container">
<h3>CONFIGURA<EFBFBD><EFBFBD>O DE AN<EFBFBD>NCIO</h3>
<hr/>
<form method="POST" id="formAnuncio" action="index.php?idProg=313">
<div class="row">
<h3>Destino da Liga<EFBFBD><EFBFBD>o</h3>
<div class="col-75">
<div class="col-25" style="margin-right: 10px;">
<select name="opcao" class="caixas" id="opcao" onchange="ajaxComboBox('admin/popula.php?id=<?php echo $acaoDest; ?>', 'acaoDest', 'opcao', '<?php echo $acaoDest; ?>');">
<?php
include_once("admin/opcoes.php");
$anuncio = ___GetAnuncio();
$anuncio = $_SESSION['SSopcao'] ? $_SESSION['SSopcao'] : $anunc['opcao'];
echo _GetOpcoes($dbcon, $anuncio);
?>
</select>
</div>
<div class="col-25">
<select name="acaoDest" style="display: none;" class="caixas" id="acaoDest">
</select>
</div>
</div>
</div>
<div class="row">
<h3><EFBFBD>udio para Fora de Hor<EFBFBD>rio</h3>
<div class="col-25" style="margin-right: 10px;">
<select id="audio_msg" name="audio_msg">
<?php echo ___GetAudios(); ?>
</select>
</div>
<div class="col-25" style="display: none" id="sound_prop">
<audio id="sound" src="" controls preload>
</audio>
<label id="sound_msg" style="font-size:10px;color: red;"> </label>
</div>
</div>
<div class="row">
<div class="col-75">
<a href="#" onclick="abre_janela('475', '232', 'index.php?idProg=11043&pbxRequest=1');" style="text-decoration: none;">
<img src="imgSite/cloud-upload.png" width="45px">
<p style="color: #f44336;font-size: 11px;">Clique aqui para realizar upload de um arquivo .MP3</p>
</a>
</div>
</div>
</form>
</div>
</body>
</html>