ZnoteAAC/api/api.php
Rodrigo Paixão 2817010781 Compatibility with OTHire (#330)
* Preparing compatibility to OTHire

* Still working on compatibility to OTHire

* More compatibility

* More compatibility

Not tested yet

* Some fixes

- Fixed Account Creation.
- Fixed a problem that you can't load the website, that include that you can now recover your account number.

* More fixes

- Fixed character creation.
- Fixed login problem.
- Fixed displaying account number in My Account.
- Fixed displaying if you have premium days or not in My Account.

* More fixes

- Handle Kills/Deaths as TFS_03

* More fixes

- Fixed showing outfits in character profile
- Fixed displaying player houses in character profile
- Fixed displaying guilds

* Update init.php
2018-12-03 07:58:29 +01:00

47 lines
1.5 KiB
PHP

<?php
// Verify the PHP version, gives tutorial if fail.
if (version_compare(phpversion(), '5.3.3', '<')) die('PHP 5.3.3 or higher is required');
if (!isset($filepath)) $filepath = '../';
$version = '1.5_SVN';
session_start();
ob_start();
require_once $filepath.'config.php';
require_once $filepath.'engine/database/connect.php';
require_once $filepath.'engine/function/general.php';
require_once $filepath.'engine/function/cache.php';
// Initiate default config if nothing is specified (outdated config file)
if (!isset($config['api']['debug'])) $config['api']['debug'] = false;
$response = array(
'version' => array(
'znote' => $version,
'ot' => $config['ServerEngine']
),
);
if (isset($moduleVersion)) $response['version']['module'] = $moduleVersion;
function UseClass($name = false, $module = false, $path = false) {
if ($name !== false) {
if (!is_array($name)) {
if (!$module) $module = $name;
if (!$path) require_once "modules/base/{$module}/class/{$name}.php";
else require_once "{$path}/{$name}.php";
} else {
foreach ($name as $class) {
if (!$module) $module = $class;
if (!$path) require_once "modules/base/{$module}/class/{$class}.php";
else require_once "{$path}/{$class}.php";
}
}
} else die('Error in function UseClass: class parameter is false.');
}
function SendResponse($response) {
global $config;
if ($config['api']['debug'] || isset($_GET['debug'])) data_dump($response, false, "Response (debug mode)");
else echo json_encode($response);
}
?>