Esempio n. 1
0
     if (isSittingAlready($room['eventid'], 13, $userid)) {
         undoReservation($userid, $room['eventid']);
     }
     makeReservation($userid, $_GET['roomid'], $_POST['x'], $_POST['y']);
 }
 if (isset($_POST['unreserve'])) {
     undoReservation($userid, $room['eventid']);
 }
 if (isset($_POST['sitdown'])) {
     if (isSittingAlready($room['eventid'], 11, $userid)) {
         standUp($userid, $room['eventid']);
     }
     if (isSittingAlready($room['eventid'], 13, $userid)) {
         undoReservation($userid, $room['eventid']);
     }
     sitDown($userid, $_GET['roomid'], $_POST['x'], $_POST['y']);
 }
 if (isset($_POST['standup'])) {
     standUp($userid, $room['eventid']);
 }
 //Remove and seat other ppl
 if ($isallowedtoseatppl) {
     if (isset($_POST['remove'])) {
         removeUser($_GET['roomid'], $_POST['x'], $_POST['y']);
     }
     if (isset($_POST['placeUser'])) {
         $couldseat = seatUser($_GET['roomid'], $room['eventid'], $_POST['x'], $_POST['y'], $_POST['userid']);
         $notify->add($lang->get('room'), $lang->get($couldseat));
     }
 }
 $smarty->assign("remove_and_add_users", $room['eventid'] <= 0 ? false : $isallowedtoseatppl);
Esempio n. 2
0
function seatUser($roomid, $eventid, $x, $y, $userid)
{
    global $db;
    $userid = $userid <= 0 ? -1 : $userid;
    $exists = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'users', "*", "userid=" . secureMySQL((int) $userid));
    if (!$exists) {
        return "seating_nosuchuser";
    }
    if (isSittingAlready($eventid, 11, $userid)) {
        standUp($userid, $eventid);
    }
    if (isSittingAlready($eventid, 13, $userid)) {
        undoReservation($userid, $eventid);
    }
    $event = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'events', "*", "eventid=" . (int) $eventid);
    $dummy = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'register', '*', "userid=" . (int) $userid . " AND eventid=" . (int) $eventid);
    $isallowedtoreserve = ($event['free'] == 1 or $dummy['payed'] > 0);
    $isallowedtositdown = $dummy['appeared'] != 0;
    if ($isallowedtositdown) {
        sitDown($userid, $roomid, $x, $y);
        return "seating_seated";
    } elseif ($isallowedtoreserve) {
        makeReservation($userid, $roomid, $x, $y);
        return "seating_reserved";
    }
    return "seating_notpayed";
}