Beispiel #1
0
function SetupGroups()
{
    //Get groups
    $groups = array();
    $group = new Lan_permission_groups();
    //Setup system groups
    //Anonymous == everyone
    $groups[] = $group->FindGroupID("Anonymous");
    //Are we logged in?
    if (!streq(getCurrentUID(), "0")) {
        $groups[] = $group->FindGroupID("Registered");
    }
    //Attending this lan?
    $attendee = new lan_attendees();
    $attendee->user_id = getCurrentUID();
    $attendee->lan_id = getCurrentLID();
    if ($attendee->count() != 0) {
        $groups[] = $group->FindGroupID("Attending");
    }
    //Booked a place at this lan?
    $booked = false;
    $sold = new Lan_addons_sold();
    $addon = new Lan_addons_groups();
    $sold->joinAdd($addon);
    $sold->user_id = getCurrentUID();
    $sold->lan_id = getCurrentLID();
    $sold->find();
    while ($sold->fetch()) {
        if (streq($sold->allowSeating, "1")) {
            $groups[] = $group->FindGroupID("Booked");
            break;
        }
    }
    //Integration mode flag group.
    //if(defined("_LANMAN_INTEGRATION"))
    //$groups[] = $group->FindGroupID("Integration");
    //Membership based groups
    if (!streq(getCurrentUID(), "0")) {
        $group = new lan_permission_groups();
        $membership = new lan_permission_membership();
        $group->user_group = 1;
        $membership->user_id = getCurrentUID();
        $group->joinAdd($membership);
        $group->find();
        while ($group->fetch()) {
            $groups[] = $group->permgroup_id;
        }
    }
    $_SESSION['groups'] = $groups;
}
Beispiel #2
0
if ($success) {
    $lan->text = str_replace("\\n", "\n", $lan->text);
    $lan->text = str_replace("\\r", "\r", $lan->text);
    $master->Smarty->assign("lan", $lan);
    $attendees = new Lan_attendees();
    $user = new Lan_users();
    $attendees->lan_id = getCurrentLID();
    $attendees->joinAdd($user);
    $attendees->orderBy('username');
    $attendees->find();
    $attendeeslist = array();
    while ($attendees->fetch()) {
        if (streq(getCurrentUID(), $attendees->user_id)) {
            $state = "signedup";
        }
        $sold = new Lan_addons_sold();
        $sold->lan_id = getCurrentLID();
        $sold->user_id = $attendees->user_id;
        $sold->find();
        $soldlists = array();
        while ($sold->fetch()) {
            $g = new Lan_addons_groups();
            $g->get($sold->addon_id);
            $soldlists[] = $g->name;
            if (getCurrentUID() == $sold->user_id && 0 == strcmp($g->allowSeating, '1')) {
                $state = "hasticket";
            }
        }
        $attendees->tickets = $soldlists;
        $seat = new Lan_seats();
        $seat->lan_id = getCurrentLID();
Beispiel #3
0
 private function iCheckGroup($id, $lan, $gid, $ogid)
 {
     $products = new Lan_addons_sold();
     $products->lan_id = $lan;
     $products->user_id = $id;
     $products->addon_id = $ogid;
     if (0 == $products->count()) {
         $this->connect();
         $sql = "SELECT user_class from " . $this->mySQLprefix . "user WHERE `user_id` = " . $id . ";";
         $res = $this->getQuerySingleResult($sql);
         if ($res != false) {
             $groups = explode(',', $res[0]);
             $inGroup = false;
             foreach ($groups as $group) {
                 if (0 == strcmp($group, $gid)) {
                     $inGroup = true;
                 }
             }
             if ($inGroup) {
                 $product = new Lan_addons_sold();
                 $product->addon_id = $ogid;
                 $product->user_id = $id;
                 $product->lan_id = $lan;
                 $product->insert();
             }
         }
     }
 }
Beispiel #4
0
            if ($success) {
                $Frontend = new FrontEnd();
                logMessage($Frontend->getUserId(), 0, "Removed attendance for " . $Frontend->getName($user->user_id) . "' from " . $lan->name . " [" . $lan->id . "]");
                $user->delete();
            }
            break;
    }
}
if (isset($_POST["user"]) && isset($_POST["lan"])) {
    $newuser = new Lan_attendees();
    $newuser->lan_id = $newuser->escape($_POST["lan"]);
    $newuser->user_id = $newuser->escape($_POST["user"]);
    $newuser->insert();
    $Frontend = new FrontEnd();
    $lan = new Lan_events();
    $lan->get($lan->escape($_GET["id"]));
    logMessage($Frontend->getUserId(), 0, "Added attendee " . $Frontend->getName($newuser->user_id) . " at " . $lan->name);
}
if (isset($_POST["lanid"]) && isset($_POST["ticket"])) {
    $newticket = new Lan_addons_sold();
    $newticket->lan_id = $newticket->escape($_POST["lanid"]);
    $newticket->user_id = $newticket->escape($_POST["user"]);
    $newticket->addon_id = $newticket->escape($_POST["ticket"]);
    $newticket->insert();
    $lan = new Lan_events();
    $lan->get($lan->escape($_GET["id"]));
    $group = new Lan_addons_groups();
    $group->get($newticket->escape($_POST["ticket"]));
    $Frontend = new FrontEnd();
    logMessage($Frontend->getUserId(), 0, "Added new '" . $group->name . "' ticket for " . $Frontend->getName($newticket->user_id) . " at " . $lan->name);
}
Beispiel #5
0
    $filter = $_GET["filter"];
    $master->Smarty->assign("filter", $filter);
}
switch ($filter) {
    default:
    case 'current':
        $lanid = getCurrentLID();
        $user->query("SELECT *, {$arrived->__table}.aid as arrived,{$seat->__table}.seat_name, {$seat->__table}.id as seat_id, {$user->__table}.user_id as userid  FROM {$user->__table} LEFT JOIN {$arrived->__table} on {$arrived->__table}.user_id " . " = {$user->__table}.user_id LEFT JOIN {$seat->__table} on {$seat->__table}.user_id =  {$user->__table}.user_id  WHERE {$seat->__table}.lan_id = '{$lanid}' AND {$user->__table}.user_id IN (SELECT user_id FROM {$attendees->__table} WHERE `lan_id` = '{$lanid}') ORDER BY {$user->__table}.username");
        while ($user->fetch()) {
            if (strlen($user->arrived) == 0) {
                $user->arrived = "No";
            } else {
                $user->arrived = "Yes";
            }
            //Pull tickets
            $sold = new Lan_addons_sold();
            $addon = new Lan_addons_groups();
            $sold->whereAdd("user_id = {$user->user_id}");
            //$sold->user_id ;
            $sold->lan_id = getCurrentLID();
            $sold->joinAdd($addon);
            $sold->find();
            $tickets = array();
            while ($sold->fetch()) {
                $tickets[] = clone $sold;
            }
            $user->tickets = $tickets;
            $userlist[] = clone $user;
        }
        break;
    case 'none':
Beispiel #6
0
 $attendees->find();
 $attendeeslist = array();
 while ($attendees->fetch()) {
     if ($attendees->user_id == null) {
         $attendees->user_id = "0";
     }
     $attendeeslist[] = clone $attendees;
 }
 $master->Smarty->assign("attendees", $attendeeslist);
 if (!streq('0', getCurrentUID())) {
     $exseat = new Lan_seats();
     $exseat->user_id = getCurrentUID();
     $exseat->lan_id = getCurrentLID();
     if (0 == $exseat->count()) {
         $allowSeating = false;
         $tickets = new Lan_addons_sold();
         $tickets->user_id = getCurrentUID();
         $tickets->lan_id = getCurrentLID();
         $ticktypes = new Lan_addons_groups();
         $tickets->joinAdd($ticktypes, "LEFT");
         $tickets->selectAs($ticktypes, 'type_%s');
         $tickets->find();
         $a = array();
         while ($tickets->fetch()) {
             if (0 == strcmp($tickets->type_allowSeating, '1')) {
                 $allowSeating = true;
             }
         }
         if ($allowSeating) {
             $master->Smarty->assign("state", "noseat");
         }