function get_season_data($seasonKey)
{
    $ak = getAccessToken();
    if ($ak) {
        $season = getSeason($ak, $seasonKey, 'micro_card');
        return $season;
    } else {
        setAccessToken();
        $ak = getAccessToken();
        if ($ak) {
            return get_season_data($seasonKey);
        } else {
            die('Error while getting season information');
        }
    }
}
function notifyDraftOrder($leagueID)
{
    debug("notifydraftorder.. hello");
    $order = getDraftOrder($leagueID);
    $season = getSeason();
    $sql = "\r\r\n\tSELECT u.email\r\r\n\t\tFROM fch_users u, fch_league_membership m\r\r\n\t\tWHERE u.id = m.userID\r\r\n\t\tAND season =  \"{$season}\"\r\r\n\t\tAND m.leagueID = {$leagueID}\r\r\n\t";
    debug("notifyDraftOrder: {$sql}");
    $draftTime = getSingleton("fch_leagues", "draftTime", " WHERE id = {$leagueID} and season = \"{$season}\"");
    $leagueName = getSingleton("fch_leagues", "display_name", " WHERE id = {$leagueID} and season = \"{$season}\"");
    $body = <<<BODY

\tHello,


\tThis is an automated notification from Fantasy College Hockey.

\tYou've joined a league - {$leagueName}. The registration deadline has passed, and we've generated a draft order. Here it is:

\t{$order}

\t
\tNote: The draft will occur in order for the first round, then in reverse order for the 2nd round, and vice versa. For example if there are 3 people in your draft, it'll go pick 1-2-3-3-2-1-1-2-3 and so on.
\t
\tYour draft is scheduled for {$draftTime} EST


\t
\tHave a great season and feel free to contact us at fantasycollegehockey@gmail.com.
BODY;
    $con = initializeDB();
    debug("notifyDraftOrder: {$sql}");
    $result = $con->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        $order = 1;
        while ($row = $result->fetch_assoc()) {
            sendEmail($row[email], "Your FCH Draft is Coming! Here's Your Draft Order", $body);
            debug("EMAIL: " . $row[email] . " Body: " . $body);
        }
    } else {
        return "";
    }
}
require_once "fch-lib.php";
$userID = getUserID();
$os = "";
debug("regarding-league");
//debug(selectCount("fch_user_preferences"," WHERE userID = $userID "));
if (selectCount("fch_user_preferences", " WHERE userID = {$userID} ") == 0) {
    //debug("Creating preference row , ");
    $key = rand(0, 2147483647);
    $sql = "INSERT INTO  `fanta66_joomla`.`fch_user_preferences` (`id` ,`userID` ,`displayLeague`, `secretKey`) VALUES (NULL ,  {$userID}, NULL, {$key});";
    //debug($sql);
    executeGenericInsertSQL($sql);
}
//if (getSingleton("fch_user_preferences","displayLeague", " WHERE userID = $userID") == NULL)
//generateUserPreferences($userID);
$leagueCount = intval(selectCount("fch_league_membership", " where userID =  {$userID}  "));
$season = getSeason();
$dbLeague = getSingleton("fch_user_preferences", "displayLeague", " WHERE userID = {$userID}");
if (strlen($dbLeague) == 0) {
    debug("Setting default league.");
    generateUserPreferences($userID);
}
/*
if ($leagueCount == 1)
{
	debug("In only one league");
	if (intval(selectCount("fch_league_membership", " WHERE userID = $userID and season = \"$season\"")) == 1)
	{	
		debug("In only one league. Setting default membership.");
		$thisLeague = getSingleton("fch_league_membership","leagueID"," WHERE season = \"$season\" and userID = $userID");
		debug("Setting default league for user $userID to $thisLeague");
		$sql = "
<?php

require_once "fch-lib.php";
require_once "fch-lib.js";
$userID = getUserID();
$leagueID = leagueHandler($_POST, $userID);
debug("User is {$userID} League is {$leagueID}");
$season = getSeason();
$app = JFactory::getApplication();
$teamDisplayName = getSingleton("fch_league_membership", "teamDisplayName", " WHERE userID = {$userID} and leagueID = {$leagueID} and season = \"{$season}\"");
debug("Team display Name: {$teamDisplayName}");
$menu =& JSite::getMenu();
$active = $menu->getActive();
$menuname = $active->params->get('page_heading');
echo $menuname;
$thisSeason = getSeason();
$lastSeason = getLastSeason();
$thisSeasonNoDash = preg_replace("/[^A-Za-z0-9 ]/", '', $thisSeason);
$lastSeasonNoDash = preg_replace("/[^A-Za-z0-9 ]/", '', $lastSeason);
?>
<form name = "get_stats" action = "/get_stats.cgi" method = "get"  class="form-validate form-horizontal">
	<fieldset>
		<div class="control-group">
			<legend>What Would You Like to Download?</legend>
				<div class="control-label">
					<label id="jform_contact_name-lbl" for="jform_contact_name" class="hasTooltip required" title="&lt;strong&gt;Name&lt;/strong&gt;&lt;br /&gt;Your name.">
					Player Type</label>
				</div>

				<div class="controls">
					<select name = "type">
<?php

require_once "fch-lib.php";
require_once "fch-lib.js";
$userID = getUserID();
$leagueID = leagueHandler($_POST, $userID);
debug("League is {$leagueID}");
$season = getSeason();
?>


To join a league, choose the league you're looking to join, the password provided by its administrator, and the name of your team. You can only join a league once. If a league's registration deadline has passed, it does not appear on the list.<p/>
<?php 
debug($_POST["action"]);
if ($_POST["action"] == "leagueEnroll") {
    $pass = getSingleton("fch_leagues", "pw", " where id = " . $_POST['leagueID'] . " and season = \"" . getSeason() . "\"");
    debug("Criteria -- displName=" . $_POST["teamDisplayName"] . " pw=" . $_POST['password'] . " pass="******"teamDisplayName"]) > 0) {
        echo displayResults(addGMToLeague($_POST["leagueID"], $userID, $_POST["teamDisplayName"]));
    } else {
        echo displayResults(getReturnCode(0, "Sorry, your password was incorrect or you didn't enter a team name."));
    }
}
?>

 <div class="contact-form">
<form  name="leagueEnroll" method="post" class="form-validate form-horizontal" >
			<input name = "action" value = "leagueEnroll" type = "hidden">
  
		<fieldset>
			<legend>What League Would You Like to Join?</legend>
function sqlRefresh()
{
    $season = getSeason();
    /// /////////////////////////////////////////////////
    /// TRUNCATE SCHEDULE
    $sql = <<<SQL

\t\ttruncate table fanta66_joomla.fch_schedule;
SQL;
    $scheduleTruncateResults = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// REBUILD SCHEDULE
    $sql = <<<SQL

\t\tinsert into fanta66_joomla.fch_schedule
\t\t(dateStamp,visitor,home)
\t\tselect date_stamp,visitor,home from fanta66_zudnicfchmaster.schedule_master;
SQL;
    $scheduleResults = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// TRUNCATE SCHEDULE
    $sql = <<<SQL

\t\ttruncate table fanta66_joomla.fch_schedule_lastseason;
SQL;
    $scheduleTruncateResultsLY = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// REBUILD SCHEDULE
    $sql = <<<SQL

\t\tinsert into fanta66_joomla.fch_schedule_lastseason
\t\t(dateStamp,visitor,home)
\t\tselect date_stamp,visitor,home from fanta66_zudnicfchmaster.schedule_lastseason;
SQL;
    $scheduleResultsLY = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// TRUNCATE RESULTS
    $sql = <<<SQL

\t\tDELETE FROM fanta66_joomla.fch_consolidated_results where season = "{$season}";
SQL;
    $out .= "<HR><B>Truncate Results SQL: </B><br/>{$sql}<p/>\n";
    $truncateResultsResults = executeGenericSQL($sql);
    /// /////////////////////////////////////////////////
    /// REBUILD RESULTS - SKATERS
    $sql = <<<SQL

insert into fanta66_joomla.fch_consolidated_results
(dateStamp
,totalPoints
,season
,playerID
,schoolID
,opponent
,opponentDisplayName
,playerDisplayName
,position
,schoolDisplayName
,statLine
,dateLine
,atVs)

SELECT DISTINCT 
\t`fanta66_zudnicfchmaster`.`results_skaters`.`date_stamp` AS `date_stamp`

\t,`fanta66_zudnicfchmaster`.`results_skaters`.`total_points` AS `totalPoints`
\t,convert(CONCAT (
\t\t\tsubstr(`fanta66_zudnicfchmaster`.`results_skaters`.`season`, 1, 4)
\t\t\t,"-"
\t\t\t,substr(`fanta66_zudnicfchmaster`.`results_skaters`.`season`, 5, 4)
\t\t\t) using utf8) AS `season`
\t,replace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`results_skaters`.`player`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_id` AS `schoolID`
\t,

IF (
\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`visitor`)
\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`home`
\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`visitor`
\t\t) AS `opponent`
\t,`fanta66_zudnicfchmaster`.`school_master`.`school_shortname` AS `opponentDisplayName`
\t,CONCAT (
\t\t`fanta66_zudnicfchmaster`.`player_master`.`first_name`
\t\t," "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name`
\t\t,", "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name`
\t\t) AS `playerDisplayName`
\t,`fanta66_zudnicfchmaster`.`player_master`.`position` as position
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName

\t,CONCAT (
\t\tconvert(IF (
\t\t\t\t(1 > `fanta66_zudnicfchmaster`.`results_skaters`.`goals`)
\t\t\t\t,"0"
\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`goals`
\t\t\t\t) using latin1 )
\t\t\t," G, "
\t\t\t,convert(IF (
\t\t\t\t\t(1 > `fanta66_zudnicfchmaster`.`results_skaters`.`assists`)
\t\t\t\t\t,"0"
\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`assists`
\t\t\t\t\t) using latin1 )
\t\t\t\t," A "
\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`info` ) AS `statLine`
\t\t\t\t,CONCAT (convert(date_format(`fanta66_zudnicfchmaster`.`results_skaters`.`date_stamp`, "%c/%e") using latin1)) AS `dateLine`
\t\t\t\t,convert(IF (
\t\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`visitor`)
\t\t\t\t\t\t," at "
\t\t\t\t\t\t," vs "
\t\t\t\t\t\t) using latin1 ) AS `atVs` FROM (
\t\t\t\t\t(
\t\t\t\t\t\t`fanta66_zudnicfchmaster`.`results_skaters` JOIN `fanta66_zudnicfchmaster`.`player_master`
\t\t\t\t\t\t) JOIN `fanta66_zudnicfchmaster`.`school_master`
\t\t\t\t\t) WHERE (
\t\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`text_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`player`)
\t\t\t\t\t\tAND (
\t\t\t\t\t\t\t`fanta66_zudnicfchmaster`.`school_master`.`school_id` = IF (
\t\t\t\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_skaters`.`visitor`)
\t\t\t\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`home`
\t\t\t\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_skaters`.`visitor`
\t\t\t\t\t\t\t\t) ) ) ORDER BY `fanta66_zudnicfchmaster`.`results_skaters`.`date_stamp` DESC;
SQL;
    $skaterInsertResults = executeGenericSQL($sql);
    $out .= "<HR><B>Skater Results SQL: </B><br/>{$sql}<p/>\n";
    /////////////////////////////////////////
    // GOALIE RESULTS
    $sql = <<<SQL

\tinsert into fanta66_joomla.fch_consolidated_results
(dateStamp
,totalPoints
,season
,playerID
,schoolID
,opponent
,opponentDisplayName
,playerDisplayName
,position
,schoolDisplayName
,statLine
,dateLine
,atVs)
\tSELECT DISTINCT `fanta66_zudnicfchmaster`.`results_goalies`.`date_stamp` AS `date_stamp`
\t,`fanta66_zudnicfchmaster`.`results_goalies`.`points` AS `total_points`
\t,convert(CONCAT (
\t\t\tsubstr(`fanta66_zudnicfchmaster`.`results_goalies`.`season`, 1, 4)
\t\t\t,"-"
\t\t\t,substr(`fanta66_zudnicfchmaster`.`results_goalies`.`season`, 5, 4)
\t\t\t) using utf8) AS `season`
\t,replace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`results_goalies`.`player`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_id` AS `schoolID`
\t

,IF (
\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`visitor`)
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`home`
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`visitor`
\t\t) AS `opponent`
\t,`fanta66_zudnicfchmaster`.`school_master`.`school_shortname` AS `opponentDisplayName`
\t,CONCAT (
\t\t`fanta66_zudnicfchmaster`.`player_master`.`first_name`
\t\t," "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name`
\t\t, ", "
\t\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name`

\t\t) AS `playerDisplayName`
\t,`fanta66_zudnicfchmaster`.`player_master`.`position` AS position
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName
\t,CONCAT (
\t\t`fanta66_zudnicfchmaster`.`results_goalies`.`goals_allowed`
\t\t," GA, "
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`saves`
\t\t," saves, "
\t\t,round(`fanta66_zudnicfchmaster`.`results_goalies`.`gaa`, 3)
\t\t," GAA, "
\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`decision`
\t\t) AS `statLine`
\t,CONCAT (convert(date_format(`fanta66_zudnicfchmaster`.`results_goalies`.`date_stamp`, "%c/%e") using latin1)) AS `dateLine`
\t,convert(IF (
\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`visitor`)
\t\t\t," at "
\t\t\t," vs "
\t\t\t) using latin1 ) AS `atVs` FROM (
\t\t(
\t\t\t`fanta66_zudnicfchmaster`.`results_goalies` JOIN `fanta66_zudnicfchmaster`.`player_master`
\t\t\t) JOIN `fanta66_zudnicfchmaster`.`school_master`
\t\t) WHERE (
\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`text_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`player`)
\t\t\tAND (
\t\t\t\t`fanta66_zudnicfchmaster`.`school_master`.`school_id` = IF (
\t\t\t\t\t(`fanta66_zudnicfchmaster`.`player_master`.`school_id` = `fanta66_zudnicfchmaster`.`results_goalies`.`visitor`)
\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`home`
\t\t\t\t\t,`fanta66_zudnicfchmaster`.`results_goalies`.`visitor`
\t\t\t\t\t) ) ) ORDER BY `fanta66_zudnicfchmaster`.`results_goalies`.`date_stamp` DESC;
SQL;
    $goalieInsertResults = executeGenericSQL($sql);
    $out .= "<HR><B>Goalie Results SQL: </B><br/>{$sql}<p/>\n";
    $out .= "Skater Results Insert: " . $skaterInsertResults["msg"] . "\n<br/>";
    $out .= "Goalie Results Insert: " . $goalieInsertResults["msg"] . "\n<br/>";
    $playerTruncateResults = executeGenericSQL("truncate table fanta66_joomla.fch_players");
    $out .= "Player Truncate: " . $playerTruncateResults["msg"] . "\n";
    $sql = <<<SQL

\tinsert into fanta66_joomla.fch_players
(playerID, lastName, firstName, schoolDisplayName, schoolID, playerYear, position, season)
select distinct
\treplace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`player_master`.`text_id`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name` as lastName
\t,`fanta66_zudnicfchmaster`.`player_master`.`first_name` as firstName
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName
\t, `fanta66_zudnicfchmaster`.`player_master`.`school_id` as schoolID
\t, `fanta66_zudnicfchmaster`.`player_master`.`year_in_school` as playerYear
\t, `fanta66_zudnicfchmaster`.`player_master`.`position` as position
\t, convert(CONCAT (
\t\t\tsubstr(`fanta66_zudnicfchmaster`.`player_master`.`season`, 1, 4)
\t\t\t,"-"
\t\t\t,substr(`fanta66_zudnicfchmaster`.`player_master`.`season`, 5, 4)
\t\t\t) using utf8) AS `season`
\tfrom `fanta66_zudnicfchmaster`.`player_master`
\twhere `fanta66_zudnicfchmaster`.`player_master`.`test` = "prod"
SQL;
    $sql .= " and season = \"" . preg_replace("/[^A-Za-z0-9 ]/", '', getSeason()) . "\";";
    $playerInsertResults = executeGenericSQL($sql);
    $out .= "Player refresh insert: " . $playerInsertResults["msg"] . "\n";
    echo "Full Insert playerInsertResults: {$sql}<p>\n\n";
    $lastSeason = preg_replace("/[^A-Za-z0-9 ]/", '', getLastSeason());
    $season = getSeason();
    $sql = <<<SQL

\tinsert into fanta66_joomla.fch_players
(playerID, lastName, firstName, schoolDisplayName, schoolID, playerYear, position, season)
select distinct
\treplace(replace(replace(replace(replace(`fanta66_zudnicfchmaster`.`player_master`.`text_id`, "'", ""), "-", ""), ".", ""), " ", ""), "~", "") AS `playerID`
\t,`fanta66_zudnicfchmaster`.`player_master`.`last_name` as lastName
\t,`fanta66_zudnicfchmaster`.`player_master`.`first_name` as firstName
\t,`fanta66_zudnicfchmaster`.`player_master`.`school_name` as schoolDisplayName
\t, `fanta66_zudnicfchmaster`.`player_master`.`school_id` as schoolID
\t, "?" as playerYear
\t, `fanta66_zudnicfchmaster`.`player_master`.`position` as position
\t, {$season} AS `season`
\tfrom `fanta66_zudnicfchmaster`.`player_master`
\twhere `fanta66_zudnicfchmaster`.`player_master`.`year_in_school` != "Sr" 
SQL;
    $sql .= " and `fanta66_zudnicfchmaster`.`player_master`.`season` = \"{$lastSeason}\" ";
    $sql .= " and `fanta66_zudnicfchmaster`.`player_master`.`school_id` not in (select distinct schoolID from fanta66_joomla.fch_players where season = \"" . getSeason() . "\");";
    SQL;
    echo "Delta Insert: {$sql}<BR>\n\n";
    $deltaInsertResults = executeGenericSQL($sql);
    $out .= "Player delta insert: " . $deltaInsertResults["msg"] . "\n";
    $deltaUpdateResults = executeGenericSQL("UPDATE fch_players SET season = \"" . getSeason() . "\", playerYear = NULL where playerYear = \"?\"");
    $out .= "Player delta update: " . $deltaInsertResults["msg"] . "\n";
    // Draft times are in eastern time. No offset.
    $sql = "SELECT u.email as email, DATE_FORMAT(l.draftTime ,'%W, %b %d %h:%i %p, Eastern time') as draftTime, l.id as id\r\r\n\tFROM fch_users u, fch_leagues l, fch_league_membership lm\r\r\n\tWHERE l.draftTime > DATE_ADD( NOW( ) , INTERVAL +24 HOUR ) \r\r\n\tAND l.draftTime < DATE_ADD( NOW( ) , INTERVAL +48 HOUR ) \r\r\n\tAND lm.leagueID = l.id\r\r\n\tAND l.draftReminderSent != TRUE\r\r\n\tAND lm.userID = u.id";
    /*
    $sql = "
    SELECT u.email AS email, DATE_FORMAT( l.draftTime,  '%W, %b %d %h:%i %p, Eastern time' ), l.id AS draftTime
    FROM fch_users u, fch_leagues l, fch_league_membership lm
    WHERE lm.leagueID = l.id
    AND lm.userID = u.id
    AND l.id =35";
    */
    $con = initializeDB();
    $result = $con->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $body = "Hi,\n";
            $body .= "This is a reminder that your Fantasy College Hockey draft is tomorrow, " . $row[draftTime] . ".\n\n";
            $body .= "The draft is live on fantasycollegehockey.com. The draft is available in the League menu and includes a live chat.\n\n";
            $body .= "One hour prior to draft time, the system will close new registrations to the league and generate the draft order. The order will be e-mailed to you.\n\n";
            $body .= "Your league administrator will need to open the draft. When the draft is over, the administrator will close the draft and your drafted players will be moved onto your roster.\n\n";
            $body .= "** DO NOT REPLY ** to this email. Please contact us at fantasycollegehockey@gmail.com if you have questions.\n\n";
            $body .= "Have fun!\n";
            $updateDraftReminder = "UPDATE fch_leagues SET draftReminderSent = TRUE WHERE id = " . $row[id];
            $out .= "<HR>Draft Reminder, SQL: {$updateDraftReminder}";
            executeGenericSQL($updateDraftReminder);
            sendEmail($row[email], "Reminder: Your Draft Is Tomorrow", $body);
            $emailSentTo .= $row[email] . ", ";
        }
    }
    $truncateByTeamResult = executeGenericSql("DELETE FROM fanta66_joomla.fch_schedule_byteam");
    $out .= "<hr/>Delete all from fch_scheduleByTeam: " . $truncateByTeamResult["msg"];
    $sql = "\r\r\n\t\tinsert into fch_schedule_byteam (id,dateStamp,schoolID,atVs,opponent) \r\r\n\t\t(select NULL, dateStamp, home, \"vs\" , visitor  from fch_schedule)\r\r\n\t\tunion all\r\r\n\t\t(select NULL, dateStamp, visitor as schoolID, \"at\" as atVs, home as opponent from fch_schedule)";
    $rebuildByTeamResult = executeGenericSql($sql);
    $out .= "<hr>Rebuild fch_scheduleByTeam: <p/>\n{$sql}<p/>\nResult:" . $rebuildByTeamResult["msg"];
    closeDB($con);
    $out .= "<p/>\n\tEmail sent to: {$emailSentTo}";
    sendEmail("*****@*****.**", "FCH Cron Results", $out);
    echo $out;
}
                    echo $catS->cat_name;
                    ?>
<span><?php 
                    echo $cat->cat_name;
                    ?>
</span></p>
                                                <small>Coming soon</small>
                                            </div>
                                        <?php 
                } else {
                    ?>
                                            <a href="<?php 
                    echo get_category_link($catS->cat_ID);
                    ?>
" class="slide <?php 
                    echo $catS->cat_name == getSeason() && (int) $cat->name == (int) date('Y') ? 'active' : '';
                    ?>
">
                                                <p><?php 
                    echo $catS->cat_name;
                    ?>
<span><?php 
                    echo $cat->cat_name;
                    ?>
</span></p>
                                            </a>
                                        <?php 
                }
                ?>
                                        <?php 
                $i++;
Пример #8
0
function getRawGMList($leagueID)
{
    $season = getSeason();
    $sql = "select teamDisplayName from fch_league_membership where leagueID = {$leagueID} and status = \"active\" and season = \"{$season}\" ORDER BY teamDisplayName ASC";
    $con = initializeDB();
    $result = $con->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $out .= $row["teamDisplayName"] . "<br/>";
        }
    }
    closeDB($con);
    return $out;
}
Пример #9
0
								<th>FG%</th>
								<th>TPM</th>
								<th>TPA</th>
								<th>TP%</th>
								<th>FTM</th>
								<th>FTA</th>
								<th>FT%</th>
								<th>AST</th>
								<th>STL</th>
								<th>REB</th>
								<th>BLK</th>
							</tr>
						</thead>
						<tbody id="ps_pergame_body">
							<?php 
getSeason();
?>
					  	</tbody>						
		  			</table>
		  		</div>	
	  		</div>
		</div>


	</body>
</html>

<?php 
require_once 'footer.php';
?>
function true_load_posts_issues()
{
    $args = array('parent' => $_POST['categoryLoader'], 'hide_empty' => 0);
    $categories = get_categories($args);
    $request = array();
    if ($categories) {
        foreach ($categories as $cat) {
            $category = get_category($_POST['categoryLoader']);
            $yearFuture = (int) $category->name > (int) date('Y') ? true : false;
            $monthFuture = getNumberSeason($cat->cat_name) > getNumberSeason(getSeason()) && (int) $category->name == (int) date('Y') ? true : false;
            $clickable = $yearFuture || $monthFuture ? false : true;
            $request[] = array('link' => get_category_link($cat->cat_ID), 'title' => $cat->cat_name, 'category' => $category->cat_name, 'clickable' => $clickable, 'active' => $cat->cat_name == getSeason() && (int) $category->name == (int) date('Y') ? true : false);
        }
    }
    wp_reset_query();
    die(json_encode($request));
}