$cfg_web_root = '../'; require_once '../include/custom_error_handler.inc'; require_once '../classes/configobject.class.php'; require_once '../classes/usernotices.class.php'; require_once '../classes/userobject.class.php'; require_once '../classes/dbutils.class.php'; @apache_setenv('no-gzip', 1); @ini_set('implicit_flush', 1); error_reporting(E_ALL); @ob_implicit_flush(1); @apache_setenv('no-gzip', 1); @ini_set('implicit_flush', 1); set_time_limit(0); $configObject = Config::get_instance(); $notice = null; $mysqli = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $configObject->get('cfg_db_staff_user'), $configObject->get('cfg_db_staff_passwd'), $configObject->get('cfg_db_database'), $configObject->get('cfg_db_charset'), $notice, 'mysqli', 6446); error_reporting(E_ALL); $db = $mysqli; if ($mysqli->error) { try { throw new Exception("MySQL error {$mysqli->error} <br> Query:<br> ", $mysqli->errno); } catch (Exception $e) { echo "Error No: " . $e->getCode() . " - " . $e->getMessage() . "<br />"; echo nl2br($e->getTraceAsString()); } } function execute($save_answers, $db, $count, $commit_interval = 800) { global $log_id, $mark, $totalpos, $saved_response, $screen_no, $tmp_duration, $dismiss, $option_order, $metadataID; $screen_no = 1; $metadataID = 1 + 10000 + rand(0, 100) / 10 * 7123;
// You should have received a copy of the GNU General Public License // along with Rogō. If not, see <http://www.gnu.org/licenses/>. /** * * @author Rob Ingram * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ require_once '../include/load_config.php'; require_once '../classes/formutils.class.php'; require_once '../classes/lang.class.php'; require_once '../classes/dbutils.class.php'; require_once '../classes/usernotices.class.php'; $notice = UserNotices::get_instance(); $mysqli = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $configObject->get('cfg_db_username'), $configObject->get('cfg_db_passwd'), $configObject->get('cfg_db_database'), $configObject->get('cfg_db_charset'), $notice, $configObject->get('dbclass')); $email = isset($_GET['email']) ? $_GET['email'] : ''; $message = ''; $errors = array(); $form_util = new FormUtils(); if (isset($_POST['submit']) and $_POST['submit'] == $string['send']) { $email = $_POST['email']; // Process the form submission $errors = $form_util->check_required(array('email' => $string['emailaddress'])); if (count($errors) == 0) { // Check if the supplied value is an email address (avoid an unnecessary DB call) if (!$form_util->is_email($email)) { $errors[] = $string['emailaddressinvalid']; } else { if ($form_util->is_email_in_cfg_institutional_domains($email)) { $errors[] = $string['emailaddressininstitutionaldomains'];
* We can run this script as a cron job and so not have to remember to go to the site every day to run the test. * * @author Joseph Baxter * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ require_once 'classes/class_totals.php'; require_once '../classes/dbutils.class.php'; include_once '../include/load_config.php'; $cfg_web_host = $configObject->get('cfg_web_host'); $support_email = $configObject->get('support_email'); $cfg_cron_user = $configObject->get('cfg_cron_user'); $cfg_cron_passwd = $configObject->get('cfg_cron_passwd'); // DB connection. $mysqli = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $configObject->get('cfg_db_sysadmin_user'), $configObject->get('cfg_db_sysadmin_passwd'), $configObject->get('cfg_db_database'), $configObject->get('cfg_db_charset'), $configObject->get('notice'), $configObject->get('dbclass'), $configObject->get('cfg_db_port')); // Exit if not on command line. if (php_sapi_name() != 'cli') { require '../include/sysadmin_auth.inc'; $msg = sprintf($string['furtherassistance'], $support_email, $support_email); $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['accessdenied'], '/artwork/page_not_found.png', '#C00000', true, true); } if ($cfg_cron_user == null or $cfg_cron_passwd == null) { echo 'This script requires the cron use to be set-up'; exit; } set_time_limit(0); // Timestamp function for logging. function timestamp() { $time = microtime(true);
?> " class="ok" /></div> </form> <?php } ?> </body> </html> <?php } else { if ($configObject->get('cfg_db_charset') == null) { $cfg_db_charset = 'latin1'; } else { $cfg_db_charset = $configObject->get('cfg_db_charset'); } $mysqli = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $_POST['mysql_admin_user'], $_POST['mysql_admin_pass'], $configObject->get('cfg_db_database'), $cfg_db_charset, $notice, $configObject->get('dbclass'), $configObject->get('cfg_db_port')); if ($mysqli->connect_error) { echo "<div>Failed to contect to MySQL using " . $_POST['mysql_admin_user'] . '' . $_POST['mysql_admin_pass'] . '</div>'; echo "</body>"; echo "</html>"; exit; } $updater_utils = new UpdaterUtils($mysqli, $configObject->get('cfg_db_database')); // Backup the config file before proceeding. $updater_utils->backup_file($cfg_web_root, $old_version); // Avoid repeated method calls $cfg_db_database = $configObject->get('cfg_db_database'); $cfg_db_student_user = $configObject->get('cfg_db_student_user'); $cfg_db_staff_user = $configObject->get('cfg_db_staff_user'); $cfg_db_host = $configObject->get('cfg_db_host'); $cfg_db_username = $configObject->get('cfg_db_username');
static function sms_api($data) { global $mysqli; if ($data[0] != 'SMS') { return ''; } $SMS = SmsUtils::GetSmsUtils(); if ($SMS === false) { $configObject = Config::get_instance(); $notice = UserNotices::get_instance(); $userObject = UserObject::get_instance(); $userid = 0; $username = '******'; if (isset($userObject)) { $userid = $userObject->get_user_ID(); $username = $userObject->get_username(); } $error_type = 'Notice'; $errstr = 'ROGO:SMS not correctly setup'; $errfile = 'lti_integration.php'; if (is_null($configObject->get('cfg_db_port'))) { $configObject->set('cfg_db_port', 3306); } // Query may fail if we try to insert while another statement is open. // Since we don't have a handle on the original statement, create another DB link $mysqli2 = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $configObject->get('cfg_db_username'), $configObject->get('cfg_db_passwd'), $configObject->get('cfg_db_database'), $configObject->get('cfg_db_charset'), $notice, $configObject->get('dbclass'), $configObject->get('cfg_db_port')); $log_error = $mysqli2->prepare("INSERT INTO sys_errors VALUES(NULL, NOW(), ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?)"); $log_error->bind_param('issssssssisss', $userid, $username, $error_type, $errstr, $errfile, $errline, $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'], $_SERVER['REQUEST_METHOD'], $paperID, $post_data, $variables, $backtrace); $log_error->execute(); $log_error->close(); return ''; } else { $SMS->set_module($data[2]); return $SMS->url; } }
require_once '../classes/userobject.class.php'; require_once '../classes/dbutils.class.php'; @apache_setenv('no-gzip', 1); @ini_set('zlib.output_compression', 0); @ini_set('implicit_flush', 1); error_reporting(E_ALL); @ob_flush(); @ob_end_flush(); @ob_implicit_flush(1); @apache_setenv('no-gzip', 1); @ini_set('zlib.output_compression', 0); @ini_set('implicit_flush', 1); set_time_limit(0); $configObject = Config::get_instance(); $notice = null; $db = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), 'root', '@Password1', 'rogotest', $configObject->get('cfg_db_charset'), $notice, $configObject->get('dbclass'), $configObject->get('cfg_db_port')); //$configObject->get('cfg_db_staff_user') $configObject->get('cfg_db_staff_passwd') $configObject->get('cfg_db_database') error_reporting(E_ALL); function get_log_ids_and_lock($paper_log_type, $screen_no, $metadataID, $db) { $log_ids = array(); $log_check = $db->prepare("SELECT id, q_id FROM log{$paper_log_type} WHERE metadataID = ? AND screen = ? FOR UPDATE"); $log_check->bind_param('ii', $metadataID, $screen_no); $log_check->execute(); $log_check->bind_result($tmp_id, $tmp_q_id); while ($log_check->fetch()) { $log_ids[$tmp_q_id] = $tmp_id; } $log_check->close(); return $log_ids; }
//XML call so debug info messes up the output error_reporting(E_ALL); ini_set('display_errors', 'On'); if (!isset($_GET['url'])) { $action = ''; $parms = ''; } else { if (substr_count($_GET['url'], '/') > 0) { list($action, $parms) = explode('/', $_GET['url'], 2); } else { $action = $_GET['url']; } } if ($action == 'getModulePaperList') { // Force a staff DB connection for getModulePaperList $mysqli = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $configObject->get('cfg_db_staff_user'), $configObject->get('cfg_db_staff_passwd'), $configObject->get('cfg_db_database'), $configObject->get('cfg_db_charset'), UserNotices::get_instance(), $configObject->get('dbclass')); $result = $mysqli->select_db($configObject->get('cfg_db_database')); } else { require '../include/staff_student_auth.inc'; } require './restAPI.class.php'; class webServiceRestAPI extends restAPI { var $db; private $qtypes = array('0' => 'Formative Quiz', '1' => 'Progress Test', '2' => 'Summative Exam', '3' => 'Survey (Questionnaire)', '4' => 'OSCE Station', '5' => 'Offline Paper', '6' => 'Peer Review'); public function __construct($mysqli) { $this->db = $mysqli; parent::__construct(); } /**
<?php // This file is part of Rogō // // Rogō 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, either version 3 of the License, or // (at your option) any later version. // // Rogō 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 Rogō. If not, see <http://www.gnu.org/licenses/>. require_once 'ims-lti\\UoN_LTI.php'; $root = str_replace('/include', '/', str_replace('\\', '/', dirname(__FILE__))); $root = $root . '/../'; require_once $root . 'include/load_config.php'; require_once $cfg_web_root . 'classes/dbutils.class.php'; $mysqli = DBUtils::get_mysqli_link($cfg_db_host, $cfg_db_username, $cfg_db_passwd, $cfg_db_database, $cfg_db_charset, $notice, $dbclass); $lti = new UoN_LTI($mysqli); $lti->init_lti0($mysqli); $lti->init_lti(true, false); print "<pre>"; print_r($lti); var_dump($lti); echo $lti->dump(); print "</pre>";