forked from TomZastrow/reptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoai.php
60 lines (46 loc) · 1.58 KB
/
oai.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
include("oaipmh-functions.php");
include("config.php");
global $config;
$verb = $_GET['verb'];
$metadataPrefix = $_GET['metadataPrefix'];
$identifier = $_GET['identifier'];
$from = $_GET['from'];
$set = $_GET['set'];
$datadir = "data" . $identifier;
$dcFile = realpath($datadir . $config['nameDCFile']);
$dcFile = realpath(dirname(__FILE__)) . "/" . $datadir . $config['nameDCFile'];
$thisUrl = "http" . (!empty($_SERVER['HTTPS']) ? "s" : "") . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<?php
$date = date("c", time());
echo "<responseDate>$date</responseDate>\n";
if ($verb == "GetRecord") {
getRecord($identifier, $metadataPrefix, $thisUrl, $dcFile);
}
if ($verb == "Identify") {
identify($thisUrl);
}
if ($verb == "ListMetadataFormats") {
getMetadataFormats($thisUrl);
}
if ($verb == "ListSets") {
getListSets($thisUrl);
}
if ($verb == "ListRecords"){
getListRecords($thisUrl, $from, $set, $metadataPrefix, false);
}
if ($verb == "ListIdentifiers"){
getListRecords($thisUrl, $from, $set, $metadataPrefix, true);
}
?>
</OAI-PMH>