$t->printWelcome(); } $t->startMain(); if (isset($_POST['y'])) { // Process the reservation if (isset($_GET['id']) && isset($_GET['memberid']) && isset($_GET['action'])) { global $conf; $memberid = $_GET['memberid']; $resid = $_GET['id']; $action = $_GET['action']; $accept_code = $_GET['accept_code']; // Get the user $user = new User($memberid); if ($user == null) { // User not found, look in the anon table $user = new AnonymousUser($memberid); if ($user == null) { // Still not found... CmnFns::do_error_box(translate('Sorry, we could not find that user in the database.'), '', false); } } else { // Get the Reservation $res = new Reservation($resid); $resource = new Resource(); $max_participants = $resource->get_property('max_participants', $res->get_machid()); // If the total number of users (minus the owner) already participating is less than the max, let this user participate if ($action == INVITE_DECLINE || ($max_participants == '' || count($res->participating_users) < $max_participants)) { $found_user = false; $owner_id = false; for ($i = 0; $i < count($res->users); $i++) { if ($res->users[$i]['memberid'] == $memberid && $res->users[$i]['accept_code'] == $accept_code) {
// There is an anonymous user with this email already, update info $a_user = new AnonymousUser($userid); $a_user->fname = $fname; $a_user->lname = $lname; $a_user->email = $email_address; $a_user->save(); // Create temporary User object for inviting them $user = new User(); $user->userid = $userid; $user->fname = $fname; $user->lname = $lname; $user->email = $email_address; $found_user = true; } else { // Create the anonymous user $a_user = AnonymousUser::getNewUser(); $a_user->fname = $fname; $a_user->lname = $lname; $a_user->email = $email_address; $a_user->save(); $user = new User(); $user->userid = $userid; $user->fname = $fname; $user->lname = $lname; $user->email = $email_address; $found_user = true; } } if ($found_user) { $participating = false; // See if the user is already in the participation list