function toBoxxy($teamid, $count, $time) { $urls = array("http://localhost:8000"); $teams = getTeams(); $team = $teams["team-{$teamid}"]; $laps = (int) $team['laps']; $count = (int) $count; $data = array('count' => $count, 'team' => array('id' => "t{$teamid}", 'name' => $team['name'], 'laps' => $laps), 'time' => date('Y-m-d\\TH:i:s.000\\Z', $time)); foreach ($urls as $url) { $ch = curl_init(); // set the target url echo "{$url}/{$teamid}/laps/"; curl_setopt($ch, CURLOPT_URL, "{$url}/{$teamid}/laps/?key=tetten"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); // print_r(json_encode($data)); $result = curl_exec($ch); curl_close($ch); } }
<?php // ------ GET CURRENT EVENT ID ------ \\ require_once __DIR__ . DIRECTORY_SEPARATOR . 'common.php'; $evtId = getEventId(); if (!$evtId) { exit('Pas de tournoi en cours'); } $evtId = getEventId(); $lastMatch = getLastMatch(); // ------ FETCH ALL AVAILABLES TEAMS ------ \\ $teams = getTeams($evtId); // ------ PARSE URL PARAMETERS TO KNOW WHAT WE SHOW ------ \\ $team = null; if (array_key_exists('team', $_GET)) { $teamAbbr = $_GET['team']; $team = findTeam($teams, $teamAbbr); $matchs = getMatchs($team['id']); usort($matchs, function ($match1, $match2) { return $match1['num'] > $match2['num'] ? 1 : -1; }); $matchs_done = array_filter($matchs, function ($match) { return (bool) $match['score']; }); $matchs_inprogress = array_filter($matchs, function ($match) { return (bool) $match['begin'] && !$match['end']; }); usort($matchs_inprogress, function ($match1, $match2) { return $match1['begin']['time'] < $match2['begin']['time'] ? 1 : -1; // DESC });
//Parameters extracted: /* CrossPG, ThroughBallsPG, LongBallsPG, ShortPassPG */ require 'helper.php'; //<div id="stage-situation-stats" class="ws-panel stat-table"> //remember to click on passes $urls = array(); $urls[] = "passes_serieA_"; $urls[] = "passes_premier_"; $urls[] = "passes_liga_"; $urls[] = "passes_bundesliga_"; echo '<div class="row"><div class="col-md-6">'; foreach ($urls as $url) { for ($year = 2010; $year <= 2015; $year++) { $league_id = setLeagueId($url); $html = file_get_html($url . $year . ".html"); echo "<br><b>Parsing Stats from " . $url . $year . ".html </b><br>"; $table = $html->getElementById("stage-passes-grid"); $dataArray = getTeams($conn, $table, $year, $league_id, "tn"); parseInput($conn, "Cross Per Game", "td[class=cr]", $table, $dataArray, "Sporty", 0, "number"); parseInput($conn, "Through Balls Per Game", "td[class=tb]", $table, $dataArray, "Sporty", 0, "number"); parseInput($conn, "Long Balls Per Game", "td[class=lb]", $table, $dataArray, "Sporty", 0, "number"); parseInput($conn, "Short Pass Per Game", "td[class=sp]", $table, $dataArray, "Sporty", 0, "number"); echo "<br><b>Done Parsing Stats from " . $url . $year . ".html </b> <br>"; } } echo '</div><div class="col-md-6">'; echo "Done Parsing<br>"; echo '<a href="home.html#seven" class="btn btn-info" role="button">Continue</a>'; echo '</div></div>';
/* gamesWon, gamesDrawn, gamesLost, goalsScored, goalsAgainst //<div id="standings-11369" style="display: block;"> */ require 'helper.php'; $urls = array(); $urls[] = "results_serieA_"; $urls[] = "results_premier_"; $urls[] = "results_liga_"; $urls[] = "results_bundesliga_"; echo '<div class="row"><div class="col-md-6">'; foreach ($urls as $url) { for ($year = 2010; $year <= 2015; $year++) { $league_id = setLeagueId($url); $html = file_get_html($url . $year . ".html"); echo "<br><b>Parsing Stats from " . $url . $year . ".html </b><br>"; $dataArray = getTeams($conn, $html, $year, $league_id, "team"); parseInput($conn, "Games Won", "td[class=w]", $html, $dataArray, "Sporty", 1, "number"); parseInput($conn, "Games Drawn", "td[class=d]", $html, $dataArray, "Sporty", 0, "number"); parseInput($conn, "Games Lost", "td[class=l]", $html, $dataArray, "Sporty", 1, "number"); parseInput($conn, "Goals Scored", "td[class=gf]", $html, $dataArray, "Offensive", 1, "number"); parseInput($conn, "Goals Against", "td[class=ga]", $html, $dataArray, "Defensive", 1, "number"); parseInput($conn, "Rank", "td[class=o]", $html, $dataArray, "Sporty", 1, "number"); echo "<br><b>Done Parsing Stats from results" . $url . $year . ".html </b> <br>"; } } echo '</div><div class="col-md-6">'; echo "Done Parsing<br>"; echo '<a href="home.html#three" class="btn btn-info" role="button">Continue</a>'; echo '</div></div>';
function getPlayerInfo($href) { //$href = "playerpage.htm?ilkid=ALLENMAR01"; //$href = "playerpage.htm?ilkid=ARRINLAV01"; $debug = false; $base_url = "http://databasefootball.com/players/"; //echo "href: $href<br>"; //echo "$base_url $href<br>"; $p_url = $base_url . $href; //echo "player url: $p_url<br>"; $player_page = file_get_html($p_url); $bio = $player_page->find('font.bio', 0); //echo var_dump($bio); $plaintext = $bio->plaintext; $innerText = $bio->innerText; //echo "innerText: $innerText<br>"; echo "Plaintext: {$plaintext}<br>"; $plaintext = preg_replace("(\\'\\')", "\"", $plaintext); $plaintext = preg_replace("(\\')", "\\'", $plaintext); $fullName = $position = $height = $weight = $dob = $hometown = $college = $drafted = $nickname = "null"; $fullName = getAttribute($plaintext, "", "Position:"); if (preg_match("/Full Name:/", $plaintext)) { if (!(strpos($fullName, "Full Name:") === false)) { $fullName = getAttribute($plaintext, "Full Name:", "Position:"); } } if (preg_match("/\\(*\\)/", $fullName)) { $nickname = getAttribute($plaintext, "(", ")"); } //echo "FullName: $fullName<br>"; if (preg_match("/Position:/", $plaintext)) { if (preg_match("/Height:/", $plaintext)) { $position = getAttribute($plaintext, "Position:", "Height:"); } else { $position = getAttribute($plaintext, "Position:", "Born:"); } } if (preg_match("/Height:/", $plaintext)) { $height = getAttribute($plaintext, "Height:", "Weight:"); } if (preg_match("/Weight:/", $plaintext)) { $weight = getAttribute($plaintext, "Weight:", "Born:"); } if (preg_match("/Born:/", $plaintext)) { if (preg_match("/, in/", $plaintext)) { $dob = getAttribute($plaintext, "Born:", ", in"); $hometown = getAttribute($plaintext, ", in", "High School:"); } else { if (preg_match("/High School:/", $plaintext)) { $dob = getAttribute($plaintext, "Born:", "High School:"); $dob = preg_replace("/,/", "", $dob); } else { $dob = getAttribute($plaintext, "Born:", ""); } } $dob = preg_replace("/,/", "", $dob); } if (preg_match("/College:/", $plaintext)) { $college = getAttribute($plaintext, "College:", "Drafted"); } if (preg_match("/Drafted:/", $plaintext)) { $drafted = getAttribute($plaintext, "Drafted:", ""); } //$fullName = $player_page->find("a h1")->plaintext; $header = $player_page->find("a[name] h1", 0); $fullName = $header->plaintext; //Jerry Da prato //John Smith //La var Arrington $fullName = preg_replace("/[[:space:]]([A-Z])/", " !\$1", htmltrim($fullName)); $fullName = preg_replace("(\\')", "\\'", $fullName); //echo var_dump($fullName)."<br>"; $name_array = explode(' !', $fullName); $first = $name_array[0]; $last = $name_array[1]; //echo "trs: ".var_dump($player_page->find('table tr[onmouseover]')); $teams = getTeams($player_page->find('table tbody tr td table tbody tr[onmouseover]')); //echo "Name: $fullName<br>"; if ($debug) { echo "plaintext: {$plaintext}<br>"; echo "nickName: {$nickname}<br>"; echo "Position: '{$position}'<br>"; echo "height: {$height}<br>"; echo "weight: {$weight}<br>"; echo "dob: {$dob}<br>"; echo "hometown: {$hometown}<br>"; echo "college: {$college}<br>"; echo "drafted: {$drafted}<br>"; echo "teams: {$teams}<br><br>"; } $insert = "INSERT INTO players (\r\n\t\t\t\tfirst_name, last_name, height, weight, dob, position, team, college, hometown, drafted, nickname) \r\n\t\t\t\tVALUES('{$first}', '{$last}', '{$height}', {$weight}, '{$dob}', '{$position}', '{$teams}', '{$college}', '{$hometown}', '{$drafted}', '{$nickname}')"; preg_replace("/''/", "'", $insert); echo $insert . "<br>"; //$result = mysql_query($insert); $id = mysql_insert_id(); /*********************** ///awards section /***********************/ getAwards($id, $player_page->find('td p font.bio', 0)); //->find('a[href^=/awards]') }
<?php include 'includes/functions.php'; if (isset($_GET['setteamid'])) { setcookie('team', $_GET['setteamid'], 32503680000.0); $selectedTeam = $_GET['setteamid']; } else { if (isset($_COOKIE['team'])) { $selectedTeam = $_COOKIE['team']; } else { $selectedTeam = ""; } } $result = getTeams(); $teams = $result->fetch_all(); ?> <html> <head> <title>Find hold</title> <?php include 'includes/header.php'; ?> </head> <body> <?php include 'navbar.php'; ?> <div class="container">
$id = $menu->getE(1); db_query("UPDATE `prefix_awards` SET time = '{$datum}', platz = '{$platz}',\r\n team = '{$team}', wofur = '{$wofur}', bild = '{$bild}', text = '{$text}' WHERE id = {$id}"); echo mysql_error(); $menu->set_url(1, ''); } else { db_query("INSERT INTO `prefix_awards` (time, platz, team, wofur, bild, text) VALUES\r\n ('" . $datum . "', '" . $platz . "', '" . $team . "', '" . $wofur . "', '" . $bild . "', '" . $text . "')"); } } #Ändern/Ausgabearray füllen if ($menu->getA(1) == 'e' and is_numeric($menu->getE(1))) { $r = db_fetch_assoc(db_query("SELECT * FROM `prefix_awards` WHERE id = " . $menu->getE(1))); $r['id'] = '-e' . $r['id']; $t = explode('-', $r['time']); $r['datum'] = $t[2] . '.' . $t[1] . '.' . $t[0]; } else { $r = array('id' => '', 'datum' => date('d.m.Y'), 'platz' => '', 'wofur' => '', 'bild' => '', 'text' => '', 'teams' => getTeams()); } #Ausgabe $tpl = new tpl('awards', 1); $tpl->set_ar_out($r, 0); if (empty($r['team'])) { $tpl->set_ar_out($r, 1); } else { $tpl->set_ar_out($r, 2); } $tpl->set_ar_out($r, 3); $erg = db_query('SELECT * FROM `prefix_awards` ORDER BY time DESC'); while ($row = db_fetch_assoc($erg)) { $t = explode('-', $row['time']); $row['datum'] = $t[2] . '.' . $t[1] . '.' . $t[0]; $tpl->set_ar_out($row, 4);
LNAME: <input type="text" name="lname" /><br /> PNAME: <input type="text" name="pname" /><br /> EMAIL: <input type="text" name="email" /><br /> <input type="submit" name="se" value="Add Softie" /> </form>--> <h3>Assign leader teams by uwid</h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> List of ID's separated by commas:<br /> <textarea name="uwids" style="width:300px;height180px;"></textarea><br /><br /> <select name="team"> <?php $teams = getTeams(array('leader', 'other', 'blacktie')); foreach ($teams as $t) { echo "\t<option value=\"" . $t['tid'] . "\">" . $t['displayname'] . "</option>\n"; } ?> </select> <br /> <input type="submit" name="changeteam" value="Change teams" /> </form> <h3>Assign leader roles by UWID</h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> List of ID's separated by commas:<br /> <textarea name="uwids" style="width:300px;height180px;"></textarea><br /><br />
<input class="search_box" type="text" onkeyup="filter(this)" placeholder="Search"> </input> <select id="players_bank" class="player_select" size="20" multiple> <?php getAllPlayers($_GET["id"]); ?> </select> <button class="btn btn-default" id="remove_selected" onclick="removeSelected()">Remove from Teams</button> </div> </div> <div class="col-xs-10 col-sm-10 col-md-9 col-lg-9"> <table class="teams_table" id="teams"> <?php $num_teams = getTeams($_GET["id"]); ?> </table> </div> </div> </div> <div class="scroll">  </div> <script src="https://code.jquery.com/jquery.js"></script> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/create_teams.js"></script> <script> var num_teams = <?php echo json_encode($num_teams); ?> ;
public function ticket($id, $nbMatch) { $tickets = TableRegistry::get('Tickets'); $prognostics = TableRegistry::get('Prognostics'); //The ticket focus $ticket = $tickets->find()->where(['id' => $id])->first(); if (!isset($ticket)) { return $this->redirect(['controller' => 'Pages', 'action' => 'page404']); } //List ticket's matchs today $matchs = $prognostics->find()->where(['n_ticket' => $ticket->id])->order(['date_match' => 'ASC']); $matchSelected = substr($nbMatch, 5); //Match Selected foreach ($matchs as $key => $ticketMatch) { if ($key == 0) { $firstMatch = $ticketMatch; } if ($key == $matchSelected - 1) { $match = $ticketMatch; break; } } if (!isset($match)) { return $this->redirect(['controller' => 'Pages', 'action' => 'page404']); } //All championship $allChampionship = getChampionships(); //$championship of the match foreach ($allChampionship as $championship) { if ($championship['caption'] == $match['competition']) { $thisChampionship = $championship; break; } } //All matchs championship $allMatchsChampionship = getGames($thisChampionship['fixtures']); //Match's stats between the teams foreach ($allMatchsChampionship as $matchChampionship) { if ($matchChampionship['homeTeamName'] == $match['home_team'] && $matchChampionship['awayTeamName'] == $match['away_team']) { $matchStats = $matchChampionship['showdown']; break; } } //Last match between the teams $lastMatchs = getStatsMatch($matchStats); //All teams championship $allTeamsChampionship = getTeams($thisChampionship['teams']); //Team's stats foreach ($allTeamsChampionship as $teamChampionship) { if ($teamChampionship['name'] == $match['home_team']) { $homeTeamStats = $teamChampionship; } if ($teamChampionship['name'] == $match['away_team']) { $awayTeamStats = $teamChampionship; } } //Ranking of the match $ranking = getRanking($thisChampionship['leagueTable'], $thisChampionship['teams'], $thisChampionship['fixtures']); if (!empty($ranking)) { foreach ($ranking as $team) { if (!is_array($team)) { if (!empty($homeTeamStats['fixtures'])) { //Home last matchs $homeLastMatchs = getLastMatchs($homeTeamStats['fixtures'], $thisChampionship['championship'], $team, $thisChampionship['teams']); $this->set('homeLastMatchs', $homeLastMatchs); } if (!empty($awayTeamStats['fixtures'])) { //Home last matchs $awayLastMatchs = getLastMatchs($awayTeamStats['fixtures'], $thisChampionship['championship'], $team, $thisChampionship['teams']); $this->set('awayLastMatchs', $awayLastMatchs); } break; } } $this->set('ranking', $ranking); } $this->set('firstMatch', $firstMatch); $this->set('match', $match); $this->set('lastMatchs', $lastMatchs); $this->set('homeTeamStats', $homeTeamStats); $this->set('awayTeamStats', $awayTeamStats); $this->set('matchs', $matchs); $this->set('ticket', $ticket); }
//get field $field = getField($match_num); } } } elseif ($_POST["submit"] == "Get Teams") { //getting match datas $match_num = $_POST["match_number"]; if (empty($match_num)) { $error[] = "Please enter a match number!!!"; } else { if ($color == "red") { $team1 = getTeams($match_num, 'red1'); $team2 = getTeams($match_num, 'red2'); } elseif ($color == "blue") { $team1 = getTeams($match_num, 'blue1'); $team2 = getTeams($match_num, 'blue2'); } else { $team1 = ""; $team2 = ""; } $field = getField($match_num); } } } ?> <?php foreach ($error as $val) { echo "<div class='alert alert-danger' role='alert'>\n <a href='#'' class='close' data-dismiss='alert' aria-lable='close'>×</a>\n <strong>Error:</strong> {$val}\n </div>"; } ?> <h1>Home</h1>
?> <!DOCTYPE html> <html> <head> <title>12Urenloop - Manuele telling</title> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link href="style.css" media="screen" rel="stylesheet" type="text/css" /> <link rel="apple-touch-icon" href="apple-touch-icon.png" /> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> <script type="text/javascript" src="script.js"></script> <script type="text/javascript" src="fastclick.js"></script> <script type="text/javascript"> var teams = (<?php echo json_encode(getTeams()); ?> ); window.addEventListener('load', function() { new FastClick(document.body); }, false); </script> </head> <body ontouchmove="event.preventDefault();" > <header> <h1>Manuele telling</h1> <button id="viewSwitcher">iPad 1/2</button> <button id="adminButton">Admin</button> </header> <div id="content"> <ul id="buttonHolder">
$id = $menu->getE(1); db_query("UPDATE `prefix_awards` SET `time` = '" . $datum . "', `platz` = '" . $platz . "',\r\n `team` = '" . $team . "', `wofur` = '" . $wofur . "', `bild` = '" . $bild . "', `text` = '" . $text . "' WHERE `id` = " . $id); echo mysql_error(); $menu->set_url(1, ''); } else { db_query("INSERT INTO `prefix_awards` (`time`, `platz`, `team`, `wofur`, `bild`, `text`) VALUES\r\n ('" . $datum . "', '" . $platz . "', '" . $team . "', '" . $wofur . "', '" . $bild . "', '" . $text . "')"); } } // Ändern/Ausgabearray füllen if ($menu->getA(1) == 'e' and is_numeric($menu->getE(1))) { $r = db_fetch_assoc(db_query("SELECT * FROM `prefix_awards` WHERE `id` = " . $menu->getE(1))); $r['id'] = '-e' . $r['id']; $t = explode('-', $r['time']); $r['datum'] = $t[2] . '.' . $t[1] . '.' . $t[0]; } else { $r = array('id' => '', 'datum' => date('d.m.Y'), 'platz' => '', 'wofur' => '', 'bild' => '', 'text' => '', 'ANTISPAM' => get_antispam('adminuser_action', 0, true), 'teams' => getTeams()); } // Ausgabe $tpl = new tpl('awards', 1); $tpl->set_ar_out($r, 0); if (empty($r['team'])) { $tpl->set_ar_out($r, 1); } else { $tpl->set_ar_out($r, 2); } $tpl->set_ar_out($r, 3); $erg = db_query('SELECT * FROM `prefix_awards` ORDER BY `time` DESC'); while ($row = db_fetch_assoc($erg)) { $t = explode('-', $row['time']); $row['datum'] = $t[2] . '.' . $t[1] . '.' . $t[0]; $tpl->set_ar_out($row, 4);
<?php global $names; function getTeams($types = array('leader', 'other')) { $query = "SELECT * FROM teams type WHERE"; foreach ($types as $t) { $query .= " type='" . $t . "' OR"; } $query = substr($query, 0, -3); $query .= " ORDER BY type"; $result = mysql_query($query); if ($result) { while ($t = mysql_fetch_assoc($result)) { $teams[] = $t; } } else { exit("No teams."); } return $teams; } $names = array('main' => "Welcome!", 'faq' => "Frequently Asked Questions", 'events' => "Event Schedule for the Week", 'cheers' => "Cheers", 'pictures' => "Pictures", 'pinktie' => "The Pink Tie Story", 'sponsors' => "Sponsors", 'contact' => "Contact Us"); $showteams = true; if (!$showteams) { $teams = array("???????", "?????", "??????", "????????", "??????", "????????", "?????", "?????????", "???????", "???????", "??????", "??????", "???????", "???????", "??????", "??????????", "Elite Four", "FOC", "Team Rocket", "Gym Leaders"); } else { $teams = getTeams(); }
} else { if ($isTeam == true) { if ($playerA != "") { if (getTid($playerA) != -1) { $listA = array(); $listA[0] = $playerA; } else { $listA = getTeams($playerA, 50); } } if ($playerB != "") { if (getTid($playerB) != -1) { $listB = array(); $listB[0] = $playerB; } else { $listB = getTeams($playerB, 50); } } } else { if ($playerA != "") { if (getPid($playerA) != 0) { $listA = array(); $listA[0] = $playerA; } else { $listA = getPlayers($playerA, 50); } } if ($playerB != "") { if (getPid($playerB) != 0) { $listB = array(); $listB[0] = $playerB;
<?php require "../php/header.php"; ob_start(); $name = $HTTP_GET_VARS['name']; if ($name == null) { header("Location: index.php"); exit; } openDatabase(false); $teams = getTeams($name, 50); if (count($teams) == 1) { if (getTid($name) != -1) { header("Location: teaminfo.php?name=" . urlencode($name)); closeDatabase(); exit; } } ob_end_flush(); include "{$BASE_FILES}/inc_top.php"; $error_heading = "Search Results"; if (count($teams) == 0) { $error_body = "Sorry, no matches to your query."; } else { $error_body = "Search Results (Limit 50 matches)<P>"; $count = 0; while ($count < count($teams)) { $error_body .= "<a href=\"teaminfo.php?name=" . urlencode($teams[$count]) . "\">" . $teams[$count] . "</A><BR>"; $count++; } }
<?php include "connect.php"; include "functions.php"; header("Content-Type: application/json"); $response = []; $teams = getTeams($db, getSessionKey()); if (is_array($teams)) { $response['teams'] = $teams; } else { http_response_code(500); $response["error"] = "Error retreiving teams."; } echo json_encode($response); $db->close();
public function listMatch() { if ($this->request->isAjax()) { $this->layout = 'ajax'; } if (isset($this->request->data['championship'])) { $championship = $this->request->data['championship']; //All championship $allChampionship = getChampionships(); //infos championship foreach ($allChampionship as $championships) { if ($championships['caption'] == $championship) { $thisChampionship = $championships; break; } } if (!isset($this->request->data['home']) && !isset($this->request->data['away']) && !isset($this->request->data['date'])) { //All matchs championship $matchs = getGamesNoPlay($thisChampionship['fixtures']); $homePennant = ''; $awayPennant = ''; $colorHomeTeam = ''; $colorAwayTeam = ''; $odds = ''; } else { $home = $this->request->data['home']; $away = $this->request->data['away']; $date = $this->request->data['date']; $matchs = ''; $allTeams = TableRegistry::get('Teams'); $homeTeam = $allTeams->find()->where(['name' => $home])->first(); $awayTeam = $allTeams->find()->where(['name' => $away])->first(); if (!empty($homeTeam)) { $colorHomeTeam = $homeTeam->color; } else { $colorHomeTeam = ''; } if (!empty($awayTeam)) { $colorAwayTeam = $awayTeam->color; } else { $colorAwayTeam = ''; } //Odds match $odds = getOdds($date, $home, $away); if (!isset($odds) || empty($odds)) { $odds = ''; } //All teams championship $teams = getTeams($thisChampionship['teams']); //Pennants foreach ($teams as $team) { if ($team['name'] == $home) { $homePennant = $team['pennant']; } if ($team['name'] == $away) { $awayPennant = $team['pennant']; } if (isset($homePennant) && isset($awayPennant)) { break; } } } } $output = array('matchs' => $matchs, 'homePennant' => $homePennant, 'awayPennant' => $awayPennant, 'colorHomeTeam' => $colorHomeTeam, 'colorAwayTeam' => $colorAwayTeam, 'odds' => $odds); return new Response(['status' => 200, 'body' => json_encode($output, JSON_FORCE_OBJECT)]); }
include 'gohtmlhead.php'; include 'goheader.php'; if (!isset($_GET['title'])) { $userSettings = new goUserSettings($userID); } ?> <form name="input" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="get"> <?php echo '<div id="selectbets">'; // search selection filters via listbox populateTimeFilter($params['timefilter']); getLeagues('nfl'); getTeams($params['league'], $params['team']); // Has lot's of data - have to think how to make decipherable and efficient echo '<input type="hidden" value="selected" name="selected" />'; echo '<input type="submit" value="go" />'; echo '</div>'; echo '</form>'; echo '<div id="gameresults">'; getPublicGames($params); echo '</div>'; include 'gofooter.php'; ob_end_flush(); exit; function getPublicGames($params) { if (count($params) > 0) { foreach ($params as $key => $value) {
foreach ($seasoning as $season) { $response = file_get_contents("https://api.fantasydata.net/{$league}/v2/JSON/Games/{$season}", false, $context); $data = json_decode($response); foreach ($data as $game) { $badDate = str_replace("T", " ", $game->DateTime); if (empty($badDate) === false) { $teamChavez = Team::getTeamByTeamApiId($pdo, $game->AwayTeamID); $teamPaul = Team::getTeamByTeamApiId($pdo, $game->HomeTeamID); if ($teamChavez !== null && $teamPaul !== null) { $gameToInsert = new Game(null, $teamChavez->getTeamId(), $teamPaul->getTeamId(), $badDate); $gameToInsert->insert($pdo); } else { echo "<p>* * * SIX OF THIRTEEN SKIPPED THIS GAME * * *</p>" . PHP_EOL; } } } } } catch (Exception $exception) { echo "Something went wrong: " . $exception->getMessage() . PHP_EOL; } catch (TypeError $typeError) { echo "Something went wrong: " . $typeError->getMessage() . PHP_EOL; } } $sportLeagues = ["NHL", "NBA", "MLB"]; $pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/sprots.ini"); foreach ($sportLeagues as $sportLeague) { $sport = Sport::getSportBySportLeague($pdo, $sportLeague); getTeams($sportLeague, $sport->getSportId()); getGames($sportLeague); getPlayers($sportLeague); }
/** * Output a team row from the scoreboard based on the cached data in * table 'scoreboard'. */ function putTeamRow($cdata, $teamids) { global $DB; if (empty($cdata)) { return; } $fdata = calcFreezeData($cdata); $displayrank = IS_JURY || !$fdata['showfrozen']; $cid = $cdata['cid']; if (!$fdata['cstarted']) { if (!IS_JURY) { global $teamdata; echo "<h2 id=\"teamwelcome\">welcome team <span id=\"teamwelcometeam\">" . htmlspecialchars($teamdata['name']) . "</span>!</h2>\n\n"; echo "<h3 id=\"contestnotstarted\">contest is " . printContestStart($cdata) . "</h3>\n\n"; } return; } // For computing team row, use smart trick when only a single team is requested such // that we don't need to compute the whole scoreboard. // This does not fully populate the summary, so the first correct problem per problem // is not computed and hence not shown in the individual team row. if (count($teamids) == 1) { $teams = getTeams(array("teams" => $teamids), true, $cdata); $probs = getProblems($cdata); $SCORES = initScores($teams); $SUMMARY = initSummary($probs); // Calculate rank, num points and total time from rank cache foreach ($teams as $teamid => $team) { $totals = $DB->q("MAYBETUPLE SELECT points, totaltime\n\t\t\t FROM rankcache_jury\n\t\t\t WHERE cid = %i\n\t\t\t AND teamid = %i", $cid, $teamid); if ($totals != null) { $SCORES[$teamid]['num_points'] = $totals['points']; $SCORES[$teamid]['total_time'] = $totals['totaltime']; } if ($displayrank) { $SCORES[$teamid]['rank'] = calcTeamRank($cdata, $teamid, $totals, true); } } // Get values for this team about problems from scoreboard cache $MATRIX = array(); $scoredata = $DB->q("SELECT * FROM scorecache_jury WHERE cid = %i AND teamid = %i", $cid, current($teamids)); // loop all info the scoreboard cache and put it in our own datastructure while ($srow = $scoredata->next()) { // skip this row if the problem is not known by us if (!array_key_exists($srow['probid'], $probs)) { continue; } $penalty = calcPenaltyTime($srow['is_correct'], $srow['submissions']); // fill our matrix with the scores from the database $MATRIX[$srow['teamid']][$srow['probid']] = array('is_correct' => (bool) $srow['is_correct'], 'num_submissions' => $srow['submissions'], 'num_pending' => $srow['pending'], 'time' => $srow['totaltime'], 'penalty' => $penalty); } // Fill in empty places in the matrix foreach (array_keys($teams) as $team) { foreach (array_keys($probs) as $prob) { // provide default scores when nothing submitted for this team,problem yet if (!isset($MATRIX[$team][$prob])) { $MATRIX[$team][$prob] = array('is_correct' => FALSE, 'num_submissions' => 0, 'num_pending' => 0, 'time' => 0, 'penalty' => 0); } } } // Combine into data as genScoreBoard returns it $sdata = array('matrix' => $MATRIX, 'scores' => $SCORES, 'summary' => $SUMMARY, 'teams' => $teams, 'problems' => $probs, 'categories' => null); } else { // Otherwise, calculate scoreboard as jury to display non-visible teams $sdata = genScoreBoard($cdata, TRUE); } // Render the row based on this info $myteamid = null; $static = FALSE; if (!IS_JURY) { echo "<div id=\"teamscoresummary\">\n"; } renderScoreBoardTable($sdata, $myteamid, $static, $teamids, $displayrank, TRUE, FALSE); if (!IS_JURY) { echo "</div>\n\n"; } return; }
function getLastMatchs($url, $soccerseason, $matchday, $urlNameTeams) { $result = connectAPI($url); $lastMatchs = array(); $i = 1; foreach ($result as $option => $fixtures) { if ($option == 'fixtures') { foreach ($fixtures as $matchs) { ${'match' . $i} = array(); foreach ($matchs as $key => $match) { if ($key == '_links') { foreach ($match as $key1 => $links) { if ($key1 == 'soccerseason') { foreach ($links as $link) { //Link season ${'match' . $i}["soccerseason"] = $link; if ($link != $soccerseason) { ${'match' . $i}["nameSoccerseason"] = 'C1'; } else { ${'match' . $i}["nameSoccerseason"] = ''; } break 2; } } } } else { if ($key == "date") { //Match's date ${'match' . $i}["date"] = $match; } else { if ($key == 'matchday') { //Match day ${'match' . $i}["matchday"] = $match; if ($match > $matchday) { break 2; } } else { if ($key == 'homeTeamName') { //Home team name ${'match' . $i}["homeTeamName"] = $match; ${'match' . $i}["homeTeamShortName"] = ''; } else { if ($key == 'awayTeamName') { //Away team name ${'match' . $i}["awayTeamName"] = $match; ${'match' . $i}["awayTeamShortName"] = ''; } else { if ($key == 'result') { foreach ($match as $goal => $results) { if ($goal == 'goalsHomeTeam') { //Goal home team ${'match' . $i}["goalsHomeTeam"] = $results; } else { if ($goal == 'goalsAwayTeam') { //Goal home team ${'match' . $i}["goalsAwayTeam"] = $results; array_push($lastMatchs, ${'match' . $i}); $i++; } } } } } } } } } } } } } /*** Short name teams ***/ $teams = getTeams($urlNameTeams); foreach ($teams as $team) { foreach ($lastMatchs as $key => $match) { if ($lastMatchs[$key]['homeTeamName'] == $team['name']) { $lastMatchs[$key]['homeTeamShortName'] = $team['shortName']; } if ($lastMatchs[$key]['awayTeamName'] == $team['name']) { $lastMatchs[$key]['awayTeamShortName'] = $team['shortName']; } } } return $lastMatchs; }