Ejemplo n.º 1
0
function getGame($id)
{
    $sql = "select * FROM games WHERE id=:id";
    try {
        $db = getConnection();
        $stmt = $db->prepare($sql);
        $stmt->bindParam("id", $id);
        $stmt->execute();
        $game = $stmt->fetchObject();
        //Récup infos teams
        $game->region = getRegion($game->region)->name;
        $game->blue = getTeam($game->blue)->name;
        $game->red = getTeam($game->red)->name;
        $game->winner = $game->winner == 1 ? $game->blue : $game->red;
        //Récup compos
        $game->blue_compo = getCompo($game->blue_compo);
        $game->red_compo = getCompo($game->red_compo);
        //Récup bans
        $game->blue_bans = getBans($game->blue_bans);
        $game->red_bans = getBans($game->red_bans);
        return $game;
    } catch (PDOException $e) {
        return null;
    }
}
Ejemplo n.º 2
0
function setRanks($list)
{
    global $racers, $ranks;
    for ($i = 0; $i < count($list); $i++) {
        if ($list[$i]) {
            $rank = array_search($list[$i], $ranks);
            $racers[$i] = array('name' => $list[$i], 'team' => getTeam($rank));
        } else {
            array_pop($racers);
        }
    }
}
Ejemplo n.º 3
0
function getMatchups()
{
    global $db;
    $rows = pg_fetch_all(pg_execute($db, "getMatchups", array()));
    $matchups = array();
    if (!empty($rows)) {
        foreach ($rows as $row) {
            $home = getTeam($row[hometeam]);
            $away = getTeam($row[awayteam]);
            //            die($row[time]);
            $time = new DateTime($row[time]);
            if ($home && $away) {
                $matchups[] = new Matchup($home, $away, $time);
            }
        }
    }
    return $matchups;
}
Ejemplo n.º 4
0
<?php

require_once 'core.php';
$name = getPost('NAME', '');
$location = getPost('LOCATION', '');
$summary = getPost('SUMMARY', '');
// See if the team already exists
$exists = getTeam($name);
if ($name != '' && $location != '' && $summary != '' && !$exists) {
    addTeam(new Team($name, $location, $summary));
}
header("Location: team.php?name={$name}");
Ejemplo n.º 5
0
<?php

require_once dirname(__FILE__) . '/../../config/require.php';
if (!_permission_allow_view_team_info && 1 != $is_admin) {
    authorize();
}
data('team', getTeam($_GET['teamid']));
template('teamview', $data);
Ejemplo n.º 6
0
<?php

include "connect.php";
include "functions.php";
header("Content-Type: application/json");
$response = [];
if (isset($_GET["team_number"])) {
    $team = getTeam($db, $_GET["team_number"], getSessionKey());
    if ($team) {
        $response['team'] = $team;
    } else {
        http_response_code(500);
        $response["error"] = "Error retreiving team information.";
    }
} else {
    http_response_code(400);
    $response["error"] = "Team number is required.";
}
echo json_encode($response);
$db->close();
Ejemplo n.º 7
0
<?php

require_once 'core.php';
require_once 'utility.php';
$name = getGet('name', '');
$team = getTeam("{$name}");
?>

<HEAD>
<TITLE>
<?php 
if ($team) {
    echo "NFL Team: {$name}";
} else {
    echo "NFL Team Lookup";
}
?>
</TITLE>
<?php 
echo $headBust;
?>
</HEAD>
<BODY BGCOLOR=WHITE>
<DIV ALIGN="CENTER">
<?php 
if ($team) {
    ?>

<TABLE ALIGN="CENTER">
<TR><H1><?php 
    echo $name;
Ejemplo n.º 8
0
    if (isset($_POST['join_team'])) {
        $teamId = cleanInput($_POST['team_id']) / 7;
        if (!isTeamValid($teamId)) {
            $e = "Access code is not valid";
        } else {
            if (getTeamCount($teamId) == 10) {
                $e = "Team is full!";
            } else {
                joinTeam($user['id'], $teamId);
                $s = "Succesfully joined team " . $teamId * 7;
                $user['team_id'] = $teamId;
            }
        }
    }
}
$team = getTeam($user['team_id']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Home - Kick the Stigma</title>

<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom CSS -->
Ejemplo n.º 9
0
<?php

require_once dirname(__FILE__) . '/../../config/require.php';
// только авторизованные пользователи могут делать это =)
if (1 != $authorized) {
    authorize();
}
if (-1 == $curteamid) {
    fail(_error_cannot_update_team_you_have_no_team);
}
if (isset($_POST['btnTeamUpdate'])) {
    $mapping = $_POST;
    $members = array('contestanta', 'contestantb', 'contestantc', 'head', 'coach');
    foreach ($members as $_ => $member) {
        if (isset($mapping['team' . $member . 'memberuserid']) && !$mapping['team' . $member . 'memberuserid']) {
            $mapping['team' . $member . 'membername'] = $mapping['team' . $member . 'memberuseridEdit'];
        } elseif (isset($mapping['team' . $member . 'memberuserid'])) {
            $mapping['team' . $member . 'memberusernickname'] = $mapping['team' . $member . 'memberuseridEdit'];
        }
    }
    if (!updateTeam($mapping)) {
        data('message', $messages[_error_team_has_not_been_updated]);
        data('team', Butler::getORMManager()->createTeam()->wrap($mapping)->safe()->unsafe());
    } else {
        data('message', $messages[_success_team_has_been_updated]);
        data('team', getTeam($curteamid));
    }
} else {
    data('team', getTeam($curteamid));
}
template('teamupdate', $data);
Ejemplo n.º 10
0
$pages_icon = array("/index.php" => "icon-home", "/add.php" => "icon-plus-sign", "/report.php" => "icon-list-alt", "/meeting.php" => "icon-bullhorn");
$nagios_state_to_badge = array("WARNING" => "warning", "CRITICAL" => "important", "UNKNOWN" => "info", "DOWN" => "inverse", "OK" => "success");
$nagios_state_to_bar = array("WARNING" => "warning", "CRITICAL" => "danger", "UNKNOWN" => "info", "OK" => "success");
$tag_to_badge = array("action" => "success", "noaction" => "important", "" => "default");
$nagios_alert_tags = array("" => "Untagged", "issue" => "Action Taken: Service Issue (View clean)", "issuetimeperiod" => "Action Taken: Service Issue, timeperiod inappropriate (View clean)", "viewissue" => "Action Taken: View issue (network/site outage, service health questionable)", "incorrecttimeperiod" => "No Action Taken: Timeperiod not appropriate", "downtimeexpired" => "No Action Taken: Work ongoing, downtime expired", "downtimenotset" => "No Action Taken: Work ongoing, downtime not set", "thresholdincorrect" => "No Action Taken: Threshold adjustment required", "checkfaulty" => "No Action Taken: Check is faulty/requires modification", "na" => "N/A");
$nagios_tag_categories = array("" => "Untagged", "action" => "Action Taken", "noaction" => "No Action Taken");
$nagios_tag_category_map = array("issue" => "action", "issuetimeperiod" => "action", "viewissue" => "action", "incorrecttimeperiod" => "noaction", "downtimeexpired" => "noaction", "downtimenotset" => "noaction", "thresholdincorrect" => "noaction", "checkfaulty" => "noaction");
$locales = array("UK" => "Europe/London", "ET" => "America/New_York", "PT" => "America/Los_Angeles");
$sleep_states = array(-1 => "Unknown", 0 => "Awake", 1 => "Asleep");
$sleep_state_icons = array(0 => "icon-eye-open", 1 => "icon-eye-close");
$sleep_state_levels = array(-1 => "Unknown", 1 => "NREM Stage 1", 2 => "NREM Stage 2", 3 => "NREM Stage 3", 4 => "REM");
// Test to make sure we can handle this team
// .. and handle dev
$fqdn = isset($fqdn) ? $fqdn : $_SERVER['HTTP_HOST'];
$fqdn = preg_replace($dev_fqdn, $prod_fqdn, $fqdn);
if (!($team_data = getTeam($fqdn))) {
    die("I don't know what to do with this FQDN, please add it to config.php");
}
$ROOT_URL = getTeamUrl();
if (!function_exists('getUsername')) {
    die("You haven't taught opsweekly how to authenticate users! Please check user_auth.php or information in the README");
}
function getOrSetRequestedDate()
{
    session_start();
    if (isset($_POST['date'])) {
        $_SESSION['opsweekly_requested_date'] = $_POST['date'];
    }
    $date = isset($_SESSION['opsweekly_requested_date']) ? $_SESSION['opsweekly_requested_date'] : "now";
    return $date;
}
Ejemplo n.º 11
0
<?php

require "api/utils/teams.php";
$app->group('/teams', function () {
    //get teams list
    $this->get('', function ($req, $res, $args) {
        $teams = getAllTeams();
        if ($teams) {
            return $res->withStatus(200)->write(json_encode($teams));
        } else {
            return $res->withStatus(400)->write($e->getMessage());
        }
    })->setName('teams');
    //get team with id
    $this->get('/{id}', function ($req, $res, $args) {
        $team = getTeam($args['id']);
        if ($team) {
            return $res->withStatus(200)->write(json_encode($team));
        } else {
            return $res->withStatus(400)->write($e->getMessage());
        }
    });
    //post new team
    $this->post('', function ($req, $res, $args) {
        $team = $req->getParsedBody();
        $sql = "INSERT INTO teams (region, name, logo, games, wins) VALUES (:region, :name, :logo, 0, 0)";
        try {
            $db = getConnection();
            $stmt = $db->prepare($sql);
            $stmt->bindParam("region", $team['region']);
            $stmt->bindParam("name", $team['name']);
Ejemplo n.º 12
0
                                                if ($content['type'] == 'Tree') {
                                                    $drawTable = "replay_tree";
                                                    include "" . OS_CURRENT_THEME_PATH . "/game_log.php";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        if ($mode == 9) {
                            $drawTable = "replay_priv";
                            include "" . OS_CURRENT_THEME_PATH . "/game_log.php";
                        } else {
                            if (getTeam($playerColor) == 1) {
                                $drawTable = "replay_allies1";
                                include "" . OS_CURRENT_THEME_PATH . "/game_log.php";
                            } else {
                                $drawTable = "replay_allies2";
                                include "" . OS_CURRENT_THEME_PATH . "/game_log.php";
                            }
                        }
                    }
                }
            }
        }
    }
}
$drawTable = "replay_footer_table";
include "" . OS_CURRENT_THEME_PATH . "/game_log.php";
Ejemplo n.º 13
0
<?php

require_once 'core.php';
$name = getPost('NAME', '');
$position = getPost('POSITION', '');
$teamname = getPost('TEAM', '');
$team = getTeam($teamname);
$summary = getPost('SUMMARY', '');
if ($name != '' && $position != '' && $team && $summary != '' && !in_array($name, getPlayerNames())) {
    addPlayer(new Player($name, $position, $team, $summary));
}
header("Location: team.php?name={$team->name}");
Ejemplo n.º 14
0
<?php

require_once 'core.php';
$home = getPost('HOMETEAM', '');
$away = getPost('AWAYTEAM', '');
$year = getPost('YEAR', 0);
$month = getPost('MONTH', 0);
$day = getPost('DAY', 0);
$hour = getPost('HOUR', 24);
$minute = getPost('MINUTE', 60);
// Get Team objects via the user defined names
$hometeam = getTeam($home);
$awayteam = getTeam($away);
// Cleaner DateTime construction than the non-default ctor offers
$when = new DateTime();
$when->setDate($year, $month, $day);
$when->setTime($hour, $minute);
// TODO - More sophisticated validation is necessary, such as avoiding February 31st
if ($hometeam && $awayteam && $home != $away && $year >= 2015 && $year <= 2115 && $month > 0 && $month <= 12 && $day > 0 && $day <= 31 && $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60) {
    addMatchup(new Matchup($hometeam, $awayteam, $when));
}
header("Location: index.php");
Ejemplo n.º 15
0
<!-- Team Members -->
<?php 
if (!defined('MyConst')) {
    die('Direct access not permitted');
}
getTeam();
if ($teamNumRows > 0) {
    echo "<div class='row' id='team'>";
    if (!empty($teamHeading)) {
        echo "<div class='col-lg-12'>";
        echo "<h2 class='page-header team'>" . $teamHeading . "</h2>";
        echo "</div>";
    }
    if (!empty($teamBlurb)) {
        echo "<div class='col-lg-12'>";
        echo "<p class='text-center'>" . $teamBlurb . "</p>";
        echo "</div>";
    }
    while ($rowTeam = mysql_fetch_array($sqlTeam)) {
        echo "<div class='col-md-" . $teamColWidth . " text-center'>";
        echo "<div class='thumbnail'>";
        if (!empty($rowTeam['image'])) {
            echo "<img class='img-responsive' src='uploads/" . $rowTeam['image'] . "' alt='" . $rowTeam['name'] . "' title='" . $rowTeam['name'] . "'>";
        }
        echo "<div class='caption'>";
        echo "<h3>";
        if (!empty($rowTeam['name'])) {
            echo $rowTeam['name'] . "<br>";
        }
        if (!empty($rowTeam['title'])) {
            echo "<small>" . $rowTeam['title'] . "</small>";
Ejemplo n.º 16
0
<?php

include 'connectDB.php';
include 'support-function.php';
$teams = getTeam();
$numberOfTeam = $teams->num_rows;
$columnLarge = 16 / computeColumnSize($numberOfTeam);
$columnSmall = computeColumnSmall($columnLarge);
while ($row = $teams->fetch_assoc()) {
    if (!$row["LEAD_IMG"]) {
        $imgPath = "images/default.jpg";
    } else {
        $imgPath = "images/";
    }
    echo '<div class="col-lg-' . $columnLarge . ' col-sm-' . $columnSmall . ' text-left">' . '<div id="' . $row["SQUAD_ID"] . '" class="team-div" onClick="sendTeamId(' . $row["SQUAD_ID"] . ')">' . '<h1>' . $row["SQUAD_NAME"] . '</h1>' . '<img class="img-circle img-responsive img-center" src="' . $imgPath . $row["LEAD_IMG"] . '" alt="">' . '</div>' . '</div>';
}
# close database
include 'database-close.php';