<?php

if (!defined("IN_EXM")) {
    exit(1);
}
if ($login->isUserLoggedIn() === false) {
    exit(1);
}
// Get Submission id
if (isset($_GET['sid']) && intval($_GET['sid']) > 0) {
    $sid = intval($_GET['sid']);
} else {
    exit("Invalid submission!");
}
$submission = new Submission($sid);
foreach ($submission->getReview() as $key => $value) {
    // Get the last id in the array
    $id = $submission->getLatestReview($key);
    if ($id > -1) {
        // Get review
        $review = new Review($id);
        // If comment form was submitted add the comment
        $commentSubmitId = 'comment' . $review->id;
        if (key_exists($commentSubmitId, $_POST)) {
            $review->addComment($_POST[$commentSubmitId]);
        }
        echo '<div class="review_box">';
        echo '<p>';
        // Link to review
        if (get_class($review->data) == "TE") {
            echo '<a class="bold" href="?view=reviewthesis&sid=' . $submission->id . '&uid=' . $review->user . '">';