Exemple #1
0
        } else {
            if (!$_SESSION['triedcert']) {
                $_SESSION['trycert'] = true;
            }
        }
    }
    CourseRoadDB::saveNewRoad($hash, $athena, $classes, $majors);
    dieJSON(array('redirectToAuth' => $_SESSION['trycert'], 'hash' => $hash));
}
// Returns the desired table of saved roads when the user is logged in
if (isset($_POST['viewSavedRoads'])) {
    requireCSRF();
    if (!$loggedin) {
        dieJSON(array('error' => true, 'errorDesc' => 'Not logged in', 'html' => 'Sorry, you need to log in again.'));
    }
    $saved_roads = CourseRoadDB::getSavedRoads($athena);
    $html = '<table>';
    $html .= '<tr>';
    $html .= '<th style="min-width:50px" title="Select if you\'d like one of ' . 'your saved roads to be available more easily at ' . 'courseroad.mit.edu/index.php#' . $athena . '">Public</th>';
    $html .= '<th style="min-width:118px">Hash</th>';
    $html .= '<th style="min-width:118px">Added</th>';
    $html .= '<th style="min-width:95px">Major(s)</th>';
    $html .= '<th>Classes</th>';
    $html .= '<th style="min-width:30px;max-width:120px;">Comment</th>';
    $html .= '<th>Delete?</th>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td><input type="radio" name="setPublicRoad" ' . 'class="setPublicRoad" value="null" ' . (CourseRoadDB::hasPublicRoad($athena) ? '' : 'checked="true" ') . '/></td>';
    $html .= '<td colspan="6">Select this row to prevent any of your ' . 'saved roads from being your publicly-facing road.</td>';
    $html .= '</tr>';
    foreach ($saved_roads as &$row) {