Enable GPACK for Player

Enable GPACK for Player
This commit is contained in:
novgorodschi catalin
2026-07-27 10:42:44 +03:00
parent 81cf911128
commit dd7ee34e20
34 changed files with 162 additions and 220 deletions
+19 -1
View File
@@ -269,11 +269,29 @@ class Profile {
private function gpack($post) {
global $database, $session;
$chosen = trim((string) $post['custom_url']);
// Acceptam doar pachete locale reale: "gpack/<nume>/" cu travian.css pe
// disc. Fara verificare, o cale gresita (sau trimisa manual) ar lasa
// jucatorul cu o pagina fara stiluri, din care nu mai poate reveni.
$isLocalPack = (bool) preg_match('#^gpack/[A-Za-z0-9_\-]+/$#', $chosen)
&& is_file(__DIR__ . '/../' . $chosen . 'travian.css');
// Sirul gol inseamna "inapoi la pachetul serverului" si e mereu permis.
if ($chosen !== '' && !$isLocalPack) {
header("Location: spieler.php?s=4");
exit;
}
$database->gpack(
$database->RemoveXSS($session->uid),
$database->RemoveXSS($post['custom_url'])
$database->RemoveXSS($chosen)
);
// Sesiunea trebuie sa reflecte imediat alegerea: config.php citeste de
// acolo, iar fara asta pachetul nou s-ar aplica abia dupa o relogare.
$_SESSION['gpack'] = $chosen;
// Invalidate the 30s session user-cache (see Session::PopulateVar) so the
// new graphics pack applies immediately, without a re-login.
unset($_SESSION['cache_user_' . ($_SESSION['username'] ?? '')]);