From 7c65b69da5bc5467560e73281b66b81bdc252974 Mon Sep 17 00:00:00 2001 From: Leandro Arndt Date: Sat, 23 Jan 2016 20:08:38 -0200 Subject: [PATCH] Correções e melhorias no script de configuração --- instalar/index.php | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/instalar/index.php b/instalar/index.php index 3a189d4..820644d 100644 --- a/instalar/index.php +++ b/instalar/index.php @@ -10,27 +10,36 @@ if ( (is_writable("../inc/config.php") and is_writable("../restrito/inc/config.p if ($_SERVER['REQUEST_METHOD'] == "POST") { $erro = false; + $nome = $_POST["nome"]; + $codigo = $_POST["codigo"]; + (substr($_POST["sitelink"], -1) != "/") ? $sitelink = $_POST["sitelink"]."/" : $sitelink = $_POST["sitelink"]; + if (substr($_POST["urlsistema"], -1) != "/") { + if ($_POST["urlsistema"] != "") { + $urlsistema = $_POST["urlsistema"]."/"; + } else { + $urlsistema = $sitelink; + } + } else { + $urlsistema = $_POST["urlsistema"]; + } + $dbhost = $_POST["dbhost"]; + $dbuser = $_POST["dbuser"]; + $dbpass = $_POST["dbpass"]; + $dbname = $_POST["dbname"]; + $phpmailer = $_POST["phpmailer"] == "phpmailer" ? "true" : "false"; + $smtphost = $_POST["smtpport"] != "" ? $_POST["smtphost"].":".$_POST["smtpport"] : $_POST["smtphost"]; + $smtpauth = $_POST["smtpauth"] == "smtpauth" ? "true" : "false"; + $smtpuser = $_POST["smtpuser"]; + $smtppwd = $_POST["smtppwd"]; + + // Verifica os campos obrigatórios - if ($_POST["nome"] and $_POST["codigo"] and $_POST["sitelink"] and $_POST["urlsistema"] and - $_POST["dbhost"] and $_POST["dbuser"] and $_POST["dbpass"] and $_POST["dbname"] and - ((!$_POST["phpmailer"]) or ($_POST["smtphost"] and - (!($_POST["smtpauth"]) or ($_POST["smtpuser"] and $_POST["smtppwd"])) + if ($nome and $codigo and $sitelink and $urlsistema and + $dbhost and $dbuser and $dbpass and $dbname and + ((!$phpmailer) or ($smtphost and + (!($smtpauth) or ($smtpuser and $smtppwd)) )) - ) { - $nome = $_POST["nome"]; - $codigo = $_POST["codigo"]; - ($_POST["sitelink"][strlen($_POST["sitelink"]-1)] != "/") ? $sitelink = $_POST["sitelink"]."/" : $sitelink = $_POST["sitelink"]; - ($_POST["urlsistema"][strlen($_POST["urlsistema"]-1)] != "/") ? $urlsistema = $_POST["urlsistema"]."/" : $urlsistema = $_POST["urlsistema"]; - $dbhost = $_POST["dbhost"]; - $dbuser = $_POST["dbuser"]; - $dbpass = $_POST["dbpass"]; - $dbname = $_POST["dbname"]; - $phpmailer = $_POST["phpmailer"] == "phpmailer" ? "true" : "false"; - $smtphost = $_POST["$smtpport"] != "" ? $_POST["smtphost"].":".$_POST["smtpport"] : $_POST["smtphost"]; - $smtpauth = $_POST["smtpauth"] == "smtpauth" ? "true" : "false"; - $smtpuser = $_POST["smtpuser"]; - $smtppwd = $_POST["smtppwd"]; - + ) { try { $config = fopen("../inc/config.php", "w"); fwrite($config, <<alert('Erro na configuração do sistema: $erro.');"; + echo ""; // Dessa maneira conseguimos exibir os caracteres especiais } -} + } else { // GET + $nome = "e-SIC Livre"; + $codigo = "esiclivre"; + } include("../inc/topo.php"); @@ -135,37 +147,38 @@ include("../inc/topo.php");

Instalação do e-SIC Livre

Passo 1 de 2

+

Configuração do sistema

Informações do sistema - - - - + + + +
Banco de dados - - - - + + + +
Usuário:*
Usuário:*
Envio de e-mail - + - - - - - + + + + +
">
Se usar o PHP Mailer, preencha os campos a seguir:
Porta de SMTP:
Necessário autenticar?
Usuário do servidor de e-mail:
Senha do usuário do servidor de e-mail:
">
Porta de SMTP:">
Necessário autenticar?">
Usuário do servidor de e-mail:
Senha do usuário do servidor de e-mail:

*Campos obrigatórios.

-- libgit2 0.21.2