projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Release of plat/al 1.1.4
[platal.git]
/
modules
/
survey
/
survey.inc.php
diff --git
a/modules/survey/survey.inc.php
b/modules/survey/survey.inc.php
index
299b7fb
..
852c5e8
100644
(file)
--- a/
modules/survey/survey.inc.php
+++ b/
modules/survey/survey.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-201
0
Polytechnique.org *
+ * Copyright (C) 2003-201
1
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-348,6
+348,9
@@
class Survey
default:
return null;
}
default:
return null;
}
+ if (!S::user()->checkPerms(PERMS_USER)) {
+ $where .= XDB::format(' AND mode = {?}', self::MODE_ALL);
+ }
$sql = 'SELECT id, title, end, mode
FROM surveys
WHERE '.$where.'
$sql = 'SELECT id, title, end, mode
FROM surveys
WHERE '.$where.'
@@
-439,7
+442,8
@@
class Survey
public function vote($uid, $args)
{
XDB::execute('INSERT INTO survey_votes
public function vote($uid, $args)
{
XDB::execute('INSERT INTO survey_votes
- SET survey_id = {?}, uid = {?};', $this->id, $uid); // notes the user as having voted
+ SET survey_id = {?}, uid = {?}',
+ $this->id, ($uid == 0) ? null : $uid); // notes the user as having voted
$vid = XDB::insertId();
for ($i = 0; $i < count($this->questions); $i++) {
$ans = $this->questions[$i]->checkAnswer($args[$i]);
$vid = XDB::insertId();
for ($i = 0; $i < count($this->questions); $i++) {
$ans = $this->questions[$i]->checkAnswer($args[$i]);