diff --git a/config-metadataformats.php b/config-metadataformats.php
new file mode 100644
index 0000000..e85d184
--- /dev/null
+++ b/config-metadataformats.php
@@ -0,0 +1,37 @@
+$METADATAFORMATS: List of supported metadata formats. It is a two-dimensional array with keys.
+ * Each supported format is one element of this array at the first dimension.
+ * The key is the name of a metadata format.
+ * The exact number of items within each format associated array depends on the nature of a metadata format.
+ * Most definitions are done here but handlers themselves are defined in separated files because only the names of PHP script are listed here.
+ * - metadataPrefix
+ * - schema
+ * - metadataNamespace
+ * - myhandler
+ * - other optional items: record_prefix, record_namespace and etc.
+ */
+// define all supported metadata formats, has to be an array
+//
+// myhandler is the name of the file that handles the request for the
+// specific metadata format.
+// [record_prefix] describes an optional prefix for the metadata
+// [record_namespace] describe the namespace for this prefix
+
+
+$METADATAFORMATS = array (
+ 'rif' => array('metadataPrefix'=>'rif',
+ 'schema'=>'http://services.ands.org.au/sandbox/orca/schemata/registryObjects.xsd',
+ 'metadataNamespace'=>'http://ands.org.au/standards/rif-cs/registryObjects/',
+ 'myhandler'=>'record_rif.php'
+ ),
+ 'oai_dc' => array('metadataPrefix'=>'oai_dc',
+ 'schema'=>'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
+ 'metadataNamespace'=>'http://www.openarchives.org/OAI/2.0/oai_dc/',
+ 'myhandler'=>'record_dc.php',
+ 'record_prefix'=>'dc',
+ 'record_namespace' => 'http://purl.org/dc/elements/1.1/'
+ )
+);
+
+if (!is_array($METADATAFORMATS)) { exit("Configuration of METADATAFORMAT has been wrongly set. Correct your ".__FILE__);}
diff --git a/listmetadataformats.php b/listmetadataformats.php
index 93405e2..e46afc4 100644
--- a/listmetadataformats.php
+++ b/listmetadataformats.php
@@ -3,8 +3,9 @@
* \file
* \brief Response to Verb ListMetadataFormats
*
- * The information of supported metadata formats is saved in database and retrieved by calling function idFormatQuery.
- * \sa idFormatQuery
+ * The information of supported metadata formats :
+ * try database table $SQL['table']
+ * else try $METADATAFORMATS array from config-metadataformats.php
*/
/**
@@ -26,7 +27,7 @@ function addMetedataFormat(&$outputObj,$key,$val) {
if (isset($args['identifier'])) {
$identifier = $args['identifier'];
- $query = idFormatQuery($identifier);
+ $query = 'select '.$SQL['metadataPrefix'].' FROM '.$SQL['table']. " WHERE ".$SQL['identifier']." = '".$id."'";
$res = $db->query($query);
if ($res==false) {
if (SHOW_QUERY_ERROR) {
@@ -47,7 +48,9 @@ if (isset($args['identifier'])) {
}
//break and clean up on error
-if (!empty($errors)) oai_exit();
+if (!empty($errors)) {
+ oai_exit();
+}
$outputObj = new ANDS_Response_XML($args);
if (isset($mf)) {
diff --git a/oai2.php b/oai2.php
index 9daae83..dc4b023 100644
--- a/oai2.php
+++ b/oai2.php
@@ -67,6 +67,7 @@ foreach($attribs as $val) {
}
require_once('oaidp-config.php');
+require_once('config-metadataformats.php');
// Create a PDO object
try {
diff --git a/oaidp-config.php b/oaidp-config.php
index 2973ce8..0b98392 100644
--- a/oaidp-config.php
+++ b/oaidp-config.php
@@ -14,25 +14,12 @@
*
* Some other used variables:
*
- * - $adminEmail: the e-mail addresses of administrators of the repository.
- *
* - $repositoryIdentifier : For a data provider there is only one. For repositories to comply with the oai
* format it has to be unique identifiers for items records. Basically using domainname will be fine.
* See: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm.
*
* - $SETS: An array with key words . List of supported SETs.
*
- * - $METADATAFORMATS: List of supported metadata formats. It is a two-dimensional array with keys.
- * Each supported format is one element of this array at the first dimension.
- * The key is the name of a metadata format.
- * The exact number of items within each format associated array depends on the nature of a metadata format.
- * Most definitions are done here but handlers themselves are defined in separated files because only the names of PHP script are listed here.
- * - metadataPrefix
- * - schema
- * - metadataNamespace
- * - myhandler
- * - other optional items: record_prefix, record_namespace and etc.
- *
* - $SQL: Settings for database and queries from database
*
* - $DSN: DSN for connecting your database. Reference PDO for details.
@@ -198,29 +185,6 @@ $SETS = array (
*/
);
-// define all supported metadata formats, has to be an array
-//
-// myhandler is the name of the file that handles the request for the
-// specific metadata format.
-// [record_prefix] describes an optional prefix for the metadata
-// [record_namespace] describe the namespace for this prefix
-
-$METADATAFORMATS = array (
- 'rif' => array('metadataPrefix'=>'rif',
- 'schema'=>'http://services.ands.org.au/sandbox/orca/schemata/registryObjects.xsd',
- 'metadataNamespace'=>'http://ands.org.au/standards/rif-cs/registryObjects/',
- 'myhandler'=>'record_rif.php'
- ),
- 'oai_dc' => array('metadataPrefix'=>'oai_dc',
- 'schema'=>'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
- 'metadataNamespace'=>'http://www.openarchives.org/OAI/2.0/oai_dc/',
- 'myhandler'=>'record_dc.php',
- 'record_prefix'=>'dc',
- 'record_namespace' => 'http://purl.org/dc/elements/1.1/'
- )
- );
-
-if (!is_array($METADATAFORMATS)) { exit("Configuration of METADATAFORMAT has been wrongly set. Correct your ".__FILE__);}
// The shorthand of xml schema namespace, no need to change this
define('XMLSCHEMA', 'http://www.w3.org/2001/XMLSchema-instance');
diff --git a/oaidp-util.php b/oaidp-util.php
index e324f11..d6bb3d4 100644
--- a/oaidp-util.php
+++ b/oaidp-util.php
@@ -241,12 +241,6 @@ function selectallQuery($metadPrefix = "rif", $id = ''){
return $query;
}
-/** this function will return metadataFormat of a record */
-function idFormatQuery($id) {
- global $SQL;
- return 'select '.$SQL['metadataPrefix'].' FROM '.$SQL['table']. " WHERE ".$SQL['identifier']." = '".$id."'";
-}
-
/** this function will return identifier and datestamp for all records
* not very useful
*/