I should have merged before last commit...
[platal.git] / modules / survey / survey.inc.php
index cfc2812..852c5e8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  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;
         }
+        if (!S::user()->checkPerms(PERMS_USER)) {
+            $where .=  XDB::format(' AND mode = {?}', self::MODE_ALL);
+        }
         $sql = 'SELECT id, title, end, mode
                   FROM surveys
                  WHERE '.$where.'