Example #1
0
<?php

$user_data = Authenticator::assert_user($_COOKIE['authToken']);
$msg = new Messages($GLOBALS['locale'], '/question-student');
$type = req_data('GET', 'type', false);
include 'question-student.html.php';
Example #2
0
<?php

if ($_SERVER['REQUEST_METHOD'] != 'GET') {
    http_response_code(405);
    die;
}
if (req_data('GET', 'confirm_code')) {
    include 'confirmcode.html.php';
} else {
    include 'newuser.html.php';
}
Example #3
0
            exit_with_message($msg->_('first-manager-created'));
        } else {
            include 'newmanager.html.php';
        }
    } else {
        // database hasn't been created yet
        $fields = array('root_username' => '', 'db_name' => '', 'db_username' => '');
        if (req_data('POST', 'action') === 'setupdb') {
            $model = new Model($first_run = true);
            $GLOBALS['dbsetuperror'] = '';
            $db_data = array();
            foreach ($fields as $f => $v) {
                $db_data[$f] = $fields[$f] = trim(req_data('POST', $f));
            }
            $db_data['db_password'] = req_data('POST', 'db_password');
            $db_data['root_password'] = req_data('POST', 'root_password');
            try {
                $model->setup_database($db_data);
            } catch (Exception $e) {
                $GLOBALS['dbsetuperror'] = 'Error: ' . $e->getMessage();
                include 'setupdb.html.php';
                exit;
            }
            // No errror...
            // Send the user one level up
            header('Location: ..');
        } else {
            include 'setupdb.html.php';
        }
    }
}
Example #4
0
<?php

$user_data = Authenticator::assert_manager_or_professor($_COOKIE['authToken']);
$msg = new Messages($GLOBALS['locale']);
$type_new = req_data('GET', 'new', false);
$edit_id = req_data('GET', 'edit', false) or null;
switch ($type_new) {
    case 'short-answer':
        $methods = ['binary', 'none'];
        break;
    case 'essay':
        $methods = ['none'];
        break;
    case 'fitb-select':
        $methods = ['binary', 'success-rate', 'none'];
        break;
    case 'fitb-type':
        $methods = ['binary', 'success-rate', 'none'];
        break;
    case 'matching':
        $methods = ['binary', 'success-rate', 'none'];
        break;
    case 'multiple-choice':
        $methods = ['binary', 'success-rate', 'none'];
        break;
    case 'source-code':
        $methods = ['input-output-bin', 'input-output-avg', 'none'];
        break;
    default:
        $methods = ['none'];
}
?>
';

  $(document).ready(function() {

    $('#confirm-container').hide();

    var loadingModal = BootstrapDialog.show({
      'type': BootstrapDialog.TYPE_DEFAULT,
      'title': '<i class="fa fa-circle-o-notch fa-spin"></i> ' + pleaseWait,
      'message': verifying,
      'closable': false,
    });

    var form_data = "<?php 
htmlout(trim(req_data('GET', 'confirm_code')));
?>
";

    var req = {
      'type': 'POST',
      'url': '/api/current/confirmations',
      'data': form_data,
      'contentType': 'text/plain'
    };
    $.post(req).done(function(data, textStatus, jqXHR) {
      loadingModal.close();
      var active = jqXHR.responseText.trim() === 'active';
      BootstrapDialog.show({
        'title': confirmed,
        'message': active ? nowActive : nowPending,