Esempio n. 1
0
    $_SESSION['error'] = 'File upload size exceeded, please re-upload a smaller file';
    error_log("Upload size exceeded");
    header('Location: ' . addSession('index.php'));
    return;
}
// Model
$row = loadAssignment($LTI);
$assn_json = null;
$assn_id = false;
if ($row !== false && strlen($row['json']) > 0) {
    $assn_json = json_decode($row['json']);
    $assn_id = $row['assn_id'];
}
// Load up the submission and parts if they exist
$submit_id = false;
$submit_row = loadSubmission($assn_id, $USER->id);
if ($submit_row !== false) {
    $submit_id = $submit_row['submit_id'];
}
// Handle the submission post
if ($assn_id != false && $assn_json != null && isset($_POST['notes']) && isset($_POST['doSubmit'])) {
    if ($submit_row !== false) {
        $_SESSION['error'] = 'Cannot submit an assignment twice';
        header('Location: ' . addSession('index.php'));
        return;
    }
    // Check all files to be within our size limit
    foreach ($_FILES as $fdes) {
        if ($fdes['size'] > 1024 * 1024) {
            $_SESSION['error'] = 'Error - ' . $fdes['name'] . ' has a size of ' . $fdes['size'] . ' (1M max size per file)';
            header('Location: ' . addSession('index.php'));
Esempio n. 2
0
$user_id = $_REQUEST['user_id'];
// Load the assignment
$row = loadAssignment($LTI);
$assn_json = null;
$assn_id = false;
if ($row !== false) {
    $assn_json = json_decode($row['json']);
    $assn_id = $row['assn_id'];
}
if ($assn_id === false) {
    $_SESSION['error'] = "This assignment is not yet set up.";
    header('Location: ' . addSession('index.php'));
    return;
}
$submit_id = false;
$submit_row = loadSubmission($assn_id, $user_id);
if ($submit_row !== false) {
    $submit_id = $submit_row['submit_id'] + 0;
}
// Load user info
$user_row = loadUserInfoBypass($user_id);
if ($user_row == false) {
    $_SESSION['error'] = "Could not load student data.";
    header('Location: ' . addSession('index.php'));
    return;
}
// Handle incoming post to delete the entire submission
if (isset($_POST['deleteSubmit'])) {
    if ($submit_id == false) {
        $_SESSION['error'] = "Could not load submission.";
        header('Location: ' . addSession('index.php'));