Fix something wrong

This commit is contained in:
novgorodschi catalin
2026-08-14 13:22:45 +03:00
parent af4f695289
commit 9d81c8eaa0
5 changed files with 9 additions and 722 deletions
+9 -53
View File
@@ -13,23 +13,16 @@
## ##
#################################################################################
// verify form
if (empty($_POST['mhpw']) || empty($_POST['spw'])) {
if (defined('TRAVIANZ_INSTANCE_ID') && TRAVIANZ_INSTANCE_ID !== 'default') {
header("Location: ../accounts_instance.php?instance=" . rawurlencode(TRAVIANZ_INSTANCE_ID) . "&err=1");
} else {
header("Location: ../index.php?s=4&err=1");
}
header("Location: ../index.php?s=4&err=1");
exit;
}
// don't allow creating Natars user
if (!empty($_POST['aname']) && strtolower($_POST['aname']) == 'natars') {
if (defined('TRAVIANZ_INSTANCE_ID') && TRAVIANZ_INSTANCE_ID !== 'default') {
header("Location: ../accounts_instance.php?instance=" . rawurlencode(TRAVIANZ_INSTANCE_ID) . "&err=2");
} else {
header("Location: ../index.php?s=4&err=2");
}
header("Location: ../index.php?s=4&err=2");
exit;
}
@@ -38,21 +31,10 @@
$gameinstall = 1;
// The default installer keeps the legacy config path. A named world
// always writes to its own instance config and never modifies another
// world's configuration.
if (!class_exists('TravianZInstanceBootstrap')) {
$bootstrap = dirname(__DIR__, 2) . "/GameEngine/Instance/Bootstrap.php";
if (is_file($bootstrap)) {
require_once $bootstrap;
}
}
$configFile = class_exists('TravianZInstance')
? TravianZInstance::configPath()
: "../../GameEngine/config.php";
include_once(dirname(__DIR__, 2) . "/GameEngine/Database.php");
include_once(dirname(__DIR__, 2) . "/GameEngine/Admin/database.php");
$configFile = "../../GameEngine/config.php";
include_once($configFile);
include_once("../../GameEngine/Database.php");
include_once("../../GameEngine/Admin/database.php");
require_once dirname(__DIR__, 2) . "/GameEngine/Lang/loader.php";
tz_load_language(LANG);
@@ -174,32 +156,6 @@
}
$gameinstall = 0;
header("Location: ../index.php?s=5");
if (defined('TRAVIANZ_INSTANCE_ID') && TRAVIANZ_INSTANCE_ID !== 'default') {
// The account step is the final step for a named world. Keep the
// installed marker local to this instance and update only its
// registry entry; the default world's legacy installer marker is
// deliberately untouched.
$instancePath = dirname(__DIR__, 2) . '/instances/' . TRAVIANZ_INSTANCE_ID;
if (!is_dir($instancePath)) {
@mkdir($instancePath, 0775, true);
}
@file_put_contents($instancePath . '/installed', date('c') . PHP_EOL, LOCK_EX);
$registryFile = dirname(__DIR__, 2) . '/instances/registry.json';
if (is_file($registryFile)) {
$registry = json_decode((string) @file_get_contents($registryFile), true);
if (is_array($registry) && isset($registry[TRAVIANZ_INSTANCE_ID])) {
$registry[TRAVIANZ_INSTANCE_ID]['status'] = 'installed';
$registry[TRAVIANZ_INSTANCE_ID]['installed_at'] = date('c');
$registry[TRAVIANZ_INSTANCE_ID]['updated_at'] = date('c');
@file_put_contents($registryFile, json_encode($registry, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL, LOCK_EX);
}
}
header("Location: ../multi.php?instance=" . rawurlencode(TRAVIANZ_INSTANCE_ID));
} else {
header("Location: ../index.php?s=5");
}
?>
?>