AnonSec Shell
Server IP : 149.202.105.228  /  Your IP : 216.73.216.123
Web Server : Apache
System : Linux webm129.cluster030.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : atfycaf ( 116275)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/atfycaf/www/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/atfycaf/www/globalFunctions.php
<?php
///// GLOBAL FUNCTIONS \\\\\
function cleanPost($postedVar, $conn) {
	$returnVar	= mysqli_real_escape_string($conn, htmlspecialchars(str_replace(array("<script>", "<script type", "</script>"), array("", "", ""), $postedVar), ENT_QUOTES, 'UTF-8'));
	$returnVar	= addslashes($returnVar);
	return $returnVar;
}
function urlClean ($thisText) {
	$badURL = array('     ', '    ', '   ', '  ', ' ', '\'', '&amp;', '&', '/','Á', 'á', 'À', 'à', 'Â', 'â', 'É', 'é', 'È', 'è', 'Ê', 'ê', 'Í', 'í', 'Ì', 'ì', 'Î', 'î', 'Ó', 'ó', 'Ò', 'ò', 'Ô', 'ô', 'Ú', 'ú', 'Ù', 'ù', 'Û', 'û', 'Ü', 'ü', 'Ñ', 'ñ', 'Ç', 'ç', '(', ')', ',', '.', '´', '~', '"', "Ă", "ă", "Â", "â", "Î", "î", "Ș", "ș", "Ş", "ş", "Ţ", "ţ", "Ö", "ö", "Œ", "œ", "Ø", "ø", "Ä", "ä", "Ë", "ë", "Å", "å", "æ", "#");
	$goodURL = array('-', '-', '-', '-', '-', '', 'and', 'and', '-', 'A', 'a', 'A', 'a', 'A', 'a', 'E', 'e', 'E', 'e', 'E', 'e', 'I', 'i', 'I', 'i', 'I', 'i', 'O', 'o', 'O', 'o', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'N', 'n', 'C', 'c', '', '', '', '', '', '-', '', "A", "a", "A", "a", "I", "i", "S", "s", "S", "s", "T", "t", "O", "o", "OE", "oe", "O", "o", "A", "a", "E", "e", "A", "a", "ae", "");

	$cleanURL = strtolower(str_replace($badURL, $goodURL, $thisText));

	return $cleanURL;
}
function maskEmail($email) {
	$maskedEmail = '';
	for ($j = 0; $j < strlen($email); $j++) {
		$maskedEmail	.= '&#' . ord(substr($email, $j, 1)) . ';' ;
	}
	$emailHtml = '<a href="m&#' . ord('a') . ';&#' . ord('i') . ';&#' . ord('l') . ';&#' . ord('t') . ';o:' . $maskedEmail . '"><i class="fa fa-envelope" aria-hidden="true"></i> ' . $maskedEmail . '</a>';
	return $emailHtml;
}
function maskCommitteeEmail($email, $name) {
	$maskedEmail = '';
	for ($j = 0; $j < strlen($email); $j++) {
		$maskedEmail	.= '&#' . ord(substr($email, $j, 1)) . ';' ;
	}
	$emailHtml = '<a href="m&#' . ord('a') . ';&#' . ord('i') . ';&#' . ord('l') . ';&#' . ord('t') . ';o:' . $maskedEmail . '"><i class="fa fa-envelope" aria-hidden="true"></i> ' . $name . '</a>';
	return $emailHtml;
}
function maskPageEmail($emailAddress) {
	$maskedEmail = '';
	for ($j = 0; $j < strlen($emailAddress); $j++) {
		$maskedEmail	.= '&#' . ord(substr($emailAddress, $j, 1)) . ';' ;
	}
	$emailHtml = '<a href="m&#' . ord('a') . ';&#' . ord('i') . ';&#' . ord('l') . ';&#' . ord('t') . ';o:' . $maskedEmail . '"><i class="fa fa-envelope" aria-hidden="true"></i> ';
	return $emailHtml;
}
function assignRandValue($num) {
	$lettersNumberArray	= array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");

	return $lettersNumberArray[$num];
}
function getRandID($length) {
	if($length > 0) {
		$rand_id="";
		for($i = 1; $i <= $length; $i++) {
			mt_srand((double)microtime() * 1000000);
			$num = mt_rand(0,61);
			$rand_id .= assignRandValue($num);
		}
	}
	return $rand_id;
}
function GlobalNumber($number, $currencyLanguage) {
	$LANG_FORMAT = $currencyLanguage;
	if ($LANG_FORMAT == "en") {
		$formattedNo	= number_format($number, 0, ".", ",");
	} else {
		$formattedNo	= number_format($number, 0, ",", ".");
	}
	
	return $formattedNo;
}
function GlobalSNumber($number, $currencyLanguage) {
	$LANG_FORMAT = $currencyLanguage;
	if ($LANG_FORMAT == "en") {
		$formattedNo	= number_format($number, 2, ".", ",");
	} else {
		$formattedNo	= number_format($number, 2, ",", ".");
	}
	
	return $formattedNo;
}
function GlobalRNumber($number, $currencyLanguage) {
	$LANG_FORMAT = $currencyLanguage;
	if ($LANG_FORMAT == "en") {
		$formattedNo	= number_format($number, 2, ".", ",");
		$locale			= ".";
	} else {
		$formattedNo	= number_format($number, 2, ",", ".");
		$locale			= ",";
	}
	$formattedNo	= rtrim($formattedNo, "0");
	$formattedNo	= rtrim($formattedNo, $locale);
	
	return $formattedNo;
}
function calculateDistance($lat1, $lon1, $lat2, $lon2) {
	$theta	= $lon1 - $lon2;
	$dist	= sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
	$dist	= acos($dist);
	$dist	= rad2deg($dist);
	$miles	= $dist * 60 * 1.1515;
	$kms	= $miles * 1.609344;

	return round($kms, 2);
}

function localiseDate($thisDate, $thisLang) {
	$ofArray	= array("en"=>"of", "es"=>"de", "de"=>"", "fr"=>"", "nl"=>"", "it"=>"");
	$of			= $ofArray[$thisLang];
	$monthsEN	= array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	$daysEN		= array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
	$thEN		= array("st ", "th ", "nd ", "rd ");

	$daysLocal	= array(	"en"=>array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"), 
							"es"=>array("Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"), 
							"de"=>array("Montag" , "Dienstag", "Mittwoch", "Donnerstag" , "Freitag" , "Samstag" , "Sonntag"), 
							"fr"=>array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"), 
							"nl"=>array("Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"), 
							"it"=>array("Lunedi", "Martedì", "Mercoledì", "Giovedi", "Venerdì", "Sabato", "Domenica"));
	$thLocal	= array(	"en"=>array("st ", "th ", "nd ", "rd "), 
							"es"=>array(" de ", " de ", " de ", " de "), 
							"de"=>array(" ", " ", " ", " "), 
							"fr"=>array(" ", " ", " ", " "), 
							"nl"=>array(" ", " ", " ", " "), 
							"it"=>array(" ", " ", " ", " "));
	$mthsLocal	= array(	"en"=>array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"), 
							"es"=>array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"), 
							"de"=>array("Januar", " Februar", "März", "April", "Mai", "Juni" , "Juli" , "August" , "September" , "Oktober" , "November" , "Dezember"), 
							"fr"=>array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"), 
							"nl"=>array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "August", "September", "Oktober", "November", "December"), 
							"it"=>array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"));

	$thisDate	= strtotime($thisDate);
	$theDate	= date("jS", $thisDate) ." ". date("F, Y", $thisDate);
	$theDate	= str_replace($thEN, $thLocal[$thisLang], $theDate);
	$theDate	= str_replace($daysEN, $daysLocal[$thisLang], $theDate);
	$theDate	= str_replace($monthsEN, $mthsLocal[$thisLang], $theDate);
	return $theDate;
}

function moduleReplace($moduleContent, $LANG_DB, $LANG_DEFAULT_EMAIL, $url, $Iurl) {
	include '-system/siteData.php';
	include 'globalLang_'. $LANG_DB .'.php';
	include 'globalURLs.php';
	$SERVER_ROOT		= $_SERVER['DOCUMENT_ROOT'];
	$IMG_SERVER_ROOT	= $SERVER_ROOT ."/images";
	$emailToReplace		= maskEmail($LANG_DEFAULT_EMAIL);

	$dateToday	= date("Y-m-d");

	$moduleContent		= str_replace(array("[[DEFAULT_EMAIL]]"), array($emailToReplace), $moduleContent);

	if (strstr($moduleContent, "[[KNOCKOUT_RESULTS_BOX]]")) {
		$kResultsReplace	= '<div class="resFixMainTitle">'. $LANG_LEAGUE_TOURN_LATEST_RESULTS .'</div>';

		$lastResultsQuery = mysqli_query($conn, "SELECT tournID, roundID, roundDate FROM knockoutRounds WHERE matchScore != '-1' AND (roundDate <= '$dateToday') ORDER BY roundDate DESC LIMIT 0,1");
		if (mysqli_num_rows($lastResultsQuery) > 0) {
			while ($lRQ = mysqli_fetch_array($lastResultsQuery)) {
				$tournID		= $lRQ["tournID"];
				$roundID		= $lRQ["roundID"];
				$fixtureDate	= date("jS F, Y", strtotime($lRQ["roundDate"]));
			}
			$tournamentQuery = mysqli_query($conn, "SELECT * FROM knockoutConfig WHERE id = '$tournID'");
			while ($tQ = mysqli_fetch_array($tournamentQuery)) {
				$tournamentID	= $tQ["id"];
				$tournType		= $tQ["tournType"];
				$tournTitle		= $tQ["tournTitle"];
				$tFullSDate		= $tQ["tournStartDate"];
				$tStartMonth	=  date("F", strtotime($tFullSDate));
				$tStartYear		=  date("Y", strtotime($tFullSDate));
				$tournLocation	= $tQ["tournLocation"];
				$noCompetitors	= $tQ["noCompetitors"];
			}
			$tournamentTypeQuery = mysqli_query($conn, "SELECT groupTitle FROM knockoutGroups WHERE id = '$tournType'");
			while ($tTQ = mysqli_fetch_array($tournamentTypeQuery)) {
				$tournamentType	= $tTQ["groupTitle"];
			}
			if (trim($tournTitle) == "") {
				$tournTitle	= "$tournamentType @ $tournLocation $tStartMonth $tStartYear";
			}
			$kResultsReplace	.= '<div class="resFixTLTitle">'. $tournTitle .'</div>';
			$matchGroup		= 0;

			$compLeft		= $noCompetitors;
			$noRounds		= 1;
			do {
				$compLeft	= $compLeft / 2;
				$noRounds++;
			} while ($compLeft > 2);

			$final		= $noRounds;
			$semiFinal	= $noRounds - 1;
			$qtrFinal	= $noRounds - 2;

			$fixtureDateQuery = mysqli_query($conn, "SELECT roundDate FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') ORDER BY matchNo ASC LIMIT 0,1");
			while ($fDQ = mysqli_fetch_array($fixtureDateQuery)) {
				$fixtureDate	= date("jS F, Y", strtotime($fDQ["roundDate"]));
			}
			if ($roundID == $final) {
				$roundTitle	= "Final";
			} elseif ($roundID == $semiFinal) {
				$roundTitle	= "Semi-Finals";
			} elseif ($roundID == $qtrFinal) {
				$roundTitle	= "Quarter-Finals";
			} else {
				$roundTitle	= "Round $roundID";
			}
			$kResultsReplace	.= '<div class="resFixTitle">'. $roundTitle .': '. $fixtureDate .'</div>
			<div class="pageGroupTableSlider">';

			$roundMatchesQuery = mysqli_query($conn, "SELECT DISTINCT matchNo FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') ORDER BY matchNo ASC");
			while ($rMQ = mysqli_fetch_array($roundMatchesQuery)) {
				$matchNo	= $rMQ["matchNo"];
				if ($matchNo != 9999) {
					$matchGroup++;
					if ($matchGroup == 1) {
						$kResultsReplace	.= '
				<div class="pageGroupTable">';
					}
					$nextFixtureQuery = mysqli_query($conn, "SELECT * FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') AND (matchNo = '$matchNo') ORDER BY id ASC LIMIT 0,1");
					while ($nFQ = mysqli_fetch_array($nextFixtureQuery)) {
						$playerID			= $nFQ["id"];
						$roundDate			= $nFQ["roundDate"];
						$participantName	= $nFQ["participantName"];
						$matchScore 		= $nFQ["matchScore"];
					}
					if ($matchScore == -1) {
						$matchScore	= "";
					}
					$opponentsQuery = mysqli_query($conn, "SELECT * FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') AND (matchNo = '$matchNo') AND (id != '$playerID') ORDER BY id ASC LIMIT 0,1");
					if (mysqli_num_rows($opponentsQuery) == 0) {
						$opponentName	= "-";
						$opponentScore	= "";
					} else {
						while ($oQ = mysqli_fetch_array($opponentsQuery)) {
							$opponentName	= $oQ["participantName"];
							$opponentScore 	= $oQ["matchScore"];
						}
					}
					if ($opponentScore == -1) {
						$opponentScore	= "";
					}
					if ($matchScore == 9999) {
						$matchScore			= "<strong>BYE</strong>";
						$participantName	= "<strong>$participantName</strong>";
						$opponentScore		= "-";
					} elseif ($matchScore == 99999) {
						$matchScore			= "WD";
						$opponentName		= "<strong>$opponentName</strong>";
						$opponentScore		= "<strong>-</strong>";
					} elseif ($opponentScore == 9999) {
						$opponentScore		= "<strong>BYE</strong>";
						$opponentName		= "<strong>$opponentName</strong>";
						$matchScore			= "-";
					} elseif ($opponentScore == 99999) {
						$opponentScore		= "WD";
						$participantName	= "<strong>$participantName</strong>";
						$matchScore			= "<strong>-</strong>";
					} elseif ($matchScore > $opponentScore) {
						$participantName	= "<strong>$participantName</strong>";
						$matchScore			= "<strong>$matchScore</strong>";
					} elseif ($opponentScore == $matchScore) {
					} else {
						$opponentName		= "<strong>$opponentName</strong>";
						$opponentScore		= "<strong>$opponentScore</strong>";
					}
					$kResultsReplace	.= '
					<div class="resFixture">
						<div class="homeTeam">
							<div class="resKnockoutName">'. $participantName .'</div>
							<div class="resKnockoutScore">'. $matchScore .'</div>
						</div>
						<div class="fixturesVersus">Vs</div>
						<div class="awayTeam">
							<div class="resKnockoutScore">'. $opponentScore .'</div>
							<div class="resKnockoutName">'. $opponentName .'</div>
						</div>
					</div>';
					if ($matchGroup == 4) {
						$matchGroup	= 0;
						$kResultsReplace	.= '
				</div>';
					}
				}
			}
			if ($matchGroup != 0) {
				$kResultsReplace	.= '
				</div>';
			}
			$kResultsReplace	.= '
			</div>';
		}

		$moduleContent		= str_replace("[[KNOCKOUT_RESULTS_BOX]]", $kResultsReplace, $moduleContent);
	}

	if (strstr($moduleContent, "[[KNOCKOUT_FIXTURES_BOX]]")) {
		$kFixturesReplace	= '<div class="resFixMainTitle">'. $LANG_LEAGUE_TOURN_NEXT_FIXTURES .'</div>';

		$nextResultsQuery = mysqli_query($conn, "SELECT tournID, roundID, roundDate FROM knockoutRounds WHERE matchScore = '-1' AND (matchNo != '0') AND (roundDate >= '$dateToday') ORDER BY roundDate ASC LIMIT 0,1");
		if (mysqli_num_rows($nextResultsQuery) > 0) {
			while ($nRQ = mysqli_fetch_array($nextResultsQuery)) {
				$tournID		= $nRQ["tournID"];
				$roundID		= $nRQ["roundID"];
				$fixtureDate	= date("jS F, Y", strtotime($nRQ["roundDate"]));
			}
			$tournamentQuery = mysqli_query($conn, "SELECT * FROM knockoutConfig WHERE id = '$tournID'");
			while ($tQ = mysqli_fetch_array($tournamentQuery)) {
				$tournamentID	= $tQ["id"];
				$tournType		= $tQ["tournType"];
				$tournTitle		= $tQ["tournTitle"];
				$tFullSDate		= $tQ["tournStartDate"];
				$tStartMonth	=  date("F", strtotime($tFullSDate));
				$tStartYear		=  date("Y", strtotime($tFullSDate));
				$tournLocation	= $tQ["tournLocation"];
				$noCompetitors	= $tQ["noCompetitors"];
			}
			$tournamentTypeQuery = mysqli_query($conn, "SELECT groupTitle FROM knockoutGroups WHERE id = '$tournType'");
			while ($tTQ = mysqli_fetch_array($tournamentTypeQuery)) {
				$tournamentType	= $tTQ["groupTitle"];
			}
			if (trim($tournTitle) == "") {
				$tournTitle	= "$tournamentType @ $tournLocation $tStartMonth $tStartYear";
			}
			$kFixturesReplace	.= '<div class="resFixTLTitle">'. $tournTitle .'</div>';
			$matchGroup		= 0;

			$compLeft		= $noCompetitors;
			$noRounds		= 1;
			do {
				$compLeft	= $compLeft / 2;
				$noRounds++;
			} while ($compLeft > 2);

			$final		= $noRounds;
			$semiFinal	= $noRounds - 1;
			$qtrFinal	= $noRounds - 2;

			$fixtureDateQuery = mysqli_query($conn, "SELECT roundDate FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') ORDER BY matchNo ASC LIMIT 0,1");
			while ($fDQ = mysqli_fetch_array($fixtureDateQuery)) {
				$fixtureDate	= date("jS F, Y", strtotime($fDQ["roundDate"]));
			}
			if ($roundID == $final) {
				$roundTitle	= "Final";
			} elseif ($roundID == $semiFinal) {
				$roundTitle	= "Semi-Finals";
			} elseif ($roundID == $qtrFinal) {
				$roundTitle	= "Quarter-Finals";
			} else {
				$roundTitle	= "Round $roundID";
			}
			$kFixturesReplace	.= '<div class="resFixTitle">'. $roundTitle .'</div>
			<div class="pageGroupTableSlider">';
/*			$kFixturesReplace	.= '<div class="resFixTitle">'. $roundTitle .': '. $fixtureDate .'</div>
			<div class="pageGroupTableSlider">';
*/
			$roundDateDef	= "";
			$roundMatchesQuery = mysqli_query($conn, "SELECT DISTINCT matchNo FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') ORDER BY matchNo ASC");
			while ($rMQ = mysqli_fetch_array($roundMatchesQuery)) {
				$matchNo	= $rMQ["matchNo"];
				if ($matchNo != 9999) {
					$matchGroup++;
					if ($matchGroup == 1) {
						$kFixturesReplace	.= '
				<div class="pageGroupTable">';
					}
					$nextFixtureQuery = mysqli_query($conn, "SELECT * FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') AND (matchNo = '$matchNo') ORDER BY id ASC LIMIT 0,1");
					while ($nFQ = mysqli_fetch_array($nextFixtureQuery)) {
						$playerID			= $nFQ["id"];
						$roundDate			= $nFQ["roundDate"];
						$participantName	= $nFQ["participantName"];
						$matchScore 		= $nFQ["matchScore"];
					}
					if ( ($roundDate != $roundDateDef) || ($matchGroup == 1) ) {
						$kFixturesReplace	.= '
						<div class="pageGroupDate">'. date("g:ia l jS F Y", strtotime($roundDate)) .'</div>';

						$roundDateDef	= $roundDate;
					}
					if ($matchScore == -1) {
						$matchScore	= "";
					}
					$opponentsQuery = mysqli_query($conn, "SELECT * FROM knockoutRounds WHERE tournID = '$tournID' AND (roundID = '$roundID') AND (matchNo = '$matchNo') AND (id != '$playerID') ORDER BY id ASC LIMIT 0,1");
					if (mysqli_num_rows($opponentsQuery) == 0) {
						$opponentName	= "-";
						$opponentScore	= "";
					} else {
						while ($oQ = mysqli_fetch_array($opponentsQuery)) {
							$opponentName	= $oQ["participantName"];
							$opponentScore 	= $oQ["matchScore"];
						}
					}
					if ($opponentScore == -1) {
						$opponentScore	= "";
					}
					if ($matchScore == 9999) {
						$matchScore			= "<strong>BYE</strong>";
						$participantName	= "<strong>$participantName</strong>";
						$opponentScore		= "-";
					} elseif ($matchScore == 99999) {
						$matchScore			= "WD";
						$opponentName		= "<strong>$opponentName</strong>";
						$opponentScore		= "<strong>-</strong>";
					} elseif ($opponentScore == 9999) {
						$opponentScore		= "<strong>BYE</strong>";
						$opponentName		= "<strong>$opponentName</strong>";
						$matchScore			= "-";
					} elseif ($opponentScore == 99999) {
						$opponentScore		= "WD";
						$participantName	= "<strong>$participantName</strong>";
						$matchScore			= "<strong>-</strong>";
					} elseif ($matchScore > $opponentScore) {
						$participantName	= "<strong>$participantName</strong>";
						$matchScore			= "<strong>$matchScore</strong>";
					} elseif ($opponentScore == $matchScore) {
					} else {
						$opponentName		= "<strong>$opponentName</strong>";
						$opponentScore		= "<strong>$opponentScore</strong>";
					}
					$kFixturesReplace	.= '
					<div class="resFixture">
						<div class="homeTeam">
							<div class="resKnockoutName">'. $participantName .'</div>
							<div class="resKnockoutScore">'. $matchScore .'</div>
						</div>
						<div class="fixturesVersus">Vs</div>
						<div class="awayTeam">
							<div class="resKnockoutScore">'. $opponentScore .'</div>
							<div class="resKnockoutName">'. $opponentName .'</div>
						</div>
					</div>';
					if ($matchGroup == 4) {
						$matchGroup	= 0;
						$kFixturesReplace	.= '
				</div>';
					}
				}
			}
			if ($matchGroup != 0) {
				$kFixturesReplace	.= '
				</div>';
			}
			$kFixturesReplace	.= '
			</div>';
		}

		$moduleContent		= str_replace("[[KNOCKOUT_FIXTURES_BOX]]", $kFixturesReplace, $moduleContent);
	}

	$replaceLeagueID	= 0;
	if (strstr($moduleContent, "[[LEAGUE_RESULTS_BOX]]")) {
		$lResultsReplace	= '<div class="resFixMainTitle">'. $LANG_LEAGUE_TOURN_LATEST_RESULTS .'</div>';

		$lastResultsQuery = mysqli_query($conn, "SELECT r.weekID, r.fixtureDate, l.leagueID FROM leagueResults AS r LEFT JOIN leagueMiniLeagues AS l ON r.miniLeagueID = l.id WHERE r.homeScore != '-1' AND (fixtureDate <= '$dateToday') ORDER BY r.fixtureDate DESC LIMIT 0,1");
		if (mysqli_num_rows($lastResultsQuery) > 0) {
			while ($lRQ = mysqli_fetch_array($lastResultsQuery)) {
				$lastWeekID		= $lRQ["weekID"];
				$leagueID		= $lRQ["leagueID"];
				$fixtureDate	= date("jS F, Y", strtotime($lRQ["fixtureDate"]));
			}
			$replaceLeagueID	= $leagueID;

			$leagueQuery = mysqli_query($conn, "SELECT * FROM leagueConfig WHERE id = '$leagueID'");
			while ($lQ = mysqli_fetch_array($leagueQuery)) {
				$leagueID			= $lQ["id"];
				$leagueType			= $lQ["leagueType"];
				$leagueLink			= $lQ["pageURL"];
				$lFullSDate			= $lQ["startDate"];
				$pointsRink			= $lQ["pointsRink"];
				$lStartDate			= date("jS", strtotime($lFullSDate));
				$lStartMonth		= date("F", strtotime($lFullSDate));
				$lStartYear			= date("Y", strtotime($lFullSDate));
				$leagueStartDate	= "$lStartMonth $lStartYear";
			}
			$leagueTypeQuery = mysqli_query($conn, "SELECT pageURL, groupTitle FROM leagueGroups WHERE id = '$leagueType'");
			while ($lTQ = mysqli_fetch_array($leagueTypeQuery)) {
				$leagueGroupURL	= $lTQ["pageURL"];
				$groupTitle		= $lTQ["groupTitle"];
			}
			$leagueTitle	= "$groupTitle $leagueStartDate";

			$lResultsReplace	.= '<div class="resFixTLTitle">'. $leagueTitle .'</div>';

			$miniLeaguesQuery = mysqli_query($conn, "SELECT id FROM leagueMiniLeagues WHERE leagueID = '$leagueID'");
			while ($mLQ = mysqli_fetch_array($miniLeaguesQuery)) {
				$miniLeaguesArray[]	= $mLQ["id"];
			}

				if ($lastWeekID > 1000) {
					$noRoundsQuery = mysqli_query($conn, "SELECT DISTINCT(weekID) FROM leagueResults WHERE miniLeagueID IN('". implode("', '", $miniLeaguesArray) ."') AND (weekID BETWEEN 10000 AND 100000) ORDER BY weekID ASC LIMIT 0,1");
					while ($nRQ = mysqli_fetch_array($noRoundsQuery)) {
						$lowestWeek	= $nRQ["weekID"];
					}
					if ($lastWeekID == 9999 || $lastWeekID == 99999) {
						$roundTitle	= $LANG_ROUND_FINAL;
					} elseif ($lastWeekID == 9998 || $lastWeekID == 99998) {
						$roundTitle	= $LANG_ROUND_SEMI_FINAL;
					} elseif ($lastWeekID == 9997 || $lastWeekID == 99997) {
						$roundTitle	= $LANG_ROUND_QTR_FINAL;
					} else {
						$thisRound	= ($lastWeekID - $lowestWeek) + 1;
						$roundTitle	= "$LANG_ROUND $thisRound";
					}
					
					$lResultsReplace	.= '<div class="resFixTitle">'. $roundTitle .': '. $fixtureDate .'</div>
								<div class="fixturesLegend">
									<div class="homeTeam">
										<div class="teamName">&nbsp;</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
										<div class="teamRink">Rink Pts</div>';
									}
									$lResultsReplace	.= '
										<div class="teamScore">Score</div>
									</div>
									<div class="fixturesVersus">&nbsp;</div>
									<div class="awayTeam">
										<div class="teamScore">Score</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
										<div class="teamRink">Rink Pts</div>';
									}
									$lResultsReplace	.= '
										<div class="teamName">&nbsp;</div>
									</div>
								</div>';
					$resultsQuery = mysqli_query($conn, "SELECT * FROM leagueResults WHERE weekID = '$lastWeekID' AND (miniLeagueID IN('". implode("', '", $miniLeaguesArray) ."')) ORDER BY id ASC");
					while ($rQ = mysqli_fetch_array($resultsQuery)) {
						$firstLegID		= $rQ["firstLegID"];
						$fixtureDate	= $rQ["fixtureDate"];
						$homeTeam		= $rQ["homeTeam"];
						$homeScore		= $rQ["homeScore"];
						$homeRinkPts	= $rQ["homeRinkPts"];
						$awayTeam		= $rQ["awayTeam"];
						$awayScore		= $rQ["awayScore"];
						$awayRinkPts	= $rQ["awayRinkPts"];

					$lResultsReplace	.= '
					<div class="resFixture">
						<div class="homeTeam">
							<div class="teamName">'. $homeTeam .'</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
							<div class="teamRink">'. $homeRinkPts .'</div>';
									}
									$lResultsReplace	.= '
							<div class="teamScore">'. $homeScore .'</div>
						</div>
						<div class="fixturesVersus">Vs</div>
						<div class="awayTeam">
							<div class="teamName">'. $awayTeam .'</div>
							<div class="teamScore">'. $awayScore .'</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
							<div class="teamRink">'. $awayRinkPts .'</div>';
									}
									$lResultsReplace	.= '
						</div>
					</div>
					';
				}
			} else {
				$roundTitle	= "$LANG_LEAGUE_WEEK_TITLE $lastWeekID";
					
				$lResultsReplace	.= '
					<div class="resFixTitle">'. $roundTitle .': '. $fixtureDate .'</div>
					<div class="pageGroupTableSlider">';

				$miniLeaguesQuery = mysqli_query($conn, "SELECT id, miniLeagueTitle FROM leagueMiniLeagues WHERE leagueID = '$leagueID'");
				while ($mLQ = mysqli_fetch_array($miniLeaguesQuery)) {
					$miniLeagueID		= $mLQ["id"];
					$miniLeagueTitle	= $mLQ["miniLeagueTitle"];

					$lResultsReplace	.= '
						<div class="pageGroupTable">
							<div class="resFixTitle">'. $miniLeagueTitle .'</div>
							<div class="fixturesLegend">
								<div class="homeTeam">
									<div class="teamName">&nbsp;</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
									<div class="teamRink">Rink Pts</div>';
									}
									$lResultsReplace	.= '
									<div class="teamScore">Score</div>
								</div>
								<div class="fixturesVersus">&nbsp;</div>
								<div class="awayTeam">
									<div class="teamScore">Score</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
									<div class="teamRink">Rink Pts</div>';
									}
									$lResultsReplace	.= '
									<div class="teamName">&nbsp;</div>
								</div>
							</div>';
				
					$resultsQuery = mysqli_query($conn, "SELECT * FROM leagueResults WHERE weekID = '$lastWeekID' AND (miniLeagueID = '$miniLeagueID') ORDER BY id ASC");
					while ($rQ = mysqli_fetch_array($resultsQuery)) {
						$fixtureDate	= $rQ["fixtureDate"];
						$homeTeam		= $rQ["homeTeam"];
						$homeScore		= $rQ["homeScore"];
						$homeRinkPts	= $rQ["homeRinkPts"];
						$awayTeam		= $rQ["awayTeam"];
						$awayScore		= $rQ["awayScore"];
						$awayRinkPts	= $rQ["awayRinkPts"];

						$lResultsReplace	.= '
							<div class="resFixture">
								<div class="homeTeam">
									<div class="teamName">'. $homeTeam .'</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
									<div class="teamRink">'. $homeRinkPts .'</div>';
									}
									$lResultsReplace	.= '
									<div class="teamScore">'. $homeScore .'</div>
								</div>
								<div class="fixturesVersus">Vs</div>
								<div class="awayTeam">
									<div class="teamName">'. $awayTeam .'</div>
									<div class="teamScore">'. $awayScore .'</div>';
									if ($pointsRink != 0) {
										$lResultsReplace	.= '
									<div class="teamRink">'. $awayRinkPts .'</div>';
									}
									$lResultsReplace	.= '
								</div>
							</div>';
					}
					$lResultsReplace	.= '
						</div>';
				}
			$lResultsReplace	.= '
					</div>';
			}

			$lResultsReplace	.= '
			<a href="'. $url . $LANG_MENU_LEAGUE_URL .'/'. $leagueGroupURL .'/'. $leagueLink .'.html" class="boxViewLink">'. $LANG_VIEW_MORE .'</a>';

		} else {
			$lResultsReplace	.= "<p>$LANG_NO_RESULTS</p>";
		}
			

		$moduleContent		= str_replace("[[LEAGUE_RESULTS_BOX]]", $lResultsReplace, $moduleContent);
	}

	if (strstr($moduleContent, "[[LEAGUE_FIXTURES_BOX]]")) {
		$lFixturesReplace	= '<div class="resFixMainTitle">'. $LANG_LEAGUE_TOURN_NEXT_FIXTURES .'</div>';

		/////	NOT WORKING FOR MULTI GROUPS THAT HAVE MOVED ONTO THE PLAYOFFS	\\\\\

		$lastResultsQuery = mysqli_query($conn, "SELECT r.weekID, l.leagueID FROM leagueResults AS r LEFT JOIN leagueMiniLeagues AS l ON r.miniLeagueID = l.id WHERE r.homeScore = '-1' AND (fixtureDate >= '$dateToday') ORDER BY r.id ASC LIMIT 0,1");
		if (mysqli_num_rows($lastResultsQuery) > 0) {
			while ($lRQ = mysqli_fetch_array($lastResultsQuery)) {
				$nextWeekID	= $lRQ["weekID"];
				$leagueID	= $lRQ["leagueID"];
			}
			if (!isset($replaceLeagueID)) {
				$replaceLeagueID	= $leagueID;
			}

			$leagueQuery = mysqli_query($conn, "SELECT * FROM leagueConfig WHERE id = '$leagueID'");
			while ($lQ = mysqli_fetch_array($leagueQuery)) {
				$leagueID			= $lQ["id"];
				$leagueType			= $lQ["leagueType"];
				$leagueLink			= $lQ["pageURL"];
				$lFullSDate			= $lQ["startDate"];
				$lStartDate			= date("jS", strtotime($lFullSDate));
				$lStartMonth		= date("F", strtotime($lFullSDate));
				$lStartYear			= date("Y", strtotime($lFullSDate));
				$leagueStartDate	= "$lStartMonth $lStartYear";
			}
			$leagueTypeQuery = mysqli_query($conn, "SELECT pageURL, groupTitle FROM leagueGroups WHERE id = '$leagueType'");
			while ($lTQ = mysqli_fetch_array($leagueTypeQuery)) {
				$leagueGroupURL	= $lTQ["pageURL"];
				$groupTitle		= $lTQ["groupTitle"];
			}
			$leagueTitle	= "$groupTitle $leagueStartDate";

			$miniLeaguesArray	= array();
			$miniLeaguesQuery = mysqli_query($conn, "SELECT id FROM leagueMiniLeagues WHERE leagueID = '$leagueID'");
			while ($mLQ = mysqli_fetch_array($miniLeaguesQuery)) {
				$miniLeaguesArray[]	= $mLQ["id"];
			}
			if ($nextWeekID > 1000) {
				$noRoundsQuery = mysqli_query($conn, "SELECT DISTINCT(weekID) FROM leagueResults WHERE miniLeagueID IN('". implode("', '", $miniLeaguesArray) ."') AND (weekID BETWEEN 10000 AND 100000) ORDER BY weekID ASC LIMIT 0,1");
				while ($nRQ = mysqli_fetch_array($noRoundsQuery)) {
					$lowestWeek	= $nRQ["weekID"];
				}
				if ($nextWeekID == 9999 || $nextWeekID == 99999) {
					$roundTitle	= $LANG_ROUND_FINAL;
				} elseif ($nextWeekID == 9998 || $nextWeekID == 99998) {
					$roundTitle	= $LANG_ROUND_SEMI_FINAL;
				} elseif ($nextWeekID == 9997 || $nextWeekID == 99997) {
					$roundTitle	= $LANG_ROUND_QTR_FINAL;
				} else {
					$thisRound	= ($nextWeekID - $lowestWeek) + 1;
					$roundTitle	= "$LANG_ROUND $thisRound";
				}
			} else {
				$roundTitle	= "$LANG_LEAGUE_WEEK_TITLE $nextWeekID";
			}
			$fixtureDateQuery = mysqli_query($conn, "SELECT fixtureDate FROM leagueResults WHERE weekID = '$nextWeekID' AND (miniLeagueID IN('". implode("', '", $miniLeaguesArray) ."')) ORDER BY id ASC LIMIT 0,1");
			while ($fDQ = mysqli_fetch_array($fixtureDateQuery)) {
				$fixtureDate	= date("jS F, Y", strtotime($fDQ["fixtureDate"]));
			}
			$lFixturesReplace	.= '<div class="resFixTLTitle">'. $leagueTitle .'</div>
						<div class="resFixTitle">'. $roundTitle .': '. $fixtureDate .'</div>
						<div class="pageGroupTableSlider">';

			if ($lastWeekID > 1000) {
				$resultsQuery = mysqli_query($conn, "SELECT * FROM leagueResults WHERE weekID = '$nextWeekID' AND (miniLeagueID IN('". implode("', '", $miniLeaguesArray) ."')) ORDER BY id ASC");
				while ($rQ = mysqli_fetch_array($resultsQuery)) {
					$firstLegID		= $rQ["firstLegID"];
					$fixtureDate	= $rQ["fixtureDate"];
					$homeTeam		= $rQ["homeTeam"];
					$awayTeam		= $rQ["awayTeam"];

					$lFixturesReplace	.= '
				<div class="resFixture">
					<div class="homeTeam">
						<div class="teamName">'. $homeTeam .'</div>
					</div>
					<div class="fixturesVersus">Vs</div>
					<div class="awayTeam">
						<div class="teamName">'. $awayTeam .'</div>
					</div>
				</div>
				';
				}
			} else {

				$miniLeaguesQuery = mysqli_query($conn, "SELECT id, miniLeagueTitle FROM leagueMiniLeagues WHERE leagueID = '$leagueID'");
				while ($mLQ = mysqli_fetch_array($miniLeaguesQuery)) {
					$miniLeagueID		= $mLQ["id"];
					$miniLeagueTitle	= $mLQ["miniLeagueTitle"];

					$lFixturesReplace	.= '<div class="pageGroupTable">
					<div class="resFixTitle">'. $miniLeagueTitle .'</div>';

					$resultsQuery = mysqli_query($conn, "SELECT * FROM leagueResults WHERE weekID = '$nextWeekID' AND (miniLeagueID = '$miniLeagueID') ORDER BY id ASC");
					while ($rQ = mysqli_fetch_array($resultsQuery)) {
						$firstLegID		= $rQ["firstLegID"];
						$fixtureDate	= $rQ["fixtureDate"];
						$homeTeam		= $rQ["homeTeam"];
						$awayTeam		= $rQ["awayTeam"];

					$lFixturesReplace	.= '
				<div class="resFixture">
					<div class="homeTeam">
						<div class="teamName">'. $homeTeam .'</div>
					</div>
					<div class="fixturesVersus">Vs</div>
					<div class="awayTeam">
						<div class="teamName">'. $awayTeam .'</div>
					</div>
				</div>
				';
					}
					$lFixturesReplace	.= '</div>';
				}
				$lFixturesReplace	.= '</div>';
			}

			$lFixturesReplace	.= '<a href="'. $url . $LANG_MENU_LEAGUE_URL .'/'. $leagueGroupURL .'/'. $leagueLink .'.html" class="boxViewLink">'. $LANG_VIEW_MORE .'</a>';

		} else {
			$lFixturesReplace	.= "<p>$LANG_NO_FIXTURES</p>";
		}


		$moduleContent		= str_replace("[[LEAGUE_FIXTURES_BOX]]", $lFixturesReplace, $moduleContent);
	}

	if (strstr($moduleContent, "[[LEAGUE_TABLE_BOX]]")) {
		$lTableReplace	= '<div class="resFixMainTitle">'. $LANG_LEAGUE_TABLE_TITLE .'</div>';

		$lastResultsQuery = mysqli_query($conn, "SELECT l.leagueID FROM leagueResults AS r LEFT JOIN leagueMiniLeagues AS l ON r.miniLeagueID = l.id WHERE r.homeScore != '-1' AND (fixtureDate <= '$dateToday') ORDER BY r.fixtureDate DESC LIMIT 0,1");
		if (mysqli_num_rows($lastResultsQuery) > 0) {
			while ($lRQ = mysqli_fetch_array($lastResultsQuery)) {
				$leagueID		= $lRQ["leagueID"];
			}
			$leagueQuery = mysqli_query($conn, "SELECT * FROM leagueConfig WHERE id = '$leagueID'");
		} else {
			$leagueQuery = mysqli_query($conn, "SELECT * FROM leagueConfig ORDER BY id DESC LIMIT 0,1");
		}
		while ($lQ = mysqli_fetch_array($leagueQuery)) {
			$leagueID			= $lQ["id"];
			$leagueLink			= $lQ["pageURL"];
			$pointsWin			= $lQ["pointsWin"];
			$pointsDraw			= $lQ["pointsDraw"];
			$pointsRink			= $lQ["pointsRink"];
			$leagueType			= $lQ["leagueType"];
			$lFullSDate			= $lQ["startDate"];
			$lStartDate			= date("jS", strtotime($lFullSDate));
			$lStartMonth		= date("F", strtotime($lFullSDate));
			$lStartYear			= date("Y", strtotime($lFullSDate));
			$leagueStartDate	= "$lStartMonth $lStartYear";
		}
		$leagueTypeQuery = mysqli_query($conn, "SELECT pageURL, groupTitle FROM leagueGroups WHERE id = '$leagueType'");
		while ($lTQ = mysqli_fetch_array($leagueTypeQuery)) {
			$leagueGroupURL	= $lTQ["pageURL"];
			$groupTitle		= $lTQ["groupTitle"];
		}
		$leagueTitle	= "$groupTitle $leagueStartDate";

		$lTableReplace	.= '<div class="resFixTLTitle">'. $leagueTitle .'</div>
			<div class="pageGroupTableSlider">';

		$miniLeagueQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeagues WHERE leagueID = '$leagueID' ORDER BY id ASC");
		$numMiniLeagues	= mysqli_num_rows($miniLeagueQuery);
		while ($mLQ = mysqli_fetch_array($miniLeagueQuery)) {
			$miniLeagueID		= $mLQ["id"];
			$miniLeagueTitle	= $mLQ["miniLeagueTitle"];

			$lTableReplace	.= '<div class="pageGroupTable">
				<div class="resFixTitle">'. $miniLeagueTitle .'</div>
					<table class="leagueTable">
						<thead>
							<th class="tN">&nbsp;</th>
							<th class="tS" title="'. $LANG_LEAGUE_PLD_TITLE .'">P</th>
							<th class="tS" title="'. $LANG_LEAGUE_W_TITLE .'">W</th>
							<th class="tS" title="'. $LANG_LEAGUE_D_TITLE .'">D</th>
							<th class="tS" title="'. $LANG_LEAGUE_L_TITLE .'">L</th>
							<th class="tL" title="'. $LANG_LEAGUE_SHOT_DIFF_TITLE .'">Diff</th>
							<th class="tL tP" title="'. $LANG_LEAGUE_PTS_TITLE .'">Pts</th>
						</thead>
						<tbody>';

					$leagueStandingQuery = mysqli_query($conn, "SELECT 
						team, 
						COUNT(*) AS played, 
						COUNT(CASE WHEN homeScore > awayScore THEN 1 END) AS won, 
						COUNT(CASE WHEN homeScore = awayScore THEN 1 END) AS drawn, 
						COUNT(CASE WHEN awayScore> homeScore THEN 1 END) AS lost, 
						SUM(homeScore) AS shotsFor, 
						SUM(awayScore) AS shotsAgainst, 
						SUM(homeScore) - SUM(awayScore) AS shotsDiff,
						SUM(homeRinkPts) AS rinkPts,
						SUM(
							  CASE WHEN homeScore > awayScore THEN $pointsWin ELSE 0 END 
							+ CASE WHEN homeScore = awayScore THEN $pointsDraw ELSE 0 END
							+ homeRinkPts
						) AS pts 
					FROM (
						SELECT homeTeam AS team, homeScore, awayScore, homeRinkPts, awayRinkPts from leagueResults WHERE miniLeagueID = '$miniLeagueID' AND ((homeTeam != '') AND (awayTeam != '')) AND ((homeScore >= 0) AND (awayScore >= 0)) AND (weekID < 900)
					  UNION ALL
						SELECT awayTeam AS team, awayScore, homeScore, awayRinkPts, homeRinkPts from leagueResults WHERE miniLeagueID = '$miniLeagueID' AND ((homeTeam != '') AND (awayTeam != '')) AND ((homeScore >= 0) AND (awayScore >= 0)) AND (weekID < 900)
					) AS a 
					GROUP BY team
					ORDER BY pts DESC, shotsDiff DESC") or die (mysqli_error($conn));
					if (mysqli_num_rows($leagueStandingQuery) > 0) {
						$addedTeams	= array();
						while ($lSQ = mysqli_fetch_array($leagueStandingQuery)) {
							$teamName		= $lSQ["team"];
							$addedTeams[]	= $teamName;
							$matchesPlayed	= $lSQ["played"];
							$matchesWon		= $lSQ["won"];
							$matchesDrawn	= $lSQ["drawn"];
							$matchesLost	= $lSQ["lost"];
							$shotsFor		= $lSQ["shotsFor"];
							$shotsAgainst	= $lSQ["shotsAgainst"];
							$shotsDiff		= $lSQ["shotsDiff"];
							$rinkPts		= $lSQ["rinkPts"];
							$totalPts		= $lSQ["pts"];

							$lTableReplace	.= '
							<tr>
								<td class="tN">'. $teamName .'</td>
								<td class="tS">'. $matchesPlayed .'</td>
								<td class="tS">'. $matchesWon .'</td>
								<td class="tS">'. $matchesDrawn .'</td>
								<td class="tS">'. $matchesLost .'</td>
								<td class="tL">'. $shotsDiff .'</td>
								<td class="tL tP">'. $totalPts .'</td>
							</tr>';

						}

						$defaultLeagueQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeaguesTeams WHERE miniLeagueID = '$miniLeagueID' AND (teamName NOT IN ('". implode("', '", $addedTeams) ."')) ORDER BY teamName ASC");
						while ($dLQ = mysqli_fetch_array($defaultLeagueQuery)) {
							$missingTeamName	= $dLQ["teamName"];

							$lTableReplace	.= '
							<tr>
								<td class="tN ttt">'. $missingTeamName .'</td>
								<td class="tS">0</td>
								<td class="tS">0</td>
								<td class="tS">0</td>
								<td class="tS">0</td>
								<td class="tL">0</td>
								<td class="tL tP">0</td>
							</tr>';
						}
					} else {
						$defaultLeagueQuery = mysqli_query($conn, "SELECT * FROM leagueMiniLeaguesTeams WHERE miniLeagueID = '$miniLeagueID' ORDER BY teamName ASC");
						while ($dLQ = mysqli_fetch_array($defaultLeagueQuery)) {
							$teamName		= $dLQ["teamName"];

							$lTableReplace	.= '

							<tr>
								<td class="tN">'. $teamName .'</td>
								<td>0</td>
								<td>0</td>
								<td>0</td>
								<td>0</td>
								<td>0</td>
								<td class="tP">0</td>
							</tr>';
						}
					}
					$lTableReplace	.= '
						</tbody>
					</table>
				</div>';
		}
		$lTableReplace	.= '</div>
		<a href="'. $url . $LANG_MENU_LEAGUE_URL .'/'. $leagueGroupURL .'/'. $leagueLink .'.html" class="boxViewLink">'. $LANG_VIEW_MORE .'</a>';

		$moduleContent		= str_replace("[[LEAGUE_TABLE_BOX]]", $lTableReplace, $moduleContent);
	}

	if (strstr($moduleContent, "[[GALLERY_BOX]]")) {
		$pGalleryReplace	= "";

		$photoGalleryQuery = mysqli_query($conn, "SELECT * FROM photoGallery WHERE galleryID != '9999' ORDER BY RAND() LIMIT 0,5");
		while ($pGQ = mysqli_fetch_array($photoGalleryQuery)) {
			$photoID	= $pGQ["id"];
			$galleryID	= $pGQ["galleryID"];
			$photoURL	= substr_replace($pGQ["imageURL"], "-thumb", "-4", 0);
			$photoTitle	= $pGQ["imageTitle"];
			
			$galleryCatQuery = mysqli_query($conn, "SELECT pageURL FROM photoGalleryCats WHERE id = '$galleryID'");
			while ($gCQ = mysqli_fetch_array($galleryCatQuery)) {
				$catURL			= $gCQ["pageURL"];
			}
			$pGalleryReplace	.= '
			<div class="galleryPhoto">
				<a href="'. $url . $LANG_MENU_GALLERY_URL ."/". $catURL .'">
					<img src="'. $Iurl .'gallery/'. $photoURL .'" width="200" alt="'. $photoTitle .'" title="'. $photoTitle .'" data-pid="'. $photoID .'">
				</a>';
			
			if (trim($photoTitle) != "") {
				$pGalleryReplace	.= '
				<div class="galleryPhotoTitle">'. $photoTitle .'</div>';
			}
			$pGalleryReplace	.= '
			</div>';
		}

		$moduleContent		= str_replace("[[GALLERY_BOX]]", $pGalleryReplace, $moduleContent);
	}

	return $moduleContent;
	
}
?>

Anon7 - 2022
AnonSec Team