|
|
|
@ -846,25 +846,39 @@ class common {
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function sendMail($to, $subject, $content, $replyTo = null) {
|
|
|
|
|
// Utilisation de PHPMailer version 6.0.6
|
|
|
|
|
//require_once "core/vendor/phpmailer/phpmailer.php";
|
|
|
|
|
//require_once "core/vendor/phpmailer/exception.php";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Layout
|
|
|
|
|
ob_start();
|
|
|
|
|
include 'core/layout/mail.php';
|
|
|
|
|
include 'core/layout/mail.php';
|
|
|
|
|
$layout = ob_get_clean();
|
|
|
|
|
$mail = new PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
|
// $mail->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_SERVER;
|
|
|
|
|
// Mail
|
|
|
|
|
try{
|
|
|
|
|
$mail = new PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
|
$mail->CharSet = 'UTF-8';
|
|
|
|
|
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
|
|
|
|
$mail->setFrom('no-reply@' . $host, $this->getData(['config', 'title']));
|
|
|
|
|
if (is_null($replyTo)) {
|
|
|
|
|
$mail->addReplyTo('no-reply@' . $host, $this->getData(['config', 'title']));
|
|
|
|
|
// Paramètres SMTP
|
|
|
|
|
if ($this->getdata(['config','smtp','enable'])) {
|
|
|
|
|
$mail->isSMTP();
|
|
|
|
|
$mail->Host = $this->getdata(['config','smtp','host']);
|
|
|
|
|
$mail->Port = (int) $this->getdata(['config','smtp','port']);
|
|
|
|
|
if ($this->getData(['config','smtp','auth'])) {
|
|
|
|
|
$mail->Username = $this->getData(['config','smtp','username']);
|
|
|
|
|
$mail->Password = $this->getData(['config','smtp','password']);
|
|
|
|
|
$mail->SMTPAuth = $this->getData(['config','smtp','auth']);
|
|
|
|
|
$mail->SMTPSecure = $this->getData(['config','smtp','secure']);
|
|
|
|
|
$mail->setFrom($this->getData(['config','smtp','sender']));
|
|
|
|
|
}
|
|
|
|
|
// Fin SMTP
|
|
|
|
|
} else {
|
|
|
|
|
$mail->addReplyTo($replyTo);
|
|
|
|
|
}
|
|
|
|
|
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
|
|
|
|
$mail->setFrom('no-reply@' . $host, $this->getData(['config', 'title']));
|
|
|
|
|
if (is_null($replyTo)) {
|
|
|
|
|
$mail->addReplyTo('no-reply@' . $host, $this->getData(['config', 'title']));
|
|
|
|
|
} else {
|
|
|
|
|
$mail->addReplyTo($replyTo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$mail->CharSet = 'UTF-8';
|
|
|
|
|
if(is_array($to)) {
|
|
|
|
|
foreach($to as $userMail) {
|
|
|
|
|
$mail->addAddress($userMail);
|
|
|
|
@ -904,8 +918,6 @@ class common {
|
|
|
|
|
//Retourne une chaine contenant le dossier à créer
|
|
|
|
|
$folder = $this->dirData ($keys[0],'fr');
|
|
|
|
|
// Constructeur JsonDB
|
|
|
|
|
//require_once "core/vendor/jsondb/Dot.php";
|
|
|
|
|
//require_once "core/vendor/jsondb/JsonDb.php";
|
|
|
|
|
$db = new \Prowebcraft\JsonDb([
|
|
|
|
|
'name' => $keys[0] . '.json',
|
|
|
|
|
'dir' => $folder,
|
|
|
|
@ -1426,6 +1438,7 @@ class core extends common {
|
|
|
|
|
* @param string $className Nom de la classe à charger
|
|
|
|
|
*/
|
|
|
|
|
public static function autoload($className) {
|
|
|
|
|
|
|
|
|
|
$classPath = strtolower($className) . '/' . strtolower($className) . '.php';
|
|
|
|
|
// Module du coeur
|
|
|
|
|
if(is_readable('core/module/' . $classPath)) {
|
|
|
|
|