diff --git a/action/add_comment.php b/action/add_comment.php index 7dfa47e..d980281 100644 --- a/action/add_comment.php +++ b/action/add_comment.php @@ -17,12 +17,7 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ use Framadate\Message; -use Framadate\Services\InputService; -use Framadate\Services\LogService; -use Framadate\Services\MailService; use Framadate\Services\NotificationService; -use Framadate\Services\PollService; -use Framadate\Services\SecurityService; include_once __DIR__ . '/../app/inc/init.php'; @@ -39,12 +34,10 @@ $is_admin = false; /* Services */ /*----------*/ -$logService = new LogService(); -$inputService = new InputService(); -$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(); +$inputService = Services::input(); +$notificationService = Services::notification(); +$pollService = Services::poll(); +$securityService = Services::security(); /* PAGE */ /* ---- */ diff --git a/action/send_edit_link_by_email_action.php b/action/send_edit_link_by_email_action.php index 9ec80e5..cc09c18 100644 --- a/action/send_edit_link_by_email_action.php +++ b/action/send_edit_link_by_email_action.php @@ -18,20 +18,14 @@ */ use Framadate\Message; -use Framadate\Services\LogService; -use Framadate\Services\MailService; -use Framadate\Services\NotificationService; -use Framadate\Services\PollService; -use Framadate\Services\SessionService; use Framadate\Utils; include_once __DIR__ . '/../app/inc/init.php'; -$logService = new LogService(); -$sessionService = new SessionService(); -$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']); -$notificationService = new NotificationService($mailService, $smarty); -$pollService = new PollService($connect, $logService, $notificationService); +$mailService = Services::mail(); +$notificationService = Services::notification(); +$pollService = Services::poll(); +$sessionService = Services::session(); $result = false; $message = null; diff --git a/admin/cleanDemo.php b/admin/cleanDemo.php index e6e4a32..3d9bc05 100644 --- a/admin/cleanDemo.php +++ b/admin/cleanDemo.php @@ -17,13 +17,6 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -use Framadate\Services\LogService; -use Framadate\Services\PurgeService; - include_once __DIR__ . '/../app/inc/init.php'; -$logService = new LogService(); -$purgeService = new PurgeService($connect, $logService); - -$purgeService->cleanDemoPoll(); - +Services::purge()->cleanDemoPoll(); diff --git a/admin/polls.php b/admin/polls.php index 42ab48b..c502e6d 100644 --- a/admin/polls.php +++ b/admin/polls.php @@ -17,11 +17,6 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -use Framadate\Services\AdminPollService; -use Framadate\Services\LogService; -use Framadate\Services\MailService; -use Framadate\Services\PollService; -use Framadate\Services\SecurityService; use Framadate\Services\SuperAdminService; include_once __DIR__ . '/../app/inc/init.php'; @@ -50,13 +45,10 @@ $poll_to_delete = null; /* Services */ /*----------*/ -$logService = 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); -$adminPollService = new AdminPollService($connect, $pollService, $logService); +$adminPollService = Services::adminPoll(); +$pollService = Services::poll(); +$securityService = Services::security(); $superAdminService = new SuperAdminService(); -$securityService = new SecurityService(); /* GET */ /*-----*/ diff --git a/admin/purge.php b/admin/purge.php index 7593a9f..66da864 100644 --- a/admin/purge.php +++ b/admin/purge.php @@ -17,11 +17,6 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -use Framadate\Services\InputService; -use Framadate\Services\LogService; -use Framadate\Services\PurgeService; -use Framadate\Services\SecurityService; - include_once __DIR__ . '/../app/inc/init.php'; include_once __DIR__ . '/../bandeaux.php'; @@ -33,10 +28,9 @@ $message = null; /* Services */ /*----------*/ -$logService = new LogService(); -$purgeService = new PurgeService($connect, $logService); -$securityService = new SecurityService(); -$inputService = new InputService(); +$inputService = Services::input(); +$purgeService = Services::purge(); +$securityService = Services::security(); /* POST */ /*-----*/ @@ -57,4 +51,4 @@ $smarty->assign('crsf', $securityService->getToken('admin')); $smarty->assign('title', __('Admin', 'Purge')); -$smarty->display('admin/purge.tpl'); \ No newline at end of file +$smarty->display('admin/purge.tpl'); diff --git a/adminstuds.php b/adminstuds.php index ff81b08..7679561 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -26,13 +26,7 @@ use Framadate\Exception\MomentAlreadyExistsException; use Framadate\Exception\SlotAlreadyExistsException; use Framadate\Message; use Framadate\Security\PasswordHasher; -use Framadate\Services\AdminPollService; -use Framadate\Services\InputService; -use Framadate\Services\LogService; -use Framadate\Services\MailService; use Framadate\Services\NotificationService; -use Framadate\Services\PollService; -use Framadate\Services\SessionService; use Framadate\Utils; include_once __DIR__ . '/app/inc/init.php'; @@ -49,13 +43,11 @@ $editingVoteId = 0; /* Services */ /*----------*/ -$logService = 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); -$adminPollService = new AdminPollService($connect, $pollService, $logService); -$inputService = new InputService(); -$sessionService = new SessionService(); +$adminPollService = Services::adminPoll(); +$inputService = Services::input(); +$notificationService = Services::notification(); +$pollService = Services::poll(); +$sessionService = Services::session(); /* PAGE */ /* ---- */ diff --git a/create_classic_poll.php b/create_classic_poll.php index 7ec210f..b00835e 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -18,25 +18,11 @@ */ use Framadate\Choice; use Framadate\Form; -use Framadate\Services\InputService; -use Framadate\Services\LogService; -use Framadate\Services\MailService; -use Framadate\Services\NotificationService; -use Framadate\Services\PollService; -use Framadate\Services\PurgeService; -use Framadate\Services\SessionService; use Framadate\Utils; include_once __DIR__ . '/app/inc/init.php'; -/* Service */ -/*---------*/ -$logService = 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); -$purgeService = new PurgeService($connect, $logService); -$sessionService = new SessionService(); +$pollService = Services::poll(); if (is_file('bandeaux_local.php')) { include_once('bandeaux_local.php'); diff --git a/create_date_poll.php b/create_date_poll.php index ae03ee7..a1af888 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -18,26 +18,12 @@ */ use Framadate\Choice; use Framadate\Form; -use Framadate\Services\InputService; -use Framadate\Services\LogService; -use Framadate\Services\MailService; -use Framadate\Services\NotificationService; -use Framadate\Services\PollService; -use Framadate\Services\PurgeService; -use Framadate\Services\SessionService; use Framadate\Utils; include_once __DIR__ . '/app/inc/init.php'; -/* Service */ -/*---------*/ -$logService = new LogService(); -$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']); -$notificationService = new NotificationService($mailService, $smarty); -$purgeService = new PurgeService($connect, $logService); -$inputService = new InputService(); -$sessionService = new SessionService(); -$pollService = new PollService($connect, $logService, $notificationService); +$inputService = Services::input(); +$pollService = Services::poll(); if (is_readable('bandeaux_local.php')) { include_once('bandeaux_local.php'); diff --git a/create_poll.php b/create_poll.php index f547d05..fb6b4bc 100644 --- a/create_poll.php +++ b/create_poll.php @@ -20,7 +20,6 @@ use Framadate\Form; use Framadate\Repositories\RepositoryFactory; use Framadate\Security\PasswordHasher; -use Framadate\Services\InputService; use Framadate\Utils; include_once __DIR__ . '/app/inc/init.php'; @@ -30,7 +29,7 @@ const GO_TO_STEP_2 = 'gotostep2'; /* Services */ /*----------*/ -$inputService = new InputService(); +$inputService = Services::input(); $pollRepository = RepositoryFactory::pollRepository(); /* PAGE */ diff --git a/exportcsv.php b/exportcsv.php index df0f112..69db35e 100644 --- a/exportcsv.php +++ b/exportcsv.php @@ -16,9 +16,6 @@ * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaƫl DROZ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -use Framadate\Services\LogService; -use Framadate\Services\PollService; -use Framadate\Services\SecurityService; use Framadate\Utils; include_once __DIR__ . '/app/inc/init.php'; @@ -34,11 +31,8 @@ $poll = null; /* Services */ /*----------*/ -$logService = 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); -$securityService = new SecurityService(); +$pollService = Services::poll(); +$securityService = Services::security(); /* PAGE */ /* ---- */ diff --git a/find_polls.php b/find_polls.php index b95b2ce..d293def 100644 --- a/find_polls.php +++ b/find_polls.php @@ -18,19 +18,14 @@ */ use Framadate\Message; -use Framadate\Services\LogService; -use Framadate\Services\MailService; -use Framadate\Services\NotificationService; -use Framadate\Services\PollService; include_once __DIR__ . '/app/inc/init.php'; /* SERVICES */ /* -------- */ -$logService = 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); + +$notificationService = Services::notification(); +$pollService = Services::poll(); /* PAGE */ /* ---- */ diff --git a/index.php b/index.php index d8b557f..aa13dae 100644 --- a/index.php +++ b/index.php @@ -17,10 +17,6 @@ * 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\Utils; include_once __DIR__ . '/app/inc/init.php'; @@ -30,13 +26,6 @@ if (!is_file(CONF_FILENAME)) { exit; } -/* SERVICES */ -/* -------- */ -$logService = 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 */ /* ---- */ diff --git a/studs.php b/studs.php index f391ed6..84f2a7a 100644 --- a/studs.php +++ b/studs.php @@ -22,12 +22,7 @@ use Framadate\Exception\ConcurrentEditionException; use Framadate\Exception\ConcurrentVoteException; use Framadate\Message; use Framadate\Security\Token; -use Framadate\Services\InputService; -use Framadate\Services\LogService; -use Framadate\Services\MailService; use Framadate\Services\NotificationService; -use Framadate\Services\PollService; -use Framadate\Services\SecurityService; use Framadate\Services\SessionService; use Framadate\Utils; @@ -55,13 +50,11 @@ $selectedNewVotes = []; /* Services */ /*----------*/ -$logService = new LogService(); -$inputService = new InputService(); -$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']); -$notificationService = new NotificationService($mailService, $smarty); -$pollService = new PollService($connect, $logService, $notifierService); -$securityService = new SecurityService(); -$sessionService = new SessionService(); +$inputService = Services::input(); +$notificationService = Services::notification(); +$pollService = Services::poll(); +$securityService = Services::security(); +$sessionService = Services::session(); /* PAGE */ /* ---- */