From 402f2abf64646b220e3fde35d926ef3f957f0648 Mon Sep 17 00:00:00 2001 From: m Date: Sat, 7 Apr 2018 22:24:55 +0200 Subject: [PATCH 1/2] =?UTF-8?q?ajout=20du=20message=20"Le=20sondage=20est?= =?UTF-8?q?=20bien=20cr=C3=A9=C3=A9."=20https://framagit.org/framasoft/fra?= =?UTF-8?q?madate/issues/62?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminstuds.php | 9 +++++++++ create_classic_poll.php | 3 +++ create_date_poll.php | 3 +++ locale/ar.json | 1 + locale/br.json | 1 + locale/de.json | 1 + locale/en.json | 1 + locale/es.json | 1 + locale/fr.json | 1 + locale/it.json | 1 + locale/nl.json | 1 + locale/oc.json | 1 + 12 files changed, 24 insertions(+) diff --git a/adminstuds.php b/adminstuds.php index ab2cacd..57e9668 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -70,6 +70,15 @@ if ($poll) { exit; } +// ------------------------------- +// creation message +// ------------------------------- + +if (isset($_SESSION["Framadate"]["messagePollCreated"])) { + unset($_SESSION["Framadate"]["messagePollCreated"]); + $message = new Message('success', __('adminstuds', 'The poll is created.')); +} + // ------------------------------- // Update poll info // ------------------------------- diff --git a/create_classic_poll.php b/create_classic_poll.php index 5e88774..2465cfe 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -108,6 +108,9 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( // Delete old polls $purgeService->purgeOldPolls(); + // creation message + $_SESSION["Framadate"]["messagePollCreated"] = TRUE; + // Redirect to poll administration header('Location:' . Utils::getUrlSondage($admin_poll_id, true)); exit; diff --git a/create_date_poll.php b/create_date_poll.php index 9b0fa49..0ad2f1d 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -232,6 +232,9 @@ switch ($step) { // Delete old polls $purgeService->purgeOldPolls(); + // creation message + $_SESSION["Framadate"]["messagePollCreated"] = TRUE; + // Redirect to poll administration header('Location:' . Utils::getUrlSondage($admin_poll_id, true)); exit; diff --git a/locale/ar.json b/locale/ar.json index bc1df27..716af7d 100644 --- a/locale/ar.json +++ b/locale/ar.json @@ -437,6 +437,7 @@ "Vote updated": "تم تحديث التصويت", "You can add a new scheduling date to your poll.": "You can add a new scheduling date to your poll.", "Your poll has been removed!": "Your poll has been removed!", + "The poll is created." : "The poll is created.", "and add a new column with": "and add a new column with", "remove a column or a line with": "remove a column or a line with" }, diff --git a/locale/br.json b/locale/br.json index 901335e..a49f092 100644 --- a/locale/br.json +++ b/locale/br.json @@ -437,6 +437,7 @@ "Vote updated": "Hizivaet eo bet ar vouezh", "You can add a new scheduling date to your poll.": "Gallout a rit ouzhpennañ un deiziad d'ho sontadeg.", "Your poll has been removed!": "Dilamet eo bet ar sontadeg!", + "The poll is created." : "The poll is created.", "and add a new column with": "ha m'ho peus disoñjet un dibab e c'hallit ouzhpennañ ur bann en ur glikañ war", "remove a column or a line with": "dilemel ur bann pe ul linenn gant" }, diff --git a/locale/de.json b/locale/de.json index 064f127..cf45008 100644 --- a/locale/de.json +++ b/locale/de.json @@ -437,6 +437,7 @@ "Vote updated": "Stimme aktualisiert", "You can add a new scheduling date to your poll.": "Sie können Ihrer Umfrage ein neues Datum hinzufügen.", "Your poll has been removed!": "Ihre Umfrage wurde gelöscht!", + "The poll is created." : "The poll is created.", "and add a new column with": "und neue Spalte hinzufügen mit", "remove a column or a line with": "Zeile oder Spalte entfernen mit" }, diff --git a/locale/en.json b/locale/en.json index 0a1c6f9..c8df96b 100644 --- a/locale/en.json +++ b/locale/en.json @@ -438,6 +438,7 @@ "Vote updated": "Vote updated", "You can add a new scheduling date to your poll.": "You can add a new scheduling date to your poll.", "Your poll has been removed!": "Your poll has been removed!", + "The poll is created." : "The poll is created.", "and add a new column with": "and add a new column with", "remove a column or a line with": "remove a column or a line with" }, diff --git a/locale/es.json b/locale/es.json index 88ee450..ec863f9 100644 --- a/locale/es.json +++ b/locale/es.json @@ -437,6 +437,7 @@ "Vote updated": "Voto actualizado", "You can add a new scheduling date to your poll.": "Puede añadir una nueva fecha de encuentro a su encuesta.", "Your poll has been removed!": "Su encuesta ha sido borrada", + "The poll is created." : "The poll is created.", "and add a new column with": "y se puede añadir una columna con", "remove a column or a line with": "borrar una columna o una fila con" }, diff --git a/locale/fr.json b/locale/fr.json index 3a87813..63a8d91 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -438,6 +438,7 @@ "Vote updated": "Vote mis à jour", "You can add a new scheduling date to your poll.": "Vous pouvez ajouter une date à votre sondage.", "Your poll has been removed!": "Votre sondage a été supprimé !", + "The poll is created." : "Le sondage est bien créé.", "and add a new column with": "et si vous avez oublié de saisir un choix, vous pouvez rajouter une colonne en cliquant sur", "remove a column or a line with": "effacer une colonne ou une ligne avec" }, diff --git a/locale/it.json b/locale/it.json index 3a287d2..c653d2f 100644 --- a/locale/it.json +++ b/locale/it.json @@ -437,6 +437,7 @@ "Vote updated": "Voto aggiornato", "You can add a new scheduling date to your poll.": "Potete aggiungere una data al vostro sondaggio.", "Your poll has been removed!": "Il vostro sondaggio è stato eliminato !", + "The poll is created." : "The poll is created.", "and add a new column with": "e se vi foste dimenticati di inserire una scelta, potreste aggiungere una colonna cliccando su", "remove a column or a line with": " cancellare una colonna o una riga con " }, diff --git a/locale/nl.json b/locale/nl.json index cc32c34..e65ef16 100644 --- a/locale/nl.json +++ b/locale/nl.json @@ -437,6 +437,7 @@ "Vote updated": "Stem aangepast", "You can add a new scheduling date to your poll.": "Je kan een nieuwe datum toevoegen aan je poll.", "Your poll has been removed!": "Je poll is verwijderd!", + "The poll is created." : "The poll is created.", "and add a new column with": "en voeg een nieuwe kokom toe met", "remove a column or a line with": "verwijder een kolom of regel met" }, diff --git a/locale/oc.json b/locale/oc.json index 6b59c48..4eb3951 100644 --- a/locale/oc.json +++ b/locale/oc.json @@ -437,6 +437,7 @@ "Vote updated": "Vòte mes a jorn", "You can add a new scheduling date to your poll.": "Podètz apondre una data a vòstre sondatge.", "Your poll has been removed!": "Vòstre sondatge es estat suprimit !", + "The poll is created." : "The poll is created.", "and add a new column with": "E se avètz oblidat de picar una causida, podètz tornar apondre una colomna en clicant sus", "remove a column or a line with": "escafar una colomna o una linha amb" }, From addaa95ce75b190f62a0e2ac59f9295dc2feb2c1 Mon Sep 17 00:00:00 2001 From: m Date: Sun, 8 Apr 2018 11:21:11 +0200 Subject: [PATCH 2/2] using SessionService --- adminstuds.php | 9 +++++++-- create_classic_poll.php | 4 +++- create_date_poll.php | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/adminstuds.php b/adminstuds.php index 57e9668..011500c 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -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.')); } diff --git a/create_classic_poll.php b/create_classic_poll.php index 2465cfe..920b0ae 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -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)); diff --git a/create_date_poll.php b/create_date_poll.php index 0ad2f1d..a66330d 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -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));