Exemple #1
0
        $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);
        return;
    }
}
$error = "Unknown event!";
Exemple #2
0
<?php

if (isset($_GET["imgid"])) {
    $game = new Lan_games();
    if (1 == $game->get($game->escape($_GET["imgid"]))) {
        echo Config::$webPath . "images/games/" . $game->picture;
    }
}
die;
Exemple #3
0
        }
        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);
        $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();
Exemple #4
0
 $form = null;
 if (isset($_POST["id"])) {
     $form = parseForm($_POST["id"]);
 } else {
     $form = parseForm();
 }
 $form->details = stripslashes($form->details);
 $master->Smarty->assign("event", $form);
 if (isset($_POST["delete"])) {
     $form->delete();
     header('Location: intranet.php?p=timetable');
     die;
 } else {
     if (streq($_POST["submitBtn"], "Update")) {
         //Update or switch type
         $game = new Lan_games();
         if (isset($_POST["game"]) && 1 == $game->get($game->escape($_POST["game"]))) {
             $master->Smarty->assign("image", "images/games/" . $game->picture);
             $logoAssigned = true;
         } else {
             $master->Smarty->assign("image", "images/games/other.png");
         }
         setupLanTime("when", strtotime($form->occurs), $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;
         }
Exemple #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);