public static function unregister($id, $returnDB) { $ids = explode("-", $id); TestSession::change_db($ids[0]); $obj = TestSession::from_mysql_id($ids[1]); if ($obj != null) { $obj->remove(); } unset($_SESSION['sids'][session_id()]); TestSession::change_db($returnDB); }
//vars $name = "concerto.table.query"; $db = User::get_current_db(); if (array_key_exists("db", $_POST)) { $workspace_id = $_POST['db']; } $table_name = ""; if (array_key_exists("table_name", $_POST)) { $table_name = $_POST['table_name']; } $type = "SELECT"; if (array_key_exists("type", $_POST)) { $type = $_POST['type']; } $ws = UserWorkspace::from_property(array("db_name" => $db), false); TestSession::change_db($ws->id); $table = Table::from_property(array("name" => $table_name), false); $table_columns = array(); if ($table != null) { $table_columns = $table->get_columns(); } $select_section = array(array("v" => 0, "w0" => "*", "c" => "*")); $select_section = json_encode($select_section); if (array_key_exists('select_section', $_POST)) { $select_section = $_POST['select_section']; } $select_section = json_decode($select_section); if (array_key_exists("select_section_add", $_POST) && $_POST['select_section_add'] == 1) { array_push($select_section, json_decode(json_encode(array("v" => 0, "w0" => "*", "c" => "*")))); } $where_section = array();
<?php /* Concerto Platform - Online Adaptive Testing Platform Copyright (C) 2011-2012, The Psychometrics Centre, Cambridge University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License, and not any of the later versions. 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ if (!isset($ini)) { require_once '../Ini.php'; $ini = new Ini(); } TestSession::change_db($_POST['wid']); $session = TestSession::from_property(array("id" => $_POST['sid'], "hash" => $_POST['hash']), false); if ($session != null) { $session->log_error($_POST['message'], TestSessionLog::TEST_SESSION_LOG_TYPE_JS); }
private function authorize_client($client_sock, $input) { if (Ini::$log_server_events) { self::log_debug("TestServer->authorize_client() --- Client authorization started"); } $data = json_decode($input); TestSession::change_db($data->workspace_id); $session = TestSession::authorized_session($data->workspace_id, $data->session_id, $data->hash); if ($session == null) { if (Ini::$log_server_events) { self::log_debug("TestServer->authorize_client() --- Client authorization failed"); } if (!socket_write($client_sock, json_encode(array("return" => -1)) . chr(0))) { if (Ini::$log_server_events) { self::log_debug("TestServer->authorize_client() --- Error: (socket_write) " . socket_last_error() . " - " . socket_strerror(socket_last_error())); } } return false; } if (!array_key_exists("sid" . $data->workspace_id . "-" . $data->session_id, $this->instances) && $session->status != TestSession::TEST_SESSION_STATUS_SERIALIZED && $session->status != TestSession::TEST_SESSION_STATUS_NEW) { if (Ini::$log_server_events) { self::log_debug("TestServer->authorize_client() --- Client authorization failed - invalid session"); } if (!socket_write($client_sock, json_encode(array("return" => -1)) . chr(0))) { if (Ini::$log_server_events) { self::log_debug("TestServer->authorize_client() --- Error: (socket_write) " . socket_last_error() . " - " . socket_strerror(socket_last_error())); } } return false; } if (Ini::$log_server_events) { self::log_debug("TestServer->authorize_client() --- Client authorization succeeded"); } return true; }
public function get_Test() { TestSession::change_db($this->UserWorkspace_id); $session = $this->get_TestSession(); if ($session == null) { return null; } return Test::from_mysql_id($session->Test_id); }