function section_jointeam_dispForm($team, $invite) { echo '<center><BR>' . playerLink($_SESSION['playerid'], $_SESSION['callsign']) . ', are you sure that you really want to join the fabulous ' . teamLink($team->name, $team->id, false) . '?<br>'; echo '<BR><form method=get> <input type=hidden name=link value="jointeam"> <input type=hidden name=id value=' . $team->id . '>'; if ($invite) { echo '<input type=hidden name=invite value="yep">'; } echo htmlFormbutton(' YES ', 'f_yes_x') . ' ' . htmlFormbutton(' NO ', 'f_no_x', CLRBUT) . ' </form></center>'; }
function section_invite_dispForm($team, $player, $link, $days) { global $invite_durations; echo '<center><form method=post><font size=+1>Sending an invitation to ' . playerLink($player->id, $player->callsign) . ' to join your team, ' . teamLink($team->name, $team->id, false) . '</font><br>'; echo '<BR><TABLE><TR><TD><HR><p>This invitation will allow ' . playerLink($id, $player->callsign) . ' to join your team, even if it is closed.<BR>Please select when this invitation should expire: <select name=days>'; foreach ($invite_durations as $val => $text) { htmlOption($val, $text, $days); } echo '</select><p><hr><p> Enter a few words which will be attached to your invitation (mandatory):<br> <textarea cols=50 rows=6 name=f_invite>' . $f_invite . '</textarea> <center><p><TABLE align=center><TR><TD>' . htmlFormButton("Invite", 'f_ok_x') . '</td><TD width=10></td><TD>' . htmlURLbutton("Cancel", 'playerinfo', "id={$id}", CLRBUT) . '</td></tr></table>'; echo '<input type=hidden name=link value=' . $link . '> <input type=hidden name=id value=' . $player->id . '> </center></form></center> </td></tr></table>'; }
function section_online() { echo '<BR>'; $showIP = isFuncAllowed('show_ip'); $logged = sqlQuery('SELECT callsign, MIN(' . SESSION_LIFETIME . '-(UNIX_TIMESTAMP(expire)-UNIX_TIMESTAMP())) AS idle, ip, playerid FROM ' . TBL_SESSION . ' WHERE callsign IS NOT NULL AND expire > NOW() GROUP BY callsign '); if (!$logged) { echo 'Data problems - try back later<BR>'; return; } $guests = sqlQuery('SELECT MIN(' . SESSION_LIFETIME . '-(UNIX_TIMESTAMP(expire)-UNIX_TIMESTAMP())) AS idle, ip FROM ' . TBL_SESSION . ' WHERE callsign IS NULL AND expire > NOW() GROUP BY ip'); if (mysql_num_rows($logged) == 0 && mysql_num_rows($guests) == 0) { echo "<center>Nobody's online</center>"; return; } echo '<center><table>'; while ($row = mysql_fetch_object($logged)) { echo '<TR><TD>' . $ipLong . playerLink($row->playerid, $row->callsign) . ' </td><TD> (idle: ' . section_online_timestr($row->idle) . ')</td>'; if ($showIP) { echo "<TD width=10></td><TD>{$row->ip}</td>"; } echo '</tr>'; } if (isFuncAllowed('show_guests')) { echo '<TR><TD colspan=5><BR></td></tr>'; while ($row = mysql_fetch_object($guests)) { // Ignore googlebot and msnbot/microsoft surfers. Narrow this down if possible if (!section_online_matchCIDR($row->ip, "66.249.64.0/19") && !section_online_matchCIDR($row->ip, "207.46.0.0/16")) { echo '<TR><TD>guest </td><TD> (idle: ' . section_online_timestr($row->idle) . ')</td>'; if ($showIP) { echo "<TD width=10></td><TD>{$row->ip}</td>"; } echo '</tr>'; } } } echo '</table></center>'; }
$schedule = $ffn->getSchedule(); echo '<h4>Season Schedule</h4>'; echo '<p>Current Week: ', $schedule['currentWeek'], '</p>'; foreach ($schedule['Schedule'] as $game) { echo '<p>'; echo 'Week: ', $game['gameWeek'], ' ', $game['awayTeam'], ' at ', $game['homeTeam'], ' on ', $game['gameDate'], ' at ', $game['gameTimeET'], ' ET', ' playing on ', $game['tvStation']; echo '</p>'; } } /**** Player Listing **********************************************/ if ($display == "players") { $players = $ffn->getPlayers(); echo '<h4>All NFL Players</h4>'; foreach ($players as $player) { echo '<p>'; echo playerLink($player['playerId'], $player['displayName']), ' : ', $player['position'], ' : ', $player['team']; echo '</p>'; } } /**** Player Details **********************************************/ if ($display == "playerDetails") { if (empty($_GET['playerId'])) { ?> <form action="<?php echo PHP_SELF; ?> " method="get"> <input type="hidden" name="display" value="playerDetails" /> <p>FFN playerId: <input type="text" name="playerId" size="4" /></p> <p><input type="submit" /></p> </form>
function section_players() { if (!($sort = $_GET['sort'])) { $sort = 'team'; } if (!($include = $_GET['include'])) { $include = 3; } if ($sort == 'callsign') { $sby = 'P.callsign'; } else { if ($sort == 'joined') { $sby = 'P.created'; } else { if ($sort == 'country') { $sby = 'P.country, P.callsign'; } else { $sby = 'T.name, P.callsign'; } } } if ($include == 1) { $inc = 'AND P.team <= 0'; } else { if ($include == 2) { $inc = 'AND P.team > 0'; } } if (SHOW_PLAYER_ACTIVE > 0) { $activeDays = SHOW_PLAYER_ACTIVE; } else { $activeDays = 0; } $res = sqlQuery("select P.id, P.callsign, unix_timestamp(P.created) as created, T.name, T.leader, T.id teamid, \n P.logo, P.country, C.flagname, C.name as countryname,\n last_login > subdate(now(), INTERVAL {$activeDays} DAY) as active\n from l_player P left join l_team T on P.team = T.id\n left join bzl_countries C on P.country = C.numcode\n where P.status != 'deleted' {$inc} order by {$sby}"); section_players_doSelectForm($sort, $include); echo "<BR><table align=center cellspacing=0 cellpadding=1><tr class=tabhead>\n <td>Callsign</td><td>Team</td><TD colspan=3> Joined</td><TD></td></tr>"; $curteam = ""; $rownum = 0; while ($obj = mysql_fetch_object($res)) { if ($obj->logo != '') { $logo = '<img TITLE="Player has a logo" src="' . THEME_DIR . 'islogo.gif">'; } else { $logo = ' '; } if ($obj->name != "") { if ($obj->id == $obj->leader) { $mem = '<img TITLE="Team Leader" src="' . THEME_DIR . 'leader.gif">'; } else { $mem = ' '; } $pteam = '<a href="index.php?link=teaminfo&id=' . $obj->teamid . '">' . $obj->name . '</a>'; } else { $mem = ""; $pteam = "<i><font color=#a0a0a0>none</font></i>"; } if ($sort == 'team' && $obj->name != $curteam) { $curteam = $obj->name; $rownum = 0; echo '<tr><td colspan=5><hr></td></tr>'; } else { if ($sort == 'country' && $obj->countryname != $curteam) { $curteam = $obj->countryname; $rownum = 0; echo '<tr><td colspan=5><hr></td></tr>'; } } $c = $rownum++ % 2 ? 'rowodd' : 'roweven'; $flag = ''; if ($obj->flagname) { $flag = smallFlag($obj->flagname, $obj->countryname); } $joined = date('Y-m-d', $obj->created); echo "<tr class={$c}><td>" . playerLink($obj->id, $obj->callsign) . "</td><td align=left>{$pteam}</td><TD><nobr> {$joined} </nobr></td>\n <TD>{$flag}</td><TD>"; if ($obj->active) { echo ' <img TITLE="Active member" src="' . THEME_DIR . 'active.gif">'; } echo "</td><td> {$logo}{$mem}</td></tr>\n"; } echo "</table>"; }
function section_teaminfo() { require_once 'lib/common.php'; $s_teamid = $_SESSION['teamid']; $s_logedin = isAuthenticated(); $s_level = $_SESSION['level']; $s_playerid = $_SESSION['playerid']; $id = addslashes($_GET['id']); $res = mysql_query("SELECT name, comment, leader, logo, status, score, \n unix_timestamp(status_changed) as status_changed, unix_timestamp(created) as ucreated\n FROM l_team WHERE id='{$id}'"); $team = mysql_fetch_object($res); if (!$team) { echo '<BR><CENTER>Specified team does not exist<BR>'; return; } echo '<TABLE align=center><TR><TD>' . htmlURLbutton('Opponent summary', 'oppsumm', "id={$id}") . '</td>'; // Join this team if opened, and if we are logged and not belonging to any team if ($s_logedin && !$s_teamid && $members < 20 && $team->status == "opened") { echo '<TD>' . htmlURLbutton('Join Team', 'jointhisteam', "id={$id}") . '</td>'; } // Send a message to all the team members if ($s_logedin && $team->status != 'deleted') { echo '<TD>' . htmlURLbutton('Send BZmessage', 'sendmessage', "tid={$id}") . '</td>'; } echo '</tr></table>'; if ($team->status == 'deleted') { echo '<div class=feedback>'; if ($team->status_changed) { echo "<br><center>This team was deleted on " . gmdate('Y-m-d', $team->status_changed) . "</center>"; } else { echo "<br><center>This team is deleted.</center>"; } echo '</div>'; } echo '<BR><table align=center border=0 cellspacing=0 cellpadding=1> <tr><td class=teamName align=center>' . $team->name . '<BR></td></tr>'; // Logo if any if ($team->logo != "") { echo '<tr><td align=center> <table><TR><TD bgcolor=white><img src="' . $team->logo . '"></td></tr></table> <hr></td></tr>'; } // Ratings $act45 = teamActivity($id, 45); $act90 = teamActivity($id, 90); echo '<tr><td> <TABLE align=center> <TR><TD width=50% align=right>Created:</td><td width=10></td><td width=50%>' . gmdate('Y-m-d', $team->ucreated) . '</td></tr> <TR><TD align=right>Rating:</td><td></td><td>' . displayRating($id) . '</td></tr> <TR><TD align=right>Activity:</td><TD></td><td>' . sprintf('%1.2f / %1.2f', $act45, $act90) . '</td></tr> <TR><TD colspan=3 align=center> Average number of games played per day<BR> <NOBR>(exponential moving average over last 45 / 90 days)</nobr></td></tr>'; echo '</td></td></table></td></tr>'; // Matches statistics $sta1 = mysql_fetch_object(mysql_query("select ifnull(sum(if(score1>score2,1,0)),0) win,\n ifnull(sum(if(score1=score2,1,0)),0) draw,\n ifnull(sum(if(score1<score2,1,0)),0) loss\n from " . TBL_MATCH . " where team1={$id}")); $sta2 = mysql_fetch_object(mysql_query("select ifnull(sum(if(score2>score1,1,0)),0) win,\n ifnull(sum(if(score2=score1,1,0)),0) draw,\n ifnull(sum(if(score2<score1,1,0)),0) loss\n from " . TBL_MATCH . " where team2={$id}")); $win = $sta1->win + $sta2->win; $draw = $sta1->draw + $sta2->draw; $loss = $sta1->loss + $sta2->loss; echo "<tr><td align=center><hr>\n <table border=0 cellspacing=0 cellpadding=0 align=center><tr>\n <td align=center>Wins</td><td align=center> Draws </td><td align=center>Losses</td></tr><tr>\n <td align=center>{$win}</td><td align=center>{$draw}</td><td align=center>{$loss}</td>\n </tr></table>\n <hr></td></tr>"; // Comment if any if ($team->comment != "") { echo '<tr><td><ul>' . nl2br($team->comment) . '</ul><hr></td></tr>'; } // Players list $i = 0; if (SHOW_PLAYER_ACTIVE > 0) { $activeDays = SHOW_PLAYER_ACTIVE; } else { $activeDays = 0; } $res = mysql_query("select id, callsign, comment, status, C.flagname, \n last_login > subdate(now(), INTERVAL {$activeDays} DAY) as active\n from l_player\n left join bzl_countries C on country = C.numcode\n where team=" . $id . "\n order by active desc,callsign"); $members = 0; echo '<TR><TD><table border=0 cellspacing=0 cellpadding=0 align=center>'; while ($obj = mysql_fetch_object($res)) { $members++; if (++$i & 1) { $cl = "rowEven"; } else { $cl = "rowOdd"; } echo "<tr class='{$cl}' valign=middle>"; echo "<TD align=right><a href='index.php?link=playerinfo&id={$obj->id}'>{$obj->callsign}</a></td><TD>"; if ($obj->id == $team->leader) { echo ' <img TITLE="Team Leader" src="' . THEME_DIR . 'leader.gif">'; } echo '</td><TD>'; if ($obj->active) { echo ' <img TITLE="Active player (has logged into this site recently)" src="' . THEME_DIR . 'active.gif">'; } echo '</td><TD width=10></td>'; echo '<TD>' . smallflag($obj->flagname) . '</td>'; if ($s_logedin && (isFuncAllowed('teamadmin::edit_any_team') || $s_playerid == $team->leader)) { if ($obj->id != $team->leader) { // Link to ban a player from a team echo '<td align=center>' . htmlURLbutSmall('BAN', 'banplayer', "playerid={$obj->id}&teamid={$id}&f_ok_x=2", ADMBUT) . '</form></td></tr>'; } else { echo '<td> </td></tr>'; } } else { echo '<td> </td></tr>'; } echo "\n"; } echo '</td></tr></table>'; // Show last fights $sql = "SELECT t1.id, t1.name, f.score1, t2.id, t2.name, f.score2, f.tsactual, unix_timestamp(f.tsactual) tstamp_ts \n" . "FROM " . TBL_MATCH . " f, l_team t1, l_team t2 " . "WHERE (f.team1 = '{$id}' OR f.team2 = '{$id}') " . " AND f.team1 = t1.id " . " AND f.team2 = t2.id " . "ORDER BY f.tsactual DESC " . "LIMIT 11 "; $res = sqlQuery($sql); $tmp = ''; $count = 0; while ($row = mysql_fetch_array($res)) { $count++; if ($count < 11) { if (isset($_SESSION['last_login']) && $_SESSION['last_login'] < $row[7]) { $new1 = "<font color=\"red\">"; $new2 = "</font>"; } else { $new1 = ''; $new2 = ''; } if ($count % 2) { $cl = "rowEven"; } else { $cl = "rowOdd"; } $tmp .= "<tr class=\"{$cl}\">"; $tmp .= '<td align="right">' . $new1 . $row[6] . $new2 . '</td>'; if ($row[0] != $id) { $oppid = $row[0]; $oppname = stripslashes($row[1]); $oppscore = $row[2]; $teamscore = $row[5]; } else { $oppid = $row[3]; $oppname = stripslashes($row[4]); $oppscore = $row[5]; $teamscore = $row[2]; } $tmp .= "<td>{$new1}"; $oppname = '<a href="index.php?link=teaminfo&id=' . $oppid . '&' . SID . '">' . $new1 . $oppname . $new2 . '</a>'; if ($oppscore < $teamscore) { $tmp .= "<b>Won</b> against {$oppname}"; } elseif ($oppscore > $teamscore) { $tmp .= "<b>Lost</b> against {$oppname}"; } else { $tmp .= "<b>Tie</b> against {$oppname}"; } $tmp .= " ({$row[2]} - {$row[5]})"; $tmp .= "{$new2}</td>"; $tmp .= "</tr>\n"; } } echo '<tr>'; echo '<td align=center> <br><b>'; if ($count == 1) { echo 'Last match'; } else { if ($count == 11) { echo 'Last 10 matches, view them all <a href="index.php?link=fights&id=' . $id . '&' . SID . '">here</a>'; } elseif ($count == 0) { echo "No matches played"; } else { echo "Last {$count} matches"; } } echo '</b><BR><BR></td></tr><TR><TD>'; echo "<table align=center border=0>{$tmp}</table>"; // Or... edit your team if you are a leader or ad admin, or with a password if you are a member // Team members can't change the password, though... // Unless ofcause the team is deleted if ($team->status == 'deleted') { if ($team->status_changed) { echo "<br><center>This team is deleted as of " . gmdate('Y-m-d', $team->status_changed) . "</center>"; } else { echo "<br><center>This team is deleted.</center>"; } } else { if ($s_logedin && (isFuncAllowed('teamadmin::edit_any_team') || $s_teamid == $id)) { if (!isFuncAllowed('teamadmin::edit_any_team') && $s_playerid != $team->leader) { // Team member, need password echo '<form method=post> <input type=hidden name=link value=teamadmin> <input type=hidden name=id value=' . $id . '> <br><center>Enter team password <input type=password size=8 maxlength=8 name=f_password> and ' . htmlFormButton('Edit Team', 'f_edit_x') . ' </center></form>'; } else { $invites = sqlQuery("SELECT *, l_player.callsign FROM bzl_invites, l_player\n WHERE teamid={$id} AND expires > NOW() AND bzl_invites.playerid = l_player.id"); if (mysql_num_rows($invites) > 0) { echo '<BR><HR>Invitations currently active:<BR><TABLE>'; while ($row = mysql_fetch_object($invites)) { echo '<TR><TD width=25></td><TD>' . playerLink($row->playerid, $row->callsign) . "</td><TD width=10></td><TD>(expires: {$row->expires})</td></tr>"; } echo '</table><HR>'; } // Team leader or admin, let's go echo '<center><BR> ' . htmlURLbutton('Edit Team', 'teamadmin', "id={$id}", ADMBUT) . ' <BR> ' . htmlURLbutton('Dismiss Team', 'dismissteam', "id={$id}", ADMBUT); } } } }