1<?php 2 3include_once( 'functions.php'); 4 5$vevent = urldecode( $_GET['vevent'] ); 6$output = "BEGIN:VCALENDAR\r\n"; 7$output .= "PRODID: -//Google Inc//Google Calendar 70.9054//EN"."\r\n"; 8$output .= "VERSION:2.0\r\n"; 9$output .= "METHOD:PUBLISH"."\r\n"; 10$output .= $vevent; 11$output .= "END:VCALENDAR\r\n"; 12 13// Get the event parameters 14$entry = parse_vevent( $vevent ); 15 16// Make a filename 17$filename = 'iCalendar_'; 18 19if ( $entry['allday'] ) 20{ 21 if ( $entry['startdate'] != $entry['enddate'] ) 22 { 23 $filename .= $entry['startdate'].'_'.$entry['enddate']; 24 } 25 else { 26 $filename .= $entry['startdate']; 27 } 28} 29else { 30 if ( $entry['startdate'] != $entry['enddate'] ) 31 { 32 $filename .= $entry['startdate'].$entry['starttime'].'_'.$entry['enddate'].$entry['endtime']; 33 } 34 else { 35 $filename .= $entry['startdate'].'_'.$entry['starttime'].'_'.$entry['endtime']; 36 } 37} 38$filename .= '.ics'; 39$filename = str_replace(":", "", $filename ); 40 41// Output the file 42header('Content-Type: text/Calendar'); 43header('Content-Disposition: attachment; filename='.$filename); 44echo $output; 45 46?>