Merge branch 'refacto-creation-poll-service' into 'develop'
Refactorisation of the creation poll service See merge request framasoft/framadate/framadate!383
This commit is contained in:
commit
13d1103698
|
@ -40,10 +40,10 @@ $is_admin = false;
|
||||||
/*----------*/
|
/*----------*/
|
||||||
|
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
|
||||||
$inputService = new InputService();
|
$inputService = new InputService();
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
$securityService = new SecurityService();
|
$securityService = new SecurityService();
|
||||||
|
|
||||||
/* PAGE */
|
/* PAGE */
|
||||||
|
|
|
@ -31,7 +31,7 @@ $logService = new LogService();
|
||||||
$sessionService = new SessionService();
|
$sessionService = new SessionService();
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
$pollService = new PollService($connect, $logService);
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
|
|
||||||
$result = false;
|
$result = false;
|
||||||
$message = null;
|
$message = null;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
use Framadate\Services\AdminPollService;
|
use Framadate\Services\AdminPollService;
|
||||||
use Framadate\Services\LogService;
|
use Framadate\Services\LogService;
|
||||||
|
use Framadate\Services\MailService;
|
||||||
use Framadate\Services\PollService;
|
use Framadate\Services\PollService;
|
||||||
use Framadate\Services\SecurityService;
|
use Framadate\Services\SecurityService;
|
||||||
use Framadate\Services\SuperAdminService;
|
use Framadate\Services\SuperAdminService;
|
||||||
|
@ -50,7 +51,9 @@ $poll_to_delete = null;
|
||||||
/*----------*/
|
/*----------*/
|
||||||
|
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
$adminPollService = new AdminPollService($connect, $pollService, $logService);
|
$adminPollService = new AdminPollService($connect, $pollService, $logService);
|
||||||
$superAdminService = new SuperAdminService();
|
$superAdminService = new SuperAdminService();
|
||||||
$securityService = new SecurityService();
|
$securityService = new SecurityService();
|
||||||
|
|
|
@ -47,11 +47,11 @@ $editingVoteId = 0;
|
||||||
/*----------*/
|
/*----------*/
|
||||||
|
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
|
||||||
$adminPollService = new AdminPollService($connect, $pollService, $logService);
|
|
||||||
$inputService = new InputService();
|
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
|
$adminPollService = new AdminPollService($connect, $pollService, $logService);
|
||||||
|
$inputService = new InputService();
|
||||||
$sessionService = new SessionService();
|
$sessionService = new SessionService();
|
||||||
|
|
||||||
/* PAGE */
|
/* PAGE */
|
||||||
|
|
|
@ -47,8 +47,12 @@ class MailService {
|
||||||
return filter_var($email, FILTER_VALIDATE_EMAIL);
|
return filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isEnabled() {
|
||||||
|
return $this->smtp_allowed === true;
|
||||||
|
}
|
||||||
|
|
||||||
public function send($to, $subject, $body, $msgKey = null) {
|
public function send($to, $subject, $body, $msgKey = null) {
|
||||||
if ($this->smtp_allowed === true && $this->canSendMsg($msgKey)) {
|
if ($this->isEnabled() && $this->canSendMsg($msgKey)) {
|
||||||
$mail = new PHPMailer(true);
|
$mail = new PHPMailer(true);
|
||||||
$this->configureMailer($mail);
|
$this->configureMailer($mail);
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,10 @@ class NotificationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendPollCreationMails($creator_mail, $creator_name, $poll_name, $poll_id, $admin_poll_id) {
|
function sendPollCreationMails($creator_mail, $creator_name, $poll_name, $poll_id, $admin_poll_id) {
|
||||||
|
if (!$this->mailService->isEnabled() || !$this->mailService->isValidEmail($creator_mail)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->smarty->assign('poll_creator_name', Utils::htmlMailEscape($creator_name));
|
$this->smarty->assign('poll_creator_name', Utils::htmlMailEscape($creator_name));
|
||||||
$this->smarty->assign('poll_name', Utils::htmlMailEscape($poll_name));
|
$this->smarty->assign('poll_name', Utils::htmlMailEscape($poll_name));
|
||||||
$this->smarty->assign('poll_url', Utils::getUrlSondage($poll_id));
|
$this->smarty->assign('poll_url', Utils::getUrlSondage($poll_id));
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
||||||
*/
|
*/
|
||||||
namespace Framadate\Services;
|
namespace Framadate\Services;
|
||||||
|
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Doctrine\DBAL\ConnectionException;
|
use Doctrine\DBAL\ConnectionException;
|
||||||
use Doctrine\DBAL\DBALException;
|
use Doctrine\DBAL\DBALException;
|
||||||
|
@ -27,6 +26,11 @@ use Framadate\Exception\ConcurrentVoteException;
|
||||||
use Framadate\Form;
|
use Framadate\Form;
|
||||||
use Framadate\Repositories\RepositoryFactory;
|
use Framadate\Repositories\RepositoryFactory;
|
||||||
use Framadate\Security\Token;
|
use Framadate\Security\Token;
|
||||||
|
use Framadate\Services\LogService;
|
||||||
|
use Framadate\Services\NotificationService;
|
||||||
|
use Framadate\Services\PurgeService;
|
||||||
|
use Framadate\Services\SessionService;
|
||||||
|
use Framadate\Utils;
|
||||||
|
|
||||||
class PollService {
|
class PollService {
|
||||||
private $connect;
|
private $connect;
|
||||||
|
@ -37,9 +41,12 @@ class PollService {
|
||||||
private $voteRepository;
|
private $voteRepository;
|
||||||
private $commentRepository;
|
private $commentRepository;
|
||||||
|
|
||||||
function __construct(Connection $connect, LogService $logService) {
|
function __construct(Connection $connect, LogService $logService, NotificationService $notificationService) {
|
||||||
$this->connect = $connect;
|
$this->connect = $connect;
|
||||||
$this->logService = $logService;
|
$this->logService = $logService;
|
||||||
|
$this->notificationService = $notificationService;
|
||||||
|
$this->sessionService = new SessionService();
|
||||||
|
$this->purgeService = new PurgeService($connect, $logService);
|
||||||
$this->pollRepository = RepositoryFactory::pollRepository();
|
$this->pollRepository = RepositoryFactory::pollRepository();
|
||||||
$this->slotRepository = RepositoryFactory::slotRepository();
|
$this->slotRepository = RepositoryFactory::slotRepository();
|
||||||
$this->voteRepository = RepositoryFactory::voteRepository();
|
$this->voteRepository = RepositoryFactory::voteRepository();
|
||||||
|
@ -154,6 +161,61 @@ class PollService {
|
||||||
return $this->commentRepository->insert($poll_id, $name, $comment);
|
return $this->commentRepository->insert($poll_id, $name, $comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point for poll creation. This action does all the following:
|
||||||
|
* - Validate input data
|
||||||
|
* - Create the poll in database
|
||||||
|
* - Send emails
|
||||||
|
* - Cleanups post creation (session and purges)
|
||||||
|
*
|
||||||
|
* @param Form $form
|
||||||
|
* @param string $end_date
|
||||||
|
* @return string|null returns the admin_id if the poll was created
|
||||||
|
*/
|
||||||
|
function doPollCreation(Form $form, $end_date) {
|
||||||
|
// Min/Max archive date
|
||||||
|
$min_expiry_time = $this->minExpiryDate();
|
||||||
|
$max_expiry_time = $this->maxExpiryDate();
|
||||||
|
|
||||||
|
if (!empty($end_date)) {
|
||||||
|
$registredate = explode('/', $end_date);
|
||||||
|
|
||||||
|
if (is_array($registredate) && count($registredate) === 3) {
|
||||||
|
$time = mktime(0, 0, 0, $registredate[1], $registredate[0], $registredate[2]);
|
||||||
|
|
||||||
|
if ($time < $min_expiry_time) {
|
||||||
|
$form->end_date = $min_expiry_time;
|
||||||
|
} elseif ($max_expiry_time < $time) {
|
||||||
|
$form->end_date = $max_expiry_time;
|
||||||
|
} else {
|
||||||
|
$form->end_date = $time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($form->end_date)) {
|
||||||
|
// By default, expiration date is 6 months after last day
|
||||||
|
$form->end_date = $max_expiry_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert poll in database
|
||||||
|
list($poll_id, $admin_poll_id) = $this->createPoll($form);
|
||||||
|
|
||||||
|
// Send confirmation by mail if enabled
|
||||||
|
// Everything went well
|
||||||
|
$this->notificationService->sendPollCreationMails($form->admin_mail, $form->admin_name, $form->title, $poll_id, $admin_poll_id);
|
||||||
|
|
||||||
|
// Clean Form data in session
|
||||||
|
$this->sessionService->removeAll('form');
|
||||||
|
// Creation message
|
||||||
|
$this->sessionService->set("Framadate", "messagePollCreated", TRUE);
|
||||||
|
|
||||||
|
// Delete old polls
|
||||||
|
$this->purgeService->repeatedCleanings();
|
||||||
|
|
||||||
|
return $admin_poll_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return array
|
* @return array
|
||||||
|
|
|
@ -55,6 +55,17 @@ class SessionService {
|
||||||
unset($_SESSION[$section][$key]);
|
unset($_SESSION[$section][$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a session section
|
||||||
|
*
|
||||||
|
* @param $section
|
||||||
|
*/
|
||||||
|
public function removeAll($section) {
|
||||||
|
assert(!empty($section));
|
||||||
|
|
||||||
|
unset($_SESSION[$section]);
|
||||||
|
}
|
||||||
|
|
||||||
private function initSectionIfNeeded($section) {
|
private function initSectionIfNeeded($section) {
|
||||||
if (!isset($_SESSION[$section])) {
|
if (!isset($_SESSION[$section])) {
|
||||||
$_SESSION[$section] = [];
|
$_SESSION[$section] = [];
|
||||||
|
|
|
@ -32,9 +32,9 @@ include_once __DIR__ . '/app/inc/init.php';
|
||||||
/* Service */
|
/* Service */
|
||||||
/*---------*/
|
/*---------*/
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
$purgeService = new PurgeService($connect, $logService);
|
$purgeService = new PurgeService($connect, $logService);
|
||||||
$sessionService = new SessionService();
|
$sessionService = new SessionService();
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@ if (is_file('bandeaux_local.php')) {
|
||||||
include_once('bandeaux.php');
|
include_once('bandeaux.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Min/Max archive date
|
|
||||||
$min_expiry_time = $pollService->minExpiryDate();
|
|
||||||
$max_expiry_time = $pollService->maxExpiryDate();
|
$max_expiry_time = $pollService->maxExpiryDate();
|
||||||
|
|
||||||
$form = isset($_SESSION['form']) ? unserialize($_SESSION['form']) : null;
|
$form = isset($_SESSION['form']) ? unserialize($_SESSION['form']) : null;
|
||||||
|
@ -156,54 +154,24 @@ switch ($step) {
|
||||||
|
|
||||||
$smarty->display('create_poll_step_3.tpl');
|
$smarty->display('create_poll_step_3.tpl');
|
||||||
exit;
|
exit;
|
||||||
case 4: // Step 4 : Data prepare before insert in DB
|
|
||||||
$enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]);
|
|
||||||
|
|
||||||
if (!empty($enddate)) {
|
case 4:
|
||||||
$registredate = explode('/', $enddate);
|
// Step 4 : Do the poll creation
|
||||||
|
|
||||||
if (is_array($registredate) && count($registredate) === 3) {
|
// Read expiration date passed in POST parameters
|
||||||
$time = mktime(0, 0, 0, $registredate[1], $registredate[0], $registredate[2]);
|
$end_date = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]);
|
||||||
|
|
||||||
if ($time < $min_expiry_time) {
|
$admin_poll_id = $pollService->doPollCreation($form, $end_date);
|
||||||
$form->end_date = $min_expiry_time;
|
|
||||||
} elseif ($max_expiry_time < $time) {
|
if (!is_null($admin_poll_id)) {
|
||||||
$form->end_date = $max_expiry_time;
|
// Redirect to poll administration
|
||||||
} else {
|
header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
|
||||||
$form->end_date = $time;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($form->end_date)) {
|
|
||||||
// By default, expiration date is 6 months after last day
|
|
||||||
$form->end_date = $max_expiry_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert poll in database
|
|
||||||
$ids = $pollService->createPoll($form);
|
|
||||||
$poll_id = $ids[0];
|
|
||||||
$admin_poll_id = $ids[1];
|
|
||||||
|
|
||||||
// Send confirmation by mail if enabled
|
|
||||||
if ($config['use_smtp'] === true && $mailService->isValidEmail($form->admin_mail)) {
|
|
||||||
$notificationService->sendPollCreationMails($form->admin_mail, $form->admin_name, $form->title, $poll_id, $admin_poll_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean Form data in $_SESSION
|
|
||||||
unset($_SESSION['form']);
|
|
||||||
|
|
||||||
// Delete old polls
|
|
||||||
$purgeService->purgeOldPolls();
|
|
||||||
|
|
||||||
// creation message
|
|
||||||
$sessionService->set("Framadate", "messagePollCreated", TRUE);
|
|
||||||
// Redirect to poll administration
|
|
||||||
header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
case 1: // Step 1/4 : error if $_SESSION from info_sondage are not valid
|
case 1:
|
||||||
default:
|
default:
|
||||||
|
// Step 1/4 : error if $_SESSION from info_sondage are not valid
|
||||||
$smarty->assign('title', __('Error', 'Error!'));
|
$smarty->assign('title', __('Error', 'Error!'));
|
||||||
$smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation, or your session has expired.'));
|
$smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation, or your session has expired.'));
|
||||||
$smarty->display('error.tpl');
|
$smarty->display('error.tpl');
|
||||||
|
|
|
@ -32,19 +32,17 @@ include_once __DIR__ . '/app/inc/init.php';
|
||||||
/* Service */
|
/* Service */
|
||||||
/*---------*/
|
/*---------*/
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
$purgeService = new PurgeService($connect, $logService);
|
$purgeService = new PurgeService($connect, $logService);
|
||||||
$inputService = new InputService();
|
$inputService = new InputService();
|
||||||
$sessionService = new SessionService();
|
$sessionService = new SessionService();
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
|
|
||||||
if (is_readable('bandeaux_local.php')) {
|
if (is_readable('bandeaux_local.php')) {
|
||||||
include_once('bandeaux_local.php');
|
include_once('bandeaux_local.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Min/Max archive date
|
|
||||||
$min_expiry_time = $pollService->minExpiryDate();
|
|
||||||
$max_expiry_time = $pollService->maxExpiryDate();
|
$max_expiry_time = $pollService->maxExpiryDate();
|
||||||
|
|
||||||
$form = isset($_SESSION['form']) ? unserialize($_SESSION['form']) : null;
|
$form = isset($_SESSION['form']) ? unserialize($_SESSION['form']) : null;
|
||||||
|
@ -193,52 +191,17 @@ switch ($step) {
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
// Step 4 : Data prepare before insert in DB
|
// Step 4 : Do the poll creation
|
||||||
|
|
||||||
// Define expiration date
|
// Read expiration date passed in POST parameters
|
||||||
$enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]);
|
$end_date = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]);
|
||||||
|
|
||||||
if (!empty($enddate)) {
|
$admin_poll_id = $pollService->doPollCreation($form, $end_date);
|
||||||
$registredate = explode('/', $enddate);
|
|
||||||
|
|
||||||
if (is_array($registredate) && count($registredate) === 3) {
|
if (!is_null($admin_poll_id)) {
|
||||||
$time = mktime(0, 0, 0, $registredate[1], $registredate[0], $registredate[2]);
|
// Redirect to poll administration
|
||||||
|
header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
|
||||||
if ($time < $min_expiry_time) {
|
|
||||||
$form->end_date = $min_expiry_time;
|
|
||||||
} elseif ($max_expiry_time < $time) {
|
|
||||||
$form->end_date = $max_expiry_time;
|
|
||||||
} else {
|
|
||||||
$form->end_date = $time;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($form->end_date)) {
|
|
||||||
// By default, expiration date is 6 months after last day
|
|
||||||
$form->end_date = $max_expiry_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert poll in database
|
|
||||||
$ids = $pollService->createPoll($form);
|
|
||||||
$poll_id = $ids[0];
|
|
||||||
$admin_poll_id = $ids[1];
|
|
||||||
|
|
||||||
// Send confirmation by mail if enabled
|
|
||||||
if ($config['use_smtp'] === true && $mailService->isValidEmail($form->admin_mail)) {
|
|
||||||
$notificationService->sendPollCreationMails($form->admin_mail, $form->admin_name, $form->title, $poll_id, $admin_poll_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean Form data in $_SESSION
|
|
||||||
unset($_SESSION['form']);
|
|
||||||
|
|
||||||
$purgeService->repeatedCleanings();
|
|
||||||
|
|
||||||
// creation message
|
|
||||||
$sessionService->set("Framadate", "messagePollCreated", TRUE);
|
|
||||||
|
|
||||||
// Redirect to poll administration
|
|
||||||
header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -35,7 +35,9 @@ $poll = null;
|
||||||
/*----------*/
|
/*----------*/
|
||||||
|
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
$securityService = new SecurityService();
|
$securityService = new SecurityService();
|
||||||
|
|
||||||
/* PAGE */
|
/* PAGE */
|
||||||
|
|
|
@ -28,9 +28,9 @@ include_once __DIR__ . '/app/inc/init.php';
|
||||||
/* SERVICES */
|
/* SERVICES */
|
||||||
/* -------- */
|
/* -------- */
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
|
|
||||||
/* PAGE */
|
/* PAGE */
|
||||||
/* ---- */
|
/* ---- */
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Framadate\Services\LogService;
|
||||||
|
use Framadate\Services\MailService;
|
||||||
|
use Framadate\Services\NotificationService;
|
||||||
use Framadate\Services\PollService;
|
use Framadate\Services\PollService;
|
||||||
use Framadate\Utils;
|
use Framadate\Utils;
|
||||||
|
|
||||||
|
@ -29,8 +32,10 @@ if (!is_file(CONF_FILENAME)) {
|
||||||
|
|
||||||
/* SERVICES */
|
/* SERVICES */
|
||||||
/* -------- */
|
/* -------- */
|
||||||
$logService = '\Framadate\Services\LogService';
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, new $logService());
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notificationService);
|
||||||
|
|
||||||
/* PAGE */
|
/* PAGE */
|
||||||
/* ---- */
|
/* ---- */
|
||||||
|
|
|
@ -56,10 +56,10 @@ $selectedNewVotes = [];
|
||||||
/*----------*/
|
/*----------*/
|
||||||
|
|
||||||
$logService = new LogService();
|
$logService = new LogService();
|
||||||
$pollService = new PollService($connect, $logService);
|
|
||||||
$inputService = new InputService();
|
$inputService = new InputService();
|
||||||
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
||||||
$notificationService = new NotificationService($mailService, $smarty);
|
$notificationService = new NotificationService($mailService, $smarty);
|
||||||
|
$pollService = new PollService($connect, $logService, $notifierService);
|
||||||
$securityService = new SecurityService();
|
$securityService = new SecurityService();
|
||||||
$sessionService = new SessionService();
|
$sessionService = new SessionService();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user