X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsurvey%2Fsurvey.inc.php;h=852c5e88fc07d9880d1297883e369286c130daf0;hb=c9566e01c2add8f12a858abe0fbb0bc6b8e3c0d4;hp=299b7fb0495e866cf2fcf6c0c8383899338429e4;hpb=245923e335d0da5bec9495991a7846be9f0563ab;p=platal.git diff --git a/modules/survey/survey.inc.php b/modules/survey/survey.inc.php index 299b7fb..852c5e8 100644 --- a/modules/survey/survey.inc.php +++ b/modules/survey/survey.inc.php @@ -1,6 +1,6 @@ checkPerms(PERMS_USER)) { + $where .= XDB::format(' AND mode = {?}', self::MODE_ALL); + } $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 - 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]);