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.
 
 
 
 
 
 

313 lines
30 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 () {
d ocument.form1.submit();
},
failure: fu n ction () {}
})
});
function MM_jumpMenu(targ, selObj, restore) { //v3.0
eval("deps.location='pop_departamento.php?id1=" + selObj.options[selObj.selectedIndex].value + "'");
if (restore)
selObj.selectedIndex = 0;
}
//-->
</script>
<link href="admin/css/forms.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #EAEAEA;
}
-->
</style></head>
<body>
<?php
$acao = $_GET["acao"];
$acao2 = $_GET["acao2"];
/*
* Parametros necessarios para manter a pagina<EFBFBD><EFBFBD>o.
*/
$param = sprintf('&numRamal=%s&pgn=%s&bloco=%s&pg=%s', $_REQUEST['numRamal'], $_REQUEST['pgn'], $_REQUEST['bloco'], $_REQUEST['pg']);
if ($acao2 == "salva") {
$id = $_POST["id"];
$caixa_postal = trim($_POST["caixa_postal"]);
$caixa_postal_old = trim($_POST["caixa_postal_old"]);
if (md5($_SESSION['SSKeepPassword']) == trim($_POST["senha"])) {
$senha = $_SESSION['SSKeepPassword'];
unset($_SESSION['SSKeepPassword']);
} else {
$senha = trim($_POST["senha"]);
}
$email = RemoveAcentos($_POST["email"], -1);
$nome = RemoveAcentos($_POST["nome"], true);
$pager = trim($_POST["pager"]);
$attach = trim($_POST["attach"]);
$delete = trim($_POST["delete"]);
$saycid = trim($_POST["saycid"]);
$envelope = trim($_POST["envelope"]);
if (strpos('@', trim($_POST["email"]) !== false)) {
echo "<script>alert('Informe um e-mail v<EFBFBD>lido para efetuar o cadastro!')</script>";
return;
}
if ($acao == "inseri") {
$query = "INSERT INTO pbx_voicemail_usuarios
(caixa_postal,senha,email,nome,pager,attach,delete,saycid,envelope)
VALUES ('$caixa_postal','$senha','$email','$nome','$pager','$attach','$delete','$saycid','$envelope')";
$result = pg_query($dbcon, $query);
if ($result) {
CommandAsterisk2($dbcon, 'VOICE2', $caixa_postal, $caixa_postal);
}
}
if ($acao == "edita") {
//REALIZA BACKUP BO BANCO
//($dbcon,'pbx_voicemail_usuarios','U',$id,'update','VOICEMAIL_USUARIOS');
$query = "UPDATE pbx_voicemail_usuarios
SET caixa_postal='$caixa_postal', senha='$senha', email='$email',nome='$nome',pager='$pager',attach='$attach',delete='$delete',saycid='$saycid',envelope='$envelope'
WHERE id=$id";
$result = pg_query($dbcon, $query);
if ($result) {
CommandAsterisk2($dbcon, 'DEL_VOICE2', $caixa_postal_old, null);
CommandAsterisk2($dbcon, 'VOICE2', $caixa_postal, $caixa_postal);
}
}//gera arquivos e executa o reload dos dados no asterisk
gera_arquivos($dbcon, 'VOICEMAIL');
echo "<script>
opener.location.reload();
fecha_popup(0,'index.php?idProg=10032&pbxRequest=1$param&acao=$acao');
</script>";
/* echo "<script>
fecha_popup(0,'index.php?idProg=10032&pbxRequest=1$param&acao=$acao$param');</script>"; */
}
if ($acao == "edita") {
$id = $_GET["id"] ?? "0";
$query = "SELECT * FROM pbx_voicemail_usuarios where id=$id";
$result = pg_query($dbcon, $query);
} else {
$query = "SELECT * FROM pbx_voicemail_usuarios where id is null";
}
$result = pg_query($dbcon, $query);
if ($dados = pg_fetch_array($result)) {
$id = $dados["id"];
$caixa_postal = $dados["caixa_postal"];
$_SESSION['SSKeepPassword'] = $dados["senha"];
$senha = md5($dados["senha"]);
$email = $dados["email"];
$nome = $dados["nome"];
$attach = $dados["attach"];
$delete = $dados["delete"];
$envelope = $dados["envelope"];
$saycid = $dados["saycid"];
$pager = $dados["pager"];
}
?>
<form name="form1" method="post" action="index.php?idProg=11032&pbxRequest=1&acao=<?php echo $acao; ?>&acao2=salva<?php echo $param; ?>" id="form1">
<table height="121" border="1" align="center" cellpadding="0" cellspacing="0" class="tabela">
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA" class="cabecalho">
<td height="21"><div align="center">CADASTRO DE VOICEMAIL
<input name="id" type="hidden" id="id" value="<?php
if ($acao == 'edita') {
echo $id;
}
?>">
<input name="caixa_postal_old" type="hidden" value="<?php
if ($acao == 'edita') {
echo $caixa_postal;
}
?>">
</div></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td height="19" class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><fieldset>
<legend class="labels">Nome:</legend>
<input name="nome" type="text" class="validate[required,custom[onlyLetter],length[0,100]] caixas" id="nome2" value="<?php
if ($acao == 'edita') {
echo $nome;
}
?>" size="40" />
</fieldset></td>
<td><fieldset>
<legend class="labels"><span class="style5">Senha:</span></legend>
<input name="senha" type="password" class="validate[required] caixas" id="senha2" value="<?php
if ($acao == 'edita') {
echo $senha;
}
?>" size="15" maxlength="10" />
</fieldset></td>
</tr>
</table></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td height="19" class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><fieldset>
<legend class="labels"><span class="style5">Ramal:</span></legend>
<input name="caixa_postal" type="text" class="validate[required,custom[onlyNumber],length[0,100]] caixas" id="caixa_postal" value="<?php
if ($acao == 'edita') {
echo $caixa_postal;
}
?>" size="15" />
</fieldset></td>
<td><fieldset>
<legend class="labels"><span class="style5">E-mail:</span></legend>
<input name="email" type="email" class="validate[optional,email,length[0,100]] caixas" id="email2" value="<?php
if ($acao == 'edita') {
echo $email;
}
?>" size="55" />
</fieldset></td>
</tr>
</table></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td height="19" class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">
<fieldset>
<legend class="labels">Reproduzir Identifica&ccedil;&atilde;o:</legend>
<span class="style5">
<input name="saycid" type="radio" value="yes" <?php
if ($acao == 'edita') {
if ($saycid == 'yes') {
echo "checked";
}
} else {
echo "checked";
}
?> />
Sim
<input name="saycid" type="radio" value="no" <?php
if ($acao == 'edita') {
if ($saycid == 'no') {
echo "checked";
}
}
?> />
N&atilde;o</span>
</fieldset></td>
<td width="50%">
<fieldset>
<legend class="labels">Enviar Anexo:</legend>
<span class="style5">
<input name="attach" type="radio" value="yes" <?php
if ($acao == 'edita') {
if ($attach == 'yes') {
echo "checked";
}
} else {
echo "checked";
}
?> />
Sim
<input name="attach" type="radio" value="no" <?php
if ($acao == 'edita') {
if ($attach == 'no') {
echo "checked";
}
}
?> />
N&atilde;o</span>
</fieldset></td></tr>
</table></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td height="19" class="labels"><div align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">
<div align="left">
<fieldset>
<legend class="labels">Deletar ap&oacute;s o envio:</legend>
<span class="style5">
<input name="delete" type="radio" value="yes" <?php
if ($acao == 'edita') {
if ($delete == 'yes') {
echo "checked";
}
} else {
echo "checked";
}
?> />
Sim
<input name="delete" type="radio" value="no" <?php
if ($acao == 'edita') {
if ($delete == 'no') {
echo "checked";
}
}
?> />
N&atilde;o</span>
</fieldset>
</div></td>
<td width="50%">
<div align="left">
<fieldset>
<legend class="labels">Reproduzir Data e Hora:</legend>
<span class="style5">
<input name="envelope" type="radio" value="yes" <?php
if ($acao == 'edita') {
if ($envelope == 'yes') {
echo "checked";
}
} else {
echo "checked";
}
?> />
Sim
<input name="envelope" type="radio" value="no" <?php
if ($acao == 'edita') {
if ($envelope == 'no') {
echo "checked";
}
}
?> />
N&atilde;o</span>
</fieldset>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td height="22"><div align="center"><span class="style1"></span><span class="style1"></span><span class="style1"></span><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>
</table>
</form>