Fix some more bugs

This commit is contained in:
Sebastian Meyer 2017-10-08 13:38:00 +02:00
parent 1c6015ed18
commit b2861398aa
3 changed files with 9 additions and 5 deletions

View File

@ -108,7 +108,7 @@ $oai2 = new OAI2Server(
'ListMetadataFormats' =>
function($identifier = '') {
global $config, $records;
if (!empty($identifier) {
if (!empty($identifier)) {
$formats = array();
foreach($records as $format => $record) {
if (!empty($record[$identifier])) {

View File

@ -252,7 +252,7 @@ p.intro {
ListIdentifiers
-->
<xsl:template match="oai:ListIdentifiers">
<xsl:apply-templates select="oai:header" />
<xsl:apply-templates select="oai:record" />
<xsl:apply-templates select="oai:resumptionToken" />
</xsl:template>
@ -265,7 +265,7 @@ p.intro {
<p>This is a list of metadata formats available for the record "<xsl:value-of select='$identifier' />". Use these links to view the metadata: <xsl:apply-templates select="oai:metadataFormat/oai:metadataPrefix" /></p>
</xsl:when>
<xsl:otherwise>
<p>This is a list of metadata formats available from this repository. Click on a format's prefix to get all available records' identifier.</p>
<p>This is a list of metadata formats available from this repository. Click on a format's prefix to get all available records' identifiers.</p>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="oai:metadataFormat" />

View File

@ -25,9 +25,13 @@ class OAI2XMLResponse {
public $doc; // DOMDocument. Handle of current XML Document object
public function __construct($uri, $verb, $request_args) {
if (substr($uri, -1, 1) == '/') {
$stylesheet = $uri.'oai2transform.xsl';
} else {
$stylesheet = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://';
$stylesheet .= $_SERVER['HTTP_HOST'].pathinfo(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), PATHINFO_DIRNAME).'/oai2transform.xsl';
}
$this->verb = $verb;
$stylesheet = $_SERVER['HTTP_HOST'].pathinfo(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), PATHINFO_DIRNAME).'/oai2transform.xsl';
$stylesheet = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://'.$stylesheet : 'http://'.$stylesheet;
$this->doc = new DOMDocument('1.0', 'UTF-8');
$this->doc->appendChild($this->doc->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.$stylesheet.'"'));
$oai_node = $this->doc->createElement('OAI-PMH');