summaryrefslogtreecommitdiffstats
path: root/api.php
diff options
context:
space:
mode:
Diffstat (limited to 'api.php')
-rw-r--r--api.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/api.php b/api.php
index 9e43a42a..5a451f3a 100644
--- a/api.php
+++ b/api.php
@@ -1,9 +1,13 @@
<?php
-error_reporting(E_ALL);
chdir(dirname($_SERVER['SCRIPT_FILENAME']));
require_once 'config.php';
+if (CONFIG_DEBUG) {
+ error_reporting(E_ALL);
+} else {
+ error_reporting(E_ALL & ~E_DEPRECATED);
+}
define('API', true);
define('AJAX', false);
@@ -13,13 +17,13 @@ if (CONFIG_SQL_PASS === '%MYSQL_OPENSLX_PASS%')
// Autoload classes from ./inc which adhere to naming scheme <lowercasename>.inc.php
spl_autoload_register(function ($class) {
- $file = 'inc/' . preg_replace('/[^a-z0-9]/', '', mb_strtolower($class)) . '.inc.php';
+ $file = 'inc/' . strtolower(preg_replace('/[^A-Za-z0-9]/', '', $class)) . '.inc.php';
if (!file_exists($file))
return;
require_once $file;
});
-function isLocalExecution()
+function isLocalExecution(): bool
{
return !isset($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] === '127.0.0.1';
}
@@ -55,7 +59,7 @@ if (Module::isAvailable($module)) {
}
if (!file_exists($module)) {
- Util::traceError('Invalid module, or module without API: ' . $module);
+ ErrorHandler::traceError('Invalid module, or module without API: ' . $module);
}
if (php_sapi_name() === 'cli') {
register_shutdown_function(function() {