E assim eh validado pelo dspace

This commit is contained in:
Usuario Moodle 2013-05-07 15:44:21 -03:00
parent b3bd6f267a
commit a89f4b7fa1
3 changed files with 88 additions and 93 deletions

View File

@ -23,10 +23,6 @@ foreach($identifyResponse as $key => $val) {
$outputObj->add2_verbNode($key, $val); $outputObj->add2_verbNode($key, $val);
} }
foreach($adminEmail as $val) {
$outputObj->add2_verbNode("adminEmail", $val);
}
if(isset($compression)) { if(isset($compression)) {
foreach($compression as $val) { foreach($compression as $val) {
$outputObj->add2_verbNode("compression", $val); $outputObj->add2_verbNode("compression", $val);

View File

@ -70,7 +70,7 @@ require_once('oaidp-config.php');
// Create a PDO object // Create a PDO object
try { try {
$db = new PDO($DSN); $db = new PDO($DSN, $DB_USER, $DB_PASSWD);
} catch (PDOException $e) { } catch (PDOException $e) {
exit('Connection failed: ' . $e->getMessage()); exit('Connection failed: ' . $e->getMessage());
} }

View File

@ -10,35 +10,35 @@
* *
* The response may may be compressed for better performace: * The response may may be compressed for better performace:
* - Compression : a compression encoding supported by the repository. The recommended values are those defined for the Content-Encoding header in Section 14.11 of RFC 2616 describing HTTP 1.1. A compression element should not be included for the identity encoding, which is implied. * - Compression : a compression encoding supported by the repository. The recommended values are those defined for the Content-Encoding header in Section 14.11 of RFC 2616 describing HTTP 1.1. A compression element should not be included for the identity encoding, which is implied.
* *
* *
* Some other used variables: * Some other used variables:
* *
* - <B>$adminEmail</B>: the e-mail addresses of administrators of the repository. * - <B>$adminEmail</B>: the e-mail addresses of administrators of the repository.
* *
* - <b>$repositoryIdentifier</b> : For a data provider there is only one. For repositories to comply with the oai * - <b>$repositoryIdentifier</b> : 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. * 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. * See: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm.
* *
* - <b>$SETS</b>: An array with key words . List of supported SETs. * - <b>$SETS</b>: An array with key words . List of supported SETs.
* *
* - <b>$METADATAFORMATS</b>: List of supported metadata formats. It is a two-dimensional array with keys. * - <b>$METADATAFORMATS</b>: 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. * Each supported format is one element of this array at the first dimension.
* The key is the name of a metadata format. * 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. * 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. * Most definitions are done here but handlers themselves are defined in separated files because only the names of PHP script are listed here.
* - metadataPrefix * - metadataPrefix
* - schema * - schema
* - metadataNamespace * - metadataNamespace
* - myhandler * - myhandler
* - other optional items: record_prefix, record_namespace and etc. * - other optional items: record_prefix, record_namespace and etc.
* *
* - <b>$SQL</b>: Settings for database and queries from database * - <b>$SQL</b>: Settings for database and queries from database
* *
* - <b>$DSN</b>: DSN for connecting your database. Reference PDO for details. * - <b>$DSN</b>: DSN for connecting your database. Reference PDO for details.
* *
* The rest of settings will not normally need to be adjusted. Read source code for details. * The rest of settings will not normally need to be adjusted. Read source code for details.
*/ */
/** /**
* Whether to show error message for dubug. * Whether to show error message for dubug.
@ -51,9 +51,9 @@
// If everything is running ok, you should use this // If everything is running ok, you should use this
define('SHOW_QUERY_ERROR',FALSE); define('SHOW_QUERY_ERROR',FALSE);
/** /**
* \property CONTENT_TYPE * \property CONTENT_TYPE
* The content-type the WWW-server delivers back. For debug-puposes, "text/plain" * The content-type the WWW-server delivers back. For debug-puposes, "text/plain"
* is easier to view. On a production site you should use "text/xml". * is easier to view. On a production site you should use "text/xml".
*/ */
#define('CONTENT_TYPE','Content-Type: text/plain'); #define('CONTENT_TYPE','Content-Type: text/plain');
@ -75,91 +75,89 @@ $identifyResponse = array();
// MUST (only one) // MUST (only one)
// please adjust // please adjust
$identifyResponse["repositoryName"] = 'Your organisation'; $identifyResponse["repositoryName"] = 'Moodle Dev2';
// For ANDS to harvest of RIF-CS, originatingSource is plantaccelerator.org.au // For ANDS to harvest of RIF-CS, originatingSource is plantaccelerator.org.au
// $dataSource = "plantaccelerator.org.au"; // $dataSource = "plantaccelerator.org.au";
define('DATASOURCE','domain.of.your.organisation'); define('DATASOURCE','dev2.moodle.ufsc.br');
// do not change // do not change
define('MY_URI','http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']); define('MY_URI','http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
// You can use a static URI as well. // You can use a static URI as well.
// $baseURL = "http://my.server.org/oai/oai2.php"; // $baseURL = "http://my.server.org/oai/oai2.php";
$identifyResponse["baseURL"] = MY_URI; $identifyResponse["baseURL"] = MY_URI;
// do not change // do not change
$identifyResponse["protocolVersion"] = '2.0'; $identifyResponse["protocolVersion"] = '2.0';
// must exist before earliestDatestamp
$identifyResponse['adminEmail'] = 'danielneis@gmail.com';
// MUST (only one) // MUST (only one)
// the earliest datestamp in your repository, // the earliest datestamp in your repository,
// please adjust // please adjust
// Only date is needed even later it will be formatted according to the granularity. // Only date is needed even later it will be formatted according to the granularity.
$identifyResponse["earliestDatestamp"] = '2011-01-01'; $identifyResponse["earliestDatestamp"] = '2013-01-01T12:00:00Z';
// How your repository handles deletions // How your repository handles deletions
// no: The repository does not maintain status about deletions. // no: The repository does not maintain status about deletions.
// It MUST NOT reveal a deleted status. // It MUST NOT reveal a deleted status.
// persistent: The repository persistently keeps track about deletions // persistent: The repository persistently keeps track about deletions
// with no time limit. It MUST consistently reveal the status // with no time limit. It MUST consistently reveal the status
// of a deleted record over time. // of a deleted record over time.
// transient: The repository does not guarantee that a list of deletions is // transient: The repository does not guarantee that a list of deletions is
// maintained. It MAY reveal a deleted status for records. // maintained. It MAY reveal a deleted status for records.
// //
// If your database keeps track of deleted records change accordingly. // If your database keeps track of deleted records change accordingly.
// Currently if $record['deleted'] is set to 'true', $status_deleted is set. // Currently if $record['deleted'] is set to 'true', $status_deleted is set.
// Some lines in listidentifiers.php, listrecords.php, getrecords.php // Some lines in listidentifiers.php, listrecords.php, getrecords.php
// must be changed to fit the condition for your database. // must be changed to fit the condition for your database.
$identifyResponse["deletedRecord"] = 'no'; $identifyResponse["deletedRecord"] = 'no';
$deletedRecord = $identifyResponse["deletedRecord"]; // a shorthand for checking the configuration of Deleted Records $deletedRecord = $identifyResponse["deletedRecord"]; // a shorthand for checking the configuration of Deleted Records
// MAY (only one) // MAY (only one)
//granularity is days //granularity is days
//$granularity = 'YYYY-MM-DD'; //$granularity = 'YYYY-MM-DD';
// granularity is seconds // granularity is seconds
$identifyResponse["granularity"] = 'YYYY-MM-DDThh:mm:ssZ'; $identifyResponse["granularity"] = 'YYYY-MM-DD';
// this is appended if your granularity is seconds. // this is appended if your granularity is seconds.
// do not change // do not change
if (strcmp($identifyResponse["granularity"],'YYYY-MM-DDThh:mm:ssZ')==0) { if (strcmp($identifyResponse["granularity"],'YYYY-MM-DDThh:mm:ssZ')==0) {
$identifyResponse["earliestDatestamp"] = $identifyResponse["earliestDatestamp"].'T00:00:00Z'; $identifyResponse["earliestDatestamp"] = $identifyResponse["earliestDatestamp"].'T00:00:00Z';
} }
// MUST (multiple)
// please adjust
$adminEmail = array('some.one@contact.com');
/** Compression methods supported. Optional (multiple). Default: null. /** Compression methods supported. Optional (multiple). Default: null.
* *
* Currently only gzip is supported (you need output buffering turned on, * Currently only gzip is supported (you need output buffering turned on,
* and php compiled with libgz). * and php compiled with libgz).
* The client MUST send "Accept-Encoding: gzip" to actually receive * The client MUST send "Accept-Encoding: gzip" to actually receive
*/ */
// $compression = array('gzip'); // $compression = array('gzip');
$compression = null; $compression = null;
// MUST (only one) // MUST (only one)
// You may choose any name, but for repositories to comply with the oai // You may choose any name, but for repositories to comply with the oai
// format it has to be unique identifiers for items records. // format it has to be unique identifiers for items records.
// see: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm // see: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm
// Basically use domainname // Basically use domainname
// please adjust // please adjust
$repositoryIdentifier = 'url.organisation.'; $repositoryIdentifier = 'dev2.moodle.ufsc.br.';
// For RIF-CS, especially with ANDS, each registryObject much has a group for the ownership of data. // For RIF-CS, especially with ANDS, each registryObject much has a group for the ownership of data.
// For detail please see ANDS guide on its web site. Each data provider should have only one REG_OBJ_GROUP // For detail please see ANDS guide on its web site. Each data provider should have only one REG_OBJ_GROUP
// for this purpose. // for this purpose.
define('REG_OBJ_GROUP','Something agreed on'); define('REG_OBJ_GROUP','Something agreed on');
// If Identifier needs to show NODE description. It is defined in identify.php // If Identifier needs to show NODE description. It is defined in identify.php
// You may include details about your community and friends (other // You may include details about your community and friends (other
// data-providers). // data-providers).
// Please check identify.php for other possible containers // Please check identify.php for other possible containers
// in the Identify response // in the Identify response
$show_identifier = false; $show_identifier = false;
// MUST (only one) // MUST (only one)
// should not be changed. Only useful when NODE description is included in the response to Identifier // should not be changed. Only useful when NODE description is included in the response to Identifier
$delimiter = ':'; $delimiter = ':';
/** Maximum mumber of the records to deliver /** Maximum mumber of the records to deliver
* (verb is ListRecords) * (verb is ListRecords)
@ -177,63 +175,65 @@ define('MAXIDS',40);
/** After 24 hours resumptionTokens become invalid. Unit is second. */ /** After 24 hours resumptionTokens become invalid. Unit is second. */
define('TOKEN_VALID',24*3600); define('TOKEN_VALID',24*3600);
$expirationdatetime = gmstrftime('%Y-%m-%dT%TZ', time()+TOKEN_VALID); $expirationdatetime = gmstrftime('%Y-%m-%dT%TZ', time()+TOKEN_VALID);
/** Where token is saved and path is included */ /** Where token is saved and path is included */
define('TOKEN_PREFIX','/tmp/ANDS_DBPD-'); define('TOKEN_PREFIX','/tmp/ANDS_DBPD-');
// define all supported sets in your repository // define all supported sets in your repository
$SETS = array ( $SETS = array (
array('setSpec'=>'class:activity', 'setName'=>'Activities'), array('setSpec'=>'class:activity', 'setName'=>'Activities'),
array('setSpec'=>'class:collection', 'setName'=>'Collections'), array('setSpec'=>'class:collection', 'setName'=>'Collections'),
array('setSpec'=>'class:party', 'setName'=>'Parties')/*, array('setSpec'=>'class:party', 'setName'=>'Parties')
array('setSpec'=>'phdthesis', 'setName'=>'PHD Thesis', 'setDescription'=>'<oai_dc:dc /*,
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" array('setSpec'=>'phdthesis', 'setName'=>'PHD Thesis', 'setDescription'=>'<oai_dc:dc
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
<dc:description>This set contains metadata describing electronic music recordings made during the 1950ies</dc:description> http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
</oai_dc:dc>') //, <dc:description>This set contains metadata describing electronic music recordings made during the 1950ies</dc:description>
// array('setSpec'=>'math', 'setName'=>'Mathematics') , </oai_dc:dc>') //,
// array('setSpec'=>'phys', 'setName'=>'Physics') // array('setSpec'=>'math', 'setName'=>'Mathematics') ,
*/); // array('setSpec'=>'phys', 'setName'=>'Physics')
*/
);
// define all supported metadata formats, has to be an array // define all supported metadata formats, has to be an array
// //
// myhandler is the name of the file that handles the request for the // myhandler is the name of the file that handles the request for the
// specific metadata format. // specific metadata format.
// [record_prefix] describes an optional prefix for the metadata // [record_prefix] describes an optional prefix for the metadata
// [record_namespace] describe the namespace for this prefix // [record_namespace] describe the namespace for this prefix
$METADATAFORMATS = array ( $METADATAFORMATS = array (
'rif' => array('metadataPrefix'=>'rif', 'rif' => array('metadataPrefix'=>'rif',
'schema'=>'http://services.ands.org.au/sandbox/orca/schemata/registryObjects.xsd', 'schema'=>'http://services.ands.org.au/sandbox/orca/schemata/registryObjects.xsd',
'metadataNamespace'=>'http://ands.org.au/standards/rif-cs/registryObjects/', 'metadataNamespace'=>'http://ands.org.au/standards/rif-cs/registryObjects/',
'myhandler'=>'record_rif.php' 'myhandler'=>'record_rif.php'
), ),
'oai_dc' => array('metadataPrefix'=>'oai_dc', 'oai_dc' => array('metadataPrefix'=>'oai_dc',
'schema'=>'http://www.openarchives.org/OAI/2.0/oai_dc.xsd', 'schema'=>'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
'metadataNamespace'=>'http://www.openarchives.org/OAI/2.0/oai_dc/', 'metadataNamespace'=>'http://www.openarchives.org/OAI/2.0/oai_dc/',
'myhandler'=>'record_dc.php', 'myhandler'=>'record_dc.php',
'record_prefix'=>'dc', 'record_prefix'=>'dc',
'record_namespace' => 'http://purl.org/dc/elements/1.1/' 'record_namespace' => 'http://purl.org/dc/elements/1.1/'
) )
); );
if (!is_array($METADATAFORMATS)) { exit("Configuration of METADATAFORMAT has been wrongly set. Correct your ".__FILE__);} 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 // The shorthand of xml schema namespace, no need to change this
define('XMLSCHEMA', 'http://www.w3.org/2001/XMLSchema-instance'); define('XMLSCHEMA', 'http://www.w3.org/2001/XMLSchema-instance');
// //
// DATABASE SETUP // DATABASE SETUP
// //
// change according to your local DB setup. // change according to your local DB setup.
$DB_HOST = '127.0.0.1'; $DB_HOST = '';
$DB_USER = 'your-name'; $DB_USER = '';
$DB_PASSWD = 'your-pwd'; $DB_PASSWD = '';
$DB_NAME = 'your-db'; $DB_NAME = '';
// Data Source Name: This is the universal connection string // Data Source Name: This is the universal connection string
// if you use something other than mysql edit accordingly. // if you use something other than mysql edit accordingly.
@ -242,20 +242,20 @@ $DB_NAME = 'your-db';
// Example for Oracle // Example for Oracle
// $DSN = "oci8://$DB_USER:$DB_PASSWD@$DB_NAME"; // $DSN = "oci8://$DB_USER:$DB_PASSWD@$DB_NAME";
$DSN = "pgsql:host=$DB_HOST;port=5432;dbname=$DB_NAME;user=$DB_USER;password=$DB_PASSWD"; $DSN = "mysql:host={$DB_HOST};dbname={$DB_NAME};port=3306;";
// the charset you store your metadata in your database // the charset you store your metadata in your database
// currently only utf-8 and iso8859-1 are supported // currently only utf-8 and iso8859-1 are supported
$charset = "iso8859-1"; $charset = "iso8859-1";
// if entities such as < > ' " in your metadata has already been escaped // if entities such as < > ' " in your metadata has already been escaped
// then set this to true (e.g. you store < as &lt; in your DB) // then set this to true (e.g. you store < as &lt; in your DB)
$xmlescaped = false; $xmlescaped = false;
// We store multiple entries for one element in a single row // We store multiple entries for one element in a single row
// in the database. SQL['split'] lists the delimiter for these entries. // in the database. SQL['split'] lists the delimiter for these entries.
// If you do not do this, do not define $SQL['split'] // If you do not do this, do not define $SQL['split']
// $SQL['split'] = ';'; // $SQL['split'] = ';';
// the name of the table where your store your metadata's header // the name of the table where your store your metadata's header
$SQL['table'] = 'oai_headers'; $SQL['table'] = 'oai_headers';
@ -276,8 +276,8 @@ $idPrefix = '';
// oai:$repositoryIdentifier:$idPrefix$SQL['identifier'] // oai:$repositoryIdentifier:$idPrefix$SQL['identifier']
// should not be changed // should not be changed
// //
// Commented out 24/11/10 14:19:09 // Commented out 24/11/10 14:19:09
// $oaiprefix = "oai".$delimiter.$repositoryIdentifier.$delimiter.$idPrefix; // $oaiprefix = "oai".$delimiter.$repositoryIdentifier.$delimiter.$idPrefix;
$oaiprefix = ""; $oaiprefix = "";
// adjust anIdentifier with sample contents an identifier // adjust anIdentifier with sample contents an identifier
@ -295,4 +295,3 @@ $SQL['deleted'] = 'deleted';
// the setnames are stored for each item // the setnames are stored for each item
// the name of the column where you store sets // the name of the column where you store sets
$SQL['set'] = 'oai_set'; $SQL['set'] = 'oai_set';
?>