Location: PHPKode > projects > Meeting Request Scheduling and Booking System > mrsbs/php/schedule/ics.php
<?PHP

   // ICS generator
   //
   // Version: $Revision: 1.1 $
   // Date: $Date: 2007/09/03 01:39:48 $
   //
   // Copyright (c) 2007 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.

// We might get called via admin/ or via reply/.  In the latter, we
// have an inviteid as auth token and auth isn't required.
if(isset($_GET['inviteid']) && $_GET['inviteid'] != "")
  $auth_required = 0;
else
  $auth_required = 1;

// We are dumping ics, so we set noheader mode so we don't dump headers.
$noheader_mode = 1;

include "../lib/mrsbs.inc";

if(isset($rvar_inviteid))
{
  // We require a valid inviteid.  We don't trust the contactid and
  // don't bother calling authorize.

  $inv = get_invite_info($rvar_inviteid);
  
  if($inv)
  {
    // We customize the ICS file according to the invitee.
    $j = -1;
    
    for($i = 0;$i < $inv['mtg']['invitees']['count'];$i++)
    {
      if($inv['mtg']['invitees'][$i]['contactid'] == $inv['contactid'])
      {
	$j = $i;
	break;
      }
    }
  
    $ics = generate_ics($inv['mtg'], $j);
    $icsname = $inv['inviteid'] . ".ics";
  }
  else
    mexit($tx['op.err.noinv'], 1);
}
else
{
  if(!authorize("schedule", "review", $rvar_mtgid))
    mexit($tx['op.err.perm'], 1);
  else
  {
    $mtg = get_meeting_info($rvar_mtgid);
  
    $ics = generate_ics($mtg, -1);
    $icsname = $mtg['mtgid'] . ".ics";
  }
}

header("Content-Description: File Transfer");
header("Content-Type: text/calendar");
header("Content-Disposition: attachment; filename=" . $icsname);
header("Accept-Ranges: bytes");
header("Content-Length: " . strlen($ics));

print $ics;
?>
Return current item: Meeting Request Scheduling and Booking System