Auto-detect base URL
This commit is contained in:
parent
a79d621fd2
commit
fd2fa1ada3
11
index.php
11
index.php
|
@ -39,10 +39,17 @@ reset($records);
|
||||||
ksort($timestamps);
|
ksort($timestamps);
|
||||||
reset($timestamps);
|
reset($timestamps);
|
||||||
|
|
||||||
|
// Get current base URL
|
||||||
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
|
||||||
|
$baseURL = 'https://'.$_SERVER['HTTP_HOST'].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
||||||
|
} else {
|
||||||
|
$baseURL = 'http://'.$_SERVER['HTTP_HOST'].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
// Build the Identify response
|
// Build the Identify response
|
||||||
$identifyResponse = array(
|
$identifyResponse = array(
|
||||||
'repositoryName' => $config['repositoryName'],
|
'repositoryName' => $config['repositoryName'],
|
||||||
'baseURL' => $config['baseURL'],
|
'baseURL' => $baseURL,
|
||||||
'protocolVersion' => '2.0',
|
'protocolVersion' => '2.0',
|
||||||
'adminEmail' => $config['adminEmail'],
|
'adminEmail' => $config['adminEmail'],
|
||||||
'earliestDatestamp' => gmdate('Y-m-d\TH:i:s\Z', key($timestamps)),
|
'earliestDatestamp' => gmdate('Y-m-d\TH:i:s\Z', key($timestamps)),
|
||||||
|
@ -51,7 +58,7 @@ $identifyResponse = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
$oai2 = new OAI2Server(
|
$oai2 = new OAI2Server(
|
||||||
'http://'.$_SERVER['HTTP_HOST'].parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH),
|
$baseURL,
|
||||||
$_GET,
|
$_GET,
|
||||||
$identifyResponse,
|
$identifyResponse,
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -29,9 +29,6 @@ $config = array();
|
||||||
// A human readable name for the repository
|
// A human readable name for the repository
|
||||||
$config['repositoryName'] = 'Simple OAI 2.0 Data Provider';
|
$config['repositoryName'] = 'Simple OAI 2.0 Data Provider';
|
||||||
|
|
||||||
// The base URL of the repository, i.e. the directory you deployed the files to
|
|
||||||
$config['baseURL'] = 'http://www.example.org/oai2/';
|
|
||||||
|
|
||||||
// Email address for contacting the repository owner
|
// Email address for contacting the repository owner
|
||||||
$config['adminEmail'] = 'admin@example.org';
|
$config['adminEmail'] = 'admin@example.org';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue