public function __construct(\Config_Lite $config, \HttpClientAbstract $client, \App\Storage\User $userStorage) { $this->_config = $config; if (function_exists("pcntl_signal")) { pcntl_signal(SIGTERM, array($this, "sigHandler")); pcntl_signal(SIGINT, array($this, "sigHandler")); } $this->_httpClient = $client; $this->_userStorage = $userStorage; $this->_logger = Logger::getLogger("main"); $this->_lockFile = DOCUMENT_ROOT . "/var/.lock"; $this->_lock(); $this->_running = true; $this->_logger->info("Vérification des alertes."); $this->_mailer = new PHPMailer($exceptions = true); $this->_mailer->setLanguage("fr", DOCUMENT_ROOT . "/lib/PHPMailer/language/"); $this->_mailer->CharSet = "utf-8"; if ($config->hasSection("mailer")) { if ($smtp = $config->get("mailer", "smtp", array())) { $this->_mailer->SMTPKeepAlive = true; if (!empty($smtp["host"])) { $this->_mailer->Host = $smtp["host"]; if (!empty($smtp["port"])) { $this->_mailer->Port = $smtp["port"]; } $this->_mailer->isSMTP(); } if (!empty($smtp["username"])) { $this->_mailer->SMTPAuth = true; $this->_mailer->Username = $smtp["username"]; } if (!empty($smtp["password"])) { $this->_mailer->SMTPAuth = true; $this->_mailer->Password = $smtp["password"]; } if (!empty($smtp["secure"])) { $this->_mailer->SMTPSecure = $smtp["secure"]; } } if ($from = $config->get("mailer", "from", null)) { $this->_mailer->Sender = $from; $this->_mailer->From = $from; $this->_mailer->FromName = $from; } } $this->_mailer->isHTML(true); }