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 ""; } }
$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 = " UPDATE fch_user_preferences SET displayLeague = $thisLeague
<?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="<strong>Name</strong><br />Your name."> Player Type</label> </div> <div class="controls"> <select name = "type">
<?php error_reporting(E_ERROR | E_PARSE); require_once 'fch-lib.php'; require_once "fch-lib.js"; define('_JEXEC', 1); define('JPATH_BASE', realpath(dirname(__FILE__) . '/')); require_once JPATH_BASE . '/includes/defines.php'; require_once JPATH_BASE . '/includes/framework.php'; $mainframe = JFactory::getApplication('site'); $season = getSeason(); $userID = getUserID(); $leagueID = leagueHandler($_POST, $userID); debug("League ID {$leagueID}"); $justNowPick = intval(getSingleton("fch_draft", "max(overallPick)", " WHERE leagueID = {$leagueID}")); ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> jQuery( document ).ready(function() { jQuery( "#runningDraftList", window.parent).append( "<LI>NewItem</LI>" ); //appendPick("test"); }); //appendPick("test"); </script> Hello World draft-latest <?php
<?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>
<?php error_reporting(E_ERROR | E_PARSE); require 'fch-lib.php'; define('_JEXEC', 1); define('JPATH_BASE', realpath(dirname(__FILE__) . '/')); require_once JPATH_BASE . '/includes/defines.php'; require_once JPATH_BASE . '/includes/framework.php'; $mainframe = JFactory::getApplication('site'); $season = getSeason(); $userID = getUserID(); $leagueID = leagueHandler($_POST, $userID); debug("League ID {$leagueID}"); $lastPick = getSingleton("fch_draft", "playerID", " WHERE leagueID = {$leagueID} ORDER BY dateStamp DESC LIMIT 0,1"); $pickType = getSingleton("fch_draft", "pickType", " WHERE leagueID = {$leagueID} ORDER BY dateStamp DESC LIMIT 0,1"); $pickBy = getSingleton("fch_draft", "userID", " WHERE leagueID = {$leagueID} ORDER BY dateStamp DESC LIMIT 0,1"); $pickByDisp = getSingleton("fch_league_membership", "teamDisplayName", " WHERE leagueID = {$leagueID} and userID = {$userID} "); $overall = getSingleton("fch_draft", "overallPick", " WHERE leagueID = {$leagueID} ORDER BY dateStamp DESC LIMIT 0,1"); if ($pickType == "m") { echo "manual pick"; } else { echo getSingleton("fch_players", "CONCAT(LEFT(firstName,1), \". \" , lastName, '<BR/>', position, \", \", schoolDisplayName)", " WHERE playerID = \"{$lastPick}\""); } echo "<br/>by {$pickByDisp}"; echo "<br/>#{$overall} Overall";
echo displayResults(getReturnCode(1, "The draft is officially closed.")); } if (selectCount("fch_players", " WHERE playerID = \"WithdrawnPick\"") == 0) { executeGenericSQL("INSERT INTO fch_players SET playerID = \"WithdrawnPick\", schoolID = \"pc\" , season = \"{$season}\""); } if (selectCount("fch_players", " WHERE playerID = \"PassedPick\"") == 0) { executeGenericSQL("INSERT INTO fch_players SET playerID = \"PassedPick\", schoolID = \"pc\" , season = \"{$season}\""); } $leagueAdmin = getSingleton("fch_leagues", "admin_user", " WHERE id = {$leagueID} and season = \"{$season}\""); // Is user the admin? if (intval($leagueAdmin) == intval($userID)) { $userIsAdmin = true; } else { $userIsAdmin = false; } if (getSingleton("fch_leagues", "draftStatus", " WHERE id = {$leagueID} and season = \"{$season}\"") != "open") { $isDraftOpen = false; } else { $isDraftOpen = true; } $nextToDraft = onTheClock($leagueID); if ($userIsAdmin) { ?> <h3>Administrator Draft Controls</h3><table border width = 100%><tr><td> <script> isAdmin = true; </script> <?php if ($isDraftOpen) { $closeDraftButton = '<button class="btn btn-primary validate" type="button" id = "close_draft_button" onclick="javascript:closeDraft(' . $leagueID . ');">Close Draft >></button>';
<?php error_reporting(E_ERROR | E_PARSE); require_once 'fch-lib.php'; require_once 'fch-lib.js'; define('_JEXEC', 1); define('JPATH_BASE', realpath(dirname(__FILE__) . '/')); require_once JPATH_BASE . '/includes/defines.php'; require_once JPATH_BASE . '/includes/framework.php'; $mainframe = JFactory::getApplication('site'); $season = getSeason(); $userID = getUserID(); $leagueID = leagueHandler($_POST, $userID); debug("League {$leagueID} season {$season}"); $tryAgain = "<form name = \"tryAgain\"><button class=\"btn btn-primary validate\" type=\"button\" id = \"button_submit_tryAgain\" onclick=\"javascript:showSubpage('','../../draft-search');\">Search Again >></button></form>"; $draftOpenStatus = getSingleton("fch_leagues", "draftStatus", " WHERE id = {$leagueID} and season = \"{$season}\""); debug("draftOpenStatus " . $draftOpenStatus); if ($draftOpenStatus != "open") { $isDraftOpen = false; } else { $isDraftOpen = true; } if (!$isDraftOpen && $draftOpenStatus != "closed") { echo "Your administrator has not yet opened the draft. {$tryagain}"; return; } if ($draftOpenStatus == "closed") { echo "The draft is now closed. {$tryagain}"; return; } $playerQuery = $_GET['q'];
function generateUserPreferences($userID) { debug("<B>GenerateUserPreferences</b>"); $season = getSeason(); $prefCount = intval(selectCount("fch_user_preferences", " WHERE userID = {$userID} and season = \"{$season}\"")); // 1. Is there a preference row at all? if ($prefCount == 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); } // 2. Is there a league in the preference row? $displayLeague = getSingleton("fch_user_preferences", "displayLeague", " WHERE userID = {$userID}"); debug("Display League is ({$displayLeague})"); if ($displayLeague == "") { debug("No display league set."); // If not, see if he has a league at all. $l = getSingleton("fch_league_membership", "leagueID", " WHERE userID = {$userID} and status = \"active\" and season = \"{$season}\" ORDER BY id desc LIMIT 0,1"); // If so, set it. if ($l != "") { debug("Setting display League {$l}"); executeGenericSQL("UPDATE fch_user_preferences SET displayLeague = {$l} WHERE userID = {$userID} "); } else { debug("Display League was already set."); } } $leagueCount = intval(selectCount("fch_league_membership", " WHERE userID = {$userID} and status = \"active\" and season = \"{$season}\"")); $l = getSingleton("fch_league_membership", "leagueID", " WHERE userID = {$userID} and season = \"{$season}\" and status = \"active\" LIMIT 0,1"); executeGenericSQL("UPDATE fch_user_preferences SET displayLeague = {$l} WHERE userID = {$userID} "); /* if ($leagueCount < 2) { debug("generateUserPreferencesDeprecated, leaguecount < 2"); $sql = " UPDATE fch_user_preferences SET displayLeague = ( SELECT leagueID FROM fch_league_membership WHERE leagueID = 35 AND userID = $userID and season = \"$season\") WHERE userID = $userID "; executeGenericSql($sql); } */ }
} ?> <h3>More Admin Tools Coming Soon.</h3> <h4>Registration Deadline</h4> <?php echo getSingleton("fch_leagues", "registrationDeadline", " WHERE id = {$leagueID} and season = \"{$season}\""); ?> <h4>Draft Time</h4> <?php echo getSingleton("fch_leagues", "draftTime", " WHERE id = {$leagueID} and season = \"{$season}\""); $regIsAllowed = getSingleton("fch_leagues", "allowRegAfterDeadline", " WHERE id = {$leagueID} and season = \"{$season}\""); debug("Reg Is Allowed: {$regIsAllowed}"); if ($regIsAllowed) { $regIsAllowedCheck = "CHECKED"; } ?> <h4>All Registered GMs</h4> <?php echo getRawGMList($leagueID); $transactionID = getNextTransactionID($userID, $leagueID); ?> <form method="post" name="allowRegAfterDeadline" class="form-validate form-horizontal"> <input name = "transactionID" value = "<?php echo $transactionID;