You are viewing mmol_6453

 
 
20 March 2009 @ 01:29 pm
Anyone have a high-capacity server?  
I've got a real winner here.  A remote calendar that always shows you as "busy" for the next hour.  I'd put it on my Slicehost, but I suspect it would quickly eat through my 100GB/mo bandwidth allocation.

function calheader()
{
	$code = "BEGIN:VCALENDAR\n";
	$code .= "VERSION:2.0\n";
	$code .= "PRODID:-//mikemol/hourblock//NONSGML 1//EN\n";
	return $code;
}
 
function calfooter()
{
	return "END:VCALENDAR\n";
}
 
function event($start, $end, $desc)
{
  $code = "BEGIN:VEVENT\n";
  $code .= "DTSTART:" . gmstrftime("%Y%m%dT%H%M%SZ", $start) . "\n";
  $code .= "DTEND:" . gmstrftime("%Y%m%dT%H%M%SZ", $end) . "\n";
  $code .= "SUMMARY:" . $desc . "\n";
  $code .= "END:VEVENT\n";
  return $code;
}
header('Content-type: text/calendar');
 
echo calheader();
echo event(time(), time()+3600, "Busy");
echo calfooter();