Example #1
0
        $exit = 0;
        foreach ($data as $v) {
            $modinfo = $modinfo . ', ' . $v[1];
            if ($v[1] == '') {
                $exit = 1;
            }
        }
        $modinfo = substr($modinfo, 2);
        echo '<h1>' . sprintf($string['module'], $modinfo) . '</h1>';
        $msg = 'First time configuration. Please select the paper you wish to use in this external tool link.';
        echo $notice->info_strip($msg, 100);
        echo '<form method="post">';
        foreach ($data as $v) {
            $moduleid = $v[1];
            list($block_id, $plk) = listtreemodules($mysqli, $moduleid, $block_id, $plk, true);
        }
        echo "<br /><div><input type=\"submit\" name=\"submit\" value=\"" . $string['ok'] . "\" class=\"ok\" style=\"margin-left:20px\" /></form></div></form>\n";
        echo '<br />';
        if ($exit == 1) {
            $plk = 0;
            $modinfo = "Undefined Module. Please contact Support.";
        }
        if ($plk == 0) {
            @ob_clean();
            unset($_SESSION['_lti_context']);
            unset($_SESSION['lti']);
            UserNotices::display_notice($string['NoPapers'], $string['NoPapersDesc'], '../artwork/access_denied.png', '#C00000');
            echo '<p>Module(s): ' . $modinfo . '</p>';
        }
    }
}
Example #2
0
//
// 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)) {
Example #3
0
 public function db_user_change()
 {
     global $db_errors, $string;
     $configObject = Config::get_instance();
     $getback = array('cfg_db_sysadmin_user', 'cfg_db_sysadmin_passwd', 'cfg_db_admin_user', 'cfg_db_admin_passwd', 'cfg_db_staff_user', 'cfg_db_staff_passwd', 'cfg_db_student_user', 'cfg_db_student_passwd', 'cfg_db_external_user', 'cfg_db_external_passwd', 'cfg_db_inv_user', 'cfg_db_inv_passwd', 'cfg_db_database');
     $arr = $this->configObj->get($getback);
     foreach ($arr as $k => $v) {
         ${$k} = $v;
     }
     // Select the aproprate database user
     if ($this->has_role('SysAdmin')) {
         $result = $this->db->change_user($cfg_db_sysadmin_user, $cfg_db_sysadmin_passwd, $cfg_db_database);
     } elseif ($this->has_role(array('Staff', 'Admin'))) {
         // Process staff first to get higher priority than students
         $result = $this->db->change_user($cfg_db_staff_user, $cfg_db_staff_passwd, $cfg_db_database);
     } elseif ($this->has_role('Student')) {
         $result = $this->db->change_user($cfg_db_student_user, $cfg_db_student_passwd, $cfg_db_database);
     } elseif ($this->has_role('External Examiner')) {
         $result = $this->db->change_user($cfg_db_external_user, $cfg_db_external_passwd, $cfg_db_database);
     } elseif ($this->has_role('Invigilator')) {
         $result = $this->db->change_user($cfg_db_inv_user, $cfg_db_inv_passwd, $cfg_db_database);
     } else {
         $result = false;
         // new security routine
         $notice = UserNotices::get_instance();
         if (!is_array($this->roles) or isset($this->roles['']) and $this->roles[''] == 1) {
             $notice->access_denied($this->db, $string, '', true, true);
         } else {
             $notice->access_denied($this->db, $string, sprintf($string['denied_role'], implode(',', array_keys($this->roles))), true, true);
         }
     }
     if ($result == false) {
         $msg = 'This should never appear, please contact support';
         $support_email = $configObject->get('support_email');
         if ($support_email != '') {
             $msg .= " (<a href=\"{$support_email}\">{$support_email}</a>)";
         }
         $msg .= '.';
         $notice = UserNotices::get_instance();
         $notice->display_notice('Change DB user failed', $msg, '../artwork/exclamation_64.png', '#C00000', true, false);
         if ($this->db->error) {
             try {
                 throw new Exception("MySQL error " . $this->db->error . "<br /> ", $this->db->errno);
             } catch (Exception $e) {
                 echo "<p>Error No: " . $e->getCode() . " - " . $e->getMessage() . "</p>";
                 echo '<p>' . nl2br($e->getTraceAsString()) . '</p>';
                 echo "<body>\n</html>";
                 exit;
             }
         }
     }
 }
Example #4
0
 static function invalid_module_code($c_internal_id, $data, $location = '')
 {
     $notices = UserNotices::get_instance();
     $notices->display_notice("Module code error", 'There is a problem with the module code as the translation code has resulted in an error.  Please contact Learning Team Support <a href="mailto:learning-team-support@nottingham.ac.uk">learning-team-support@nottingham.ac.uk</a>  Please include this debug info below:', '/artwork/access_denied.png', '#C00000');
     echo '<p>Incoming Module Code: ' . $c_internal_id . '</p>';
     echo "<p>At: {$location}</p>";
     exit;
 }
Example #5
0
 static function get_paper_properties_by_crypt_name($crypt_name, $db, $string, $exit_on_false = true)
 {
     $configObj = Config::get_instance();
     $notice = UserNotices::get_instance();
     $paper_property = new PaperProperties($db);
     $paper_property->set_crypt_name($crypt_name);
     if ($paper_property->load() !== false) {
         return $paper_property;
     } else {
         if ($exit_on_false) {
             $msg = sprintf($string['furtherassistance'], $configObj->get('support_email'), $configObj->get('support_email'));
             $notice->display_notice_and_exit($db, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
         } else {
             return false;
         }
     }
 }
Example #6
0
 /**
  * Returns a user object.
  * @param object $getauth - Normally empty auth_obj but can be used to request a specific user.
  * @return object - User object.
  */
 function get_auth_obj(&$getauth)
 {
     global $string;
     if (!is_object($getauth)) {
         $getauthobj->userid = $getauth;
         $getauthobj->userObj = new UserObject($this->configObj, $this->db);
         $getauthobj->userObj->load($getauth);
     } else {
         $getauthobj =& $getauth;
         if (!isset($getauthobj->userObj)) {
             // Serious error - we have no user object.
             $getauthobj->userObj = new UserObject($this->configObj, $this->db);
         }
         if ($this->get_userid() < 1) {
             $notice = UserNotices::get_instance();
             if (!is_null($this->configObj->get('display_auth_debug')) and $this->configObj->get('display_auth_debug') == true) {
                 $msg = $string['Authentication_notloggedin2'];
                 $reason = $string['Authentication_notloggedin2'];
             } else {
                 $msg = $string['Authentication_notloggedin2nodebug'];
                 $reason = $string['Authentication_notloggedin2nodebug'];
             }
             $notice->display_notice_and_exit($this->db, $string['Authentication_notloggedin1'], sprintf($msg, $this->configObj->get('support_email'), $this->configObj->get('support_email'), $this->debug_to_string()), sprintf($reason, $this->configObj->get('support_email'), $this->configObj->get('support_email'), $this->debug_to_string()), '/artwork/fingerprint_48.png', '#C00000', true, true);
         }
         $getauthobj->userObj->load($this->get_userid());
     }
     if (isset($this->callbackregister['getauthobj'])) {
         foreach ($this->callbackregister['getauthobj'] as $number => $callback) {
             $this->debug[] = 'run getauthobj callback ' . get_class($callback[0]) . ':' . $callback[1];
             $getauthobj = call_user_func_array($callback, array($getauthobj));
             $objid = key($this->callbackregisterdata['getauthobj'][$number]);
             $this->append_auth_object_debug($objid);
         }
     }
     return $getauthobj->userObj;
 }
Example #7
0
 /**
  * CLoads the config
  */
 function load_config()
 {
     $notice = UserNotices::get_instance();
     $this->config = $this->configObj->getbyref('lookup');
     if (!isset($this->config)) {
         $notice->display_notice($string['NoLookupConfigured'], $string['NoLookupConfiguredmessage'], '../artwork/software_64.png', $title_color = '#C00000');
         exit;
     }
     $this->debug[] = 'Loaded Config for lookup';
 }
Example #8
0
//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();
    }
    /**