forked from SimplesIP/pabx-app
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.
386 lines
28 KiB
386 lines
28 KiB
<? session_start(); ?> |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs"> |
|
<head> |
|
<title>Simples IP</title> |
|
<link href="admin/css/forms.css" rel="stylesheet" type="text/css"> |
|
<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> |
|
<style type="text/css"> |
|
<!-- |
|
body { |
|
background-color: #E6E6E6; |
|
} |
|
--> |
|
</style></head> |
|
<body> |
|
|
|
<?php |
|
/* |
|
* Parametros necessarios para manter a paginação. |
|
*/ |
|
$param = sprintf('&numRamal=%s&pgn=%s&bloco=%s&pg=%s', $_REQUEST['numRamal'], $_REQUEST['pgn'], $_REQUEST['bloco'], $_REQUEST['pg']); |
|
|
|
$acao = $_GET["acao"]; |
|
$id = $_GET['id']; |
|
$acao2 = $_GET["acao2"]; |
|
|
|
if ($acao2 == "salva") { |
|
|
|
$id = $_POST["id"]; |
|
$nome = trim($_POST["nome"]); |
|
$conta = trim($_POST["conta"]); |
|
$porta = trim($_POST["porta"]); |
|
$timeout = trim($_POST["timeout"]); |
|
$protocolo = trim($_POST["protocolo"]); |
|
$dominio = trim($_POST["dominio"]); |
|
$tsl = trim($_POST["tsl"]); |
|
$tsl_certificado = $_POST["tsl_certificado"]; |
|
$tsl_check = trim($_POST["tsl_check"]); |
|
$logfile = trim($_POST["logfile"]); |
|
$hosts = trim($_POST["hosts"]); |
|
$de = trim($_POST["de"]); |
|
$auth = trim($_POST["auth"]); |
|
$usuario = trim($_POST["usuario"]); |
|
|
|
if(md5($_SESSION['SSKeepPassword']) == trim($_POST["senha"])){ |
|
$senha = $_SESSION['SSKeepPassword']; |
|
unset($_SESSION['SSKeepPassword']); |
|
} else { |
|
$senha = trim($_POST["senha"]); |
|
} |
|
|
|
$padrao = trim($_POST["padrao"]); |
|
|
|
if ($acao == "inseri") { |
|
|
|
if ($padrao == 'S') { |
|
$query = "update pbx_confmail set padrao = 'N'"; |
|
@pg_query($dbcon, $query); |
|
} |
|
|
|
$query = "INSERT INTO pbx_confmail(conta, porta, timeout, protocolo, dominio, tsl, tsl_certificado, tsl_check, logfile, hosts, de, auth, usuario, senha,padrao) |
|
VALUES ('$conta', '$porta', '$timeout', '$protocolo', '$dominio', '$tsl', '$tsl_certificado', '$tsl_check', '$logfile', '$hosts', '$de', '$auth', '$usuario', '$senha','$padrao');"; |
|
pg_query($dbcon, $query); |
|
} |
|
|
|
if ($acao == "edita") { |
|
|
|
//REALIZA BACKUP BO BANCO |
|
backup($dbcon, 'pbx_confmail', 'U', $id, 'update', 'CONFMAIL'); |
|
|
|
if ($padrao == 'S') { |
|
$query = "update pbx_confmail set padrao = 'N'"; |
|
@pg_query($dbcon, $query); |
|
} |
|
|
|
$query = "UPDATE pbx_confmail |
|
SET conta='$conta', porta='$porta', timeout='$timeout', protocolo='$protocolo', dominio='$dominio', tsl='$tsl', tsl_certificado='$tsl_certificado', tsl_check='$tsl_check', logfile='$logfile', hosts='$hosts', de='$de', |
|
auth='$auth', usuario='$usuario', senha='$senha',padrao='$padrao' |
|
WHERE id=$id"; |
|
pg_query($dbcon, $query); |
|
}//gera arquivos e executa o reload dos dados no asterisk |
|
gera_arquivos($dbcon, 'CONFMAIL'); |
|
echo "<script type=\"text/javascript\"> |
|
//fecha a janela presa no meio do sistema |
|
fecha_popup(0,'index.php?idProg=10040&pbxRequest=1$param&acao=$acao'); |
|
</script>"; |
|
} |
|
|
|
if ($acao == "edita") { |
|
$id = $_GET["id"]; |
|
$query = "SELECT * FROM pbx_confMail where id=$id"; |
|
$result = pg_query($dbcon, $query); |
|
} else { |
|
$query = "SELECT * FROM pbx_confMail where id is null"; |
|
} |
|
$result = pg_query($dbcon, $query); |
|
|
|
while ($dados = pg_fetch_array($result)) { |
|
$id = $dados["id"]; |
|
$nome = $dados["nome"]; |
|
$conta = $dados["conta"]; |
|
$porta = $dados["porta"]; |
|
$timeout = $dados["timeout"]; |
|
$protocolo = $dados["protocolo"]; |
|
$dominio = $dados["dominio"]; |
|
$tsl = $dados["tsl"]; |
|
$tsl_certificado = $dados["tsl_certificado"]; |
|
$tsl_check = $dados["tsl_check"]; |
|
$logfile = $dados["logfile"]; |
|
$hosts = $dados["hosts"]; |
|
$de = $dados["de"]; |
|
$auth = $dados["auth"]; |
|
$usuario = $dados["usuario"]; |
|
$_SESSION['SSKeepPassword'] = $dados["senha"]; |
|
$senha = md5($dados["senha"]); |
|
$padrao = $dados["padrao"]; |
|
} |
|
?> |
|
<script language="JavaScript" type="text/JavaScript"> |
|
<!-- |
|
function MM_openBrWindow(theURL,winName,features) { //v2.0 |
|
window.open(theURL,winName,features); |
|
} |
|
//--> |
|
</script> |
|
<form name="form1" method="post" action="index.php?idProg=11040&pbxRequest=1&acao=<? echo $acao; ?>&acao2=salva<?php echo $param ?>" id="form1"> |
|
<table width="410" height="231" border="1" align="center" cellpadding="0" cellspacing="0" class="tabela"> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td width="406" height="21"><div align="center" class="cabecalho">CADASTRO DE CONTAS DE E-MAIL |
|
<input name="id" type="hidden" id="id2" value="<? |
|
if ($acao == 'edita') { |
|
echo $id; |
|
} |
|
?>" /> |
|
</div></td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="31" class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="47%"><fieldset> |
|
<legend class="labels">Conta:</legend> |
|
<input name="conta" type="text" class="validate[required,length[0,100]] caixas" id="nome" value="<? |
|
if ($acao == 'edita') { |
|
echo $conta; |
|
} |
|
?>" size="70" maxlength="100" /> |
|
</fieldset></td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="31" class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Porta:</legend> |
|
<input name="porta" type="text" class="validate[required,length[0,100]] caixas" id="nome3" value="<? |
|
if ($acao == 'edita') { |
|
echo $porta; |
|
} else { |
|
echo "25"; |
|
} |
|
?>" size="10" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Timeout:</legend> |
|
<input name="timeout" type="text" class="validate[required,length[0,100]] caixas" id="protocolo" value="<? |
|
if ($acao == 'edita') { |
|
echo $timeout; |
|
} else { |
|
echo "off"; |
|
} |
|
?>" size="10" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Protocolo:</legend> |
|
<input name="protocolo" type="text" class="validate[required,length[0,100]] caixas" id="conta2" value="<? |
|
if ($acao == 'edita') { |
|
echo $protocolo; |
|
} else { |
|
echo "smtp"; |
|
} |
|
?>" size="10" maxlength="100" /> |
|
</fieldset></td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
|
|
<tr class="labels" bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="41%"><fieldset> |
|
<legend class="labels">Domino:</legend> |
|
<input name="dominio" type="text" class="validate[required,length[0,100]] caixas" id="dominio" value="<? |
|
if ($acao == 'edita') { |
|
echo $dominio; |
|
} |
|
?>" size="30" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="27%"><fieldset> |
|
<legend class="labels">Usuário:</legend> |
|
<input name="usuario" type="text" class="validate[required,length[0,100]] caixas" id="conta22" value="<? |
|
if ($acao == 'edita') { |
|
echo $usuario; |
|
} |
|
?>" size="20" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="32%"><fieldset> |
|
<legend class="labels">Senha:</legend> |
|
<input name="senha" type="password" class="validate[required,length[0,100]] caixas" id="senha" value="<? |
|
if ($acao == 'edita') { |
|
echo $senha; |
|
} |
|
?>" size="20" maxlength="100" /> |
|
</fieldset></td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
<tr class="labels" bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="33%"><fieldset class="labels"> |
|
<legend class="labels">Tsl:</legend> |
|
<input name="tsl" type="radio" value="on" <? |
|
if ($acao == 'edita') { |
|
if ($tsl == 'on') { |
|
echo "checked"; |
|
} |
|
} |
|
?> /> |
|
Ligado |
|
<input name="tsl" type="radio" value="off" <? |
|
if ($acao == 'edita') { |
|
if ($tsl == 'off') { |
|
echo "checked"; |
|
} |
|
} else { |
|
echo "checked"; |
|
} |
|
?> /> |
|
Desligado |
|
</fieldset></td> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Tsl certificado:</legend> |
|
<input name="tsl_certificado" type="text" class="validate[optional,length[0,100]] caixas" id="tsl_certificado" value="<? |
|
if ($acao == 'edita') { |
|
echo $tsl_certificado; |
|
} |
|
?>" size="10" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="33%"><fieldset class="labels"> |
|
<legend class="labels">Tsl Cert Check:</legend> |
|
<input name="tsl_check" type="radio" value="on" <? |
|
if ($acao == 'edita') { |
|
if ($tsl_check == 'on') { |
|
echo "checked"; |
|
} |
|
} |
|
?> /> |
|
Ligado |
|
<input name="tsl_check" type="radio" value="off" <? |
|
if ($acao == 'edita') { |
|
if ($tsl_check == 'off') { |
|
echo "checked"; |
|
} |
|
} else { |
|
echo "checked"; |
|
} |
|
?> /> |
|
Desligado |
|
</fieldset></td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
<tr class="labels" bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Arquivo de log :</legend> |
|
<input name="logfile" type="text" class="validate[required,length[0,100]] caixas" id="logfile" value="<? |
|
if ($acao == 'edita') { |
|
echo $logfile; |
|
} else { |
|
echo "~/.msmtp.log"; |
|
} |
|
?>" size="20" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Servidor:</legend> |
|
<input name="hosts" type="text" class="validate[required,length[0,100]] caixas" id="hosts" value="<? |
|
if ($acao == 'edita') { |
|
echo $hosts; |
|
} |
|
?>" size="20" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="33%"><fieldset> |
|
<legend class="labels">Auth :</legend> |
|
<input name="auth" type="text" class="validate[required,length[0,100]] caixas" id="auth" value="<? |
|
if ($acao == 'edita') { |
|
echo $auth; |
|
} else { |
|
echo "login"; |
|
} |
|
?>" size="10" maxlength="100" /> |
|
</fieldset></td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
<tr class="labels" bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
<tr> |
|
<td width="16%"><fieldset> |
|
<legend class="labels">De :</legend> |
|
<input name="de" type="text" class="validate[required,length[0,100]] caixas" id="de" value="<? |
|
if ($acao == 'edita') { |
|
echo $de; |
|
} |
|
?>" size="50" maxlength="100" /> |
|
</fieldset></td> |
|
<td width="17%"><fieldset> |
|
<legend class="labels">Conta Padrão :</legend> |
|
<input name="padrao" type="checkbox" id="padrao" value="S" <? |
|
if ($padrao == 'S') { |
|
echo "checked"; |
|
} |
|
?>/> |
|
</fieldset></td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA"> |
|
<td height="22"><div align="center"> |
|
<input name="Submit2" type="button" class="labels" onclick="fecha_popup();" value="Fechar" /> |
|
<input name="Submit" type="submit" class="labels" value="Salvar" /> |
|
</div></td> |
|
</tr> |
|
</table> |
|
</form> |
|
<div id="alerta" style="display:none;width:300;height:auto"> |
|
<br> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
|
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"> |
|
<td width="5%" align="center" style="border: none;font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: #990000;background-color: #FFFFFF;"> |
|
</td> |
|
<td width="95%" align="center" bgcolor="#FFFFFF" style="border: none;font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: #990000;background-color: #FFFFFF;"><div align="center"> |
|
<input name="mens2" type="button" value="mens2" style="border: none;font-family: Arial, Helvetica, sans-serif;font-size: 14px;color: #990000;background-color: #FFFFFF;" id="mens"> |
|
</div></td> |
|
</tr> |
|
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"> |
|
<td colspan="2" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"><span style="color: #FFFFFF"> _ |
|
</span></td> |
|
</tr> |
|
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"> |
|
<td colspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" style="border-color:#FFFFFF"> |
|
<tr> |
|
<td colspan="2" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"> |
|
<div align="center"> |
|
<button id="volta" class="botoes">Voltar</button> |
|
</div> |
|
</td> |
|
</tr> |
|
</table></td> |
|
</tr> |
|
</table></div> |
|
<div id="campos" style="display:none" align="center"> |
|
<iframe src="" frameborder="0" scrolling="no" name="geral" id="geral" align="middle"></iframe> |
|
</div> |
|
</body> |
|
</html>
|
|
|