From 2ec415907a4078700a2a0a9c399b9ab5848a86f7 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Sat, 13 May 2017 12:21:26 +0200 Subject: [PATCH] Make some variables global --- index.php | 8 +++++--- oai2server.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 28feb25..ec0c4e7 100644 --- a/index.php +++ b/index.php @@ -57,6 +57,7 @@ $oai2 = new OAI2Server( array( 'GetRecord' => function($identifier, $metadataPrefix) { + global $records; if (empty($records[$identifier])) { return array(); } else { @@ -69,6 +70,7 @@ $oai2 = new OAI2Server( }, 'ListRecords' => function($metadataPrefix, $from = null, $until = null, $count = false, $deliveredRecords = 0, $maxItems = 100) { + global $records, $timestamps; $resultSet = array(); foreach($timestamps as $timestamp => $identifiers) { if ((is_null($from) || $timestamp >= $from) && (is_null($until) || $timestamp <= $until)) { @@ -89,14 +91,14 @@ $oai2 = new OAI2Server( }, 'ListMetadataFormats' => function($identifier = '') { - if (!empty($identifier) && empty($records[$identifier]) { + global $config; + if (!empty($identifier) && empty($records[$identifier])) { throw new OAI2Exception('idDoesNotExist'); } else { return array( $config['metadataFormat'] => array( - 'metadataPrefix' => $config['metadataFormat'], 'schema'=> $config['metadataSchema'], - 'metadataNamespace' => $config['metadataNamespace'] + 'namespace' => $config['metadataNamespace'] ) ); } diff --git a/oai2server.php b/oai2server.php index 5ea460c..fc073bc 100644 --- a/oai2server.php +++ b/oai2server.php @@ -105,7 +105,7 @@ class OAI2Server { $cmf = $this->response->addToVerbNode('metadataFormat'); $this->response->addChild($cmf, 'metadataPrefix', $key); $this->response->addChild($cmf, 'schema', $val['schema']); - $this->response->addChild($cmf, 'metadataNamespace', $val['metadataNamespace']); + $this->response->addChild($cmf, 'metadataNamespace', $val['namespace']); } } else { $this->errors[] = new OAI2Exception('noMetadataFormats');