function replacePlayerLinks(&$news) { $playertag_open = "<pl>"; $playertag_close = "</pl>"; while (stristr($news, $playertag_open)) { $startindex = strpos($news, $playertag_open); $endindex = strpos($news, $playertag_close); $startpos = $startindex + strlen($playertag_open); $name = substr($news, $startpos, $endindex - $startpos); $playerId = getIdForPlayer($name); if (!empty($playerId)) { $nameLink = getPlayerLinkId($name, $playerId); $news = str_replace($playertag_open . $name . $playertag_close, $nameLink, $news); } else { echo getBoxTop("Info", 0, true, ''); echo "<p><b>Error:</b> Player <b>" . $name . "</b> not found!"; echo getBoxBottom(); return; } } }
function GetBottomLine($isSixserver) { require('variables.php'); require('variablesdb.php'); $players = ""; $type = ""; if ($isSixserver) { $sql = "SELECT season FROM six_stats"; $row = mysql_fetch_array(mysql_query($sql)); $sixSeason = $row[0]; $oldseason = $sixSeason-1; $type = "Sixserver"; $sql = "SELECT wp.name as player_name FROM six_history sh ". "LEFT JOIN weblm_players wp ON sh.playerId=wp.player_id ". "where sh.season=". $oldseason ." AND sh.position=1"; } else { $oldseason = $season-1; $type = "Ladder"; $sql = "SELECT player_name from $historytable where season=". $oldseason ." AND position=1"; } $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $name = $row['player_name']; $sql = "select approved from $playerstable where name = '$name'"; $playerresult = mysql_query($sql); $playerrow = mysql_fetch_array($playerresult); $approved = $playerrow["approved"]; $nameClass = colorNameClass($name, $approved); } $players .= "$type Season $oldseason: <span $nameClass><a style='text-decoration: none;' href='$directory/profile.php?name=$name' title='view profile'>$name</a></span>"; // team ladder - player $sql = "SELECT playerId from $teamladdertable where type='player' ORDER BY timestamp DESC LIMIT 0, 1"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $playerIdSaved = $row["playerId"]; $playerName = getPlayerNameForId($playerIdSaved); } $players .= " - Team Standings leader: ".getPlayerLinkId($playerName, $playerIdSaved); // team ladder - team $sql = "SELECT playerId, playerId2 from $teamladdertable where type='team' ORDER BY timestamp DESC LIMIT 0, 1"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $playerIdSaved = $row["playerId"]; $playerName = getPlayerNameForId($playerIdSaved); $playerId2Saved = $row["playerId2"]; $player2Name = getPlayerNameForId($playerId2Saved); } $players .= " - Best Team: ".getPlayerLinkId($playerName, $playerIdSaved); $players .= '<span class="grey-small">–</span>'; $players .= getPlayerLinkId($player2Name, $playerId2Saved); if ($oldseason > 0) { $title_left = '<span style="font-size:10px;color:#000000">'. "<a style='text-decoration:none;font-weight:bold' href='champions.php'>Champions</a> - ". "<span style='font-size:10px;font-weight:normal;text-decoration: none;'>". $players. "</span></span>"; } return $title_left; }