Skip to content
Snippets Groups Projects
Commit 7469458d authored by Anthony Borghi's avatar Anthony Borghi
Browse files

Merge branch 'bug/7-correction-redmine-4171' into 'master'

Demande de Licence : message si le serveur SMTP n'est pas configuré

See merge request Development/vitis_apps/application/gtf!13
parents 513a5941 32f0ff6c
Branches
No related tags found
No related merge requests found
......@@ -433,6 +433,7 @@
"SEND_MAIL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Mail sent successfully",
"LICENSE_FILE_INSTALL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Error while installing the license file.",
"LICENSE_FILE_INSTALL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "License file successfully installed",
"SMTP_SERVER_PARAMETERS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Please enter the settings of your SMTP server",
"" : "",
"FORM_NAME_ENGINE_GTF_ENGINE" : "Name",
"FORM_SERVER_ENGINE_GTF_ENGINE" : "Server",
......
......@@ -434,6 +434,7 @@
"SEND_MAIL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Mail envoyé avec succés",
"LICENSE_FILE_INSTALL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Erreur pendant l'installation du fichier de licence.",
"LICENSE_FILE_INSTALL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Fichier de licence installé avec succés",
"SMTP_SERVER_PARAMETERS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Veuillez renseigner les paramètres de votre serveur SMTP.",
"" : "",
"FORM_NAME_ENGINE_GTF_ENGINE" : "Nom",
"FORM_SERVER_ENGINE_GTF_ENGINE" : "Serveur",
......
......@@ -170,8 +170,27 @@ class License extends GTF {
}
}
} else if ($this->aValues["action"] == 'ask') {
// Vérification des paramètres du serveur smtp (vides ou par défaut -> erreur).
$aSmtpDefault = array(
'smtp_host' => 'smtp.domaine.com',
'smtp_port' => 26,
'smtp_authentification' => true,
'smtp_login' => 'login@domaine.com',
'smtp_password' => 'password'
);
$iSmtpCount = 0;
foreach ($aSmtpDefault as $sSmtpKey => $sSmtpValue) {
if (empty($this->aProperties[$sSmtpKey]) || $this->aProperties[$sSmtpKey] == $sSmtpValue)
$iSmtpCount++;
}
if ($iSmtpCount == count($aSmtpDefault)) {
writeToErrorLog('the SMTP server is not configured');
$oError = new VitisError(1, 'SMTP_SERVER_PARAMETERS_CONFIGURATION_CONFIGURATION_GTF_LICENSE');
$aXmlRacineAttribute['status'] = 0;
$sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']);
}
else {
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
//$mail->SMTPDebug = 3; // debugger level (3 all with connection)
$mail->Debugoutput = function($str, $level) {error_log("debug level $level; message: $str");};
......@@ -230,6 +249,7 @@ class License extends GTF {
$sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']);
}
}
}
return $sMessage;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment