66
66
if (!$ password && !$ manage ) {
67
67
header ('Cache-Control: max-age=0, no-cache, no-store, must-revalidate ' );
68
68
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 . ") " );
71
71
}
72
72
$ url = '/ ' . $ id . '- ' . $ replay ['password ' ] . 'pw ' ;
73
73
echo '<p>This private replay now has a new harder-to-guess URL:</p> ' ;
74
74
echo '<p><a href=" ' . $ url . '" data-target="replace">https:// ' . $ psconfig ['routes ' ]['replays ' ] . $ url . '</a></p> ' ;
75
75
die ();
76
76
}
77
77
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) " );
79
79
}
80
80
}
81
81
@@ -95,9 +95,14 @@ function userid($username) {
95
95
$ matchSuccess = preg_match ('/ \\n \\|tier \\|([^|]*) \\n/ ' , $ replay ['log ' ], $ matches );
96
96
$ format = $ replay ['format ' ];
97
97
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 . ') ' );
101
106
$ panels ->setTab ('replay ' );
102
107
$ panels ->start ();
103
108
@@ -134,7 +139,7 @@ function userid($username) {
134
139
135
140
<pre class="urlbox" style="word-wrap: break-word;"><?php echo htmlspecialchars ('https:// ' .$ psconfig ['routes ' ]['replays ' ].'/ ' .$ fullid ); ?> </pre>
136
141
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>
138
143
<p style="padding:0 1em;margin-top:0">
139
144
<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>
140
145
</p>
0 commit comments