Пример #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;
}
Пример #2
0
function ExecBlock($master)
{
    $lan = new Lan_events();
    $lan->get(getCurrentLID());
    $now = strtotime("now");
    $start = strtotime($lan->start);
    $end = strtotime($lan->end);
    $diff = 0;
    $ndiff = 1;
    if ($start < $end) {
        $diff = $end - $start;
        $ndiff = $now - $start;
    }
    $percent = round($ndiff / $diff * 100);
    if ($percent < 0) {
        $percent = 0;
    }
    if ($percent > 100) {
        $percent = 100;
    }
    $percent = 100 - $percent;
    $master->Smarty->assign("percent", $percent);
}
Пример #3
0
            return $data;
        }
    }
}
$lan = new Lan_events();
$lanid = $lan->escape(getCurrentLID());
$success = $lan->get($lanid);
if ($success) {
    $start = new Lan_timetable();
    $start->when = date("D jS M H:i", strtotime($lan->start));
    $start->type = 'start';
    $start->diff = getDiffDateTime(strtotime($lan->start));
    $start->datetime = strtotime($lan->start);
    $events[] = $start;
    $event = new Lan_timetable();
    $event->lan_id = getCurrentLID();
    $event->orderBy('"when" ASC');
    $game = new Lan_games();
    $event->selectAs($game, "game_%s");
    $event->joinAdd($game, "LEFT");
    $event->find();
    while ($event->fetch()) {
        $event->diff = getDiffDateTime(strtotime($event->occurs));
        //Remove old events
        if (strlen($event->diff) == 0) {
            continue;
        }
        $users = new Lan_timetable_signups();
        $users->timetable_id = $event->id;
        $event->signups = $users->count();
        $users->user_id = getCurrentUID();
Пример #4
0
<?php

include_once 'core.php';
include 'skins/' . Config::$theme . '/setup.php';
include_once 'integration/integration.php';
//Pull through user ID
$frontend = new FrontEnd();
setCurrentUser($frontend->getUserId());
startSession(getCurrentUID(), $frontend->getName(getCurrentUID()));
//Check user is in db and run checks.
$frontend->pullUserInfo(getCurrentUID());
$frontend->checkGroups(getCurrentUID(), getCurrentLID());
$frontend->disconnect();
$page = new Lan_pages();
$page->name = GETSafe('page');
$page->find();
if ($page->fetch()) {
    $file = 'modules/' . $page->module . '/' . $page->file . '.php';
    if (file_exists($file)) {
        include $file;
        $master->RenderPage($page->module . '.' . $page->file . '.htm');
    } else {
        $master->AddError("The file for this page does not exist!");
    }
} else {
    $master->AddError("Unknown page!");
}
if ($master->HasFatalError()) {
    $master->RenderPage('error.htm');
}
$master->RenderSite('master.integration.htm');
Пример #5
0
    $tickets = new Lan_addons_events();
    $tickets->lan_id = getCurrentLID();
    $tickets->find();
    $ticketlists = array();
    while ($tickets->fetch()) {
        $group = new Lan_addons_groups();
        $group->get($tickets->addon_id);
        $tickets->name = $group->name;
        $tickets->price = $group->price;
        if ($group->availible == 1) {
            $ticketlists[] = clone $tickets;
        }
    }
    $master->Smarty->assign("ticketlists", $ticketlists);
} else {
    $master->AddError("Unknown LAN?");
    return;
}
$master->Smarty->assign("id", $lan->id);
if (0 == strcmp($state, "hasticket")) {
    $seat = new Lan_seats();
    $seat->lan_id = getCurrentLID();
    $seat->user_id = getCurrentUID();
    if (0 != $seat->count()) {
        $state = "hasseat";
    }
}
if (streq(getCurrentLID(), '0')) {
    $state = "anon";
}
$master->Smarty->assign("state", $state);
Пример #6
0
            } else {
                $lan = new Lan_events();
                $success = $lan->get(getCurrentLID());
                if ($success) {
                    $attendees = new Lan_attendees();
                    $attendees->lan_id = getCurrentLID();
                    $attendees->user_id = getCurrentUID();
                    if ($attendees->count() == 0) {
                        $master->Smarty->assign("message", "Oddly enough your already not signed up to this event!");
                        break;
                    } else {
                        $attendees->delete();
                        $master->Smarty->assign("message", "Removed your sign up!");
                        logMessage(getCurrentUID(), 0, "User is no longer attending LAN " . $lan->name . " [" . $lan->id . "]");
                        //check if they have any seats for this lan, if so remove them.
                        $seat = new Lan_seats();
                        $seat->user_id = getCurrentUID();
                        $seat->lan_id = getCurrentLID();
                        if ($seat->find()) {
                            $seat->delete();
                        }
                        break;
                    }
                } else {
                    $master->Smarty->assign("message", "Unknown LAN selected.");
                    break;
                }
            }
            break;
    }
}
Пример #7
0
function parseForm($id = null)
{
    global $master;
    $titem = new Lan_timetable();
    if ($id != null) {
        $titem->get($titem->escape($id));
    }
    if (isset($_POST["game"])) {
        $titem->game = $titem->escape($_POST["game"]);
        if (strlen($_POST["othergame"]) != 0) {
            $titem->game = 0;
        }
    }
    $titem->lan_id = getCurrentLID();
    //$titem->owner
    $titem->type = $titem->escape($_POST["eventtype"]);
    $titem->occurs = strftime("%Y-%m-%d %H:%M:00", getLanTime("when"));
    // "2010-06-05 19:41:54";//$titem->escape($_POST["when"]);
    //var_dump($titem->occurs);
    //die();
    if (isset($_POST["eventname"])) {
        $titem->eventname = $titem->escape($_POST["eventname"]);
    }
    if (isset($_POST["othergame"])) {
        $titem->othergame = $titem->escape($_POST["othergame"]);
    }
    if (isset($_POST["maxplayers"])) {
        $titem->maxplayers = $titem->escape($_POST["maxplayers"]);
    }
    if (isset($_POST["minplayers"])) {
        $titem->minplayers = $titem->escape($_POST["minplayers"]);
    }
    if (isset($_POST["details"])) {
        $titem->details = addslashes($_POST["details"]);
    }
    if ($master->checkUserIsAdmin() && isset($_POST["official"])) {
        $titem->userevent = 0;
    } else {
        $titem->userevent = 1;
    }
    if (isset($_POST["usesignups"])) {
        $titem->allowsignups = 1;
    } else {
        $titem->allowsignups = 0;
    }
    if (isset($_POST["maxmembers"])) {
        $titem->teamsize = $titem->escape($_POST["maxmembers"]);
    } else {
        $titem->teamsize = 0;
    }
    if (isset($_POST["teams"]) && streq("yes", $_POST["teams"])) {
        $titem->teambased = 1;
    } else {
        $titem->teambased = 0;
    }
    if ($master->checkUserIsAdmin() && isset($_POST["organiser"])) {
        $titem->owner = $titem->escape($_POST["organiser"]);
    } else {
        $titem->owner = getCurrentUID();
    }
    return $titem;
}
Пример #8
0
     $attendance->lan_id = getCurrentLID();
     $master->Smarty->assign("attending", $attendance->count() != 0);
     //Get seat
     if ($attendance->count() != 0) {
         $seat = new lan_seats();
         $seat->user_id = $user->user_id;
         $seat->lan_id = getCurrentLID();
         $seat->find();
         if ($seat->fetch()) {
             $master->Smarty->assign("seat", $seat);
         }
     }
     //Find if arrived
     $arrivals = new Lan_arrivals();
     $arrivals->user_id = $user->user_id;
     $arrivals->lan_id = getCurrentLID();
     $master->Smarty->assign("arrived", $arrivals->count() != 0);
     //List attended Lans
     $lans = array();
     $attendance = new Lan_attendees();
     $event = new Lan_events();
     $attendance->joinAdd($event);
     $attendance->user_id = $user->user_id;
     $attendance->find();
     while ($attendance->fetch()) {
         $attendance->start = date("jS F y", strtotime($attendance->start));
         $lans[] = clone $attendance;
     }
     $master->Smarty->assign("attendance", $lans);
 } else {
     $master->AddError("Unknown user!");
Пример #9
0
            $userlist[] = clone $user;
        }
        $master->Smarty->assign("userlist", $userlist);
        $tt->details = stripslashes($tt->details);
        $master->Smarty->assign("event", $tt);
        $game = new Lan_games();
        if (!$logoAssigned && 1 == $game->get($tt->game)) {
            $master->Smarty->assign("image", "images/games/" . $game->picture);
        }
        setupLanTime("when", $tt->occurs, $master->Smarty);
    } else {
        $error = "Unknown event.";
    }
} else {
    if (!isset($_POST["submitBtn"])) {
        $event = new Lan_timetable();
        $event->owner = getCurrentUID();
        $master->Smarty->assign("event", $event);
        setupLanTime("when", null, $master->Smarty);
        $userlist = array();
        $user = new Lan_users();
        $attendees = new Lan_attendees();
        $lanid = getCurrentLID();
        $user->query("SELECT user_id,username FROM {$user->__table}  WHERE {$user->__table}.user_id IN (SELECT user_id FROM {$attendees->__table} WHERE `lan_id` = '{$lanid}') ORDER BY user_id");
        while ($user->fetch()) {
            $userlist[] = clone $user;
        }
        $master->Smarty->assign("userlist", $userlist);
    }
}
//$master->Smarty->assign("_page",file_get_contents("skins/" . Config::$theme . "/lantime.htm"));
Пример #10
0
 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':
     $user->orderBy('username');
     //$user->groupBy('clan');
     $user->find();
     while ($user->fetch()) {
Пример #11
0
$page = 'timetable';
if (isset($_GET["p"])) {
    // TODO: Sanitise
    $page = $_GET["p"];
}
$page = 'intranet/modules/' . $page . '.php';
if (file_exists($page)) {
    include $page;
} else {
    $smarty->assign("_page", "Unknown Page");
}
$smarty->assign("state", "none");
$Frontend = new FrontEnd();
//$smarty->assign("userid",$Frontend->getUserId());
$lan = new Lan_events();
$lanid = $lan->escape(getCurrentLID());
$success = $lan->get($lanid);
$smarty->assign("userIsAdmin", getUserIsAdmin());
$smarty->assign("lan", $lan);
//	$str = 'The server name is {$smarty.server.SERVER_NAME|upper} ' .'at {$id}';
//$smarty->assign('foo',$str);
$smarty->assign("session", $_SESSION);
//Hardcode sidebar for now
include 'intranet/modules/session.php';
include 'intranet/modules/remaining.php';
include 'intranet/modules/yourevents.php';
if (strlen($error) != 0) {
    $smarty->assign("_page", file_get_contents("skins/" . Config::$theme . "/error.tpl"));
    $smarty->assign("msg", $error);
}
echo $page;
Пример #12
0
function setupLanTime($id, $value, $smarty)
{
    $lan = new Lan_events();
    $lan->get(getCurrentLID());
    $days = array();
    $oneday = 24 * 60 * 60;
    //Add first day
    $first = new LanTime();
    $first->text = date("l jS", strtotime($lan->start));
    $first->value = strtotime(date("d-m-Y 00:00:00", strtotime($lan->start)));
    $days[] = $first;
    //Add each further day
    $querydate = strtotime(date("d-m-Y 00:00:00", strtotime($lan->start) + $oneday));
    while ($querydate < strtotime($lan->end)) {
        $day = new LanTime();
        $day->text = date("l jS", $querydate);
        $day->value = $querydate;
        $days[] = $day;
        $querydate = $querydate + $oneday;
    }
    $smarty->assign("lantime_" . $id . "_days", $days);
    //Time
    $hours = array();
    for ($i = 0; $i < 10; $i++) {
        $lt = new LanTime();
        $lt->text = "0" . $i . ":00";
        $lt->value = $i * 60 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = "0" . $i . ":15";
        $lt->value = $i * 60 * 60 + 15 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = "0" . $i . ":30";
        $lt->value = $i * 60 * 60 + 30 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = "0" . $i . ":45";
        $lt->value = $i * 60 * 60 + 45 * 60;
        $hours[] = $lt;
    }
    for ($i = 10; $i < 24; $i++) {
        $lt = new LanTime();
        $lt->text = $i . ":00";
        $lt->value = $i * 60 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = $i . ":15";
        $lt->value = $i * 60 * 60 + 15 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = $i . ":30";
        $lt->value = $i * 60 * 60 + 30 * 60;
        $hours[] = $lt;
        $lt = new LanTime();
        $lt->text = $i . ":45";
        $lt->value = $i * 60 * 60 + 45 * 60;
        $hours[] = $lt;
    }
    $smarty->assign("lantime_" . $id . "_time", $hours);
    $template = '';
    if (file_exists("skins/" . Config::$theme . "/lantime.htm")) {
        $template = file_get_contents("skins/" . Config::$theme . "/lantime.htm");
    } else {
        $template = file_get_contents("skins/default/lantime.htm");
    }
    $template = str_replace("%%ID%%", $id, $template);
    //Set value
    if (null == $value) {
        $value = date("d-m-Y H:00:00", strtotime("now"));
    }
    $smarty->assign("lantime_" . $id . "_selectedday", strtotime(date("d-m-Y 00:00:00", strtotime($value))));
    $smarty->assign("lantime_" . $id . "_selectedtime", date("G", strtotime($value)) * (60 * 60) + date("i", strtotime($value)) * 60);
    $smarty->assign("lantime_" . $id . "_tmpl", $template);
}
Пример #13
0
 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");
         }
     } else {
         $master->Smarty->assign("state", "seated");