diff --git a/index.php b/index.php index ba6b408..f2a5d98 100644 --- a/index.php +++ b/index.php @@ -20,24 +20,14 @@ * along with this program. If not, see . */ -namespace OCC\OAI2; +use OCC\OAI2\Exception; +use OCC\OAI2\Server; -// Register autoloader -spl_autoload_register(function ($class) { - $base_dir = __DIR__.'/Classes/'; - $len = strlen(__NAMESPACE__); - if (strncmp(__NAMESPACE__, $class, $len) !== 0) { - return; - } - $relative_class = substr($class, $len); - $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; - if (file_exists($file)) { - require $file; - } -}); +// Register PSR-4 autoloader +require __DIR__.'/vendor/autoload.php'; // Load configuration -require './Configuration/Main.php'; +require __DIR__.'/Configuration/Main.php'; // Get all available records and their respective status and timestamps $records = []; diff --git a/update.php b/update.php index b9dc80b..3a9f4f9 100644 --- a/update.php +++ b/update.php @@ -22,7 +22,7 @@ if (php_sapi_name() !== 'cli') { exit; } -require './Configuration/Main.php'; +require __DIR__.'/Configuration/Main.php'; /** * Format output string @@ -71,7 +71,7 @@ $sourceDir = rtrim($sourceDir, '/').'/'; // Prepend script's path if dataDir is not an absolute path $dataDir = rtrim($config['dataDirectory'], '/').'/'.$metadataPrefix.'/'; if (strpos($dataDir, '/') !== 0) { - $dataDir = dirname(__FILE__).'/'.$dataDir; + $dataDir = __DIR__.'/'.$dataDir; } // Check dataDir permissions if (!is_dir($dataDir) || !is_writable($dataDir)) {