public static function AddNewInvitation($host_email, $guest_email) { $token = sha1(uniqid() . $guest_email); $sqlCommand = "INSERT INTO invitations (host_email,guest_email,token,created_datetime, expired_datetime)" . "VALUES (?,?,?,NOW(), DATE_ADD(NOW(), INTERVAL 30 DAY))"; $paramTypeSpec = "sss"; $mysqli = DA_Helper::mysqli_connect(); if ($mysqli->connect_errno) { $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; throw new Exception($msg, $stmt->errno); } if (!($stmt = $mysqli->prepare($sqlCommand))) { $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error; throw new Exception($msg, $stmt->errno); } if (!$stmt->bind_param($paramTypeSpec, $host_email, $guest_email, $token)) { $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; throw new Exception($msg, $stmt->errno); } if (!$stmt->execute()) { $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error; throw new Exception($msg, $stmt->errno); } $stmt->close(); $insertedID = $mysqli->insert_id; $retrievedInvitation = da_invitation::GetInvitationByID($insertedID); return $retrievedInvitation; }
public static function GetIfInvitationIsEnabled() { $response = new simpleResponse(); $parameters = InvitationEnabledWebService::collectParameters(); try { $account_id = 0; include './inc/incWebServiceSessionValidation.php'; if ($account_id > 0) { $apps = da_invitation::GetInvitationAvailability($parameters->account_id); $response->status = "OK"; $response->message = "SUCCESS"; $response->data = $apps; } else { $response->status = "ERROR"; } } catch (Exception $ex) { $response->status = "EXCEPTION"; $response->message = $ex->getMessage(); } return $response; }
public static function test_da_invitation() { ReportInfo("Initiating Invitation Test"); ReportInfo("creating invitation for robertoviquez@gmail.com"); $invitation = da_invitation::AddNewInvitation("*****@*****.**", "*****@*****.**"); ReportInfo("El resultado de la creacion de la invitacion: " . print_r($invitation, true)); ReportInfo("Invitation Tests Complete!"); }
private static function saveInvitation($parameters) { return da_invitation::AddNewInvitation($parameters->host_email, $parameters->guest_email); }