Commit addaa95c authored by m's avatar m
Browse files

using SessionService

parent 402f2abf
......@@ -29,6 +29,7 @@ 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';
......@@ -51,6 +52,7 @@ $adminPollService = new AdminPollService($connect, $pollService, $logService);
$inputService = new InputService();
$mailService = new MailService($config['use_smtp'], $config['smtp_options']);
$notificationService = new NotificationService($mailService);
$sessionService = new SessionService();
/* PAGE */
/* ---- */
......@@ -74,8 +76,11 @@ if ($poll) {
// creation message
// -------------------------------
if (isset($_SESSION["Framadate"]["messagePollCreated"])) {
unset($_SESSION["Framadate"]["messagePollCreated"]);
$messagePollCreated = $sessionService->get("Framadate", "messagePollCreated", FALSE);
if ($messagePollCreated) {
$sessionService->remove("Framadate", "messagePollCreated");
$message = new Message('success', __('adminstuds', 'The poll is created.'));
}
......
......@@ -21,6 +21,7 @@ use Framadate\Services\LogService;
use Framadate\Services\MailService;
use Framadate\Services\PollService;
use Framadate\Services\PurgeService;
use Framadate\Services\SessionService;
use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php';
......@@ -31,6 +32,7 @@ $logService = new LogService();
$pollService = new PollService($connect, $logService);
$mailService = new MailService($config['use_smtp'], $config['smtp_options']);
$purgeService = new PurgeService($connect, $logService);
$sessionService = new SessionService();
if (is_file('bandeaux_local.php')) {
include_once('bandeaux_local.php');
......@@ -109,7 +111,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
$purgeService->purgeOldPolls();
// creation message
$_SESSION["Framadate"]["messagePollCreated"] = TRUE;
$sessionService->set("Framadate", "messagePollCreated", TRUE);
// Redirect to poll administration
header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
......
......@@ -22,6 +22,7 @@ use Framadate\Services\LogService;
use Framadate\Services\MailService;
use Framadate\Services\PollService;
use Framadate\Services\PurgeService;
use Framadate\Services\SessionService;
use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php';
......@@ -33,6 +34,7 @@ $pollService = new PollService($connect, $logService);
$mailService = new MailService($config['use_smtp'], $config['smtp_options']);
$purgeService = new PurgeService($connect, $logService);
$inputService = new InputService();
$sessionService = new SessionService();
if (is_readable('bandeaux_local.php')) {
include_once('bandeaux_local.php');
......@@ -233,7 +235,7 @@ switch ($step) {
$purgeService->purgeOldPolls();
// creation message
$_SESSION["Framadate"]["messagePollCreated"] = TRUE;
$sessionService->set("Framadate", "messagePollCreated", TRUE);
// Redirect to poll administration
header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment