Passed
Branch oai_solr_new_directory_structu... (24cd44)
by Erik
02:44
created
common/class.tx_dlf_indexing.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             // Handle multi-volume documents.
102 102
             if ($doc->parentId) {
103 103
 
104
-                $parent =& tx_dlf_document::getInstance($doc->parentId, 0, TRUE);
104
+                $parent = & tx_dlf_document::getInstance($doc->parentId, 0, TRUE);
105 105
 
106 106
                 if ($parent->ready) {
107 107
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 
596 596
             $solrDoc->setField('purl', $metadata['purl'][0]);
597 597
 
598
-            $solrDoc->setField('location',$doc->location);
598
+            $solrDoc->setField('location', $doc->location);
599 599
 
600 600
             $solrDoc->setField('urn', $metadata['urn']);
601 601
 
Please login to merge, or discard this patch.
common/class.tx_dlf_solr.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -539,11 +539,11 @@
 block discarded – undo
539 539
      *
540 540
      * @return	array       The Apache Solr Documents that were fetched
541 541
      */
542
-    public function search_raw($query = '', $parameters = array())
542
+    public function search_raw($query = '', $parameters = array ())
543 543
     {
544
-        $solr_response = $this->service->search((string)$query, 0, $this->limit, array_merge($this->params, $parameters));
544
+        $solr_response = $this->service->search((string) $query, 0, $this->limit, array_merge($this->params, $parameters));
545 545
 
546
-        $searchresult = array();
546
+        $searchresult = array ();
547 547
 
548 548
         foreach ($solr_response->response->docs as $doc) {
549 549
             $searchresult[] = $doc;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -539,8 +539,7 @@
 block discarded – undo
539 539
      *
540 540
      * @return	array       The Apache Solr Documents that were fetched
541 541
      */
542
-    public function search_raw($query = '', $parameters = array())
543
-    {
542
+    public function search_raw($query = '', $parameters = array()) {
544 543
         $solr_response = $this->service->search((string)$query, 0, $this->limit, array_merge($this->params, $parameters));
545 544
 
546 545
         $searchresult = array();
Please login to merge, or discard this patch.
common/class.tx_dlf_document.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1526,7 +1526,7 @@
 block discarded – undo
1526 1526
 
1527 1527
             if ($parentLocation != $this->location) {
1528 1528
 
1529
-                $parentDoc =& tx_dlf_document::getInstance($parentLocation, $pid);
1529
+                $parentDoc = & tx_dlf_document::getInstance($parentLocation, $pid);
1530 1530
 
1531 1531
                 if ($parentDoc->ready) {
1532 1532
 
Please login to merge, or discard this patch.
common/class.tx_dlf_plugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
             $pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0);
133 133
 
134 134
             // Get instance of tx_dlf_document.
135
-            $this->doc =& tx_dlf_document::getInstance($this->piVars['id'], $pid);
135
+            $this->doc = & tx_dlf_document::getInstance($this->piVars['id'], $pid);
136 136
 
137 137
             if (!$this->doc->ready) {
138 138
 
Please login to merge, or discard this patch.
plugins/oai/class.tx_dlf_oai.php 4 patches
Indentation   +1020 added lines, -1020 removed lines patch added patch discarded remove patch
@@ -19,1118 +19,1118 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_oai extends tx_dlf_plugin {
21 21
 
22
-	public $scriptRelPath = 'plugins/oai/class.tx_dlf_oai.php';
23
-
24
-	/**
25
-	 * Did an error occur?
26
-	 *
27
-	 * @var	boolean
28
-	 * @access protected
29
-	 */
30
-	protected $error = FALSE;
31
-
32
-	/**
33
-	 * This holds the OAI DOM object
34
-	 *
35
-	 * @var	DOMDocument
36
-	 * @access protected
37
-	 */
38
-	protected $oai;
39
-
40
-	/**
41
-	 * This holds the configuration for all supported metadata prefixes
42
-	 *
43
-	 * @var	array
44
-	 * @access protected
45
-	 */
46
-	protected $formats = array (
47
-		'oai_dc' => array (
48
-			'schema' => 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
49
-			'namespace' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
50
-			'requiredFields' => array ('record_id'),
51
-		),
52
-		'epicur' => array (
53
-			'schema' => 'http://www.persistent-identifier.de/xepicur/version1.0/xepicur.xsd',
54
-			'namespace' => 'urn:nbn:de:1111-2004033116',
55
-			'requiredFields' => array ('purl', 'urn'),
56
-		),
57
-		'mets' => array (
58
-			'schema' => 'http://www.loc.gov/standards/mets/version17/mets.v1-7.xsd',
59
-			'namespace' => 'http://www.loc.gov/METS/',
60
-			'requiredFields' => array ('location'),
61
-		)
62
-	);
63
-
64
-	/**
65
-	 * Delete expired resumption tokens
66
-	 *
67
-	 * @access	protected
68
-	 *
69
-	 * @return	void
70
-	 */
71
-	protected function deleteExpiredTokens() {
72
-
73
-		// Delete expired resumption tokens.
74
-		$result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
75
-			'tx_dlf_tokens',
76
-			'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<'.intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
77
-		);
78
-
79
-		if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
80
-			// Deletion failed.
81
-			$this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens',SYSLOG_SEVERITY_WARNING);
82
-		}
83
-	}
84
-
85
-	/**
86
-	 * Process error
87
-	 *
88
-	 * @access	protected
89
-	 *
90
-	 * @param	string		$type: Error type
91
-	 *
92
-	 * @return	DOMElement		XML node to add to the OAI response
93
-	 */
94
-	protected function error($type) {
95
-		$this->error = TRUE;
96
-
97
-		$error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type, FALSE), ENT_NOQUOTES, 'UTF-8'));
98
-		$error->setAttribute('code', $type);
99
-
100
-		return $error;
101
-	}
102
-
103
-	/**
104
-	 * Load URL parameters
105
-	 *
106
-	 * @access	protected
107
-	 *
108
-	 * @return	void
109
-	 */
110
-	protected function getUrlParams() {
111
-
112
-		$allowedParams = array (
113
-			'verb',
114
-			'identifier',
115
-			'metadataPrefix',
116
-			'from',
117
-			'until',
118
-			'set',
119
-			'resumptionToken'
120
-		);
121
-
122
-		// Clear plugin variables.
123
-		$this->piVars = array ();
124
-
125
-		// Set only allowed parameters.
126
-		foreach ($allowedParams as $param) {
127
-			if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param)) {
128
-				$this->piVars[$param] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param);
129
-			}
130
-		}
131
-	}
132
-
133
-	/**
134
-	 * Get unqualified Dublin Core data.
135
-	 * @see http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore
136
-	 *
137
-	 * @access	protected
138
-	 *
139
-	 * @param	array		$metadata: The metadata array
140
-	 *
141
-	 * @return	DOMElement		XML node to add to the OAI response
142
-	 */
143
-	protected function getDcData(array $metadata) {
144
-
145
-		$oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc');
146
-
147
-		$oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
148
-		$oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
149
-		$oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']);
150
-
151
-		$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8')));
152
-
153
-		if (!empty($metadata['purl'])) {
154
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')));
155
-		}
156
-
157
-		if (!empty($metadata['urn'])) {
158
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')));
159
-		}
160
-
161
-		if (!empty($metadata['title'])) {
162
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:title', htmlspecialchars($metadata['title'], ENT_NOQUOTES, 'UTF-8')));
163
-		}
164
-
165
-		if (!empty($metadata['author'])) {
166
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:creator', htmlspecialchars($metadata['author'], ENT_NOQUOTES, 'UTF-8')));
167
-		}
168
-
169
-		if (!empty($metadata['year'])) {
170
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:date', htmlspecialchars($metadata['year'], ENT_NOQUOTES, 'UTF-8')));
171
-		}
22
+    public $scriptRelPath = 'plugins/oai/class.tx_dlf_oai.php';
23
+
24
+    /**
25
+     * Did an error occur?
26
+     *
27
+     * @var	boolean
28
+     * @access protected
29
+     */
30
+    protected $error = FALSE;
31
+
32
+    /**
33
+     * This holds the OAI DOM object
34
+     *
35
+     * @var	DOMDocument
36
+     * @access protected
37
+     */
38
+    protected $oai;
39
+
40
+    /**
41
+     * This holds the configuration for all supported metadata prefixes
42
+     *
43
+     * @var	array
44
+     * @access protected
45
+     */
46
+    protected $formats = array (
47
+        'oai_dc' => array (
48
+            'schema' => 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
49
+            'namespace' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
50
+            'requiredFields' => array ('record_id'),
51
+        ),
52
+        'epicur' => array (
53
+            'schema' => 'http://www.persistent-identifier.de/xepicur/version1.0/xepicur.xsd',
54
+            'namespace' => 'urn:nbn:de:1111-2004033116',
55
+            'requiredFields' => array ('purl', 'urn'),
56
+        ),
57
+        'mets' => array (
58
+            'schema' => 'http://www.loc.gov/standards/mets/version17/mets.v1-7.xsd',
59
+            'namespace' => 'http://www.loc.gov/METS/',
60
+            'requiredFields' => array ('location'),
61
+        )
62
+    );
63
+
64
+    /**
65
+     * Delete expired resumption tokens
66
+     *
67
+     * @access	protected
68
+     *
69
+     * @return	void
70
+     */
71
+    protected function deleteExpiredTokens() {
72
+
73
+        // Delete expired resumption tokens.
74
+        $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
75
+            'tx_dlf_tokens',
76
+            'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<'.intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
77
+        );
78
+
79
+        if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
80
+            // Deletion failed.
81
+            $this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens',SYSLOG_SEVERITY_WARNING);
82
+        }
83
+    }
84
+
85
+    /**
86
+     * Process error
87
+     *
88
+     * @access	protected
89
+     *
90
+     * @param	string		$type: Error type
91
+     *
92
+     * @return	DOMElement		XML node to add to the OAI response
93
+     */
94
+    protected function error($type) {
95
+        $this->error = TRUE;
96
+
97
+        $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type, FALSE), ENT_NOQUOTES, 'UTF-8'));
98
+        $error->setAttribute('code', $type);
99
+
100
+        return $error;
101
+    }
102
+
103
+    /**
104
+     * Load URL parameters
105
+     *
106
+     * @access	protected
107
+     *
108
+     * @return	void
109
+     */
110
+    protected function getUrlParams() {
111
+
112
+        $allowedParams = array (
113
+            'verb',
114
+            'identifier',
115
+            'metadataPrefix',
116
+            'from',
117
+            'until',
118
+            'set',
119
+            'resumptionToken'
120
+        );
121
+
122
+        // Clear plugin variables.
123
+        $this->piVars = array ();
124
+
125
+        // Set only allowed parameters.
126
+        foreach ($allowedParams as $param) {
127
+            if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param)) {
128
+                $this->piVars[$param] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param);
129
+            }
130
+        }
131
+    }
132
+
133
+    /**
134
+     * Get unqualified Dublin Core data.
135
+     * @see http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore
136
+     *
137
+     * @access	protected
138
+     *
139
+     * @param	array		$metadata: The metadata array
140
+     *
141
+     * @return	DOMElement		XML node to add to the OAI response
142
+     */
143
+    protected function getDcData(array $metadata) {
144
+
145
+        $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc');
146
+
147
+        $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
148
+        $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
149
+        $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']);
150
+
151
+        $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8')));
152
+
153
+        if (!empty($metadata['purl'])) {
154
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')));
155
+        }
156
+
157
+        if (!empty($metadata['urn'])) {
158
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')));
159
+        }
160
+
161
+        if (!empty($metadata['title'])) {
162
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:title', htmlspecialchars($metadata['title'], ENT_NOQUOTES, 'UTF-8')));
163
+        }
164
+
165
+        if (!empty($metadata['author'])) {
166
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:creator', htmlspecialchars($metadata['author'], ENT_NOQUOTES, 'UTF-8')));
167
+        }
168
+
169
+        if (!empty($metadata['year'])) {
170
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:date', htmlspecialchars($metadata['year'], ENT_NOQUOTES, 'UTF-8')));
171
+        }
172 172
 
173
-		if (!empty($metadata['place'])) {
174
-			$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:coverage', htmlspecialchars($metadata['place'], ENT_NOQUOTES, 'UTF-8')));
175
-		}
173
+        if (!empty($metadata['place'])) {
174
+            $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:coverage', htmlspecialchars($metadata['place'], ENT_NOQUOTES, 'UTF-8')));
175
+        }
176 176
 
177
-		$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:format', 'application/mets+xml'));
178
-		$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:type', 'Text'));
177
+        $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:format', 'application/mets+xml'));
178
+        $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:type', 'Text'));
179 179
 
180
-		if (!empty($metadata['partof'])) {
181
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
182
-				'tx_dlf_documents.record_id',
183
-				'tx_dlf_documents',
184
-				'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'),
185
-				'',
186
-				'',
187
-				'1'
188
-			);
180
+        if (!empty($metadata['partof'])) {
181
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
182
+                'tx_dlf_documents.record_id',
183
+                'tx_dlf_documents',
184
+                'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'),
185
+                '',
186
+                '',
187
+                '1'
188
+            );
189 189
 
190
-			if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
191
-				$partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
190
+            if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
191
+                $partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
192 192
 
193
-				$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8')));
194
-			}
195
-		}
193
+                $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8')));
194
+            }
195
+        }
196 196
 
197
-		return $oai_dc;
198
-	}
197
+        return $oai_dc;
198
+    }
199 199
 
200
-	/**
201
-	 * Get epicur data.
202
-	 * @see http://www.persistent-identifier.de/?link=210
203
-	 *
204
-	 * @access	protected
205
-	 *
206
-	 * @param	array		$metadata: The metadata array
207
-	 *
208
-	 * @return	DOMElement		XML node to add to the OAI response
209
-	 */
210
-	protected function getEpicurData(array $metadata) {
200
+    /**
201
+     * Get epicur data.
202
+     * @see http://www.persistent-identifier.de/?link=210
203
+     *
204
+     * @access	protected
205
+     *
206
+     * @param	array		$metadata: The metadata array
207
+     *
208
+     * @return	DOMElement		XML node to add to the OAI response
209
+     */
210
+    protected function getEpicurData(array $metadata) {
211 211
 
212
-		// Define all XML elements with or without qualified namespace.
213
-		if (empty($this->conf['unqualified_epicur'])) {
214
-			$epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur');
212
+        // Define all XML elements with or without qualified namespace.
213
+        if (empty($this->conf['unqualified_epicur'])) {
214
+            $epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur');
215 215
 
216
-			$admin = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:administrative_data');
216
+            $admin = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:administrative_data');
217 217
 
218
-			$delivery = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:delivery');
218
+            $delivery = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:delivery');
219 219
 
220
-			$update = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:update_status');
220
+            $update = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:update_status');
221 221
 
222
-			$transfer = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:transfer');
222
+            $transfer = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:transfer');
223 223
 
224
-			$format = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:format', 'text/html');
224
+            $format = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:format', 'text/html');
225 225
 
226
-			$record = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:record');
226
+            $record = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:record');
227 227
 
228
-			$identifier = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
228
+            $identifier = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
229 229
 
230
-			$resource = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:resource');
230
+            $resource = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:resource');
231 231
 
232
-			$ident = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
232
+            $ident = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
233 233
 
234
-		} else {
235
-			$epicur = $this->oai->createElement('epicur');
236
-			$epicur->setAttribute('xmlns', $this->formats['epicur']['namespace']);
234
+        } else {
235
+            $epicur = $this->oai->createElement('epicur');
236
+            $epicur->setAttribute('xmlns', $this->formats['epicur']['namespace']);
237 237
 
238
-			$admin = $this->oai->createElement('administrative_data');
238
+            $admin = $this->oai->createElement('administrative_data');
239 239
 
240
-			$delivery = $this->oai->createElement('delivery');
240
+            $delivery = $this->oai->createElement('delivery');
241 241
 
242
-			$update = $this->oai->createElement('update_status');
242
+            $update = $this->oai->createElement('update_status');
243 243
 
244
-			$transfer = $this->oai->createElement('transfer');
244
+            $transfer = $this->oai->createElement('transfer');
245 245
 
246
-			$format = $this->oai->createElement('format', 'text/html');
246
+            $format = $this->oai->createElement('format', 'text/html');
247 247
 
248
-			$record = $this->oai->createElement('record');
248
+            $record = $this->oai->createElement('record');
249 249
 
250
-			$identifier = $this->oai->createElement('identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
250
+            $identifier = $this->oai->createElement('identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'));
251 251
 
252
-			$resource = $this->oai->createElement('resource');
252
+            $resource = $this->oai->createElement('resource');
253 253
 
254
-			$ident = $this->oai->createElement('identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
255
-		}
254
+            $ident = $this->oai->createElement('identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'));
255
+        }
256 256
 
257
-		// Add attributes and build XML tree.
258
-		$epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
259
-		$epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']);
257
+        // Add attributes and build XML tree.
258
+        $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
259
+        $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']);
260 260
 
261
-		// Do we update an URN or register a new one?
262
-		if ($metadata['tstamp'] == $metadata['crdate']) {
263
-			$update->setAttribute('type', 'urn_new');
264
-		} else {
265
-			$update->setAttribute('type', 'url_update_general');
266
-		}
261
+        // Do we update an URN or register a new one?
262
+        if ($metadata['tstamp'] == $metadata['crdate']) {
263
+            $update->setAttribute('type', 'urn_new');
264
+        } else {
265
+            $update->setAttribute('type', 'url_update_general');
266
+        }
267 267
 
268
-		$delivery->appendChild($update);
268
+        $delivery->appendChild($update);
269 269
 
270
-		$transfer->setAttribute('type', 'http');
270
+        $transfer->setAttribute('type', 'http');
271 271
 
272
-		$delivery->appendChild($transfer);
272
+        $delivery->appendChild($transfer);
273 273
 
274
-		$admin->appendChild($delivery);
274
+        $admin->appendChild($delivery);
275 275
 
276
-		$epicur->appendChild($admin);
276
+        $epicur->appendChild($admin);
277 277
 
278
-		$identifier->setAttribute('scheme', 'urn:nbn:de');
278
+        $identifier->setAttribute('scheme', 'urn:nbn:de');
279 279
 
280
-		$record->appendChild($identifier);
280
+        $record->appendChild($identifier);
281 281
 
282
-		$ident->setAttribute('scheme', 'url');
283
-		$ident->setAttribute('type', 'frontpage');
284
-		$ident->setAttribute('role', 'primary');
282
+        $ident->setAttribute('scheme', 'url');
283
+        $ident->setAttribute('type', 'frontpage');
284
+        $ident->setAttribute('role', 'primary');
285 285
 
286
-		$resource->appendChild($ident);
286
+        $resource->appendChild($ident);
287 287
 
288
-		$format->setAttribute('scheme', 'imt');
288
+        $format->setAttribute('scheme', 'imt');
289 289
 
290
-		$resource->appendChild($format);
290
+        $resource->appendChild($format);
291 291
 
292
-		$record->appendChild($resource);
292
+        $record->appendChild($resource);
293 293
 
294
-		$epicur->appendChild($record);
294
+        $epicur->appendChild($record);
295 295
 
296
-		return $epicur;
297
-	}
296
+        return $epicur;
297
+    }
298 298
 
299
-	/**
300
-	 * Get METS data.
301
-	 * @see http://www.loc.gov/standards/mets/docs/mets.v1-7.html
302
-	 *
303
-	 * @access	protected
304
-	 *
305
-	 * @param	array		$metadata: The metadata array
306
-	 *
307
-	 * @return	DOMElement		XML node to add to the OAI response
308
-	 */
309
-	protected function getMetsData(array $metadata) {
299
+    /**
300
+     * Get METS data.
301
+     * @see http://www.loc.gov/standards/mets/docs/mets.v1-7.html
302
+     *
303
+     * @access	protected
304
+     *
305
+     * @param	array		$metadata: The metadata array
306
+     *
307
+     * @return	DOMElement		XML node to add to the OAI response
308
+     */
309
+    protected function getMetsData(array $metadata) {
310 310
 
311
-		$mets = NULL;
311
+        $mets = NULL;
312 312
 
313
-		// Load METS file.
314
-		$xml = new DOMDocument();
313
+        // Load METS file.
314
+        $xml = new DOMDocument();
315 315
 
316
-		if ($xml->load($metadata['location'])) {
317
-			// Get root element.
318
-			$root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets');
316
+        if ($xml->load($metadata['location'])) {
317
+            // Get root element.
318
+            $root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets');
319 319
 
320
-			if ($root->item(0) instanceof DOMNode) {
321
-				// Import node into DOMDocument.
322
-				$mets = $this->oai->importNode($root->item(0), TRUE);
323
-			} else {
324
-				   $this->devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
325
-			}
326
-		} else {
327
-			$this->devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
328
-		}
320
+            if ($root->item(0) instanceof DOMNode) {
321
+                // Import node into DOMDocument.
322
+                $mets = $this->oai->importNode($root->item(0), TRUE);
323
+            } else {
324
+                    $this->devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
325
+            }
326
+        } else {
327
+            $this->devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
328
+        }
329 329
 
330
-		if ($mets === NULL) {
331
-			$mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8'));
332
-		}
330
+        if ($mets === NULL) {
331
+            $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8'));
332
+        }
333 333
 
334
-		return $mets;
335
-	}
334
+        return $mets;
335
+    }
336 336
 
337
-	/**
338
-	 * The main method of the PlugIn
339
-	 *
340
-	 * @access	public
341
-	 *
342
-	 * @param	string		$content: The PlugIn content
343
-	 * @param	array		$conf: The PlugIn configuration
344
-	 *
345
-	 * @return	void
346
-	 */
347
-	public function main($content, $conf) {
337
+    /**
338
+     * The main method of the PlugIn
339
+     *
340
+     * @access	public
341
+     *
342
+     * @param	string		$content: The PlugIn content
343
+     * @param	array		$conf: The PlugIn configuration
344
+     *
345
+     * @return	void
346
+     */
347
+    public function main($content, $conf) {
348 348
 
349
-		// Initialize plugin.
350
-		$this->init($conf);
349
+        // Initialize plugin.
350
+        $this->init($conf);
351 351
 
352
-		// Turn cache off.
353
-		$this->setCache(FALSE);
352
+        // Turn cache off.
353
+        $this->setCache(FALSE);
354 354
 
355
-		// Get GET and POST variables.
356
-		$this->getUrlParams();
355
+        // Get GET and POST variables.
356
+        $this->getUrlParams();
357 357
 
358
-		// Delete expired resumption tokens.
359
-		$this->deleteExpiredTokens();
358
+        // Delete expired resumption tokens.
359
+        $this->deleteExpiredTokens();
360 360
 
361
-		// Create XML document.
362
-		$this->oai = new DOMDocument('1.0', 'UTF-8');
361
+        // Create XML document.
362
+        $this->oai = new DOMDocument('1.0', 'UTF-8');
363 363
 
364
-		// Add processing instruction (aka XSL stylesheet).
365
-		if (!empty($this->conf['stylesheet'])) {
366
-			// Resolve "EXT:" prefix in file path.
367
-			if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
364
+        // Add processing instruction (aka XSL stylesheet).
365
+        if (!empty($this->conf['stylesheet'])) {
366
+            // Resolve "EXT:" prefix in file path.
367
+            if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
368 368
 
369
-				list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
369
+                list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
370 370
 
371
-				if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
372
-					$this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath;
373
-				}
374
-			}
371
+                if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
372
+                    $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath;
373
+                }
374
+            }
375 375
 
376
-			$stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']);
376
+            $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']);
377 377
 
378
-		} else {
379
-			// Use default stylesheet if no custom stylesheet is given.
380
-			$stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
381
-		}
382
-
383
-		$this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
384
-
385
-		// Create root element.
386
-		$root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
387
-
388
-		$root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
389
-		$root->setAttributeNS('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');
390
-
391
-		// Add response date.
392
-		$root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'])));
393
-
394
-		// Get response data.
395
-		switch ($this->piVars['verb']) {
396
-			case 'GetRecord':
397
-				$response = $this->verbGetRecord();
398
-				break;
399
-
400
-			case 'Identify':
401
-				$response = $this->verbIdentify();
402
-				break;
403
-
404
-			case 'ListIdentifiers':
405
-				$response = $this->verbListIdentifiers();
406
-				break;
407
-
408
-			case 'ListMetadataFormats':
409
-				$response = $this->verbListMetadataFormats();
410
-				break;
411
-
412
-			case 'ListRecords':
413
-				$response = $this->verbListRecords();
414
-				break;
415
-
416
-			case 'ListSets':
417
-				$response = $this->verbListSets();
418
-				break;
419
-
420
-			default:
421
-				$response = $this->error('badVerb');
422
-		}
423
-
424
-		// Add request.
425
-		$linkConf = array (
426
-			'parameter' => $GLOBALS['TSFE']->id,
427
-			'forceAbsoluteUrl' => 1
428
-		);
429
-
430
-		$request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'));
431
-
432
-		if (!$this->error) {
433
-			foreach ($this->piVars as $key => $value) {
434
-				$request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8'));
435
-			}
436
-		}
437
-
438
-		$root->appendChild($request);
439
-		$root->appendChild($response);
440
-
441
-		$this->oai->appendChild($root);
442
-
443
-		$content = $this->oai->saveXML();
444
-
445
-		// Clean output buffer.
446
-		\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
378
+        } else {
379
+            // Use default stylesheet if no custom stylesheet is given.
380
+            $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
381
+        }
382
+
383
+        $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
384
+
385
+        // Create root element.
386
+        $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
387
+
388
+        $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
389
+        $root->setAttributeNS('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');
390
+
391
+        // Add response date.
392
+        $root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'])));
393
+
394
+        // Get response data.
395
+        switch ($this->piVars['verb']) {
396
+            case 'GetRecord':
397
+                $response = $this->verbGetRecord();
398
+                break;
399
+
400
+            case 'Identify':
401
+                $response = $this->verbIdentify();
402
+                break;
403
+
404
+            case 'ListIdentifiers':
405
+                $response = $this->verbListIdentifiers();
406
+                break;
407
+
408
+            case 'ListMetadataFormats':
409
+                $response = $this->verbListMetadataFormats();
410
+                break;
411
+
412
+            case 'ListRecords':
413
+                $response = $this->verbListRecords();
414
+                break;
415
+
416
+            case 'ListSets':
417
+                $response = $this->verbListSets();
418
+                break;
419
+
420
+            default:
421
+                $response = $this->error('badVerb');
422
+        }
423
+
424
+        // Add request.
425
+        $linkConf = array (
426
+            'parameter' => $GLOBALS['TSFE']->id,
427
+            'forceAbsoluteUrl' => 1
428
+        );
429
+
430
+        $request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'));
431
+
432
+        if (!$this->error) {
433
+            foreach ($this->piVars as $key => $value) {
434
+                $request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8'));
435
+            }
436
+        }
437
+
438
+        $root->appendChild($request);
439
+        $root->appendChild($response);
440
+
441
+        $this->oai->appendChild($root);
442
+
443
+        $content = $this->oai->saveXML();
444
+
445
+        // Clean output buffer.
446
+        \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
447 447
 
448
-		// Send headers.
449
-		header('HTTP/1.1 200 OK');
450
-		header('Cache-Control: no-cache');
451
-		header('Content-Length: '.strlen($content));
452
-		header('Content-Type: text/xml; charset=utf-8');
453
-		header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
454
-		header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
455
-
456
-		echo $content;
448
+        // Send headers.
449
+        header('HTTP/1.1 200 OK');
450
+        header('Cache-Control: no-cache');
451
+        header('Content-Length: '.strlen($content));
452
+        header('Content-Type: text/xml; charset=utf-8');
453
+        header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
454
+        header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
455
+
456
+        echo $content;
457 457
 
458
-		// Flush output buffer and end script processing.
459
-		ob_end_flush();
460
-
461
-		exit;
462
-	}
458
+        // Flush output buffer and end script processing.
459
+        ob_end_flush();
460
+
461
+        exit;
462
+    }
463 463
 
464
-	/**
465
-	 * Continue with resumption token
466
-	 *
467
-	 * @access	protected
468
-	 *
469
-	 * @return	string		Substitution for subpart "###RESPONSE###"
470
-	 */
471
-	protected function resume() {
472
-		// Get resumption token.
473
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
474
-			'tx_dlf_tokens.options AS options',
475
-			'tx_dlf_tokens',
476
-			'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'),
477
-			'',
478
-			'',
479
-			'1'
480
-		);
481
-
482
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
483
-			// No resumption token found or resumption token expired.
484
-			return $this->error('badResumptionToken');
485
-		}
486
-
487
-		$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
488
-
489
-		$resultSet = unserialize($resArray['options']);
490
-
491
-		return $this->generateOutputForDocumentList($resultSet);
492
-
493
-	}
494
-
495
-	/**
496
-	 * Process verb "GetRecord"
497
-	 *
498
-	 * @access	protected
499
-	 *
500
-	 * @return	string		Substitution for subpart "###RESPONSE###"
501
-	 */
502
-	protected function verbGetRecord() {
503
-
504
-		if (count($this->piVars) != 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) {
505
-			return $this->error('badArgument');
506
-		}
507
-
508
-		if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
509
-			return $this->error('cannotDisseminateFormat');
510
-		}
511
-
512
-		$where = '';
513
-
514
-		if (!$this->conf['show_userdefined']) {
515
-			$where .= ' AND tx_dlf_collections.fe_cruser_id=0';
516
-		}
517
-
518
-		$record = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
519
-			'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
520
-			'tx_dlf_documents',
521
-			'tx_dlf_relations',
522
-			'tx_dlf_collections',
523
-			'AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents').' AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
524
-			'tx_dlf_documents.uid',
525
-			'tx_dlf_documents.tstamp',
526
-			'1'
527
-		);
528
-
529
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($record)) {
530
-			return $this->error('idDoesNotExist');
531
-		}
532
-
533
-		$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($record);
534
-
535
-		// Check for required fields.
536
-		foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
537
-			if (empty($resArray[$required])) {
538
-				return $this->error('cannotDisseminateFormat');
539
-			}
540
-		}
541
-
542
-		$GetRecord = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'GetRecord');
543
-
544
-		$recordNode = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
545
-
546
-		$headerNode = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
547
-		$headerNode->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
548
-		$headerNode->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
549
-
550
-		// Handle deleted documents.
551
-		// TODO: Use TYPO3 API functions here!
552
-		if ($resArray['deleted'] || $resArray['hidden']) {
553
-			$headerNode->setAttribute('status', 'deleted');
554
-
555
-			$recordNode->appendChild($headerNode);
556
-
557
-		} else {
558
-			foreach (explode(' ', $resArray['collections']) as $spec) {
559
-				$headerNode->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
560
-			}
561
-
562
-			$recordNode->appendChild($headerNode);
563
-
564
-			$metadataNode = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
565
-
566
-			switch ($this->piVars['metadataPrefix']) {
567
-				case 'oai_dc':
568
-					$metadataNode->appendChild($this->getDcData($resArray));
569
-					break;
570
-
571
-				case 'epicur':
572
-					$metadataNode->appendChild($this->getEpicurData($resArray));
573
-					break;
574
-
575
-				case 'mets':
576
-					$metadataNode->appendChild($this->getMetsData($resArray));
577
-					break;
578
-			}
579
-
580
-			$recordNode->appendChild($metadataNode);
581
-		}
582
-
583
-		$GetRecord->appendChild($recordNode);
584
-
585
-		return $GetRecord;
586
-	}
587
-
588
-	/**
589
-	 * Process verb "Identify"
590
-	 *
591
-	 * @access	protected
592
-	 *
593
-	 * @return	DOMElement		XML node to add to the OAI response
594
-	 */
595
-	protected function verbIdentify() {
596
-
597
-		// Check for invalid arguments.
598
-		if (count($this->piVars) > 1) {
599
-			return $this->error('badArgument');
600
-		}
601
-
602
-		// Get repository name and administrative contact.
603
-		// Use default values for an installation with incomplete plugin configuration.
604
-
605
-		$adminEmail = '[email protected]';
606
-		$repositoryName = 'Kitodo.Presentation OAI-PMH interface (incomplete configuration)';
607
-
608
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
609
-			'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact',
610
-			'tx_dlf_libraries',
611
-			'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
612
-			'',
613
-			'',
614
-			''
615
-		);
616
-
617
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
618
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
619
-
620
-			$adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES);
621
-			$repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES);
622
-
623
-		} else {
624
-			$this->devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration', SYSLOG_SEVERITY_NOTICE);
625
-		}
626
-
627
-		// Get earliest datestamp. Use a default value if that fails.
628
-
629
-		$earliestDatestamp = '0000-00-00T00:00:00Z';
630
-
631
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
632
-			'tx_dlf_documents.tstamp AS tstamp',
633
-			'tx_dlf_documents',
634
-			'tx_dlf_documents.pid=' . intval($this->conf['pages']),
635
-			'',
636
-			'tx_dlf_documents.tstamp ASC',
637
-			'1'
638
-		);
639
-
640
-		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
641
-			list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
642
-			$earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
643
-		} else {
644
-			$this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' . $this->conf['pages'] . '"',SYSLOG_SEVERITY_NOTICE);
645
-		}
646
-
647
-		$linkConf = array (
648
-			'parameter' => $GLOBALS['TSFE']->id,
649
-			'forceAbsoluteUrl' => 1
650
-		);
651
-		$baseURL = htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES);
652
-
653
-		// Add identification node.
654
-		$Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify');
655
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'repositoryName', $repositoryName));
656
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','baseURL', $baseURL));
657
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','protocolVersion', '2.0'));
658
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','adminEmail', $adminEmail));
659
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','earliestDatestamp', $earliestDatestamp));
660
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','deletedRecord', 'transient'));
661
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','granularity', 'YYYY-MM-DDThh:mm:ssZ'));
662
-
663
-		return $Identify;
664
-	}
665
-
666
-	/**
667
-	 * Process verb "ListIdentifiers"
668
-	 *
669
-	 * @access	protected
670
-	 *
671
-	 * @return	string		Substitution for subpart "###RESPONSE###"
672
-	 */
673
-	protected function verbListIdentifiers() {
674
-
675
-		// If we have a resumption token we can continue our work
676
-		if (!empty($this->piVars['resumptionToken'])) {
677
-			// "resumptionToken" is an exclusive argument.
678
-			if (count($this->piVars) > 2) {
679
-				return $this->error('badArgument');
680
-			} else {
681
-				return $this->resume();
682
-			}
683
-		}
684
-
685
-		// "metadataPrefix" is required and "identifier" is not allowed.
686
-		if (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
687
-			return $this->error('badArgument');
688
-		}
689
-
690
-		if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
691
-			return $this->error('cannotDisseminateFormat');
692
-		}
693
-
694
-		try {
695
-			$documentSet = $this->fetchDocumentUIDs();
696
-		} catch (Exception $exception) {
697
-			return $this->error($exception->getMessage());
698
-		}
699
-
700
-		$resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
701
-
702
-		$resultSet->reset();
703
-		$resultSet->add($documentSet);
704
-		$resultSet->metadata = array (
705
-			'completeListSize' => count($documentSet),
706
-			'metadataPrefix' => $this->piVars['metadataPrefix'],
707
-		);
708
-
709
-		return $this->generateOutputForDocumentList($resultSet);
710
-
711
-	}
712
-
713
-	/**
714
-	 * Process verb "ListMetadataFormats"
715
-	 *
716
-	 * @access	protected
717
-	 *
718
-	 * @return	DOMElement		XML node to add to the OAI response
719
-	 */
720
-	protected function verbListMetadataFormats() {
721
-
722
-		$resArray = array ();
723
-
724
-		// Check for invalid arguments.
725
-		if (count($this->piVars) > 1) {
726
-			if (empty($this->piVars['identifier']) || count($this->piVars) > 2) {
727
-				return $this->error('badArgument');
728
-			}
729
-
730
-			// Check given identifier.
731
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
732
-				'tx_dlf_documents.*',
733
-				'tx_dlf_documents',
734
-				'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents'),
735
-				'',
736
-				'',
737
-				'1'
738
-			);
739
-
740
-			if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
741
-				return $this->error('idDoesNotExist');
742
-			}
743
-
744
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
745
-		}
746
-
747
-		// Add metadata formats node.
748
-		$ListMetadaFormats = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListMetadataFormats');
749
-
750
-		foreach ($this->formats as $prefix => $details) {
751
-			if (!empty($resArray)) {
752
-				foreach ($details['requiredFields'] as $required) {
753
-					if (empty($resArray[$required])) {
754
-						// Skip metadata formats whose requirements are not met.
755
-						continue 2;
756
-					}
757
-				}
758
-			}
759
-
760
-			// Add format node.
761
-			$format = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataFormat');
762
-
763
-			$format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataPrefix', htmlspecialchars($prefix, ENT_NOQUOTES, 'UTF-8')));
764
-			$format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'schema', htmlspecialchars($details['schema'], ENT_NOQUOTES, 'UTF-8')));
765
-			$format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataNamespace', htmlspecialchars($details['namespace'], ENT_NOQUOTES, 'UTF-8')));
766
-
767
-			$ListMetadaFormats->appendChild($format);
768
-		}
769
-
770
-		return $ListMetadaFormats;
771
-	}
772
-
773
-	/**
774
-	 * Process verb "ListRecords"
775
-	 *
776
-	 * @access	protected
777
-	 *
778
-	 * @return	string		Substitution for subpart "###RESPONSE###"
779
-	 */
780
-	protected function verbListRecords() {
781
-
782
-		// Check for invalid arguments.
783
-		if (!empty($this->piVars['resumptionToken'])) {
784
-			// "resumptionToken" is an exclusive argument.
785
-			if (count($this->piVars) > 2) {
786
-				return $this->error('badArgument');
787
-			} else {
788
-				return $this->resume();
789
-			}
790
-
791
-		}
792
-
793
-		if (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
794
-			// "metadataPrefix" is required and "identifier" is not allowed.
795
-			return $this->error('badArgument');
796
-		}
797
-
798
-		// Check "metadataPrefix" for valid value.
799
-		if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
800
-			return $this->error('cannotDisseminateFormat');
801
-		}
802
-
803
-		try {
804
-			$documentSet = $this->fetchDocumentUIDs();
805
-		} catch (Exception $exception) {
806
-			return $this->error($exception->getMessage());
807
-		}
808
-
809
-		$resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
810
-
811
-		$resultSet->reset();
812
-		$resultSet->add($documentSet);
813
-		$resultSet->metadata = array (
814
-			'completeListSize' => count($documentSet),
815
-			'metadataPrefix' => $this->piVars['metadataPrefix'],
816
-		);
817
-
818
-		return $this->generateOutputForDocumentList($resultSet);
819
-	}
820
-
821
-	/**
822
-	 * Process verb "ListSets"
823
-	 *
824
-	 * @access	protected
825
-	 *
826
-	 * @return	string		Substitution for subpart "###RESPONSE###"
827
-	 */
828
-	protected function verbListSets() {
829
-
830
-		// Check for invalid arguments.
831
-		if (count($this->piVars) > 1) {
832
-			if (!empty($this->piVars['resumptionToken'])) {
833
-				return $this->error('badResumptionToken');
834
-			} else {
835
-				return $this->error('badArgument');
836
-			}
837
-		}
838
-
839
-		$where = '';
840
-
841
-		if (!$this->conf['show_userdefined']) {
842
-			$where = ' AND tx_dlf_collections.fe_cruser_id=0';
843
-		}
844
-
845
-		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
846
-			'tx_dlf_collections.oai_name AS oai_name,tx_dlf_collections.label AS label',
847
-			'tx_dlf_collections',
848
-			'tx_dlf_collections.sys_language_uid IN (-1,0) AND NOT tx_dlf_collections.oai_name=\'\' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
849
-			'tx_dlf_collections.oai_name',
850
-			'tx_dlf_collections.oai_name',
851
-			''
852
-		);
853
-
854
-		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
855
-			return $this->error('noSetHierarchy');
856
-		}
857
-
858
-		$ListSets = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListSets');
859
-
860
-		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
861
-
862
-			$set = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'set');
863
-
864
-			$set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($resArray['oai_name'], ENT_NOQUOTES, 'UTF-8')));
865
-			$set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setName', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
866
-
867
-			$ListSets->appendChild($set);
868
-		}
869
-
870
-		return $ListSets;
871
-	}
872
-
873
-
874
-
875
-	/**
876
-	 * @return array
877
-	 * @throws Exception
878
-	 */
879
-	private function fetchDocumentUIDs()
880
-	{
881
-		$solr_query = '';
882
-
883
-		if (!$this->conf['show_userdefined']) {
884
-			$where = ' AND tx_dlf_collections.fe_cruser_id=0';
885
-		}
464
+    /**
465
+     * Continue with resumption token
466
+     *
467
+     * @access	protected
468
+     *
469
+     * @return	string		Substitution for subpart "###RESPONSE###"
470
+     */
471
+    protected function resume() {
472
+        // Get resumption token.
473
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
474
+            'tx_dlf_tokens.options AS options',
475
+            'tx_dlf_tokens',
476
+            'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'),
477
+            '',
478
+            '',
479
+            '1'
480
+        );
481
+
482
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
483
+            // No resumption token found or resumption token expired.
484
+            return $this->error('badResumptionToken');
485
+        }
486
+
487
+        $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
488
+
489
+        $resultSet = unserialize($resArray['options']);
490
+
491
+        return $this->generateOutputForDocumentList($resultSet);
492
+
493
+    }
494
+
495
+    /**
496
+     * Process verb "GetRecord"
497
+     *
498
+     * @access	protected
499
+     *
500
+     * @return	string		Substitution for subpart "###RESPONSE###"
501
+     */
502
+    protected function verbGetRecord() {
503
+
504
+        if (count($this->piVars) != 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) {
505
+            return $this->error('badArgument');
506
+        }
507
+
508
+        if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
509
+            return $this->error('cannotDisseminateFormat');
510
+        }
511
+
512
+        $where = '';
513
+
514
+        if (!$this->conf['show_userdefined']) {
515
+            $where .= ' AND tx_dlf_collections.fe_cruser_id=0';
516
+        }
517
+
518
+        $record = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
519
+            'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
520
+            'tx_dlf_documents',
521
+            'tx_dlf_relations',
522
+            'tx_dlf_collections',
523
+            'AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents').' AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
524
+            'tx_dlf_documents.uid',
525
+            'tx_dlf_documents.tstamp',
526
+            '1'
527
+        );
528
+
529
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($record)) {
530
+            return $this->error('idDoesNotExist');
531
+        }
532
+
533
+        $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($record);
534
+
535
+        // Check for required fields.
536
+        foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
537
+            if (empty($resArray[$required])) {
538
+                return $this->error('cannotDisseminateFormat');
539
+            }
540
+        }
541
+
542
+        $GetRecord = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'GetRecord');
543
+
544
+        $recordNode = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
545
+
546
+        $headerNode = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
547
+        $headerNode->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
548
+        $headerNode->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
549
+
550
+        // Handle deleted documents.
551
+        // TODO: Use TYPO3 API functions here!
552
+        if ($resArray['deleted'] || $resArray['hidden']) {
553
+            $headerNode->setAttribute('status', 'deleted');
554
+
555
+            $recordNode->appendChild($headerNode);
556
+
557
+        } else {
558
+            foreach (explode(' ', $resArray['collections']) as $spec) {
559
+                $headerNode->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
560
+            }
561
+
562
+            $recordNode->appendChild($headerNode);
563
+
564
+            $metadataNode = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
565
+
566
+            switch ($this->piVars['metadataPrefix']) {
567
+                case 'oai_dc':
568
+                    $metadataNode->appendChild($this->getDcData($resArray));
569
+                    break;
570
+
571
+                case 'epicur':
572
+                    $metadataNode->appendChild($this->getEpicurData($resArray));
573
+                    break;
574
+
575
+                case 'mets':
576
+                    $metadataNode->appendChild($this->getMetsData($resArray));
577
+                    break;
578
+            }
579
+
580
+            $recordNode->appendChild($metadataNode);
581
+        }
582
+
583
+        $GetRecord->appendChild($recordNode);
584
+
585
+        return $GetRecord;
586
+    }
587
+
588
+    /**
589
+     * Process verb "Identify"
590
+     *
591
+     * @access	protected
592
+     *
593
+     * @return	DOMElement		XML node to add to the OAI response
594
+     */
595
+    protected function verbIdentify() {
596
+
597
+        // Check for invalid arguments.
598
+        if (count($this->piVars) > 1) {
599
+            return $this->error('badArgument');
600
+        }
601
+
602
+        // Get repository name and administrative contact.
603
+        // Use default values for an installation with incomplete plugin configuration.
604
+
605
+        $adminEmail = '[email protected]';
606
+        $repositoryName = 'Kitodo.Presentation OAI-PMH interface (incomplete configuration)';
607
+
608
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
609
+            'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact',
610
+            'tx_dlf_libraries',
611
+            'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
612
+            '',
613
+            '',
614
+            ''
615
+        );
616
+
617
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
618
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
619
+
620
+            $adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES);
621
+            $repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES);
622
+
623
+        } else {
624
+            $this->devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration', SYSLOG_SEVERITY_NOTICE);
625
+        }
626
+
627
+        // Get earliest datestamp. Use a default value if that fails.
628
+
629
+        $earliestDatestamp = '0000-00-00T00:00:00Z';
630
+
631
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
632
+            'tx_dlf_documents.tstamp AS tstamp',
633
+            'tx_dlf_documents',
634
+            'tx_dlf_documents.pid=' . intval($this->conf['pages']),
635
+            '',
636
+            'tx_dlf_documents.tstamp ASC',
637
+            '1'
638
+        );
639
+
640
+        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
641
+            list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
642
+            $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
643
+        } else {
644
+            $this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' . $this->conf['pages'] . '"',SYSLOG_SEVERITY_NOTICE);
645
+        }
646
+
647
+        $linkConf = array (
648
+            'parameter' => $GLOBALS['TSFE']->id,
649
+            'forceAbsoluteUrl' => 1
650
+        );
651
+        $baseURL = htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES);
652
+
653
+        // Add identification node.
654
+        $Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify');
655
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'repositoryName', $repositoryName));
656
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','baseURL', $baseURL));
657
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','protocolVersion', '2.0'));
658
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','adminEmail', $adminEmail));
659
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','earliestDatestamp', $earliestDatestamp));
660
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','deletedRecord', 'transient'));
661
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','granularity', 'YYYY-MM-DDThh:mm:ssZ'));
662
+
663
+        return $Identify;
664
+    }
665
+
666
+    /**
667
+     * Process verb "ListIdentifiers"
668
+     *
669
+     * @access	protected
670
+     *
671
+     * @return	string		Substitution for subpart "###RESPONSE###"
672
+     */
673
+    protected function verbListIdentifiers() {
674
+
675
+        // If we have a resumption token we can continue our work
676
+        if (!empty($this->piVars['resumptionToken'])) {
677
+            // "resumptionToken" is an exclusive argument.
678
+            if (count($this->piVars) > 2) {
679
+                return $this->error('badArgument');
680
+            } else {
681
+                return $this->resume();
682
+            }
683
+        }
684
+
685
+        // "metadataPrefix" is required and "identifier" is not allowed.
686
+        if (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
687
+            return $this->error('badArgument');
688
+        }
689
+
690
+        if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
691
+            return $this->error('cannotDisseminateFormat');
692
+        }
693
+
694
+        try {
695
+            $documentSet = $this->fetchDocumentUIDs();
696
+        } catch (Exception $exception) {
697
+            return $this->error($exception->getMessage());
698
+        }
699
+
700
+        $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
701
+
702
+        $resultSet->reset();
703
+        $resultSet->add($documentSet);
704
+        $resultSet->metadata = array (
705
+            'completeListSize' => count($documentSet),
706
+            'metadataPrefix' => $this->piVars['metadataPrefix'],
707
+        );
708
+
709
+        return $this->generateOutputForDocumentList($resultSet);
710
+
711
+    }
712
+
713
+    /**
714
+     * Process verb "ListMetadataFormats"
715
+     *
716
+     * @access	protected
717
+     *
718
+     * @return	DOMElement		XML node to add to the OAI response
719
+     */
720
+    protected function verbListMetadataFormats() {
721
+
722
+        $resArray = array ();
723
+
724
+        // Check for invalid arguments.
725
+        if (count($this->piVars) > 1) {
726
+            if (empty($this->piVars['identifier']) || count($this->piVars) > 2) {
727
+                return $this->error('badArgument');
728
+            }
729
+
730
+            // Check given identifier.
731
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
732
+                'tx_dlf_documents.*',
733
+                'tx_dlf_documents',
734
+                'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents'),
735
+                '',
736
+                '',
737
+                '1'
738
+            );
739
+
740
+            if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
741
+                return $this->error('idDoesNotExist');
742
+            }
743
+
744
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
745
+        }
746
+
747
+        // Add metadata formats node.
748
+        $ListMetadaFormats = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListMetadataFormats');
749
+
750
+        foreach ($this->formats as $prefix => $details) {
751
+            if (!empty($resArray)) {
752
+                foreach ($details['requiredFields'] as $required) {
753
+                    if (empty($resArray[$required])) {
754
+                        // Skip metadata formats whose requirements are not met.
755
+                        continue 2;
756
+                    }
757
+                }
758
+            }
759
+
760
+            // Add format node.
761
+            $format = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataFormat');
762
+
763
+            $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataPrefix', htmlspecialchars($prefix, ENT_NOQUOTES, 'UTF-8')));
764
+            $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'schema', htmlspecialchars($details['schema'], ENT_NOQUOTES, 'UTF-8')));
765
+            $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataNamespace', htmlspecialchars($details['namespace'], ENT_NOQUOTES, 'UTF-8')));
766
+
767
+            $ListMetadaFormats->appendChild($format);
768
+        }
769
+
770
+        return $ListMetadaFormats;
771
+    }
772
+
773
+    /**
774
+     * Process verb "ListRecords"
775
+     *
776
+     * @access	protected
777
+     *
778
+     * @return	string		Substitution for subpart "###RESPONSE###"
779
+     */
780
+    protected function verbListRecords() {
781
+
782
+        // Check for invalid arguments.
783
+        if (!empty($this->piVars['resumptionToken'])) {
784
+            // "resumptionToken" is an exclusive argument.
785
+            if (count($this->piVars) > 2) {
786
+                return $this->error('badArgument');
787
+            } else {
788
+                return $this->resume();
789
+            }
790
+
791
+        }
792
+
793
+        if (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) {
794
+            // "metadataPrefix" is required and "identifier" is not allowed.
795
+            return $this->error('badArgument');
796
+        }
797
+
798
+        // Check "metadataPrefix" for valid value.
799
+        if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) {
800
+            return $this->error('cannotDisseminateFormat');
801
+        }
802
+
803
+        try {
804
+            $documentSet = $this->fetchDocumentUIDs();
805
+        } catch (Exception $exception) {
806
+            return $this->error($exception->getMessage());
807
+        }
808
+
809
+        $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
810
+
811
+        $resultSet->reset();
812
+        $resultSet->add($documentSet);
813
+        $resultSet->metadata = array (
814
+            'completeListSize' => count($documentSet),
815
+            'metadataPrefix' => $this->piVars['metadataPrefix'],
816
+        );
817
+
818
+        return $this->generateOutputForDocumentList($resultSet);
819
+    }
820
+
821
+    /**
822
+     * Process verb "ListSets"
823
+     *
824
+     * @access	protected
825
+     *
826
+     * @return	string		Substitution for subpart "###RESPONSE###"
827
+     */
828
+    protected function verbListSets() {
829
+
830
+        // Check for invalid arguments.
831
+        if (count($this->piVars) > 1) {
832
+            if (!empty($this->piVars['resumptionToken'])) {
833
+                return $this->error('badResumptionToken');
834
+            } else {
835
+                return $this->error('badArgument');
836
+            }
837
+        }
838
+
839
+        $where = '';
840
+
841
+        if (!$this->conf['show_userdefined']) {
842
+            $where = ' AND tx_dlf_collections.fe_cruser_id=0';
843
+        }
844
+
845
+        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
846
+            'tx_dlf_collections.oai_name AS oai_name,tx_dlf_collections.label AS label',
847
+            'tx_dlf_collections',
848
+            'tx_dlf_collections.sys_language_uid IN (-1,0) AND NOT tx_dlf_collections.oai_name=\'\' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
849
+            'tx_dlf_collections.oai_name',
850
+            'tx_dlf_collections.oai_name',
851
+            ''
852
+        );
853
+
854
+        if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
855
+            return $this->error('noSetHierarchy');
856
+        }
857
+
858
+        $ListSets = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListSets');
859
+
860
+        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
861
+
862
+            $set = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'set');
863
+
864
+            $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($resArray['oai_name'], ENT_NOQUOTES, 'UTF-8')));
865
+            $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setName', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
866
+
867
+            $ListSets->appendChild($set);
868
+        }
869
+
870
+        return $ListSets;
871
+    }
872
+
873
+
874
+
875
+    /**
876
+     * @return array
877
+     * @throws Exception
878
+     */
879
+    private function fetchDocumentUIDs()
880
+    {
881
+        $solr_query = '';
882
+
883
+        if (!$this->conf['show_userdefined']) {
884
+            $where = ' AND tx_dlf_collections.fe_cruser_id=0';
885
+        }
886 886
 
887
-		// Check "set" for valid value.
888
-		if (!empty($this->piVars['set'])) {
887
+        // Check "set" for valid value.
888
+        if (!empty($this->piVars['set'])) {
889 889
 
890
-			// For SOLR we need the index_name of the collection,
891
-			// For DB Query we need the UID of the collection
892
-			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
893
-				'tx_dlf_collections.index_name AS index_name, tx_dlf_collections.uid AS uid, tx_dlf_collections.index_search as index_query ',
894
-				'tx_dlf_collections',
895
-				'tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.oai_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'],
896
-					'tx_dlf_collections') . $where . tx_dlf_helper::whereClause('tx_dlf_collections'),
897
-				'',
898
-				'',
899
-				'1'
900
-			);
890
+            // For SOLR we need the index_name of the collection,
891
+            // For DB Query we need the UID of the collection
892
+            $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
893
+                'tx_dlf_collections.index_name AS index_name, tx_dlf_collections.uid AS uid, tx_dlf_collections.index_search as index_query ',
894
+                'tx_dlf_collections',
895
+                'tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.oai_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'],
896
+                    'tx_dlf_collections') . $where . tx_dlf_helper::whereClause('tx_dlf_collections'),
897
+                '',
898
+                '',
899
+                '1'
900
+            );
901 901
 
902
-			if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
903
-				throw new Exception('noSetHierarchy');
904
-			}
902
+            if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
903
+                throw new Exception('noSetHierarchy');
904
+            }
905 905
 
906
-			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
906
+            $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
907 907
 
908
-			if($resArray['index_query'] != "") {
909
-				$solr_query .= '(' . $resArray['index_query'] . ')';
910
-			} else {
911
-				$solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"';
912
-			}
913
-
914
-		} else {
915
-			// If no set is specified we have to query for all collections
916
-			$solr_query .= 'collection:* NOT collection:""';
908
+            if($resArray['index_query'] != "") {
909
+                $solr_query .= '(' . $resArray['index_query'] . ')';
910
+            } else {
911
+                $solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"';
912
+            }
913
+
914
+        } else {
915
+            // If no set is specified we have to query for all collections
916
+            $solr_query .= 'collection:* NOT collection:""';
917 917
 
918
-		}
918
+        }
919 919
 
920
-		// Check for required fields.
921
-		foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
922
-			$solr_query .= ' NOT ' . $required . ':""';
923
-		}
920
+        // Check for required fields.
921
+        foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
922
+            $solr_query .= ' NOT ' . $required . ':""';
923
+        }
924 924
 
925
-		$from = "*";
926
-		// Check "from" for valid value.
927
-		if (!empty($this->piVars['from'])) {
925
+        $from = "*";
926
+        // Check "from" for valid value.
927
+        if (!empty($this->piVars['from'])) {
928 928
 
929
-			// Is valid format?
930
-			if (is_array($date_array = strptime($this->piVars['from'],
931
-					'%Y-%m-%dT%H:%M:%SZ')) || is_array($date_array = strptime($this->piVars['from'], '%Y-%m-%d'))) {
929
+            // Is valid format?
930
+            if (is_array($date_array = strptime($this->piVars['from'],
931
+                    '%Y-%m-%dT%H:%M:%SZ')) || is_array($date_array = strptime($this->piVars['from'], '%Y-%m-%d'))) {
932 932
 
933
-				$timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
934
-					$date_array['tm_mday'], $date_array['tm_year'] + 1900);
933
+                $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
934
+                    $date_array['tm_mday'], $date_array['tm_year'] + 1900);
935 935
 
936
-			   $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) .'.000Z';
936
+                $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) .'.000Z';
937 937
 
938
-			} else {
939
-				throw new Exception('badArgument');
940
-			}
941
-		}
938
+            } else {
939
+                throw new Exception('badArgument');
940
+            }
941
+        }
942 942
 
943
-		$until = "*";
944
-		// Check "until" for valid value.
945
-		if (!empty($this->piVars['until'])) {
943
+        $until = "*";
944
+        // Check "until" for valid value.
945
+        if (!empty($this->piVars['until'])) {
946 946
 
947
-			// Is valid format?
948
-			if (is_array($date_array = strptime($this->piVars['until'],
949
-					'%Y-%m-%dT%H:%M:%SZ')) || is_array($date_array = strptime($this->piVars['until'], '%Y-%m-%d'))) {
947
+            // Is valid format?
948
+            if (is_array($date_array = strptime($this->piVars['until'],
949
+                    '%Y-%m-%dT%H:%M:%SZ')) || is_array($date_array = strptime($this->piVars['until'], '%Y-%m-%d'))) {
950 950
 
951
-				$timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
952
-					$date_array['tm_mday'], $date_array['tm_year'] + 1900);
951
+                $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
952
+                    $date_array['tm_mday'], $date_array['tm_year'] + 1900);
953 953
 
954
-				$until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z';
954
+                $until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z';
955 955
 
956
-				if ($from != "*" && $from > $until) {
957
-					throw new Exception('badArgument');
958
-				}
956
+                if ($from != "*" && $from > $until) {
957
+                    throw new Exception('badArgument');
958
+                }
959 959
 
960
-			} else {
961
-				throw new Exception('badArgument');
962
-			}
963
-		}
960
+            } else {
961
+                throw new Exception('badArgument');
962
+            }
963
+        }
964 964
 
965
-		// Check "from" and "until" for same granularity.
966
-		if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) {
967
-			if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) {
968
-				throw new Exception('badArgument');
969
-			}
970
-		}
965
+        // Check "from" and "until" for same granularity.
966
+        if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) {
967
+            if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) {
968
+                throw new Exception('badArgument');
969
+            }
970
+        }
971 971
 
972
-		$solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until .']';
973
-
974
-		$documentSet = array();
975
-
976
-		$solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
977
-
978
-		// We only care about the UID in the results and want them sorted
979
-		$parameters = array("fl" => "uid", "sort" => "uid asc");
980
-
981
-		$result = $solr->search_raw($solr_query, $parameters);
982
-
983
-		if (empty($result)) {
984
-			throw new Exception('noRecordsMatch');
985
-		}
972
+        $solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until .']';
973
+
974
+        $documentSet = array();
975
+
976
+        $solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
977
+
978
+        // We only care about the UID in the results and want them sorted
979
+        $parameters = array("fl" => "uid", "sort" => "uid asc");
980
+
981
+        $result = $solr->search_raw($solr_query, $parameters);
982
+
983
+        if (empty($result)) {
984
+            throw new Exception('noRecordsMatch');
985
+        }
986 986
 
987
-		foreach ($result as $doc) {
988
-			$documentSet[] = $doc->uid;
989
-		}
990
-
991
-		return $documentSet;
992
-	}
993
-
994
-	/**
995
-	 * @param tx_dlf_list $documentListSet
996
-	 * @return DOMElement
997
-	 */
998
-	private function generateOutputForDocumentList($documentListSet) {
987
+        foreach ($result as $doc) {
988
+            $documentSet[] = $doc->uid;
989
+        }
990
+
991
+        return $documentSet;
992
+    }
993
+
994
+    /**
995
+     * @param tx_dlf_list $documentListSet
996
+     * @return DOMElement
997
+     */
998
+    private function generateOutputForDocumentList($documentListSet) {
999 999
 
1000
-		 $documentsToProcess = $documentListSet->removeRange(0, intval($this->conf['limit']));
1001
-		 $verb = $this->piVars['verb'];
1000
+            $documentsToProcess = $documentListSet->removeRange(0, intval($this->conf['limit']));
1001
+            $verb = $this->piVars['verb'];
1002 1002
 
1003
-		$documents = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1004
-			'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
1005
-			'tx_dlf_documents',
1006
-			'tx_dlf_relations',
1007
-			'tx_dlf_collections',
1008
-			'AND tx_dlf_documents.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)) . ') AND tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_collections'),
1009
-			'tx_dlf_documents.uid',
1010
-			'tx_dlf_documents.tstamp',
1011
-			$this->conf['limit']
1012
-		);
1003
+        $documents = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
1004
+            'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
1005
+            'tx_dlf_documents',
1006
+            'tx_dlf_relations',
1007
+            'tx_dlf_collections',
1008
+            'AND tx_dlf_documents.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)) . ') AND tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_collections'),
1009
+            'tx_dlf_documents.uid',
1010
+            'tx_dlf_documents.tstamp',
1011
+            $this->conf['limit']
1012
+        );
1013 1013
 
1014
-		$output = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', $verb);
1015
-
1016
-		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($documents)) {
1017
-			// Add header node.
1018
-			$header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
1019
-
1020
-			$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
1021
-			$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
1022
-
1023
-			// Check if document is deleted or hidden.
1024
-			// TODO: Use TYPO3 API functions here!
1025
-			if ($resArray['deleted'] || $resArray['hidden']) {
1026
-				// Add "deleted" status.
1027
-				$header->setAttribute('status', 'deleted');
1028
-
1029
-				if ($verb == 'ListRecords') {
1030
-					// Add record node.
1031
-					$record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
1014
+        $output = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', $verb);
1015
+
1016
+        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($documents)) {
1017
+            // Add header node.
1018
+            $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header');
1019
+
1020
+            $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8')));
1021
+            $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp'])));
1022
+
1023
+            // Check if document is deleted or hidden.
1024
+            // TODO: Use TYPO3 API functions here!
1025
+            if ($resArray['deleted'] || $resArray['hidden']) {
1026
+                // Add "deleted" status.
1027
+                $header->setAttribute('status', 'deleted');
1028
+
1029
+                if ($verb == 'ListRecords') {
1030
+                    // Add record node.
1031
+                    $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
1032 1032
 
1033
-					$record->appendChild($header);
1034
-					$output->appendChild($record);
1035
-
1036
-				} elseif ($verb == 'ListIdentifiers') {
1037
-					$output->appendChild($header);
1038
-				}
1039
-
1040
-			} else {
1041
-				// Add sets.
1042
-				foreach (explode(' ', $resArray['collections']) as $spec) {
1043
-					$header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
1044
-				}
1045
-
1046
-				if ($verb == 'ListRecords') {
1047
-					// Add record node.
1048
-					$record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
1049
-
1050
-					$record->appendChild($header);
1051
-
1052
-					// Add metadata node.
1053
-					$metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
1054
-
1055
-					$metadataPrefix = $this->piVars['metadataPrefix'];
1056
-					if(!$metadataPrefix) {
1057
-						// If we resume an action the metadataPrefix is stored with the documentSet
1058
-						$metadataPrefix = $documentListSet->metadata['metadataPrefix'];
1059
-					}
1060
-
1061
-					switch ($metadataPrefix) {
1062
-						case 'oai_dc':
1063
-							$metadata->appendChild($this->getDcData($resArray));
1064
-							break;
1065
-
1066
-						case 'epicur':
1067
-							$metadata->appendChild($this->getEpicurData($resArray));
1068
-							break;
1069
-
1070
-						case 'mets':
1071
-							$metadata->appendChild($this->getMetsData($resArray));
1072
-							break;
1073
-					}
1074
-
1075
-					$record->appendChild($metadata);
1076
-					$output->appendChild($record);
1077
-
1078
-				} elseif ($verb == 'ListIdentifiers') {
1079
-					$output->appendChild($header);
1080
-				}
1081
-			}
1082
-		}
1083
-
1084
-		$output->appendChild($this->generateResumptionTokenForDocumentListSet($documentListSet));
1085
-
1086
-		return $output;
1087
-	}
1088
-
1089
-	/**
1090
-	 * @param tx_dlf_list $documentListSet
1091
-	 * @return DOMElement
1092
-	 */
1093
-	private function generateResumptionTokenForDocumentListSet($documentListSet)
1094
-	{
1095
-		$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken');
1096
-
1097
-		if ($documentListSet->count() != 0) {
1098
-
1099
-			$token = uniqid();
1100
-
1101
-			$GLOBALS['TYPO3_DB']->exec_INSERTquery(
1102
-				'tx_dlf_tokens',
1103
-				array(
1104
-					'tstamp' => $GLOBALS['EXEC_TIME'],
1105
-					'token' => $token,
1106
-					'options' => serialize($documentListSet),
1107
-					'ident' => 'oai',
1108
-				)
1109
-			);
1110
-
1111
-			if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
1112
-				$resumptionToken->setAttribute('resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1113
-			} else {
1114
-				$this->devLog('[tx_dlf_oai->verb'. $this->piVars['verb'] .'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
1115
-			}
1116
-		}
1117
-
1118
-		$resumptionToken->setAttribute('cursor', intval($documentListSet->metadata['completeListSize']) - count($documentListSet));
1119
-		$resumptionToken->setAttribute('completeListSize',	$documentListSet->metadata['completeListSize']);
1120
-		$resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1121
-
1122
-		return $resumptionToken;
1123
-	}
1124
-
1125
-	private function devLog($message, $severity, $data = null) {
1126
-		if (TYPO3_DLOG) {
1127
-			\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, $this->extKey, $severity, $data);
1128
-		}
1129
-	}
1033
+                    $record->appendChild($header);
1034
+                    $output->appendChild($record);
1035
+
1036
+                } elseif ($verb == 'ListIdentifiers') {
1037
+                    $output->appendChild($header);
1038
+                }
1039
+
1040
+            } else {
1041
+                // Add sets.
1042
+                foreach (explode(' ', $resArray['collections']) as $spec) {
1043
+                    $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8')));
1044
+                }
1045
+
1046
+                if ($verb == 'ListRecords') {
1047
+                    // Add record node.
1048
+                    $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record');
1049
+
1050
+                    $record->appendChild($header);
1051
+
1052
+                    // Add metadata node.
1053
+                    $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
1054
+
1055
+                    $metadataPrefix = $this->piVars['metadataPrefix'];
1056
+                    if(!$metadataPrefix) {
1057
+                        // If we resume an action the metadataPrefix is stored with the documentSet
1058
+                        $metadataPrefix = $documentListSet->metadata['metadataPrefix'];
1059
+                    }
1060
+
1061
+                    switch ($metadataPrefix) {
1062
+                        case 'oai_dc':
1063
+                            $metadata->appendChild($this->getDcData($resArray));
1064
+                            break;
1065
+
1066
+                        case 'epicur':
1067
+                            $metadata->appendChild($this->getEpicurData($resArray));
1068
+                            break;
1069
+
1070
+                        case 'mets':
1071
+                            $metadata->appendChild($this->getMetsData($resArray));
1072
+                            break;
1073
+                    }
1074
+
1075
+                    $record->appendChild($metadata);
1076
+                    $output->appendChild($record);
1077
+
1078
+                } elseif ($verb == 'ListIdentifiers') {
1079
+                    $output->appendChild($header);
1080
+                }
1081
+            }
1082
+        }
1083
+
1084
+        $output->appendChild($this->generateResumptionTokenForDocumentListSet($documentListSet));
1085
+
1086
+        return $output;
1087
+    }
1088
+
1089
+    /**
1090
+     * @param tx_dlf_list $documentListSet
1091
+     * @return DOMElement
1092
+     */
1093
+    private function generateResumptionTokenForDocumentListSet($documentListSet)
1094
+    {
1095
+        $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken');
1096
+
1097
+        if ($documentListSet->count() != 0) {
1098
+
1099
+            $token = uniqid();
1100
+
1101
+            $GLOBALS['TYPO3_DB']->exec_INSERTquery(
1102
+                'tx_dlf_tokens',
1103
+                array(
1104
+                    'tstamp' => $GLOBALS['EXEC_TIME'],
1105
+                    'token' => $token,
1106
+                    'options' => serialize($documentListSet),
1107
+                    'ident' => 'oai',
1108
+                )
1109
+            );
1110
+
1111
+            if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
1112
+                $resumptionToken->setAttribute('resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1113
+            } else {
1114
+                $this->devLog('[tx_dlf_oai->verb'. $this->piVars['verb'] .'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
1115
+            }
1116
+        }
1117
+
1118
+        $resumptionToken->setAttribute('cursor', intval($documentListSet->metadata['completeListSize']) - count($documentListSet));
1119
+        $resumptionToken->setAttribute('completeListSize',	$documentListSet->metadata['completeListSize']);
1120
+        $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1121
+
1122
+        return $resumptionToken;
1123
+    }
1124
+
1125
+    private function devLog($message, $severity, $data = null) {
1126
+        if (TYPO3_DLOG) {
1127
+            \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, $this->extKey, $severity, $data);
1128
+        }
1129
+    }
1130 1130
 
1131 1131
 }
1132 1132
 
1133 1133
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php'])	{
1134
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
1134
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
1135 1135
 
1136 1136
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
80 80
 			// Deletion failed.
81
-			$this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens',SYSLOG_SEVERITY_WARNING);
81
+			$this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', SYSLOG_SEVERITY_WARNING);
82 82
 		}
83 83
 	}
84 84
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
632 632
 			'tx_dlf_documents.tstamp AS tstamp',
633 633
 			'tx_dlf_documents',
634
-			'tx_dlf_documents.pid=' . intval($this->conf['pages']),
634
+			'tx_dlf_documents.pid='.intval($this->conf['pages']),
635 635
 			'',
636 636
 			'tx_dlf_documents.tstamp ASC',
637 637
 			'1'
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 			list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
642 642
 			$earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
643 643
 		} else {
644
-			$this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' . $this->conf['pages'] . '"',SYSLOG_SEVERITY_NOTICE);
644
+			$this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "'.$this->conf['pages'].'"', SYSLOG_SEVERITY_NOTICE);
645 645
 		}
646 646
 
647 647
 		$linkConf = array (
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 		// Add identification node.
654 654
 		$Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify');
655 655
 		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'repositoryName', $repositoryName));
656
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','baseURL', $baseURL));
657
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','protocolVersion', '2.0'));
658
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','adminEmail', $adminEmail));
659
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','earliestDatestamp', $earliestDatestamp));
660
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','deletedRecord', 'transient'));
661
-		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','granularity', 'YYYY-MM-DDThh:mm:ssZ'));
656
+		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'baseURL', $baseURL));
657
+		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'protocolVersion', '2.0'));
658
+		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'adminEmail', $adminEmail));
659
+		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'earliestDatestamp', $earliestDatestamp));
660
+		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'deletedRecord', 'transient'));
661
+		$Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'granularity', 'YYYY-MM-DDThh:mm:ssZ'));
662 662
 
663 663
 		return $Identify;
664 664
 	}
@@ -892,8 +892,8 @@  discard block
 block discarded – undo
892 892
 			$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
893 893
 				'tx_dlf_collections.index_name AS index_name, tx_dlf_collections.uid AS uid, tx_dlf_collections.index_search as index_query ',
894 894
 				'tx_dlf_collections',
895
-				'tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.oai_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'],
896
-					'tx_dlf_collections') . $where . tx_dlf_helper::whereClause('tx_dlf_collections'),
895
+				'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'],
896
+					'tx_dlf_collections').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
897 897
 				'',
898 898
 				'',
899 899
 				'1'
@@ -905,10 +905,10 @@  discard block
 block discarded – undo
905 905
 
906 906
 			$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
907 907
 
908
-			if($resArray['index_query'] != "") {
909
-				$solr_query .= '(' . $resArray['index_query'] . ')';
908
+			if ($resArray['index_query'] != "") {
909
+				$solr_query .= '('.$resArray['index_query'].')';
910 910
 			} else {
911
-				$solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"';
911
+				$solr_query .= 'collection:'.'"'.$resArray['index_name'].'"';
912 912
 			}
913 913
 
914 914
 		} else {
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
 		// Check for required fields.
921 921
 		foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
922
-			$solr_query .= ' NOT ' . $required . ':""';
922
+			$solr_query .= ' NOT '.$required.':""';
923 923
 		}
924 924
 
925 925
 		$from = "*";
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 				$timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
934 934
 					$date_array['tm_mday'], $date_array['tm_year'] + 1900);
935 935
 
936
-			   $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) .'.000Z';
936
+			   $from = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.000Z';
937 937
 
938 938
 			} else {
939 939
 				throw new Exception('badArgument');
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 				$timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
952 952
 					$date_array['tm_mday'], $date_array['tm_year'] + 1900);
953 953
 
954
-				$until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z';
954
+				$until = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.999Z';
955 955
 
956 956
 				if ($from != "*" && $from > $until) {
957 957
 					throw new Exception('badArgument');
@@ -969,14 +969,14 @@  discard block
 block discarded – undo
969 969
 			}
970 970
 		}
971 971
 
972
-		$solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until .']';
972
+		$solr_query .= ' AND timestamp:['.$from.' TO '.$until.']';
973 973
 
974
-		$documentSet = array();
974
+		$documentSet = array ();
975 975
 
976 976
 		$solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
977 977
 
978 978
 		// We only care about the UID in the results and want them sorted
979
-		$parameters = array("fl" => "uid", "sort" => "uid asc");
979
+		$parameters = array ("fl" => "uid", "sort" => "uid asc");
980 980
 
981 981
 		$result = $solr->search_raw($solr_query, $parameters);
982 982
 
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			'tx_dlf_documents',
1006 1006
 			'tx_dlf_relations',
1007 1007
 			'tx_dlf_collections',
1008
-			'AND tx_dlf_documents.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)) . ') AND tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_collections'),
1008
+			'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_collections'),
1009 1009
 			'tx_dlf_documents.uid',
1010 1010
 			'tx_dlf_documents.tstamp',
1011 1011
 			$this->conf['limit']
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 					$metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
1054 1054
 
1055 1055
 					$metadataPrefix = $this->piVars['metadataPrefix'];
1056
-					if(!$metadataPrefix) {
1056
+					if (!$metadataPrefix) {
1057 1057
 						// If we resume an action the metadataPrefix is stored with the documentSet
1058 1058
 						$metadataPrefix = $documentListSet->metadata['metadataPrefix'];
1059 1059
 					}
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
 			$GLOBALS['TYPO3_DB']->exec_INSERTquery(
1102 1102
 				'tx_dlf_tokens',
1103
-				array(
1103
+				array (
1104 1104
 					'tstamp' => $GLOBALS['EXEC_TIME'],
1105 1105
 					'token' => $token,
1106 1106
 					'options' => serialize($documentListSet),
@@ -1108,15 +1108,15 @@  discard block
 block discarded – undo
1108 1108
 				)
1109 1109
 			);
1110 1110
 
1111
-			if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
1111
+			if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
1112 1112
 				$resumptionToken->setAttribute('resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1113 1113
 			} else {
1114
-				$this->devLog('[tx_dlf_oai->verb'. $this->piVars['verb'] .'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
1114
+				$this->devLog('[tx_dlf_oai->verb'.$this->piVars['verb'].'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
1115 1115
 			}
1116 1116
 		}
1117 1117
 
1118 1118
 		$resumptionToken->setAttribute('cursor', intval($documentListSet->metadata['completeListSize']) - count($documentListSet));
1119
-		$resumptionToken->setAttribute('completeListSize',	$documentListSet->metadata['completeListSize']);
1119
+		$resumptionToken->setAttribute('completeListSize', $documentListSet->metadata['completeListSize']);
1120 1120
 		$resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1121 1121
 
1122 1122
 		return $resumptionToken;
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 }
1132 1132
 
1133
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php'])	{
1133
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']) {
1134 1134
 	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
1135 1135
 
1136 1136
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -876,8 +876,7 @@  discard block
 block discarded – undo
876 876
 	 * @return array
877 877
 	 * @throws Exception
878 878
 	 */
879
-	private function fetchDocumentUIDs()
880
-	{
879
+	private function fetchDocumentUIDs() {
881 880
 		$solr_query = '';
882 881
 
883 882
 		if (!$this->conf['show_userdefined']) {
@@ -1090,8 +1089,7 @@  discard block
 block discarded – undo
1090 1089
 	 * @param tx_dlf_list $documentListSet
1091 1090
 	 * @return DOMElement
1092 1091
 	 */
1093
-	private function generateResumptionTokenForDocumentListSet($documentListSet)
1094
-	{
1092
+	private function generateResumptionTokenForDocumentListSet($documentListSet) {
1095 1093
 		$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken');
1096 1094
 
1097 1095
 		if ($documentListSet->count() != 0) {
@@ -1130,7 +1128,7 @@  discard block
 block discarded – undo
1130 1128
 
1131 1129
 }
1132 1130
 
1133
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php'])	{
1131
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']) {
1134 1132
 	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
1135 1133
 
1136 1134
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1122,7 +1122,7 @@
 block discarded – undo
1122 1122
 		return $resumptionToken;
1123 1123
 	}
1124 1124
 
1125
-	private function devLog($message, $severity, $data = null) {
1125
+	private function devLog($message, $severity, $data = NULL) {
1126 1126
 		if (TYPO3_DLOG) {
1127 1127
 			\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, $this->extKey, $severity, $data);
1128 1128
 		}
Please login to merge, or discard this patch.
modules/indexing/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $this->list->save();
163 163
 
164 164
         // Save document to database and index.
165
-        $doc =& tx_dlf_document::getInstance($uid, 0, TRUE);
165
+        $doc = & tx_dlf_document::getInstance($uid, 0, TRUE);
166 166
 
167 167
         if ($doc->ready) {
168 168
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                         && \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->data['id'])) {
220 220
 
221 221
                         // Save document to database and index.
222
-                        $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE);
222
+                        $doc = & tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE);
223 223
 
224 224
                         if ($doc->ready) {
225 225
 
Please login to merge, or discard this patch.
cli/class.tx_dlf_cli.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 }
90 90
 
91 91
                 // Get the document...
92
-                $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE);
92
+                $doc = & tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE);
93 93
 
94 94
                 if ($doc->ready) {
95 95
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
171 171
 
172 172
                     // Get the document...
173
-                    $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE);
173
+                    $doc = & tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE);
174 174
 
175 175
                     if ($doc->ready) {
176 176
 
Please login to merge, or discard this patch.
hooks/class.tx_dlf_doctype.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
         if (!empty($this->piVars['id'])) {
162 162
 
163 163
             // Get instance of tx_dlf_document.
164
-            $this->doc =& tx_dlf_document::getInstance($this->piVars['id']);
164
+            $this->doc = & tx_dlf_document::getInstance($this->piVars['id']);
165 165
 
166 166
             if (!$this->doc->ready) {
167 167
 
Please login to merge, or discard this patch.
hooks/class.tx_dlf_tcemain.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                             } else {
338 338
 
339 339
                                 // Reindex document.
340
-                                $doc =& tx_dlf_document::getInstance($id);
340
+                                $doc = & tx_dlf_document::getInstance($id);
341 341
 
342 342
                                 if ($doc->ready) {
343 343
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
                     case 'undelete':
423 423
 
424 424
                         // Reindex document.
425
-                        $doc =& tx_dlf_document::getInstance($id);
425
+                        $doc = & tx_dlf_document::getInstance($id);
426 426
 
427 427
                         if ($doc->ready) {
428 428
 
Please login to merge, or discard this patch.