* For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ define("FORFEIT_INPUT", "/"); // Get leagues for user $user_ID = get_current_user_id(); $my_clubs = array(); $my_club_ids = array(); if ($user_ID != 0) { $db = new PHPLeague_Database(); $clubs = $db->get_user_clubs_information($user_ID); foreach ($clubs as $club) { $my_clubs[] = $club; } } $leagues = $db->get_every_league(0, $db->count_leagues()); $my_leagues = array(); foreach ($leagues as $league) { foreach ($my_clubs as $club) { if (!$db->is_club_already_in_league($league->id, $club->id)) { // is_club_already_in_league returns false when in league $my_leagues[] = $league; break; } } } $id_league = !empty($_GET['id_league']) && $db->is_league_exists($_GET['id_league']) === TRUE ? (int) $_GET['id_league'] : $my_leagues[0]->id; foreach ($my_clubs as $club) { $my_club_ids[] = $db->get_team_id($club->id, $id_league); } if ($db->is_league_exists($id_league) === FALSE) {