AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.216.161.178


Current Path : /var/www/lhjmq-records.qc.ca/public_html/administration/lib/
Upload File :
Current File : /var/www/lhjmq-records.qc.ca/public_html/administration/lib/league.php

<?php

function getleaguename($id){
	trigger_error('Function decrecated, please replace this function call with something else', E_USER_ERROR);
}

function &get_leagues($mysql_link, $date_start, $date_end, $returnmode = FILTER_MODE_IGNORE, $filterarray = array()){
	//Get the current structure
	global $struct_tree;
	if(!isset($struct_tree[$date_start.'-'.$date_end])){ $struct_tree[$date_start.'-'.$date_end] = struct_get_tree($mysql_link, $date_start, $date_end); }
	$tree = &$struct_tree[$date_start.'-'.$date_end];
	//Check the structure for leagues and add them according to the filter params
	if(!is_array($filterarray)){ trigger_error('Fatal error, passing a non array to get_leagues::filterarray'); }
	$leagues = array();
	foreach($tree as $league){
		if($returnmode == FILTER_MODE_IGNORE && is_numeric($league['sys_node_data']['id_ligue'])){
			$leagues[$league['sys_node_data']['id_ligue']] = $league['sys_node_data'];
		}elseif($returnmode == FILTER_MODE_TAKE && in_array($league['sys_node_data']['id_ligue'], $filterarray) && is_numeric($league['sys_node_data']['id_ligue'])){
			$leagues[$league['sys_node_data']['id_ligue']] = $league['sys_node_data'];
		}elseif($returnmode == FILTER_MODE_REMOVE && !in_array($league['sys_node_data']['id_ligue'], $filterarray) && is_numeric($league['sys_node_data']['id_ligue'])){
			$leagues[$league['sys_node_data']['id_ligue']] = $league['sys_node_data'];
		}
	}
	return $leagues;
}

function league_get_list($mysql_link, $returnmode = FILTER_MODE_IGNORE, $filterarray = array()){
	//Get the list of leagues
	$leagues_res = mysql_query('SELECT * FROM ligues ORDER BY description_fr', $mysql_link);
	//Check the structure for leagues and add them according to the filter params
	if(!is_array($filterarray)){ trigger_error('Fatal error, passing a non array to league_get_list::filterarray'); }
	$leagues = array();
	while($league = mysql_fetch_assoc($leagues_res)){
		if($returnmode == FILTER_MODE_IGNORE){
			$leagues[$league['id_ligue']] = $league;
		}elseif($returnmode == FILTER_MODE_TAKE && in_array($league['id_ligue'], $filterarray)){
			$leagues[$league['id_ligue']] = $league;
		}elseif($returnmode == FILTER_MODE_REMOVE && !in_array($league['id_ligue'], $filterarray)){
			$leagues[$league['id_ligue']] = $league;
		}
	}
	return $leagues;
}

function league_get_data($mysql_link, $id_league){
	if(is_array($id_league)){
		$res = mysql_query($sql = 'SELECT * FROM ligues AS l WHERE id_ligue IN ('.implode(', ', $id_league).')', $mysql_link);
	}else{
		$res = mysql_query('SELECT * FROM ligues AS l WHERE id_ligue = "'.$id_league.'"', $mysql_link);
	}
	$data = array();
	while($row = mysql_fetch_assoc($res)){
		$data[$row['id_ligue']] = $row;
	}
	return $data;
}


function &get_leagues_for_id_list($mysql_link, $id_list = array()){
	//Build a list to filter
	$filterlist = array(0);
	if(is_array($id_list)){
	foreach($id_list as $league => $additionnaldata){
		$filterlist[] = $league;
	}}
	//Query the leagues not in filter
	$res = mysql_query($sql='SELECT id_ligue, description_fr AS description FROM ligues WHERE id_ligue IN ('.implode(', ', $filterlist).') ORDER BY description', $mysql_link);
	while($resitem = mysql_fetch_assoc($res)){
		$leagues[$resitem['id_ligue']] = $resitem;
	}
	return $leagues;
}
function &get_leagues_for_team_id($mysql_link, $id_equipe){
	trigger_error('Function decrecated, please replace this function call with something else', E_USER_ERROR);
}
function &get_league($mysql_link, $id_ligue){
	//Query the leagues where team is in X
	$row = mysql_fetch_assoc(mysql_query($sql='SELECT * FROM ligues AS l WHERE id_ligue = "'.mysql_escape_string($id_ligue).'"', $mysql_link));
	return $row;
}
?>