die("You must provide a schedule"); } // Decode the schedule $schedule = json_decode(stripslashes($_POST['schedule']), true); // Set header for ical mime, output the xml header("Content-Type: text/calendar"); header("Content-Disposition: attachment; filename='generated_schedule" . md5(serialize($schedule)) . ".ics'"); ?> BEGIN:VCALENDAR PRODID: -//CSH ScheduleMaker//iCal4j 1.0//EN VERSION:2.0 METHOD:PUBLISH CALSCALE:GREGORIAN <?= generateIcal($schedule) ?> END:VCALENDAR <? break; case "old": // OLD SCHEDULE FORMAT ///////////////////////////////////////////// require "./inc/header.inc"; // Grab the schedule $schedule = getScheduleFromOldId($_GET['id']); if($schedule == NULL) { ?> <div class='schedUrl error'> <p><span style='font-weight:bold'>Fatal Error:</span> The requested schedule does not exist!</p> </div>
$mode = "save"; } // Switch on the mode switch ($mode) { case "ical": // iCAL FORMAT SCHEDULE //////////////////////////////////////////// // If we don't have a schedule, die! if (empty($id)) { die("You must provide a schedule"); } // Decode the schedule $schedule = getScheduleFromId($id); // Set header for ical mime, output the xml header("Content-Type: text/calendar"); header("Content-Disposition: attachment; filename=generated_schedule" . md5(serialize($schedule)) . ".ics"); echo generateIcal($schedule); break; case "old": // OLD SCHEDULE FORMAT ///////////////////////////////////////////// //TODO: Support the old format /* // Grab the schedule $schedule = getScheduleFromOldId($_GET['id']); if($schedule == NULL) { ?> <div class="container"> <div class="alert alert-danger"> <i class="fa fa-exclamation-circle"></i> <strong>Fatal Error:</strong> The requested schedule does not exist! </div> </div> <?