/** * CourseRoad: A Four-Year Planner for the MIT Undergraduate Community * August 17, 2012 * By: Danny Ben-David (dannybd@mit.edu) */ error_reporting(0); // Makes it easier to test POST code if (__DEV__ && isset($_GET['dev'])) { error_reporting(E_ALL); $_POST = $_POST + $_GET; } require 'functions.php'; // Yields a JSON-encoded list of classes which match the autocompletion field // in the Add Class tab. if (isset($_POST['autocomplete'])) { $results = CourseRoadDB::getAutocompleteResults($_POST['autocomplete']); dieJSON($results); } // Loads class data from the database and serves up the JSON which CourseRoad // requires to load that class. if (isset($_POST['getClass'])) { requirePostDataFields('subjectId'); $class = $_POST['subjectId']; $year = isset($_POST['year']) ? $_POST['year'] : false; dieJSON(pullClass($class, $year)); } // Same, but for a custom class. These are used by the Add tab. if (isset($_POST['getCustom'])) { requirePostDataFields('name'); $units = isset($_POST['units']) ? floatval($_POST['units']) : false; dieJSON(pullCustom($_POST['name'], $units));