forked from pdinklag/MinecraftStats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
142 lines (131 loc) · 4.19 KB
/
index.php
File metadata and controls
142 lines (131 loc) · 4.19 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
require_once('config.php');
require_once('util.php');
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo($title); ?></title>
<?php //CSS ?>
<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v3.3.7/dist/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="style.css"/>
<?php // SCRIPTS ?>
<script src="jquery-2.1.1.min.js"></script>
<script>
function skinLoaded(img) {
var canvas = img.parentNode.getElementsByTagName("canvas")[0];
var ctx = canvas.getContext('2d');
ctx.imageSmoothingEnabled = false;
ctx.mozImageSmoothingEnabled = false;
ctx.drawImage(img, 8, 8, 8, 8, 0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 40, 8, 8, 8, 0, 0, canvas.width, canvas.height);
}
function skinError(img, gender) {
switch(gender) {
case 0:
img.src = "<?php echo($defaultSkins[0]); ?>";
break;
case 1:
img.src = "<?php echo($defaultSkins[1]); ?>";
break;
}
}
</script>
</head>
<body>
<div id="nav">
<a href="index.php">Medalhas</a>
|
<a href="?hof">Hall da Fama</a>
|
<a href="?stat=stat.playOneMinute">Lista de players</a>
<?php
function compareUUIDsByPlayerName($a, $b) {
return strcasecmp(getPlayerName($a), getPlayerName($b));
}
$searchResults = [];
if(isset($_POST['findname'])) {
$search = $_POST['findname'];
$searchResults = findPlayersByName($search);
if(count($searchResults) == 0) {
$formError = "Ninguem encontrado!";
} else if(count($searchResults) == 1) {
$foundUUID = $searchResults[0]; //only result
} else {
//sort results
usort($searchResults, 'compareUUIDsByPlayerName');
}
}
if(isset($foundUUID) && isset($_POST['goto'])) {
$_GET["player"] = $foundUUID;
}
if(isset($_POST['itsme'])) {
$me = $_POST['itsme'];
setcookie('me', $me, time() + 60*60*24*365);
} else if(isset($_GET['notme'])) {
setcookie('me', null);
unset($me);
} else if(isset($_COOKIE['me'])) {
$me = $_COOKIE['me'];
}
?>
<?php if(isset($me)): ?>
|
<?php echo(createPlayerWidget($me, 16)) ?>
<a class="notme" href="?notme">[X]</a>
<?php endif; ?>
<form action="index.php" method="post">
Pesquisa de players: <input name="findname" type="text" size="16"/>
<button name="goto">Go</button>
<?php if(isset($formError)): ?>
<span class=\"error\"><?php echo $formError?></span>
<?php endif; ?>
</form>
<?php
?>
</div>
<div id="last-update">
As estatisticas foram atualizadas
<?php
if(is_file($lastUpdateFile)) {
$lastUpdate = unserialize(file_get_contents($lastUpdateFile));
$delta = (time() - $lastUpdate);
$deltaMinutes = (int)($delta / 60);
if($delta >= 120) {
echo("$deltaMinutes minutos atras.");
} else if($delta >= 60) {
echo("um minuto atras.");
} else {
echo("$delta segundos atras.");
}
}
?>
</div>
<h1><?php echo($title); ?></h1>
<?php
if(count($searchResults) > 1) {
require("view-search.php");
} else if(isset($_GET["stat"])) {
require("view-stat.php");
} else if(isset($_GET["player"])) {
require("view-player.php");
} else if(isset($_GET["raw"])) {
require("view-player-raw.php");
} else if(isset($_GET["hof"])) {
require("view-hof.php");
} else {
require("view-awards.php");
}
?>
<div id="clear"> </div>
<div id="foot">
<div id="timezone">
Todos os horarios estao no Horario de Brasilia.
</div>
<div id="legal">
<span class="hl">SatoshiCraft Stats <?php echo($mcstatsVersion); ?></span>.
Criado por pdinklag, editado e traduzido por Gabriel0Augusto.<br/>
</div>
</div>
</body>
</html>