2022-12-19 18:26:14 +00:00
|
|
|
|
<?php
|
2023-01-12 20:38:13 +00:00
|
|
|
|
|
2023-07-19 12:36:13 +00:00
|
|
|
|
//error_reporting(E_ALL);
|
2022-12-19 18:26:14 +00:00
|
|
|
|
const GAME = true; // Для совместимости с этой "защитой".
|
|
|
|
|
const GAME_VERSION = 'alpha-7.4';
|
|
|
|
|
// Новая автозагрузка.
|
|
|
|
|
// ВНИМАНИЕ! Не введено в эксплуатацию!
|
|
|
|
|
|
|
|
|
|
require_once 'mysql_override.php';
|
|
|
|
|
|
|
|
|
|
spl_autoload_register(function (string $className) {
|
2023-12-09 13:51:08 +00:00
|
|
|
|
$rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data' . DIRECTORY_SEPARATOR;
|
2022-12-19 18:26:14 +00:00
|
|
|
|
# 1 with namespaces
|
|
|
|
|
# 2 without
|
|
|
|
|
$fileName = [
|
2023-12-09 13:51:08 +00:00
|
|
|
|
$rootdir . 'class' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
|
|
|
|
$rootdir . 'class' . DIRECTORY_SEPARATOR . $className . '.php',
|
|
|
|
|
$rootdir . 'function' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
|
|
|
|
$rootdir . 'vendor' . DIRECTORY_SEPARATOR . $className . '.php',
|
2022-12-19 18:26:14 +00:00
|
|
|
|
];
|
|
|
|
|
foreach ($fileName as $file) {
|
|
|
|
|
if (file_exists($file)) {
|
|
|
|
|
require_once $file;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
spl_autoload_register(function (string $classname) {
|
2023-12-09 13:51:08 +00:00
|
|
|
|
$rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data';
|
2022-12-19 18:26:14 +00:00
|
|
|
|
$classMap = [
|
2023-04-15 19:18:08 +00:00
|
|
|
|
'NewCombats' => $rootdir . '/class/',
|
|
|
|
|
'Insallah' => $rootdir . '/class/Insallah/',
|
|
|
|
|
'DarksLight2' => $rootdir . '/class/DarksLight2/',
|
2022-12-19 18:26:14 +00:00
|
|
|
|
];
|
|
|
|
|
$parts = explode('\\', $classname);
|
|
|
|
|
$namespace = array_shift($parts);
|
|
|
|
|
$classFile = array_pop($parts) . '.php';
|
|
|
|
|
|
|
|
|
|
if (!array_key_exists($namespace, $classMap)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$path = implode(DIRECTORY_SEPARATOR, $parts);
|
|
|
|
|
$file = $classMap[$namespace] . $path . DIRECTORY_SEPARATOR . $classFile;
|
|
|
|
|
|
|
|
|
|
if (!file_exists($file) && !class_exists($classname)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require_once $file;
|
2023-01-18 11:53:20 +00:00
|
|
|
|
});
|