From d980571a749ceb6400b7f1c301ca44fdb8ed7bd9 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Thu, 6 Oct 2016 21:13:01 +0200 Subject: [PATCH] Disable export when results are invisibles --- exportcsv.php | 11 +++++++++++ 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/oc.json | 1 + tpl/part/poll_info.tpl | 8 +++++++- 9 files changed, 25 insertions(+), 1 deletion(-) diff --git a/exportcsv.php b/exportcsv.php index db8832a..4f89f28 100644 --- a/exportcsv.php +++ b/exportcsv.php @@ -42,6 +42,12 @@ $pollService = new PollService($connect, $logService); if (!empty($_GET['poll'])) { $poll_id = filter_input(INPUT_GET, 'poll', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); $poll = $pollService->findById($poll_id); +} else if (!empty($_GET['admin'])) { + $admin_id = filter_input(INPUT_GET, 'admin', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => ADMIN_POLL_REGEX]]); + $poll = $pollService->findByAdminId($admin_id); + if ($poll) { + $poll_id = $poll->id; + } } if (!$poll) { @@ -50,6 +56,11 @@ if (!$poll) { exit; } +if ($poll->hidden && empty($admin_id)) { + $smarty->assign('error', __('Error', 'Forbidden!')); + $smarty->display('error.tpl'); + exit; +} $slots = $pollService->allSlotsByPoll($poll); $votes = $pollService->allVotesByPollId($poll_id); diff --git a/locale/br.json b/locale/br.json index ccf8f3d..c6362f0 100644 --- a/locale/br.json +++ b/locale/br.json @@ -368,6 +368,7 @@ }, "Error": { "Error!": "Fazi!", + "Forbidden!": "BR_Interdit !", "Enter a title": "Ret eo enankañ un titl!", "Something is going wrong...": "Un dra bennak a-dreuz a zo...", "Something is wrong with the format": "Un dra bennak a-dreuz a zo gant ar mentrezh", diff --git a/locale/de.json b/locale/de.json index e2d2d89..b4e8716 100644 --- a/locale/de.json +++ b/locale/de.json @@ -369,6 +369,7 @@ }, "Error": { "Error!": "Fehler!", + "Forbidden!": "Verboten!", "Enter a title": "Titel eingeben", "Something is going wrong...": "Etwas geht schief...", "Something is wrong with the format": "Mit dem Format stimmt etwas nicht", diff --git a/locale/en.json b/locale/en.json index b26536f..03fb781 100644 --- a/locale/en.json +++ b/locale/en.json @@ -370,6 +370,7 @@ }, "Error": { "Error!": "Error!", + "Forbidden!": "Forbidden!", "Enter a title": "Enter a title", "Something is going wrong...": "Something has gone wrong...", "Something is wrong with the format": "Something is wrong with the format", diff --git a/locale/es.json b/locale/es.json index 3f79e53..9401089 100644 --- a/locale/es.json +++ b/locale/es.json @@ -369,6 +369,7 @@ }, "Error": { "Error!": "¡Error!", + "Forbidden!": "¡Prohibido!", "Enter a title": "Introducza un título", "Something is going wrong...": "Algo anda mal...", "Something is wrong with the format": "Algo está mal con el formato", diff --git a/locale/fr.json b/locale/fr.json index 7cc8652..16005f5 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -369,6 +369,7 @@ }, "Error": { "Error!": "Erreur !", + "Forbidden!": "Interdit !", "Enter a title": "Il faut saisir un titre !", "Something is going wrong...": "Quelque chose ne va pas...", "Something is wrong with the format": "Quelque chose ne va pas avec le format", diff --git a/locale/it.json b/locale/it.json index d5bd192..39ad8b5 100644 --- a/locale/it.json +++ b/locale/it.json @@ -369,6 +369,7 @@ }, "Error": { "Error!": "Errore!", + "Forbidden!": "Proibito!", "Enter a title": "È necessario inserire un titolo !", "Something is going wrong...": "Qualcosa non è corretto...", "Something is wrong with the format": "Qualche errore nel formato", diff --git a/locale/oc.json b/locale/oc.json index 9317653..e5defca 100644 --- a/locale/oc.json +++ b/locale/oc.json @@ -369,6 +369,7 @@ }, "Error": { "Error!": "Error !", + "Forbidden!": "OC_Interdit !", "Enter a title": "Cal picar un títol !", "Something is going wrong...": "I a quicòm que truca...", "Something is wrong with the format": "I a quicòm que truca amb lo format.", diff --git a/tpl/part/poll_info.tpl b/tpl/part/poll_info.tpl index c568721..ebf3562 100644 --- a/tpl/part/poll_info.tpl +++ b/tpl/part/poll_info.tpl @@ -21,7 +21,13 @@
- {__('PollInfo', 'Export to CSV')} + {if $admin} + {__('PollInfo', 'Export to CSV')} + {else} + {if !$hidden} + {__('PollInfo', 'Export to CSV')} + {/if} + {/if} {if $admin} {if !$expired}