Location: PHPKode > projects > Meeting Request Scheduling and Booking System > mrsbs/php/reply/reply-op-handler.php
<?PHP

   // Reply operations handler
   //
   // Version: $Revision: 1.3 $
   // Date: $Date: 2007/08/31 23:13:54 $
   //
   // Copyright (c) 2006 - 2007 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.

$auth_required = 0;

include('../lib/mrsbs.inc');

// We must have a place to go back to

if(isset($rvar_return))
  $op_ret = $rvar_return;
else
  mexit($tx['op.err.badparam'], 1);

// Reply operations require a valid inviteid.  We don't trust the contactid
// and don't bother calling authorize.

$inv = get_invite_info($rvar_inviteid);

if($inv)
{
  switch($rvar_op)
  {
  case "contact":
    if(update_contact($inv['contactid'], $rvar_givenname, $rvar_sn,
		      $rvar_mail))
      $result = $tx['op.successful'];
    else
    {
      $result = $tx['op.failed'] . ": " . $dbc->ErrorMsg();
      $err++;
    }
    break; // contact
  case "reply":
    // Build the replies into one timegrid.

    $attend = false;
    $slots = array();
    $slots['count'] = 0;
    $locs = array();
    $locs['count'] = 0;
     
    if($rvar_attend == "A")
    {
      $attend = true;

      // Build the slot and location arrays

      for($i = 0;$i < count($rvar_slotid);$i++)
      {
	$slots[$i] = array();
	$slots[$i]['begin'] = $rvar_sstart[$i];
	$slots[$i]['end'] = $rvar_send[$i];
	$slots[$i]['pref'] = $_POST[$rvar_slotid[$i]];
	$slots['count']++;
      }

      for($i = 0;$i < count($rvar_locid);$i++)
      {
	$locs[$i] = array();
	$locs[$i]['locid'] = $rvar_locid[$i];
	$locs[$i]['pref'] = $_POST["l-".$rvar_locid[$i]];
	$locs['count']++;
      }
    }

    if(update_invitee_reply($rvar_inviteid, $attend, $slots, $locs,
			    $rvar_note))
    {
      send_host_reply($rvar_inviteid, $rvar_note);
      
      $result = $tx['op.successful'];
    }
    else
    {
      $result = $tx['op.failed'] . ": " . $dbc->ErrorMsg();
      $err++;
    }
    break; // reply
  default:
    $result = $tx['op.err.badparam'];
    $err++;
    break;
  }
}
else
{
  $result = $tx['op.err.noinv'];
  $err++;
}
?>
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" CONTENT="<?PHP print (isset($err) ? "1" : "0");?>;URL=<?PHP
  if(strstr($op_ret, "?")) $c = "&";
  else $c = "?";
  print hstr($op_ret) . $c . (isset($err) ? "error=" : "result=") . $result;
?>">
</HEAD>
<BODY BGCOLOR=gray>
<?PHP /*print $op_ret;*/?>
</BODY>
</HTML>
Return current item: Meeting Request Scheduling and Booking System