Disable export when results are invisibles

This commit is contained in:
Olivier PEREZ 2016-10-06 21:13:01 +02:00
parent e8aac339f0
commit d980571a74
9 changed files with 25 additions and 1 deletions

View File

@ -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);

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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.",

View File

@ -21,7 +21,13 @@
<div class="col-md-5 hidden-print">
<div class="btn-group pull-right">
<button onclick="print(); return false;" class="btn btn-default"><span class="glyphicon glyphicon-print"></span> {__('PollInfo', 'Print')}</button>
<a href="{$SERVER_URL|html}exportcsv.php?poll={$poll_id|html}" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span> {__('PollInfo', 'Export to CSV')}</a>
{if $admin}
<a href="{$SERVER_URL|html}exportcsv.php?admin={$admin_poll_id|html}" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span> {__('PollInfo', 'Export to CSV')}</a>
{else}
{if !$hidden}
<a href="{$SERVER_URL|html}exportcsv.php?poll={$poll_id|html}" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span> {__('PollInfo', 'Export to CSV')}</a>
{/if}
{/if}
{if $admin}
{if !$expired}
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">