Skip to content

Commit 918bf7e

Browse files
committed
Replays: Fix manager
1 parent 25c6456 commit 918bf7e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

replay.pokemonshowdown.com/replay-manage.php

+12-7
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@
6666
if (!$password && !$manage) {
6767
header('Cache-Control: max-age=0, no-cache, no-store, must-revalidate');
6868
require_once '../lib/ntbb-session.lib.php';
69-
if ($curuser['userid'] !== $replay['p1id'] && $curuser['userid'] !== $replay['p2id']) {
70-
die("Access denied (you must be logged into " . $replay['p1id'] . " or " . $replay['p2id'] . ")");
69+
if ($curuser['userid'] !== $p1id && $curuser['userid'] !== $p2id) {
70+
die("Access denied (you must be logged into " . $p1id . " or " . $p2id . ")");
7171
}
7272
$url = '/' . $id . '-' . $replay['password'] . 'pw';
7373
echo '<p>This private replay now has a new harder-to-guess URL:</p>';
7474
echo '<p><a href="' . $url . '" data-target="replace">https://' . $psconfig['routes']['replays'] . $url . '</a></p>';
7575
die();
7676
}
7777
if ($password !== $replay['password'] && !$manage) {
78-
die("Access denied (please ask " . $replay['p1id'] . " or " . $replay['p2id'] . " for the password)");
78+
die("Access denied (please ask " . $p1id . " or " . $p2id . " for the password)");
7979
}
8080
}
8181

@@ -95,9 +95,14 @@ function userid($username) {
9595
$matchSuccess = preg_match('/\\n\\|tier\\|([^|]*)\\n/', $replay['log'], $matches);
9696
$format = $replay['format'];
9797
if ($matchSuccess) $format = $matches[1];
98-
99-
$panels->setPageTitle($format.' replay: '.$replay['p1'].' vs. '.$replay['p2']);
100-
$panels->setPageDescription('Watch a replay of a Pokémon battle between ' . $replay['p1'] . ' and ' . $replay['p2'] . ' (' . $format . ')');
98+
$players = explode(",", $replay['players']);
99+
$p1 = $players[0];
100+
$p2 = $players[1];
101+
$p1id = $users->userid($p1);
102+
$p2id = $users->userid($p2);
103+
104+
$panels->setPageTitle($format.' replay: '.$p1.' vs. '.$p2);
105+
$panels->setPageDescription('Watch a replay of a Pokémon battle between ' . $p1 . ' and ' . $p2 . ' (' . $format . ')');
101106
$panels->setTab('replay');
102107
$panels->start();
103108

@@ -134,7 +139,7 @@ function userid($username) {
134139

135140
<pre class="urlbox" style="word-wrap: break-word;"><?php echo htmlspecialchars('https://'.$psconfig['routes']['replays'].'/'.$fullid); ?></pre>
136141

137-
<h1 style="font-weight:normal;text-align:left"><strong><?= htmlspecialchars($format) ?></strong>: <a href="//<?= $psconfig['routes']['users'] ?>/<?= userid($replay['p1']) ?>" class="subtle"><?= htmlspecialchars($replay['p1']) ?></a> vs. <a href="//<?= $psconfig['routes']['users'] ?>/<?= userid($replay['p2']) ?>" class="subtle"><?= htmlspecialchars($replay['p2']) ?></a></h1>
142+
<h1 style="font-weight:normal;text-align:left"><strong><?= htmlspecialchars($format) ?></strong>: <a href="//<?= $psconfig['routes']['users'] ?>/<?= userid($p1) ?>" class="subtle"><?= htmlspecialchars($p1) ?></a> vs. <a href="//<?= $psconfig['routes']['users'] ?>/<?= userid($p2) ?>" class="subtle"><?= htmlspecialchars($p2) ?></a></h1>
138143
<p style="padding:0 1em;margin-top:0">
139144
<small class="uploaddate" data-timestamp="<?= @$replay['uploadtime'] ?? @$replay['date'] ?>"><em>Uploaded:</em> <?php echo date("M j, Y", @$replay['uploadtime'] ?? @$replay['date']); ?><?= @$replay['rating'] ? ' | <em>Rating:</em> ' . $replay['rating'] : '' ?></small>
140145
</p>

0 commit comments

Comments
 (0)