.inc.php spl_autoload_register(function ($class) { $file = 'inc/' . preg_replace('/[^a-z0-9]/', '', mb_strtolower($class)) . '.inc.php'; if (!file_exists($file)) return; require_once $file; }); function isLocalExecution() { return !isset($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] === '127.0.0.1'; } if (!empty($_REQUEST['do'])) { $module = preg_replace('/[^a-z]/', '', $_REQUEST['do']); } elseif (!empty($argv[1])) { $module = preg_replace('/[^a-z]/', '', $argv[1]); } else { exit(1); } Module::init(); if (Module::isAvailable($module)) { $module = 'modules/' . $module . '/api.inc.php'; } else { $module = 'apis/' . $module . '.inc.php'; } if (!file_exists($module)) { Util::traceError('Invalid module, or module without API: ' . $module); } Header('Expires: Wed, 29 Mar 2007 09:56:28 GMT'); Header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); Header("Cache-Control: post-check=0, pre-check=0", false); Header("Pragma: no-cache"); Header('Content-Type: text/plain; charset=utf-8'); ob_start('ob_gzhandler'); // Load module - it will execute pre-processing, or act upon request parameters require_once($module);