* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ----------------------------------------------------------------------------- */ require_once "ajax.php"; require_once "auth.php"; require_once "NRG/Configuration.php"; require_once '../database.php'; //Require Administrator privileges setClearanceLevel(90); try { $config = new \NRG\Configuration("../config.ini.php"); $dbconfig = $config->Database; $db = new Database($dbconfig['host'], $dbconfig['user'], $dbconfig['pass'], $dbconfig['name']); if (!$db) { throw new Exception("Couldn't connect to the database."); } $success = 1; $message = ""; $result = array(); $method = $_SERVER['REQUEST_METHOD']; try { switch ($method) { case 'GET': $result = $db->listUsers();
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ----------------------------------------------------------------------------- * * @todo Refuse to store the final data if the subject has been locked. */ require_once "ajax.php"; require_once "auth.php"; require_once "NRG/Configuration.php"; require_once '../database.php'; //Require da manager privileges setClearanceLevel(50); //Check for errors if (empty($_POST) || empty($_POST['label']) || empty($_POST['data'])) { ajax_error('Invalid request.'); } $lock = 0; //Check the lock parameter if (!empty($_POST['lock'])) { $temp = $_POST['lock']; if ($temp == 1 || strtolower($temp) == "true") { $lock = 1; } } //Trim the data, remove html tags and escape any html special chars left. $label = trim(strip_tags($_POST['label'])); $data = trim($_POST['data']);
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ----------------------------------------------------------------------------- */ require_once "ajax.php"; require_once "auth.php"; require_once "NRG/Configuration.php"; require_once '../database.php'; //Require data entry privileges setClearanceLevel(30); //Check for errors if (empty($_POST) || empty($_POST['subjectid'])) { ajax_error('Invalid request.'); } $subjectid = trim($_POST['subjectid']); if (empty($subjectid)) { ajax_error('Invalid Subject ID.'); } if (!preg_match('/^[A-Za-z0-9]+$/', $subjectid)) { ajax_error('The Subject ID you have entered contains invalid characters.'); } //Connect to the database try { $config = new \NRG\Configuration(CONFIG_FILE); $dbconf = $config->Database;
* it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ----------------------------------------------------------------------------- */ require_once "ajax.php"; require_once "auth.php"; require_once "NRG/Configuration.php"; require_once '../database.php'; //Require some privileges setClearanceLevel(10); try { $config = new \NRG\Configuration("../config.ini.php"); $dbconfig = $config->Database; $db = new Database($dbconfig['host'], $dbconfig['user'], $dbconfig['pass'], $dbconfig['name']); if (!$db) { throw new Exception("Couldn't connect to the database."); } $result = $db->listSubjectsCreatedBy($_SESSION['aclID']); ajax_result(array("total" => count($result), "subjects" => $result)); } catch (\Exception $e) { error_log('[OnlineQuestionnaire] ERROR: ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine(), 0); }