ldc-groupe/rgpd/autoload.php
Vincent BRIDIER e2ea65cc2b - FIx RGPD
2020-12-22 12:34:58 +01:00

57 lines
1.7 KiB
PHP

<?php
require_once __DIR__ . '../../vendor/autoload.php';
Dotenv\Dotenv::createImmutable(__DIR__ . '../../')->load();
// Custom Dotenv Boolean Support
if (! function_exists('evalBool')) {
function evalBool($value)
{
return (strcasecmp($value, 'true') ? false : true);
}
}
require_once("inc/PHPMailer.php");
require_once("inc/SMTP.php");
require_once("inc/Exception.php");
define('ENV', getenv('ENVIRONMENT'));
$host = getenv('DB_HOST');
$db = getenv('DB_NAME');
$username = getenv('DB_USER');
$pwd = getenv('DB_PASSWORD');
$charte_POST_ID = 1946;
$charte_TABLE = "wp01_posts";
$db = new \PDO("mysql:host=$host;dbname=$db;charset=UTF8", $username, $pwd, array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
session_start();
function configure_smtp(PHPMailer $phpmailer){
$phpmailer->IsHTML(true);
//Pour ne pas avoir de soucis par la suite il est conseillé de donner l' encodage
$phpmailer->CharSet = "UTF-8";
$phpmailer->isSMTP(); //switch to smtp
$phpmailer->Host = getenv('SMTP_HOST');
$phpmailer->SMTPAuth = evalBool(getenv('SMTP_AUTH'));
$phpmailer->Port = getenv('SMTP_PORT');
$phpmailer->Username = getenv('SMTP_USER');
$phpmailer->Password = getenv('SMTP_PASS');
$phpmailer->SMTPSecure = getenv('SMTP_SECURE');
if (ENV === 'production'){
$phpmailer->AddAddress('rgpd@ldc.fr');
$phpmailer->AddBCC('sylvain.gouet@ldc.fr');
$phpmailer->AddBCC('sebastien.hattry@ldc.fr');
}else{
$phpmailer->AddAddress('informatique.internet@ldc.fr');
}
$phpmailer->SMTPAutoTLS = false;
$phpmailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
}