-
Notifications
You must be signed in to change notification settings - Fork 0
/
ranking.php
32 lines (24 loc) · 991 Bytes
/
ranking.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once("common.php");
$ladderID = get("ladder");
$userID = get("player");
checkLadder($ladderID);
if ($userID !== null) {
checkLadderPlayer($ladderID, $userID);
}
$ladderNameHtml = htmlentities(db()->stdGet("ladders", array("ladderID"=>$ladderID), "name"));
if (get("page") === null && $userID !== null) {
$rank = db()->stdGet("ladderPlayers", array("ladderID"=>$ladderID, "userID"=>$userID), "rank");
$page = 1 + (int)(($rank - 1) / 50);
} else {
$page = pageNumber();
}
if ($userID === null) {
$title = "Top players";
} else if ($userID == currentUserID()) {
$title = "Your rank";
} else {
$userNameHtml = htmlentities(db()->stdGet("users", array("userID"=>$userID), "name"));
$title = "$userNameHtml's rank";
}
return page(renderRanking($ladderID, null, "There don't seem to be any players on this ladder.", $userID, null, null, $page), "ranking", $title, "<a href=\"ladder.php?ladder=$ladderID\">$ladderNameHtml</a>", null, $title . " - " . $ladderNameHtml);