Check for valid URIs

This commit is contained in:
Sebastian Meyer 2017-12-20 17:40:58 +01:00
parent 06de5421a5
commit 39ad464313
3 changed files with 11 additions and 12 deletions

View File

@ -88,6 +88,10 @@ final class tx_dlf_document {
* @access protected
*/
protected $formats = array (
'OAI' => array (
'rootElement' => 'OAI-PMH',
'namespaceURI' => 'http://www.openarchives.org/OAI/2.0/',
),
'METS' => array (
'rootElement' => 'mets',
'namespaceURI' => 'http://www.loc.gov/METS/',
@ -853,7 +857,7 @@ final class tx_dlf_document {
}
// Set default value if applicable.
if (empty($metadata[$resArray['index_name']][0]) && $resArray['default_value']) {
if (empty($metadata[$resArray['index_name']][0])) {
$metadata[$resArray['index_name']] = array ($resArray['default_value']);
@ -945,7 +949,7 @@ final class tx_dlf_document {
return 1;
}
/**
* This determines a title for the given document
*
@ -1029,7 +1033,7 @@ final class tx_dlf_document {
// Set record identifier for METS file if not present.
if (is_array($titledata) && array_key_exists('record_id', $titledata)) {
if (!in_array($this->recordId, $titledata['record_id'])) {
if (!empty($this->recordId) && !in_array($this->recordId, $titledata['record_id'])) {
array_unshift($titledata['record_id'], $this->recordId);
@ -2418,7 +2422,7 @@ final class tx_dlf_document {
$location = (string) $uid;
// Try to load METS file.
if ($this->load($location)) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($location) && $this->load($location)) {
// Initialize core METS object.
$this->init();

View File

@ -38,7 +38,7 @@ class tx_dlf_hacks {
$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
// Get all logical structure nodes with metadata, but without associated METS-Pointers.
if (($divs = $xml->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
$smLinks = $xml->xpath('//mets:structLink/mets:smLink');

View File

@ -215,7 +215,8 @@ class tx_dlf_modIndexing extends tx_dlf_module {
case 'indexFile':
if (!empty($this->data['id']) && isset($this->data['core'])) {
if (!empty($this->data['id']) && isset($this->data['core'])
&& \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->data['id'])) {
// Save document to database and index.
$doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE);
@ -338,12 +339,6 @@ class tx_dlf_modIndexing extends tx_dlf_module {
break;
case 'reindexDoc':
$this->markerArray['CONTENT'] .= $this->getDocList();
break;
case 'reindexDocs':
$this->markerArray['CONTENT'] .= $this->getCollList();