function recMatches(&$matches, $key) { if (hasNextWinnerMatch($matches[$key])) { $winner_bracket = getNextWinnerBracket($matches[$key]); $winner_round = getNextWinnerRound($matches[$key]); $winner_match = getNextWinnerMatch($matches[$key]); $winner_player = getNextWinnerPlayer($matches[$key]); $new_key = "{$winner_bracket}-{$winner_round}-{$winner_match}"; if ($matches[$new_key]['id_' . $winner_player] == 0 and $matches[$key]['confirmed'] == "0000-00-00 00:00:00") { $matches[$new_key][$winner_player] = "Winner [{$key}]"; } $matches[$new_key]['prev_match_' . $winner_player] = $key; } if (hasNextLoserMatch($matches[$key])) { $loser_bracket = getNextLoserBracket($matches[$key]); $loser_round = getNextLoserRound($matches[$key]); $loser_match = getNextLoserMatch($matches[$key]); $loser_player = getNextLoserPlayer($matches[$key]); $new_key = "{$loser_bracket}-{$loser_round}-{$loser_match}"; if ($matches[$new_key]['id_' . $loser_player] == 0) { $matches[$new_key][$loser_player] = "Loser [{$key}]"; } $matches[$new_key]['prev_match_' . $loser_player] = $key; } }
function getLoserMatch(&$match) { global $cfg; global $season; if (hasNextLoserMatch($match)) { $loser_bracket = getNextLoserBracket($match); $loser_round = getNextLoserRound($match); $loser_match = getNextLoserMatch($match); $loser_player = getNextLoserPlayer($match); $matches_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}matches` " . "WHERE `id_season` = {$season['id']} " . "AND `bracket` = '{$loser_bracket}' " . "AND `round` = {$loser_round} " . "AND `match` = {$loser_match}"); if ($matches_row = dbFetch($matches_ref)) { return $matches_row; } else { return NULL; } } return NULL; }