projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix networking display on profiles
[platal.git]
/
modules
/
survey.php
diff --git
a/modules/survey.php
b/modules/survey.php
index
03829f0
..
1057622
100644
(file)
--- a/
modules/survey.php
+++ b/
modules/survey.php
@@
-70,6
+70,10
@@
class SurveyModule extends PLModule
return PL_DO_AUTH;
}
if (Post::has('survey_submit')) { // checks if the survey has already been filled in
return PL_DO_AUTH;
}
if (Post::has('survey_submit')) { // checks if the survey has already been filled in
+ // admins can see the survey but not vote
+ if (!$this->check_surveyPerms($page, $survey, false, false)) {
+ return PL_DO_AUTH;
+ }
$uid = 0;
if (!$survey->isMode(Survey::MODE_ALL)) { // if survey is restriced to alumni
$uid = S::v('uid');
$uid = 0;
if (!$survey->isMode(Survey::MODE_ALL)) { // if survey is restriced to alumni
$uid = S::v('uid');
@@
-110,6
+114,7
@@
class SurveyModule extends PLModule
}
if ($show == 'csv') {
pl_content_headers("text/csv");
}
if ($show == 'csv') {
pl_content_headers("text/csv");
+ header('Content-Disposition: attachment; filename="'.addslashes($survey->getTitle()).'.csv"');
echo $survey->toCSV();
exit;
} else {
echo $survey->toCSV();
exit;
} else {
@@
-396,7
+401,7
@@
class SurveyModule extends PLModule
// }}}
// {{{ function check_surveyPerms() : checks the particular surveys access permissions
// }}}
// {{{ function check_surveyPerms() : checks the particular surveys access permissions
- function check_surveyPerms(&$page, $survey, $silent = false)
+ function check_surveyPerms(&$page, $survey, $silent = false
, $admin_allowed = true
)
{
$this->load('survey.inc.php');
if ($survey->isMode(Survey::MODE_ALL)) { // if the survey is not reserved to alumni
{
$this->load('survey.inc.php');
if ($survey->isMode(Survey::MODE_ALL)) { // if the survey is not reserved to alumni
@@
-420,6
+425,12
@@
class SurveyModule extends PLModule
if ($allowed) {
return true;
}
if ($allowed) {
return true;
}
+ if (S::admin() && $admin_allowed) {
+ if (!$silent) {
+ $page->trigWarning('Tu as accès à ce sondage car tu es administrateur du site.');
+ }
+ return true;
+ }
if (!$silent) {
$page->kill("Tu n'as pas accès à ce sondage car il est réservé à d'autres promotions.");
}
if (!$silent) {
$page->kill("Tu n'as pas accès à ce sondage car il est réservé à d'autres promotions.");
}