Make some variables global

This commit is contained in:
Sebastian Meyer 2017-05-13 12:21:26 +02:00
parent 387bc4c161
commit 2ec415907a
2 changed files with 6 additions and 4 deletions

View File

@ -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']
)
);
}

View File

@ -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');