-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
/** | ||
* Class for OAI-PMH Web Services | ||
* | ||
* Copyright (C) 2012 Arie Nugraha ([email protected]) | ||
* Copyright (C) 2012 Arie Nugraha ([email protected]) | ||
* | ||
* Patch by: Ismail Fahmi | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -153,8 +155,10 @@ public function ListRecords($metadataPrefix = 'oai_dc') { | |
$where = ''; | ||
|
||
if (isset($_GET['resumptionToken'])) { | ||
echo 'resumption'; | ||
parse_str($_GET['resumptionToken'], $resumptionToken); | ||
// commented by Ismail | ||
//echo 'resumption'; | ||
// we need to urldecode the parameter | ||
parse_str(urldecode($_GET['resumptionToken']), $resumptionToken); | ||
if (isset($resumptionToken['offset'])) { | ||
$offset = (integer)$resumptionToken['offset']; | ||
} | ||
|
@@ -294,27 +298,28 @@ protected function outputRecordXML($recordID, $metadataPrefix = 'oai_dc') { | |
if ($metadataPrefix == 'oai_dc') { | ||
$detail = new detail($this->db, $recordID, 'dc'); | ||
$rec_detail = $detail->DublinCoreOutput(); | ||
} | ||
|
||
// mulai output XML | ||
ob_start(); | ||
echo '<record>' | ||
."<header><identifier>".$sysconf['OAI']['identifierPrefix'].$recordID."</identifier></header>"; | ||
echo "<metadata>"; | ||
if ($metadataPrefix == 'oai_dc') { | ||
echo '<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; | ||
} | ||
|
||
|
||
// mulai output XML | ||
ob_start(); | ||
echo '<record>' | ||
."<header><identifier>".$sysconf['OAI']['identifierPrefix'].$recordID."</identifier></header>"; | ||
echo "<metadata>"; | ||
if ($metadataPrefix == 'oai_dc') { | ||
echo '<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; | ||
} | ||
|
||
echo $rec_detail; | ||
echo $rec_detail; | ||
|
||
if ($metadataPrefix == 'oai_dc') { | ||
echo '</oai_dc:dc>'; | ||
} | ||
if ($metadataPrefix == 'oai_dc') { | ||
echo '</oai_dc:dc>'; | ||
} | ||
|
||
echo "</metadata>\n"; | ||
echo "</record>\n"; | ||
$recordXML = ob_get_clean(); | ||
echo "</metadata>\n"; | ||
echo "</record>\n"; | ||
$recordXML = ob_get_clean(); | ||
|
||
return $recordXML; | ||
return $recordXML; | ||
} // ismail: put the closing bracket here to prevent undefined $rec_detail | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
/** | ||
* OAI-PMH | ||
* | ||
* Copyright (C) 2012 Arie Nugraha ([email protected]) | ||
* Copyright (C) 2012 Arie Nugraha ([email protected]) | ||
* | ||
* Patch by: Ismail Fahmi | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -25,7 +27,12 @@ | |
|
||
// required file | ||
require 'sysconfig.inc.php'; | ||
$date_respons = date('Y-m-d').'T'.date('H:i:s').'Z'; | ||
if (class_exists('DateTime')) { | ||
$date = new DateTime(); | ||
$date_respons = $date->format('Y-m-d').'T'.$date->format('H:i:s').'Z'; | ||
} else { | ||
$date_respons = date('Y-m-d').'T'.date('H:i:s').'Z'; | ||
} | ||
|
||
if (!$sysconf['OAI']['enable']) { | ||
header('Content-type: text/xml'); | ||
|
@@ -80,7 +87,11 @@ | |
break; | ||
case 'ListRecords'; | ||
$metadataPrefix = isset($_GET['metadataPrefix'])?$dbs->escape_string(trim($_GET['metadataPrefix'])):'oai_dc'; | ||
echo $oai_respon_handlers->ListRecords($_GET['metadataPrefix']); | ||
|
||
// ismail: metadataPrefix is not mandatory with resumptionToken | ||
//echo $oai_respon_handlers->ListRecords($_GET['metadataPrefix']); | ||
echo $oai_respon_handlers->ListRecords($metadataPrefix); | ||
|
||
break; | ||
case 'GetRecord'; | ||
$identifier = isset($_GET['identifier'])?$dbs->escape_string(trim($_GET['identifier'])):'0'; | ||
|