示例#1
0
 /**
  * Create a team
  * @param $name
  * @param $tag
  */
 public function CreateTeam()
 {
     //Anonymous users cannot register.
     if (streq($this->owner, "0")) {
         return "Anonymous users cannot register teams!";
     }
     //Validate against team name being in use.
     $test = new Lan_timetable_teams();
     $test->name = $this->name;
     $test->tag = $this->tag;
     $test->timetable_id = $this->timetable_id;
     if ($test->count() != 0) {
         return "A team with this name already exists!";
     }
     //Validate against the captain already being in a team
     $tm = new Lan_timetable_team_members();
     $tm->user_id = $this->owner;
     $test = new Lan_timetable_teams();
     $test->joinAdd($tm, "CENTER");
     if ($test->count() != 0) {
         return "You cannot create a team whilst you are in a team!";
     }
     //Check that teams are being used
     $tt = new Lan_timetable();
     $tt->id = $this->timetable_id;
     $tt->teambased = 1;
     if ($tt->find() != 1) {
         return "This event is not team based!";
     }
     $tt->fetch();
     $test = new Lan_timetable_teams();
     $test->timetable_id = $this->timetable_id;
     if (!streq("0", $tt->maxplayers) && $tt->maxplayers < $test->count() + 1) {
         return "Max team count reached for this event.";
     }
     //All is ok, so insert the team
     if (0 == $this->insert()) {
         return "Team creation failed!";
     }
     //Add the captain as a member
     $tm = new Lan_timetable_team_members();
     $tm->team_id = $this->team_id;
     $tm->user_id = $this->owner;
     if (0 == $tm->insert()) {
         return "Error adding captain as team member!";
     }
     //If the player is a PUG player then remove them from the list.
     $signup = new Lan_timetable_signups();
     $signup->timetable_id = $this->timetable_id;
     $signup->user_id = $this->owner;
     while ($signup->fetch()) {
         $signup->delete();
     }
     return false;
 }
示例#2
0
 function CheckLogin($user, $pass)
 {
     try {
         $this->init();
         $out = $this->client->CheckLogin($user, $pass);
         $this->CheckForError($out);
         if (streq('1', $out)) {
             return true;
         }
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
     return false;
 }
示例#3
0
function CheckLogin($user, $pass)
{
    $Frontend = new FrontEnd();
    //Manually pull updated info
    $uid = $Frontend->findUserID($user);
    if (streq($uid, '0')) {
        return false;
    }
    $Frontend->pullUserInfo($uid);
    $dbuser = new Lan_users();
    $dbuser->username = $dbuser->escape($user);
    $dbuser->password = $pass;
    $dbuser->find();
    return 0 != $dbuser->count();
}
示例#4
0
文件: userview.php 项目: laiello/ascn
 public function ajax_signin_submit()
 {
     $r = new AJAXResponse();
     $pseudo = getValue('pseudo');
     $password = getValue('password');
     $password_repeat = getValue('password_repeat');
     $r->pseudo = $pseudo;
     $r->success = false;
     $ok = true;
     if (empty($pseudo) || empty($password) || empty($password_repeat)) {
         $r->addError('Un champ n\'a pas été rempli.') . ($ok = false);
     }
     if (preg_match('/^[a-zA-Z0-9]*$/', $pseudo)) {
         if (strlen($pseudo) < 4 || strlen($pseudo) > 32) {
             $r->addError('Le pseudo doit avoir entre 4 et 32 caractères.');
             $ok = false;
         }
     } else {
         $r->addError('Le pseudo doit avoir entre 4 et 32 caractères.');
         $r->addError('Le pseudo doit contenir seulement des lettres et des chiffres.');
         $ok = false;
     }
     if (!preg_match('/^[a-zA-Z0-9]{4,32}$/', $pseudo)) {
         $r->addError('Le pseudo doit contenir seulement des lettres et des chiffres, et doit avoir entre 4 et 32 caractères.') . ($ok = false);
     }
     if (!streq($password, $password_repeat)) {
         $r->addError('Le mot de passe répété ne correspond pas au premier mot de passe.') . ($ok = false);
     }
     if ($ok) {
         if (Joueur::createUser($pseudo, $password)) {
             $r->success = true;
         } else {
             $r->addError('Ce pseudo est déjà utilisé.');
         }
     }
     return $r;
 }
示例#5
0
<?php

$text = "Regenerating games list<br />";
if ($handle = opendir('images/games/')) {
    $text .= "Directory handle: {$handle}\n";
    $text .= "Files:\n";
    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))) {
        if (!streq("..", $file) && !streq(".", $file)) {
            $name = str_replace("-", " ", $file);
            $name = str_replace("_", " ", $name);
            $name = str_replace(".png", " ", $name);
            $game = new Lan_games();
            $game->name = $name;
            //$game->find();
            if ($game->count() == 0) {
                $game->picture = $file;
                $game->insert();
                $text .= "{$name}\n<br/>";
            }
        }
    }
    closedir($handle);
}
$master->Smarty->assign("_text", $text);
示例#6
0
if (isset($_GET["tid"])) {
    $user = new Lan_users();
    $biggame->joinAdd($user, "LEFT");
    if ($biggame->get($biggame->escape($_GET["tid"]))) {
        $biggame->fetch();
        //Find sign ups
        $tts = new Lan_timetable_signups();
        $user = new Lan_users();
        $tts->joinAdd($user);
        $tts->timetable_id = $biggame->id;
        $list = array();
        $tts->find();
        $currentUserSignedUp = false;
        $signups = 0;
        while ($tts->fetch()) {
            if (streq($tts->user_id, getCurrentUID())) {
                $currentUserSignedUp = true;
            }
            $list[] = clone $tts;
            $signups++;
        }
        $biggame->signups = $signups;
        $game = new Lan_games();
        if (1 == $game->get($biggame->game)) {
            $master->Smarty->assign("image", "images/games/" . $game->picture);
            $master->Smarty->assign("gamename", $game->name);
        }
        $biggame->occurs = date("l jS H:i", strtotime($biggame->occurs));
        $master->Smarty->assign("currentUserSignedUp", $currentUserSignedUp);
        $master->Smarty->assign("foodrun", $biggame);
        $master->Smarty->assign("signups", $list);
示例#7
0
<?php

$root = Config::$dir . '/files/';
$folder = '';
if (isset($_GET["folder"])) {
    $folder = str_replace('..', '', base64_decode(GETSafe('folder')));
}
include 'index.logic.php';
$header = '';
$headerhtml = '';
$inroot = strlen($folder) == 0 || streq('..', $folder) || streq('\\', $folder) || streq('/', $folder);
include 'browse.php';
if ($inroot) {
    $headerhtml = $master->GetTemplate('fileshare.header.htm');
}
$master->Smarty->assign("fs_folder_raw", $folder);
$master->Smarty->assign("fs_folder", GETSafe('folder'));
$master->Smarty->assign("fs_header_html", $headerhtml);
$master->Smarty->assign("fs_header", $header);
$space = disk_free_space($root);
$master->Smarty->assign("fs_freespace", decodeSize($space));
示例#8
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);
示例#9
0
                 $attendees->insert();
                 logMessage(getCurrentUID(), 0, "User signed up to LAN " . $lan->name . " [" . $lan->id . "]");
                 $master->Smarty->assign("message", "You were successfully signed up.");
                 break;
             } else {
                 $master->Smarty->assign("message", "You are already signed up to this LAN!");
                 break;
             }
         } else {
             $master->Smarty->assign("message", "Unknown LAN selected.");
             break;
         }
     }
     break;
 case 'removeme':
     if (streq("0", getCurrentUID())) {
         $master->Smarty->assign("message", "Anonymous users cannot unregister.");
         break;
     } 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!");
示例#10
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;
}
示例#11
0
 public function HasFatalError()
 {
     foreach ($this->errors as $error) {
         if (streq($error->type, 'error')) {
             return true;
         }
     }
     return false;
 }
示例#12
0
 if (streq($_GET["user-session-login"], "1")) {
     if (isset($_POST["Register"])) {
         //Register button clicked
         global $master;
         $master->AddWarning("Register on the <a href=\"http://lanops.co.uk/signup.php\">main web site *click here*</a>.");
         return;
     }
     $login = $_POST["user"];
     $password = $_POST["password"];
     $loginOK = checkLogin($login, $password);
     if ($loginOK) {
         startSession($loginOK->user_id, $loginOK->username);
         //header( 'Location: intranet.php' ) ;
     } else {
         $Frontend = new FrontEnd();
         if (!streq("0", $Frontend->getUserId())) {
             $Frontend->pullUserInfo($Frontend->getUserId());
             $loginOK = checkLogin($login, $password);
             if ($loginOK) {
                 startSession($loginOK->user_id, $loginOK->username);
                 //header( 'Location: intranet.php' ) ;
             } else {
                 $displayError = true;
             }
         } else {
             $displayError = true;
         }
         /**
         			 echo "nok";
         			 //Login failed, so check remote site.
         			 $rpc = new RPC;
示例#13
0
function CheckPermission($module, $action)
{
    $settings = new Lan_permission_settings();
    $permission = new Lan_permission();
    /**
    
    	$permission->whereAdd("module = '$module'");
    	$permission->whereAdd("action = '$action'");
    	$settings->mode_id = $_SESSION["lanmode"];
    	$addedGroup = false;
    	if(isset($_SESSION['groups'])){
    	foreach($_SESSION['groups'] as $k => $v)
    	{
    	$settings->whereAdd("group_id = " . $v, "OR");
    	$addedGroup = true;
    	}
    	}
    	if(!$addedGroup)
    	return false;
    
    	$settings->joinAdd($permission,"LEFT");**/
    if (isset($_SESSION['groups'])) {
        $groups = "";
        //"( group_id = 1 ) OR ( group_id = 2 ) OR ( group_id = 3 ) OR ( group_id = 4 ) OR ( group_id = 6 )";
        $list = $_SESSION['groups'];
        for ($i = count($list) - 1; $i >= 0; $i--) {
            if ($i == 0) {
                $groups .= "( group_id = {$list[$i]} )";
            } else {
                $groups .= "( group_id = {$list[$i]} ) OR";
            }
        }
        $modeid = $_SESSION["lanmode"];
        $settings->query("SELECT count(lan_permission_settings.perset_id) as perset_id FROM {$settings->__table} " . "LEFT JOIN {$permission->__table} ON ({$permission->__table}.permission_id={$settings->__table}.permission_id) " . "WHERE ( {$groups} ) AND ( ( module = '{$module}' ) AND ( action = '{$action}' ) ) AND ( {$settings->__table}.mode_id = {$modeid} )");
        if (0 == $settings->fetch()) {
            return false;
        }
        return !streq("0", $settings->perset_id);
    }
    return false;
}
示例#14
0
    $master->AddError("You do not have permission to access this page!");
    $allowed = false;
}
if ($allowed && isset($_POST["update"])) {
    $mode = new Lan_permission_modes();
    if ($mode->get(GETSafe("mode"))) {
        //Clear down settings for the current mode
        $settings = new Lan_permission_settings();
        $settings->mode_id = $mode->mode_id;
        $settings->find();
        while ($settings->fetch()) {
            $settings->delete();
        }
        //Add settings for the current mode
        foreach ($_POST as $k => $v) {
            if (!streq("update", $k) || streq("1", $v)) {
                $values = explode("-", $k);
                if (2 == count($values)) {
                    //	echo "perm " . $values[0] . " group " . $values[1];
                    $settings = new Lan_permission_settings();
                    $settings->group_id = $values[1];
                    $settings->mode_id = $mode->mode_id;
                    $settings->permission_id = $values[0];
                    $settings->insert();
                }
            }
        }
    } else {
        $master->AddError("Progamtic error, no mode passed?");
    }
}
示例#15
0
if (defined("LANMAN_AJAX")) {
    include 'rpc.php';
    die;
}
/*
 * Seat types:
 * 0: Normal
 * 1: Staff only
 * 2: Disabled
 */
if (!isset($_GET["id"])) {
    $master->Smarty->assign("msg", "Unknown lan");
    $master->Smarty->display('error.tpl');
    return;
} else {
    $lan = new Lan_events();
    $success = $lan->get($lan->escape($_GET["id"]));
    if ($success) {
        if (!file_exists($lan->layout) || streq($lan->layout, "")) {
            $lan->layout = "images/no_seating_plan.png";
        }
        $master->Smarty->assign("img", $lan->layout);
        $master->Smarty->assign("size", cssifysize($lan->layout));
    } else {
        $master->Smarty->assign("msg", "Unknown lan");
        $master->Smarty->display('error.tpl');
        return;
    }
    $master->Smarty->assign("id", $lan->id);
}
示例#16
0
                $list[] = $server;
            }
        }
    } catch (Exception $ex) {
    }
}
$gamelist = $q->GetGameList();
$master->Smarty->assign("gameslist", $gamelist);
foreach ($list as $server) {
    $name = $server->game;
    if (array_key_exists($server->game, $gamelist)) {
        $server->game = $gamelist[$server->game];
    }
}
$master->Smarty->assign("servers", $list);
$master->Smarty->assign("userlist", $userlist);
$master->Smarty->assign("variablelist", $variablelist);
if (isset($_GET["action"]) && streq($_GET["action"], "showplayers")) {
    $master->Smarty->assign("forceshowplayers", GETSafe("sid"));
}
$offservercount = 0;
$unoffservercount = 0;
foreach ($list as $server) {
    if (streq($server->type, "1")) {
        $offservercount++;
    } else {
        $unoffservercount++;
    }
}
$master->Smarty->assign("hasoffical", $offservercount > 0);
$master->Smarty->assign("hasunofficial", $unoffservercount > 0);
示例#17
0
 function FindMapImage($server)
 {
     if (streq($server->ping, "-1")) {
         return "libs/lgsl/lgsl_files/other/map_no_response.jpg";
     }
     $file = "libs/lgsl/lgsl_files/maps/" . $server->protocol . "/" . $server->game . "/" . $server->map . ".jpg";
     if (file_exists($file)) {
         return $file;
     }
     return "libs/lgsl/lgsl_files/other/map_no_image.jpg";
 }
示例#18
0
     $master->Smarty->Assign("address", $address);
     $master->Smarty->Assign("cport", $cport);
     $master->Smarty->Assign("qport", $qport);
     $server = new Lan_servers();
     $server->protocol = $protocol;
     $server->address = $address;
     $server->cport = $cport;
     $server->qport = $qport;
     if (strlen($cport) == 0) {
         $master->Smarty->Assign("valerror", "You must enter a port!");
     } else {
         if (0 == $server->count()) {
             $q = new GameServerQuery();
             $server = $q->CheckPorts($server);
             $server = $q->QueryServer($server);
             if (streq($server->ping, "-1")) {
                 $master->Smarty->Assign("valerror", "Please check the information entered, I could not find a server at that location!");
             } else {
                 $server->user_id = getCurrentUID();
                 $server->type = 0;
                 $server->lastupdated = strftime("%Y-%m-%d %H:%M:00", strtotime("yesterday"));
                 $key = $server->insert();
                 header("Location: ?page=editserver&sid=" . $key);
                 die;
             }
         } else {
             $master->Smarty->Assign("valerror", "A server at this location already exists!");
         }
     }
 } catch (Exception $e) {
     $master->Smarty->Assign("valerror", $e->getMessage());
示例#19
0
     if (!streq($biggame->game, "0")) {
         $link = "http://apps.metacritic.com/search/process?ty=3&ts=" . $game->name . "&tfs=game_title&sb=0&game_platform=PC&x=11&y=6&release_date_s=";
         $link = str_replace(" ", "+", $link);
         $master->Smarty->assign("gameinfolink", $link);
     }
 }
 if (streq("1", $biggame->teambased)) {
     $teams = array();
     $team = new Lan_timetable_teams();
     $team->timetable_id = $biggame->id;
     $team->find();
     while ($team->fetch()) {
         $team->PopulateMembers();
         $team->userinteam = false;
         foreach ($team->members as $member) {
             if (streq($member->user_id, getCurrentUID())) {
                 $currentUserSignedUp = "team";
                 $team->userinteam = true;
             }
         }
         $teams[] = clone $team;
     }
     $master->Smarty->assign("teams", $teams);
     //Admin: Find all attending players not currently in a team
     $addableusers = array();
     $attendees = new Lan_attendees();
     $users = new Lan_users();
     $teams = new Lan_timetable_teams();
     $signups = new Lan_timetable_signups();
     $members = new Lan_timetable_team_members();
     $attendees->query("SELECT DISTINCT ({$users->__table}.user_id), {$users->__table}.username " . "FROM {$attendees->__table} " . "LEFT JOIN {$users->__table} ON {$attendees->__table}.user_id = {$users->__table}.user_id " . "WHERE {$attendees->__table}.user_id NOT IN (" . "SELECT DISTINCT ( user_id) " . "FROM {$teams->__table} CENTER JOIN {$members->__table} " . "WHERE timetable_id = '{$biggame->id}' )" . "AND username IS NOT NULL");
示例#20
0
文件: rpc.php 项目: Kayomani/Obsidian
<?php

include 'core.php';
include "libs/phprpc/phprpc_server.php";
include 'libs/rpclib.php';
if (isset($_GET["key"]) && streq($_GET["key"], Config::$intpass)) {
    $server = new PHPRPC_Server();
    $server->add('GetUsers');
    $server->add('CheckLogin');
    $server->start();
} else {
    echo "Aliens, they be coming!!!1";
}
 /**
  * Remove a user from a team
  * @param timetable id $ttid
  */
 public function RemoveMember($ttid)
 {
     if (null == $ttid) {
         return "Programming error: No timetable ID passed!";
     }
     //Find team
     $team = new Lan_timetable_teams();
     $team->timetable_id = $ttid;
     $team->team_id = $this->team_id;
     $team->find();
     while ($team->fetch()) {
         $member = new Lan_timetable_team_members();
         $member->user_id = $this->user_id;
         $member->team_id = $this->team_id;
         $userid = $member->user_id;
         if ($member->count() != 0) {
             $member->delete();
             //If there are no members left then remove the team
             $member = new Lan_timetable_team_members();
             $member->team_id = $team->team_id;
             if (0 == $member->count()) {
                 $team->delete();
             } else {
                 //There are team members left, check captain and adjust if needed.
                 if (streq($team->owner, $userid)) {
                     $member = new Lan_timetable_team_members();
                     $member->team_id = $this->team_id;
                     $member->find();
                     $member->fetch();
                     $team->owner = $member->user_id;
                     $team->update();
                 }
             }
             return false;
         }
     }
     return "Failed to remove signup.";
 }
示例#22
0
<?php

if (isset($_GET["action"]) && streq($_GET["action"], "edit") && isset($_POST["address"])) {
    $server = new Lan_servers();
    if ($server->get(GETSafe('sid'))) {
        $server->address = POSTSafe("address");
        $server->cport = POSTSafe("port");
        $server->qport = POSTSafe("qport");
        $server->hostnameoverride = POSTSafe("hostnameoverride");
        $server->comment = POSTSafe("comment");
        if (isset($_POST["official"])) {
            $server->type = 1;
        } else {
            $server->type = 0;
        }
        if (isset($_POST["delete"])) {
            $server->delete();
            header("Location: ?page=serverlist");
            die;
        } else {
            $server->update();
        }
    }
}
示例#23
0
     $g->get($sold->addon_id);
     $g->tid = $sold->id;
     $soldlists[] = clone $g;
 }
 $attendees->tickets = $soldlists;
 //Get user info
 $attendees->username = $Frontend->getName($attendees->user_id);
 //Get availible tickets
 $tickets = new Lan_addons_groups();
 $ticketlist = array();
 $tickets->find();
 while ($tickets->fetch()) {
     $found = false;
     foreach ($soldlists as $value) {
         //echo $value->id . " to " . $tickets->id ."<br />";
         if (streq($value->id, $tickets->id)) {
             $found = true;
         }
     }
     if (!$found) {
         $ticketlist[] = clone $tickets;
     }
 }
 $attendees->availtickets = $ticketlist;
 //if(in_array($attendees->username,$allusers,false))
 unset($allusers[$attendees->username]);
 //Get seat
 $seat = new Lan_seats();
 $seat->lan_id = $lan->id;
 $seat->user_id = $attendees->user_id;
 $success = $seat->find();
示例#24
0
<?php

if (isset($_POST["Update"])) {
    $frontend = new FrontEnd();
    $user = new Lan_users();
    $id = POSTSafe("userid");
    if ($user->get($id)) {
        $currentpassword = $frontend->encryptPassword(POSTSafe("currentpass"));
        if (streq($currentpassword, $user->password)) {
            if (strlen(POSTSafe("newpass")) > 0) {
                $user->password = $frontend->encryptPassword(POSTSafe("newpass"));
            }
            $user->steamprofile = POSTSafe("steamprofile");
            $user->updateSteamData();
            $user->update();
            //Reset session if we are changing the current user, so we make sure the session has the latest data.
            if (streq(getCurrentUID(), $user->user_id)) {
                startSession($user->user_id, $user->username);
            }
        } else {
            $master->AddWarning("Incorrect current password!");
        }
    }
}
示例#25
0
文件: log.php 项目: Kayomani/Obsidian
<?php

function convertDateOut($data)
{
    $date = strtotime($data);
    $fdate = strftime("%d/%m/%Y %H:%M", $date);
    return $fdate;
}
$logs = new Lan_log();
$user = new Lan_users();
$logs->joinAdd($user);
$logs->orderBy('id DESC');
$logs->find();
$loglist = array();
$count = 0;
while ($logs->fetch()) {
    if ($count > 200) {
        break;
    }
    $count++;
    if (streq('0', $logs->user_id)) {
        $logs->username = "******";
    }
    switch ($logs->type) {
        case '0':
            $logs->type = "Message";
            break;
    }
    $loglist[] = clone $logs;
}
$master->Smarty->assign("logs", $loglist);
示例#26
0
<?php

include 'editprofile.logic.php';
$userid = getCurrentUID();
if (isset($_GET["uid"])) {
    $userid = GETSafe("uid");
}
if (streq("0", $userid)) {
    $master->AddError("You must login to edit your profile!");
} else {
    $user = new Lan_users();
    if ($user->get($userid)) {
        $master->Smarty->assign("theuser", $user);
    } else {
        $master->AddError("Unknown user!");
    }
}
示例#27
0
 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();
     if (getCurrentUID() == 0) {
         $event->currentUserSignedUp = false;
     } else {
         $event->currentUserSignedUp = $users->count() != 0;
     }
     if (streq("1", $event->teambased)) {
         $event->PopulateTeams();
     }
     $event->datetime = strtotime($event->occurs);
     //Pull additional info based on type
     switch ($event->type) {
         //	case 'start':
         //case 'end':
         //	 $event->when = date("D jS M G:i", strtotime($event->when));
         //	break;
         case 'food':
             //break;
         //break;
         case 'biggame':
             //  break;
         //  break;
示例#28
0
<?php

include 'ttedit.logic.php';
$gamelist = array();
$game = new Lan_games();
$game->orderBy('name');
$game->find();
while ($game->fetch()) {
    $gamelist[] = clone $game;
}
$master->Smarty->assign("gamelist", $gamelist);
if (isset($_GET["tid"])) {
    $tt = new Lan_timetable();
    if (1 == $tt->get($tt->escape($_GET["tid"]))) {
        if (!($master->checkUserIsAdmin() || streq($tt->owner, getCurrentUID()) || streq($tt->owner, ""))) {
            $error = "You don't have permission to edit this event!";
        }
        if ($master->checkUserIsAdmin()) {
            $master->Smarty->assign("userIsAdmin", "1");
        }
        $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);
        $tt->details = stripslashes($tt->details);
        $master->Smarty->assign("event", $tt);
示例#29
0
    $headerhtml = nl2br($header);
}
foreach ($list as $item) {
    if (!streq('.', $item) && !streq('Thumbs.db', $item) && !streq('.info', $item)) {
        if (is_dir($root . $folder . '/' . $item)) {
            $dir = new DirectoryItem();
            $dir->directory = $item;
            if (streq('..', $item)) {
                $dir->path = dirname($folder);
                if (streq($dir->path, "\\")) {
                    $dir->path = "";
                }
            } else {
                $dir->path = $folder . '/' . $item;
            }
            if (!($inroot && streq('..', $item))) {
                $dirlist[] = $dir;
            }
        } else {
            $file = new FileItem();
            $file->name = $item;
            $file->image = findimage($item);
            //Strip leading slash
            $path = $folder . '/' . $item;
            if (strlen($path) > 0) {
                $path = substr($path, 1, strlen($path) - 1);
            }
            $file->path = $path;
            $file->size = decodeSize(getFileSize($root . $folder . '/' . $item));
            $filelist[] = $file;
        }
示例#30
0
 $attendees = new Lan_seats();
 $user = new Lan_users();
 $attendees->lan_id = $lanid;
 $attendees->joinAdd($user, "LEFT");
 $attendees->orderBy('seat_name');
 $attendees->orderBy('id');
 $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')) {