diff --git a/lib/detail.inc.php b/lib/detail.inc.php index 41e4618..0e8a594 100755 --- a/lib/detail.inc.php +++ b/lib/detail.inc.php @@ -447,8 +447,11 @@ public function DublinCoreOutput() // imprint/publication data $_xml_output .= 'record_detail['publisher_name'].']]>'."\n"; - // date - $_xml_output .= 'record_detail['publish_year'].']]>'."\n"; + if ($this->record_detail['publish_year']) { + $_xml_output .= 'record_detail['publish_year'].']]>'."\n"; + } else { + $_xml_output .= ''."\n"; + } // edition $_xml_output .= 'record_detail['edition'].']]>'."\n"; diff --git a/lib/oai-pmh.inc.php b/lib/oai-pmh.inc.php index cb31436..e1d886c 100755 --- a/lib/oai-pmh.inc.php +++ b/lib/oai-pmh.inc.php @@ -2,7 +2,9 @@ /** * Class for OAI-PMH Web Services * - * Copyright (C) 2012 Arie Nugraha (dicarve@yahoo.com) + * Copyright (C) 2012 Arie Nugraha (dicarve@gmail.com) + * + * 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 '' - ."
".$sysconf['OAI']['identifierPrefix'].$recordID."
"; - echo ""; - if ($metadataPrefix == 'oai_dc') { - echo ''; - } + + + // mulai output XML + ob_start(); + echo '' + ."
".$sysconf['OAI']['identifierPrefix'].$recordID."
"; + echo ""; + if ($metadataPrefix == 'oai_dc') { + echo ''; + } - echo $rec_detail; + echo $rec_detail; - if ($metadataPrefix == 'oai_dc') { - echo ''; - } + if ($metadataPrefix == 'oai_dc') { + echo '
'; + } - echo "
\n"; - echo "
\n"; - $recordXML = ob_get_clean(); + echo "\n"; + echo "\n"; + $recordXML = ob_get_clean(); - return $recordXML; + return $recordXML; + } // ismail: put the closing bracket here to prevent undefined $rec_detail } } diff --git a/oai.php b/oai.php index 5662371..c2fe7ea 100755 --- a/oai.php +++ b/oai.php @@ -2,7 +2,9 @@ /** * OAI-PMH * - * Copyright (C) 2012 Arie Nugraha (dicarve@yahoo.com) + * Copyright (C) 2012 Arie Nugraha (dicarve@gmail.com) + * + * 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';