We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -19,1755 +19,1755 @@ |
||
| 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($result) === -1) { |
|
| 80 | - |
|
| 81 | - // Deletion failed. |
|
| 82 | - if (TYPO3_DLOG) { |
|
| 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($result) === -1) { |
|
| 80 | + |
|
| 81 | + // Deletion failed. |
|
| 82 | + if (TYPO3_DLOG) { |
|
| 83 | 83 | |
| 84 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 84 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 85 | 85 | |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Process error |
|
| 94 | - * |
|
| 95 | - * @access protected |
|
| 96 | - * |
|
| 97 | - * @param string $type: Error type |
|
| 98 | - * |
|
| 99 | - * @return DOMElement XML node to add to the OAI response |
|
| 100 | - */ |
|
| 101 | - protected function error($type) { |
|
| 92 | + /** |
|
| 93 | + * Process error |
|
| 94 | + * |
|
| 95 | + * @access protected |
|
| 96 | + * |
|
| 97 | + * @param string $type: Error type |
|
| 98 | + * |
|
| 99 | + * @return DOMElement XML node to add to the OAI response |
|
| 100 | + */ |
|
| 101 | + protected function error($type) { |
|
| 102 | 102 | |
| 103 | - $this->error = TRUE; |
|
| 103 | + $this->error = TRUE; |
|
| 104 | 104 | |
| 105 | - $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type, FALSE), ENT_NOQUOTES, 'UTF-8')); |
|
| 105 | + $error = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'error', htmlspecialchars($this->pi_getLL($type, $type, FALSE), ENT_NOQUOTES, 'UTF-8')); |
|
| 106 | 106 | |
| 107 | - $error->setAttribute('code', $type); |
|
| 107 | + $error->setAttribute('code', $type); |
|
| 108 | 108 | |
| 109 | - return $error; |
|
| 109 | + return $error; |
|
| 110 | 110 | |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Load URL parameters |
|
| 115 | - * |
|
| 116 | - * @access protected |
|
| 117 | - * |
|
| 118 | - * @return void |
|
| 119 | - */ |
|
| 120 | - protected function getUrlParams() { |
|
| 113 | + /** |
|
| 114 | + * Load URL parameters |
|
| 115 | + * |
|
| 116 | + * @access protected |
|
| 117 | + * |
|
| 118 | + * @return void |
|
| 119 | + */ |
|
| 120 | + protected function getUrlParams() { |
|
| 121 | 121 | |
| 122 | - $allowedParams = array ( |
|
| 123 | - 'verb', |
|
| 124 | - 'identifier', |
|
| 125 | - 'metadataPrefix', |
|
| 126 | - 'from', |
|
| 127 | - 'until', |
|
| 128 | - 'set', |
|
| 129 | - 'resumptionToken' |
|
| 130 | - ); |
|
| 122 | + $allowedParams = array ( |
|
| 123 | + 'verb', |
|
| 124 | + 'identifier', |
|
| 125 | + 'metadataPrefix', |
|
| 126 | + 'from', |
|
| 127 | + 'until', |
|
| 128 | + 'set', |
|
| 129 | + 'resumptionToken' |
|
| 130 | + ); |
|
| 131 | 131 | |
| 132 | - // Clear plugin variables. |
|
| 133 | - $this->piVars = array (); |
|
| 132 | + // Clear plugin variables. |
|
| 133 | + $this->piVars = array (); |
|
| 134 | 134 | |
| 135 | - // Set only allowed parameters. |
|
| 136 | - foreach ($allowedParams as $param) { |
|
| 135 | + // Set only allowed parameters. |
|
| 136 | + foreach ($allowedParams as $param) { |
|
| 137 | 137 | |
| 138 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param)) { |
|
| 138 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param)) { |
|
| 139 | 139 | |
| 140 | - $this->piVars[$param] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param); |
|
| 140 | + $this->piVars[$param] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($param); |
|
| 141 | 141 | |
| 142 | - } |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - } |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - } |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * Get unqualified Dublin Core data. |
|
| 150 | - * @see http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore |
|
| 151 | - * |
|
| 152 | - * @access protected |
|
| 153 | - * |
|
| 154 | - * @param array $metadata: The metadata array |
|
| 155 | - * |
|
| 156 | - * @return DOMElement XML node to add to the OAI response |
|
| 157 | - */ |
|
| 158 | - protected function getDcData(array $metadata) { |
|
| 148 | + /** |
|
| 149 | + * Get unqualified Dublin Core data. |
|
| 150 | + * @see http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore |
|
| 151 | + * |
|
| 152 | + * @access protected |
|
| 153 | + * |
|
| 154 | + * @param array $metadata: The metadata array |
|
| 155 | + * |
|
| 156 | + * @return DOMElement XML node to add to the OAI response |
|
| 157 | + */ |
|
| 158 | + protected function getDcData(array $metadata) { |
|
| 159 | 159 | |
| 160 | - $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc'); |
|
| 160 | + $oai_dc = $this->oai->createElementNS($this->formats['oai_dc']['namespace'], 'oai_dc:dc'); |
|
| 161 | 161 | |
| 162 | - $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|
| 162 | + $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|
| 163 | 163 | |
| 164 | - $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 164 | + $oai_dc->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 165 | 165 | |
| 166 | - $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']); |
|
| 166 | + $oai_dc->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['oai_dc']['namespace'].' '.$this->formats['oai_dc']['schema']); |
|
| 167 | 167 | |
| 168 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 168 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 169 | 169 | |
| 170 | - if (!empty($metadata['purl'])) { |
|
| 170 | + if (!empty($metadata['purl'])) { |
|
| 171 | 171 | |
| 172 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 172 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 173 | 173 | |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - if (!empty($metadata['urn'])) { |
|
| 176 | + if (!empty($metadata['urn'])) { |
|
| 177 | 177 | |
| 178 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 178 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 179 | 179 | |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - if (!empty($metadata['title'])) { |
|
| 182 | + if (!empty($metadata['title'])) { |
|
| 183 | 183 | |
| 184 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:title', htmlspecialchars($metadata['title'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 184 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:title', htmlspecialchars($metadata['title'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 185 | 185 | |
| 186 | - } |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - if (!empty($metadata['author'])) { |
|
| 188 | + if (!empty($metadata['author'])) { |
|
| 189 | 189 | |
| 190 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:creator', htmlspecialchars($metadata['author'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 190 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:creator', htmlspecialchars($metadata['author'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 191 | 191 | |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - if (!empty($metadata['year'])) { |
|
| 194 | + if (!empty($metadata['year'])) { |
|
| 195 | 195 | |
| 196 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:date', htmlspecialchars($metadata['year'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 196 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:date', htmlspecialchars($metadata['year'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 197 | 197 | |
| 198 | - } |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | - if (!empty($metadata['place'])) { |
|
| 200 | + if (!empty($metadata['place'])) { |
|
| 201 | 201 | |
| 202 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:coverage', htmlspecialchars($metadata['place'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 202 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:coverage', htmlspecialchars($metadata['place'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 203 | 203 | |
| 204 | - } |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:format', 'application/mets+xml')); |
|
| 206 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:format', 'application/mets+xml')); |
|
| 207 | 207 | |
| 208 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:type', 'Text')); |
|
| 208 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:type', 'Text')); |
|
| 209 | 209 | |
| 210 | - if (!empty($metadata['partof'])) { |
|
| 210 | + if (!empty($metadata['partof'])) { |
|
| 211 | 211 | |
| 212 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 213 | - 'tx_dlf_documents.record_id', |
|
| 214 | - 'tx_dlf_documents', |
|
| 215 | - 'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 216 | - '', |
|
| 217 | - '', |
|
| 218 | - '1' |
|
| 219 | - ); |
|
| 212 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 213 | + 'tx_dlf_documents.record_id', |
|
| 214 | + 'tx_dlf_documents', |
|
| 215 | + 'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 216 | + '', |
|
| 217 | + '', |
|
| 218 | + '1' |
|
| 219 | + ); |
|
| 220 | 220 | |
| 221 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 221 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 222 | 222 | |
| 223 | - $partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 223 | + $partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 224 | 224 | |
| 225 | - $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 225 | + $oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 226 | 226 | |
| 227 | - } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - } |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - return $oai_dc; |
|
| 231 | + return $oai_dc; |
|
| 232 | 232 | |
| 233 | - } |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - /** |
|
| 236 | - * Get epicur data. |
|
| 237 | - * @see http://www.persistent-identifier.de/?link=210 |
|
| 238 | - * |
|
| 239 | - * @access protected |
|
| 240 | - * |
|
| 241 | - * @param array $metadata: The metadata array |
|
| 242 | - * |
|
| 243 | - * @return DOMElement XML node to add to the OAI response |
|
| 244 | - */ |
|
| 245 | - protected function getEpicurData(array $metadata) { |
|
| 235 | + /** |
|
| 236 | + * Get epicur data. |
|
| 237 | + * @see http://www.persistent-identifier.de/?link=210 |
|
| 238 | + * |
|
| 239 | + * @access protected |
|
| 240 | + * |
|
| 241 | + * @param array $metadata: The metadata array |
|
| 242 | + * |
|
| 243 | + * @return DOMElement XML node to add to the OAI response |
|
| 244 | + */ |
|
| 245 | + protected function getEpicurData(array $metadata) { |
|
| 246 | 246 | |
| 247 | - // Define all XML elements with or without qualified namespace. |
|
| 248 | - if (empty($this->conf['unqualified_epicur'])) { |
|
| 247 | + // Define all XML elements with or without qualified namespace. |
|
| 248 | + if (empty($this->conf['unqualified_epicur'])) { |
|
| 249 | 249 | |
| 250 | - // Create epicur element. |
|
| 251 | - $epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur'); |
|
| 250 | + // Create epicur element. |
|
| 251 | + $epicur = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:epicur'); |
|
| 252 | 252 | |
| 253 | - // Add administrative data. |
|
| 254 | - $admin = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:administrative_data'); |
|
| 253 | + // Add administrative data. |
|
| 254 | + $admin = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:administrative_data'); |
|
| 255 | 255 | |
| 256 | - $delivery = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:delivery'); |
|
| 256 | + $delivery = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:delivery'); |
|
| 257 | 257 | |
| 258 | - $update = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:update_status'); |
|
| 258 | + $update = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:update_status'); |
|
| 259 | 259 | |
| 260 | - $transfer = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:transfer'); |
|
| 260 | + $transfer = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:transfer'); |
|
| 261 | 261 | |
| 262 | - $format = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:format', 'text/html'); |
|
| 262 | + $format = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:format', 'text/html'); |
|
| 263 | 263 | |
| 264 | - // Add record data. |
|
| 265 | - $record = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:record'); |
|
| 264 | + // Add record data. |
|
| 265 | + $record = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:record'); |
|
| 266 | 266 | |
| 267 | - $identifier = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')); |
|
| 267 | + $identifier = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')); |
|
| 268 | 268 | |
| 269 | - $resource = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:resource'); |
|
| 269 | + $resource = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:resource'); |
|
| 270 | 270 | |
| 271 | - $ident = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')); |
|
| 271 | + $ident = $this->oai->createElementNS($this->formats['epicur']['namespace'], 'epicur:identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')); |
|
| 272 | 272 | |
| 273 | - } else { |
|
| 273 | + } else { |
|
| 274 | 274 | |
| 275 | - // Create epicur element with unqualified namespace. |
|
| 276 | - $epicur = $this->oai->createElement('epicur'); |
|
| 275 | + // Create epicur element with unqualified namespace. |
|
| 276 | + $epicur = $this->oai->createElement('epicur'); |
|
| 277 | 277 | |
| 278 | - $epicur->setAttribute('xmlns', $this->formats['epicur']['namespace']); |
|
| 278 | + $epicur->setAttribute('xmlns', $this->formats['epicur']['namespace']); |
|
| 279 | 279 | |
| 280 | - // Add administrative data without qualified namespace. |
|
| 281 | - $admin = $this->oai->createElement('administrative_data'); |
|
| 280 | + // Add administrative data without qualified namespace. |
|
| 281 | + $admin = $this->oai->createElement('administrative_data'); |
|
| 282 | 282 | |
| 283 | - $delivery = $this->oai->createElement('delivery'); |
|
| 283 | + $delivery = $this->oai->createElement('delivery'); |
|
| 284 | 284 | |
| 285 | - $update = $this->oai->createElement('update_status'); |
|
| 285 | + $update = $this->oai->createElement('update_status'); |
|
| 286 | 286 | |
| 287 | - $transfer = $this->oai->createElement('transfer'); |
|
| 287 | + $transfer = $this->oai->createElement('transfer'); |
|
| 288 | 288 | |
| 289 | - $format = $this->oai->createElement('format', 'text/html'); |
|
| 289 | + $format = $this->oai->createElement('format', 'text/html'); |
|
| 290 | 290 | |
| 291 | - // Add record data without qualified namespace. |
|
| 292 | - $record = $this->oai->createElement('record'); |
|
| 291 | + // Add record data without qualified namespace. |
|
| 292 | + $record = $this->oai->createElement('record'); |
|
| 293 | 293 | |
| 294 | - $identifier = $this->oai->createElement('identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')); |
|
| 294 | + $identifier = $this->oai->createElement('identifier', htmlspecialchars($metadata['urn'], ENT_NOQUOTES, 'UTF-8')); |
|
| 295 | 295 | |
| 296 | - $resource = $this->oai->createElement('resource'); |
|
| 296 | + $resource = $this->oai->createElement('resource'); |
|
| 297 | 297 | |
| 298 | - $ident = $this->oai->createElement('identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')); |
|
| 298 | + $ident = $this->oai->createElement('identifier', htmlspecialchars($metadata['purl'], ENT_NOQUOTES, 'UTF-8')); |
|
| 299 | 299 | |
| 300 | - } |
|
| 300 | + } |
|
| 301 | 301 | |
| 302 | - // Add attributes and build XML tree. |
|
| 303 | - $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 302 | + // Add attributes and build XML tree. |
|
| 303 | + $epicur->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 304 | 304 | |
| 305 | - $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']); |
|
| 305 | + $epicur->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', $this->formats['epicur']['namespace'].' '.$this->formats['epicur']['schema']); |
|
| 306 | 306 | |
| 307 | - // Do we update an URN or register a new one? |
|
| 308 | - if ($metadata['tstamp'] == $metadata['crdate']) { |
|
| 307 | + // Do we update an URN or register a new one? |
|
| 308 | + if ($metadata['tstamp'] == $metadata['crdate']) { |
|
| 309 | 309 | |
| 310 | - $update->setAttribute('type', 'urn_new'); |
|
| 310 | + $update->setAttribute('type', 'urn_new'); |
|
| 311 | 311 | |
| 312 | - } else { |
|
| 312 | + } else { |
|
| 313 | 313 | |
| 314 | - $update->setAttribute('type', 'url_update_general'); |
|
| 314 | + $update->setAttribute('type', 'url_update_general'); |
|
| 315 | 315 | |
| 316 | - } |
|
| 316 | + } |
|
| 317 | 317 | |
| 318 | - $delivery->appendChild($update); |
|
| 318 | + $delivery->appendChild($update); |
|
| 319 | 319 | |
| 320 | - $transfer->setAttribute('type', 'http'); |
|
| 320 | + $transfer->setAttribute('type', 'http'); |
|
| 321 | 321 | |
| 322 | - $delivery->appendChild($transfer); |
|
| 322 | + $delivery->appendChild($transfer); |
|
| 323 | 323 | |
| 324 | - $admin->appendChild($delivery); |
|
| 324 | + $admin->appendChild($delivery); |
|
| 325 | 325 | |
| 326 | - $epicur->appendChild($admin); |
|
| 326 | + $epicur->appendChild($admin); |
|
| 327 | 327 | |
| 328 | - $identifier->setAttribute('scheme', 'urn:nbn:de'); |
|
| 328 | + $identifier->setAttribute('scheme', 'urn:nbn:de'); |
|
| 329 | 329 | |
| 330 | - $record->appendChild($identifier); |
|
| 330 | + $record->appendChild($identifier); |
|
| 331 | 331 | |
| 332 | - $ident->setAttribute('scheme', 'url'); |
|
| 332 | + $ident->setAttribute('scheme', 'url'); |
|
| 333 | 333 | |
| 334 | - $ident->setAttribute('type', 'frontpage'); |
|
| 334 | + $ident->setAttribute('type', 'frontpage'); |
|
| 335 | 335 | |
| 336 | - $ident->setAttribute('role', 'primary'); |
|
| 336 | + $ident->setAttribute('role', 'primary'); |
|
| 337 | 337 | |
| 338 | - $resource->appendChild($ident); |
|
| 338 | + $resource->appendChild($ident); |
|
| 339 | 339 | |
| 340 | - $format->setAttribute('scheme', 'imt'); |
|
| 340 | + $format->setAttribute('scheme', 'imt'); |
|
| 341 | 341 | |
| 342 | - $resource->appendChild($format); |
|
| 342 | + $resource->appendChild($format); |
|
| 343 | 343 | |
| 344 | - $record->appendChild($resource); |
|
| 344 | + $record->appendChild($resource); |
|
| 345 | 345 | |
| 346 | - $epicur->appendChild($record); |
|
| 346 | + $epicur->appendChild($record); |
|
| 347 | 347 | |
| 348 | - return $epicur; |
|
| 348 | + return $epicur; |
|
| 349 | 349 | |
| 350 | - } |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - /** |
|
| 353 | - * Get METS data. |
|
| 354 | - * @see http://www.loc.gov/standards/mets/docs/mets.v1-7.html |
|
| 355 | - * |
|
| 356 | - * @access protected |
|
| 357 | - * |
|
| 358 | - * @param array $metadata: The metadata array |
|
| 359 | - * |
|
| 360 | - * @return DOMElement XML node to add to the OAI response |
|
| 361 | - */ |
|
| 362 | - protected function getMetsData(array $metadata) { |
|
| 352 | + /** |
|
| 353 | + * Get METS data. |
|
| 354 | + * @see http://www.loc.gov/standards/mets/docs/mets.v1-7.html |
|
| 355 | + * |
|
| 356 | + * @access protected |
|
| 357 | + * |
|
| 358 | + * @param array $metadata: The metadata array |
|
| 359 | + * |
|
| 360 | + * @return DOMElement XML node to add to the OAI response |
|
| 361 | + */ |
|
| 362 | + protected function getMetsData(array $metadata) { |
|
| 363 | 363 | |
| 364 | - $mets = NULL; |
|
| 364 | + $mets = NULL; |
|
| 365 | 365 | |
| 366 | - // Load METS file. |
|
| 367 | - $xml = new DOMDocument(); |
|
| 366 | + // Load METS file. |
|
| 367 | + $xml = new DOMDocument(); |
|
| 368 | 368 | |
| 369 | - if ($xml->load($metadata['location'])) { |
|
| 369 | + if ($xml->load($metadata['location'])) { |
|
| 370 | 370 | |
| 371 | - // Get root element. |
|
| 372 | - $root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets'); |
|
| 371 | + // Get root element. |
|
| 372 | + $root = $xml->getElementsByTagNameNS($this->formats['mets']['namespace'], 'mets'); |
|
| 373 | 373 | |
| 374 | - if ($root->item(0) instanceof DOMNode) { |
|
| 374 | + if ($root->item(0) instanceof DOMNode) { |
|
| 375 | 375 | |
| 376 | - // Import node into DOMDocument. |
|
| 377 | - $mets = $this->oai->importNode($root->item(0), TRUE); |
|
| 376 | + // Import node into DOMDocument. |
|
| 377 | + $mets = $this->oai->importNode($root->item(0), TRUE); |
|
| 378 | 378 | |
| 379 | - } else { |
|
| 379 | + } else { |
|
| 380 | 380 | |
| 381 | - if (TYPO3_DLOG) { |
|
| 381 | + if (TYPO3_DLOG) { |
|
| 382 | 382 | |
| 383 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata); |
|
| 383 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata); |
|
| 384 | 384 | |
| 385 | - } |
|
| 385 | + } |
|
| 386 | 386 | |
| 387 | - } |
|
| 387 | + } |
|
| 388 | 388 | |
| 389 | - } else { |
|
| 389 | + } else { |
|
| 390 | 390 | |
| 391 | - if (TYPO3_DLOG) { |
|
| 391 | + if (TYPO3_DLOG) { |
|
| 392 | 392 | |
| 393 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata); |
|
| 393 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata); |
|
| 394 | 394 | |
| 395 | - } |
|
| 395 | + } |
|
| 396 | 396 | |
| 397 | - } |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | - if ($mets === NULL) { |
|
| 399 | + if ($mets === NULL) { |
|
| 400 | 400 | |
| 401 | - $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8')); |
|
| 401 | + $mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8')); |
|
| 402 | 402 | |
| 403 | - } |
|
| 403 | + } |
|
| 404 | 404 | |
| 405 | - return $mets; |
|
| 405 | + return $mets; |
|
| 406 | 406 | |
| 407 | - } |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | - /** |
|
| 410 | - * The main method of the PlugIn |
|
| 411 | - * |
|
| 412 | - * @access public |
|
| 413 | - * |
|
| 414 | - * @param string $content: The PlugIn content |
|
| 415 | - * @param array $conf: The PlugIn configuration |
|
| 416 | - * |
|
| 417 | - * @return void |
|
| 418 | - */ |
|
| 419 | - public function main($content, $conf) { |
|
| 409 | + /** |
|
| 410 | + * The main method of the PlugIn |
|
| 411 | + * |
|
| 412 | + * @access public |
|
| 413 | + * |
|
| 414 | + * @param string $content: The PlugIn content |
|
| 415 | + * @param array $conf: The PlugIn configuration |
|
| 416 | + * |
|
| 417 | + * @return void |
|
| 418 | + */ |
|
| 419 | + public function main($content, $conf) { |
|
| 420 | 420 | |
| 421 | - // Initialize plugin. |
|
| 422 | - $this->init($conf); |
|
| 421 | + // Initialize plugin. |
|
| 422 | + $this->init($conf); |
|
| 423 | 423 | |
| 424 | - // Turn cache off. |
|
| 425 | - $this->setCache(FALSE); |
|
| 424 | + // Turn cache off. |
|
| 425 | + $this->setCache(FALSE); |
|
| 426 | 426 | |
| 427 | - // Get GET and POST variables. |
|
| 428 | - $this->getUrlParams(); |
|
| 427 | + // Get GET and POST variables. |
|
| 428 | + $this->getUrlParams(); |
|
| 429 | 429 | |
| 430 | - // Delete expired resumption tokens. |
|
| 431 | - $this->deleteExpiredTokens(); |
|
| 430 | + // Delete expired resumption tokens. |
|
| 431 | + $this->deleteExpiredTokens(); |
|
| 432 | 432 | |
| 433 | - // Create XML document. |
|
| 434 | - $this->oai = new DOMDocument('1.0', 'UTF-8'); |
|
| 433 | + // Create XML document. |
|
| 434 | + $this->oai = new DOMDocument('1.0', 'UTF-8'); |
|
| 435 | 435 | |
| 436 | - // Add processing instruction (aka XSL stylesheet). |
|
| 437 | - if (!empty($this->conf['stylesheet'])) { |
|
| 436 | + // Add processing instruction (aka XSL stylesheet). |
|
| 437 | + if (!empty($this->conf['stylesheet'])) { |
|
| 438 | 438 | |
| 439 | - // Resolve "EXT:" prefix in file path. |
|
| 440 | - if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') { |
|
| 439 | + // Resolve "EXT:" prefix in file path. |
|
| 440 | + if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') { |
|
| 441 | 441 | |
| 442 | - list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2); |
|
| 442 | + list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2); |
|
| 443 | 443 | |
| 444 | - if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) { |
|
| 444 | + if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) { |
|
| 445 | 445 | |
| 446 | - $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath; |
|
| 446 | + $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey).$filePath; |
|
| 447 | 447 | |
| 448 | - } |
|
| 448 | + } |
|
| 449 | 449 | |
| 450 | - } |
|
| 450 | + } |
|
| 451 | 451 | |
| 452 | - $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']); |
|
| 452 | + $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']); |
|
| 453 | 453 | |
| 454 | - } else { |
|
| 454 | + } else { |
|
| 455 | 455 | |
| 456 | - // Use default stylesheet if no custom stylesheet is given. |
|
| 457 | - $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl'); |
|
| 456 | + // Use default stylesheet if no custom stylesheet is given. |
|
| 457 | + $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl'); |
|
| 458 | 458 | |
| 459 | - } |
|
| 459 | + } |
|
| 460 | 460 | |
| 461 | - $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"')); |
|
| 461 | + $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"')); |
|
| 462 | 462 | |
| 463 | - // Create root element. |
|
| 464 | - $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH'); |
|
| 463 | + // Create root element. |
|
| 464 | + $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH'); |
|
| 465 | 465 | |
| 466 | - $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 466 | + $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|
| 467 | 467 | |
| 468 | - $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'); |
|
| 468 | + $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'); |
|
| 469 | 469 | |
| 470 | - // Add response date. |
|
| 471 | - $root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME']))); |
|
| 470 | + // Add response date. |
|
| 471 | + $root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME']))); |
|
| 472 | 472 | |
| 473 | - // Get response data. |
|
| 474 | - switch ($this->piVars['verb']) { |
|
| 473 | + // Get response data. |
|
| 474 | + switch ($this->piVars['verb']) { |
|
| 475 | 475 | |
| 476 | - case 'GetRecord': |
|
| 476 | + case 'GetRecord': |
|
| 477 | 477 | |
| 478 | - $response = $this->verbGetRecord(); |
|
| 478 | + $response = $this->verbGetRecord(); |
|
| 479 | 479 | |
| 480 | - break; |
|
| 480 | + break; |
|
| 481 | 481 | |
| 482 | - case 'Identify': |
|
| 482 | + case 'Identify': |
|
| 483 | 483 | |
| 484 | - $response = $this->verbIdentify(); |
|
| 484 | + $response = $this->verbIdentify(); |
|
| 485 | 485 | |
| 486 | - break; |
|
| 486 | + break; |
|
| 487 | 487 | |
| 488 | - case 'ListIdentifiers': |
|
| 488 | + case 'ListIdentifiers': |
|
| 489 | 489 | |
| 490 | - $response = $this->verbListIdentifiers(); |
|
| 490 | + $response = $this->verbListIdentifiers(); |
|
| 491 | 491 | |
| 492 | - break; |
|
| 492 | + break; |
|
| 493 | 493 | |
| 494 | - case 'ListMetadataFormats': |
|
| 494 | + case 'ListMetadataFormats': |
|
| 495 | 495 | |
| 496 | - $response = $this->verbListMetadataFormats(); |
|
| 496 | + $response = $this->verbListMetadataFormats(); |
|
| 497 | 497 | |
| 498 | - break; |
|
| 498 | + break; |
|
| 499 | 499 | |
| 500 | - case 'ListRecords': |
|
| 500 | + case 'ListRecords': |
|
| 501 | 501 | |
| 502 | - $response = $this->verbListRecords(); |
|
| 502 | + $response = $this->verbListRecords(); |
|
| 503 | 503 | |
| 504 | - break; |
|
| 504 | + break; |
|
| 505 | 505 | |
| 506 | - case 'ListSets': |
|
| 506 | + case 'ListSets': |
|
| 507 | 507 | |
| 508 | - $response = $this->verbListSets(); |
|
| 508 | + $response = $this->verbListSets(); |
|
| 509 | 509 | |
| 510 | - break; |
|
| 510 | + break; |
|
| 511 | 511 | |
| 512 | - default: |
|
| 512 | + default: |
|
| 513 | 513 | |
| 514 | - $response = $this->error('badVerb'); |
|
| 514 | + $response = $this->error('badVerb'); |
|
| 515 | 515 | |
| 516 | - } |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | - // Add request. |
|
| 519 | - $linkConf = array ( |
|
| 520 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
| 521 | - 'forceAbsoluteUrl' => 1 |
|
| 522 | - ); |
|
| 518 | + // Add request. |
|
| 519 | + $linkConf = array ( |
|
| 520 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
| 521 | + 'forceAbsoluteUrl' => 1 |
|
| 522 | + ); |
|
| 523 | 523 | |
| 524 | - $request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')); |
|
| 524 | + $request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')); |
|
| 525 | 525 | |
| 526 | - if (!$this->error) { |
|
| 526 | + if (!$this->error) { |
|
| 527 | 527 | |
| 528 | - foreach ($this->piVars as $key => $value) { |
|
| 528 | + foreach ($this->piVars as $key => $value) { |
|
| 529 | 529 | |
| 530 | - $request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); |
|
| 530 | + $request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); |
|
| 531 | 531 | |
| 532 | - } |
|
| 532 | + } |
|
| 533 | 533 | |
| 534 | - } |
|
| 534 | + } |
|
| 535 | 535 | |
| 536 | - $root->appendChild($request); |
|
| 536 | + $root->appendChild($request); |
|
| 537 | 537 | |
| 538 | - // Add response data. |
|
| 539 | - $root->appendChild($response); |
|
| 538 | + // Add response data. |
|
| 539 | + $root->appendChild($response); |
|
| 540 | 540 | |
| 541 | - // Build XML output. |
|
| 542 | - $this->oai->appendChild($root); |
|
| 541 | + // Build XML output. |
|
| 542 | + $this->oai->appendChild($root); |
|
| 543 | 543 | |
| 544 | - $content = $this->oai->saveXML(); |
|
| 544 | + $content = $this->oai->saveXML(); |
|
| 545 | 545 | |
| 546 | - // Clean output buffer. |
|
| 547 | - \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
| 546 | + // Clean output buffer. |
|
| 547 | + \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
| 548 | 548 | |
| 549 | - // Send headers. |
|
| 550 | - header('HTTP/1.1 200 OK'); |
|
| 549 | + // Send headers. |
|
| 550 | + header('HTTP/1.1 200 OK'); |
|
| 551 | 551 | |
| 552 | - header('Cache-Control: no-cache'); |
|
| 552 | + header('Cache-Control: no-cache'); |
|
| 553 | 553 | |
| 554 | - header('Content-Length: '.strlen($content)); |
|
| 554 | + header('Content-Length: '.strlen($content)); |
|
| 555 | 555 | |
| 556 | - header('Content-Type: text/xml; charset=utf-8'); |
|
| 556 | + header('Content-Type: text/xml; charset=utf-8'); |
|
| 557 | 557 | |
| 558 | - header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 558 | + header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 559 | 559 | |
| 560 | - header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 560 | + header('Expires: '.date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 561 | 561 | |
| 562 | - echo $content; |
|
| 562 | + echo $content; |
|
| 563 | 563 | |
| 564 | - // Flush output buffer and end script processing. |
|
| 565 | - ob_end_flush(); |
|
| 564 | + // Flush output buffer and end script processing. |
|
| 565 | + ob_end_flush(); |
|
| 566 | 566 | |
| 567 | - exit; |
|
| 567 | + exit; |
|
| 568 | 568 | |
| 569 | - } |
|
| 569 | + } |
|
| 570 | 570 | |
| 571 | - /** |
|
| 572 | - * Continue with resumption token |
|
| 573 | - * |
|
| 574 | - * @access protected |
|
| 575 | - * |
|
| 576 | - * @return string Substitution for subpart "###RESPONSE###" |
|
| 577 | - */ |
|
| 578 | - protected function resume() { |
|
| 571 | + /** |
|
| 572 | + * Continue with resumption token |
|
| 573 | + * |
|
| 574 | + * @access protected |
|
| 575 | + * |
|
| 576 | + * @return string Substitution for subpart "###RESPONSE###" |
|
| 577 | + */ |
|
| 578 | + protected function resume() { |
|
| 579 | 579 | |
| 580 | - // Get resumption token. |
|
| 581 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 582 | - 'tx_dlf_tokens.options AS options', |
|
| 583 | - 'tx_dlf_tokens', |
|
| 584 | - 'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'), |
|
| 585 | - '', |
|
| 586 | - '', |
|
| 587 | - '1' |
|
| 588 | - ); |
|
| 580 | + // Get resumption token. |
|
| 581 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 582 | + 'tx_dlf_tokens.options AS options', |
|
| 583 | + 'tx_dlf_tokens', |
|
| 584 | + 'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'), |
|
| 585 | + '', |
|
| 586 | + '', |
|
| 587 | + '1' |
|
| 588 | + ); |
|
| 589 | 589 | |
| 590 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 590 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 591 | 591 | |
| 592 | - // No resumption token found or resumption token expired. |
|
| 593 | - return $this->error('badResumptionToken'); |
|
| 592 | + // No resumption token found or resumption token expired. |
|
| 593 | + return $this->error('badResumptionToken'); |
|
| 594 | 594 | |
| 595 | - } |
|
| 595 | + } |
|
| 596 | 596 | |
| 597 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 597 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 598 | 598 | |
| 599 | - $resultSet = unserialize($resArray['options']); |
|
| 599 | + $resultSet = unserialize($resArray['options']); |
|
| 600 | 600 | |
| 601 | - $complete = FALSE; |
|
| 601 | + $complete = FALSE; |
|
| 602 | 602 | |
| 603 | - $todo = array (); |
|
| 603 | + $todo = array (); |
|
| 604 | 604 | |
| 605 | - $resume = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', $this->piVars['verb']); |
|
| 605 | + $resume = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', $this->piVars['verb']); |
|
| 606 | 606 | |
| 607 | - for ($i = $resultSet->metadata['offset'], $j = intval($resultSet->metadata['offset'] + $this->conf['limit']); $i < $j; $i++) { |
|
| 607 | + for ($i = $resultSet->metadata['offset'], $j = intval($resultSet->metadata['offset'] + $this->conf['limit']); $i < $j; $i++) { |
|
| 608 | 608 | |
| 609 | - $todo[] = $resultSet[$i]; |
|
| 609 | + $todo[] = $resultSet[$i]; |
|
| 610 | 610 | |
| 611 | - if (empty($resultSet[$i + 1])) { |
|
| 611 | + if (empty($resultSet[$i + 1])) { |
|
| 612 | 612 | |
| 613 | - $complete = TRUE; |
|
| 613 | + $complete = TRUE; |
|
| 614 | 614 | |
| 615 | - break; |
|
| 615 | + break; |
|
| 616 | 616 | |
| 617 | - } |
|
| 617 | + } |
|
| 618 | 618 | |
| 619 | - } |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 622 | - 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 623 | - 'tx_dlf_documents', |
|
| 624 | - 'tx_dlf_relations', |
|
| 625 | - 'tx_dlf_collections', |
|
| 626 | - 'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') 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'), |
|
| 627 | - 'tx_dlf_documents.uid', |
|
| 628 | - 'tx_dlf_documents.tstamp', |
|
| 629 | - $this->conf['limit'] |
|
| 630 | - ); |
|
| 621 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 622 | + 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 623 | + 'tx_dlf_documents', |
|
| 624 | + 'tx_dlf_relations', |
|
| 625 | + 'tx_dlf_collections', |
|
| 626 | + 'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') 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'), |
|
| 627 | + 'tx_dlf_documents.uid', |
|
| 628 | + 'tx_dlf_documents.tstamp', |
|
| 629 | + $this->conf['limit'] |
|
| 630 | + ); |
|
| 631 | 631 | |
| 632 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 632 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 633 | 633 | |
| 634 | - // Add header node. |
|
| 635 | - $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 634 | + // Add header node. |
|
| 635 | + $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 636 | 636 | |
| 637 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 637 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 638 | 638 | |
| 639 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 639 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 640 | 640 | |
| 641 | - // Check if document is deleted or hidden. |
|
| 642 | - // TODO: Use TYPO3 API functions here! |
|
| 643 | - if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 641 | + // Check if document is deleted or hidden. |
|
| 642 | + // TODO: Use TYPO3 API functions here! |
|
| 643 | + if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 644 | 644 | |
| 645 | - // Add "deleted" status. |
|
| 646 | - $header->setAttribute('status', 'deleted'); |
|
| 645 | + // Add "deleted" status. |
|
| 646 | + $header->setAttribute('status', 'deleted'); |
|
| 647 | 647 | |
| 648 | - if ($this->piVars['verb'] == 'ListRecords') { |
|
| 648 | + if ($this->piVars['verb'] == 'ListRecords') { |
|
| 649 | 649 | |
| 650 | - // Add record node. |
|
| 651 | - $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 650 | + // Add record node. |
|
| 651 | + $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 652 | 652 | |
| 653 | - $record->appendChild($header); |
|
| 653 | + $record->appendChild($header); |
|
| 654 | 654 | |
| 655 | - $resume->appendChild($record); |
|
| 655 | + $resume->appendChild($record); |
|
| 656 | 656 | |
| 657 | - } elseif ($this->piVars['verb'] == 'ListIdentifiers') { |
|
| 657 | + } elseif ($this->piVars['verb'] == 'ListIdentifiers') { |
|
| 658 | 658 | |
| 659 | - $resume->appendChild($header); |
|
| 659 | + $resume->appendChild($header); |
|
| 660 | 660 | |
| 661 | - } |
|
| 661 | + } |
|
| 662 | 662 | |
| 663 | - } else { |
|
| 663 | + } else { |
|
| 664 | 664 | |
| 665 | - // Add sets. |
|
| 666 | - foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 665 | + // Add sets. |
|
| 666 | + foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 667 | 667 | |
| 668 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 668 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 669 | 669 | |
| 670 | - } |
|
| 670 | + } |
|
| 671 | 671 | |
| 672 | - if ($this->piVars['verb'] == 'ListRecords') { |
|
| 672 | + if ($this->piVars['verb'] == 'ListRecords') { |
|
| 673 | 673 | |
| 674 | - // Add record node. |
|
| 675 | - $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 674 | + // Add record node. |
|
| 675 | + $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 676 | 676 | |
| 677 | - $record->appendChild($header); |
|
| 677 | + $record->appendChild($header); |
|
| 678 | 678 | |
| 679 | - // Add metadata node. |
|
| 680 | - $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata'); |
|
| 679 | + // Add metadata node. |
|
| 680 | + $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata'); |
|
| 681 | 681 | |
| 682 | - switch ($resultSet->metadata['metadataPrefix']) { |
|
| 682 | + switch ($resultSet->metadata['metadataPrefix']) { |
|
| 683 | 683 | |
| 684 | - case 'oai_dc': |
|
| 684 | + case 'oai_dc': |
|
| 685 | 685 | |
| 686 | - $metadata->appendChild($this->getDcData($resArray)); |
|
| 686 | + $metadata->appendChild($this->getDcData($resArray)); |
|
| 687 | 687 | |
| 688 | - break; |
|
| 688 | + break; |
|
| 689 | 689 | |
| 690 | - case 'epicur': |
|
| 690 | + case 'epicur': |
|
| 691 | 691 | |
| 692 | - $metadata->appendChild($this->getEpicurData($resArray)); |
|
| 692 | + $metadata->appendChild($this->getEpicurData($resArray)); |
|
| 693 | 693 | |
| 694 | - break; |
|
| 694 | + break; |
|
| 695 | 695 | |
| 696 | - case 'mets': |
|
| 696 | + case 'mets': |
|
| 697 | 697 | |
| 698 | - $metadata->appendChild($this->getMetsData($resArray)); |
|
| 698 | + $metadata->appendChild($this->getMetsData($resArray)); |
|
| 699 | 699 | |
| 700 | - break; |
|
| 700 | + break; |
|
| 701 | 701 | |
| 702 | - } |
|
| 702 | + } |
|
| 703 | 703 | |
| 704 | - $record->appendChild($metadata); |
|
| 704 | + $record->appendChild($metadata); |
|
| 705 | 705 | |
| 706 | - $resume->appendChild($record); |
|
| 706 | + $resume->appendChild($record); |
|
| 707 | 707 | |
| 708 | - } elseif ($this->piVars['verb'] == 'ListIdentifiers') { |
|
| 708 | + } elseif ($this->piVars['verb'] == 'ListIdentifiers') { |
|
| 709 | 709 | |
| 710 | - $resume->appendChild($header); |
|
| 710 | + $resume->appendChild($header); |
|
| 711 | 711 | |
| 712 | - } |
|
| 712 | + } |
|
| 713 | 713 | |
| 714 | - } |
|
| 714 | + } |
|
| 715 | 715 | |
| 716 | - } |
|
| 716 | + } |
|
| 717 | 717 | |
| 718 | - if (!$complete) { |
|
| 718 | + if (!$complete) { |
|
| 719 | 719 | |
| 720 | - // Save result set to database and generate resumption token. |
|
| 721 | - $token = uniqid(); |
|
| 720 | + // Save result set to database and generate resumption token. |
|
| 721 | + $token = uniqid(); |
|
| 722 | 722 | |
| 723 | - $resultSet->metadata = array ( |
|
| 724 | - 'offset' => intval($resultSet->metadata['offset'] + $this->conf['limit']), |
|
| 725 | - 'metadataPrefix' => $resultSet->metadata['metadataPrefix'], |
|
| 726 | - ); |
|
| 723 | + $resultSet->metadata = array ( |
|
| 724 | + 'offset' => intval($resultSet->metadata['offset'] + $this->conf['limit']), |
|
| 725 | + 'metadataPrefix' => $resultSet->metadata['metadataPrefix'], |
|
| 726 | + ); |
|
| 727 | 727 | |
| 728 | - $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery( |
|
| 729 | - 'tx_dlf_tokens', |
|
| 730 | - array ( |
|
| 731 | - 'tstamp' => $GLOBALS['EXEC_TIME'], |
|
| 732 | - 'token' => $token, |
|
| 733 | - 'options' => serialize($resultSet), |
|
| 734 | - 'ident' => 'oai', |
|
| 735 | - ) |
|
| 736 | - ); |
|
| 728 | + $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery( |
|
| 729 | + 'tx_dlf_tokens', |
|
| 730 | + array ( |
|
| 731 | + 'tstamp' => $GLOBALS['EXEC_TIME'], |
|
| 732 | + 'token' => $token, |
|
| 733 | + 'options' => serialize($resultSet), |
|
| 734 | + 'ident' => 'oai', |
|
| 735 | + ) |
|
| 736 | + ); |
|
| 737 | 737 | |
| 738 | - if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) { |
|
| 738 | + if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) { |
|
| 739 | 739 | |
| 740 | - $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8')); |
|
| 740 | + $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8')); |
|
| 741 | 741 | |
| 742 | - } else { |
|
| 742 | + } else { |
|
| 743 | 743 | |
| 744 | - if (TYPO3_DLOG) { |
|
| 744 | + if (TYPO3_DLOG) { |
|
| 745 | 745 | |
| 746 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->resume()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 746 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->resume()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 747 | 747 | |
| 748 | - } |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | - } |
|
| 750 | + } |
|
| 751 | 751 | |
| 752 | - } else { |
|
| 752 | + } else { |
|
| 753 | 753 | |
| 754 | - // Result set complete. No more resumption token needed. |
|
| 755 | - $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken'); |
|
| 754 | + // Result set complete. No more resumption token needed. |
|
| 755 | + $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken'); |
|
| 756 | 756 | |
| 757 | - } |
|
| 757 | + } |
|
| 758 | 758 | |
| 759 | - $resumptionToken->setAttribute('cursor', $resultSet->metadata['offset']); |
|
| 759 | + $resumptionToken->setAttribute('cursor', $resultSet->metadata['offset']); |
|
| 760 | 760 | |
| 761 | - $resumptionToken->setAttribute('completeListSize', count($resultSet)); |
|
| 761 | + $resumptionToken->setAttribute('completeListSize', count($resultSet)); |
|
| 762 | 762 | |
| 763 | - $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 763 | + $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 764 | 764 | |
| 765 | - $resume->appendChild($resumptionToken); |
|
| 765 | + $resume->appendChild($resumptionToken); |
|
| 766 | 766 | |
| 767 | - return $resume; |
|
| 767 | + return $resume; |
|
| 768 | 768 | |
| 769 | - } |
|
| 769 | + } |
|
| 770 | 770 | |
| 771 | - /** |
|
| 772 | - * Process verb "GetRecord" |
|
| 773 | - * |
|
| 774 | - * @access protected |
|
| 775 | - * |
|
| 776 | - * @return string Substitution for subpart "###RESPONSE###" |
|
| 777 | - */ |
|
| 778 | - protected function verbGetRecord() { |
|
| 771 | + /** |
|
| 772 | + * Process verb "GetRecord" |
|
| 773 | + * |
|
| 774 | + * @access protected |
|
| 775 | + * |
|
| 776 | + * @return string Substitution for subpart "###RESPONSE###" |
|
| 777 | + */ |
|
| 778 | + protected function verbGetRecord() { |
|
| 779 | 779 | |
| 780 | - // Check for invalid arguments. |
|
| 781 | - if (count($this->piVars) != 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) { |
|
| 780 | + // Check for invalid arguments. |
|
| 781 | + if (count($this->piVars) != 3 || empty($this->piVars['metadataPrefix']) || empty($this->piVars['identifier'])) { |
|
| 782 | 782 | |
| 783 | - return $this->error('badArgument'); |
|
| 783 | + return $this->error('badArgument'); |
|
| 784 | 784 | |
| 785 | - } else { |
|
| 785 | + } else { |
|
| 786 | 786 | |
| 787 | - // Check "metadataPrefix" for valid value. |
|
| 788 | - if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) { |
|
| 787 | + // Check "metadataPrefix" for valid value. |
|
| 788 | + if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) { |
|
| 789 | 789 | |
| 790 | - return $this->error('cannotDisseminateFormat'); |
|
| 790 | + return $this->error('cannotDisseminateFormat'); |
|
| 791 | 791 | |
| 792 | - } |
|
| 792 | + } |
|
| 793 | 793 | |
| 794 | - $where = ''; |
|
| 794 | + $where = ''; |
|
| 795 | 795 | |
| 796 | - // Select records from database. |
|
| 797 | - if (!$this->conf['show_userdefined']) { |
|
| 796 | + // Select records from database. |
|
| 797 | + if (!$this->conf['show_userdefined']) { |
|
| 798 | 798 | |
| 799 | - $where .= ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 799 | + $where .= ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 800 | 800 | |
| 801 | - } |
|
| 801 | + } |
|
| 802 | 802 | |
| 803 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 804 | - 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 805 | - 'tx_dlf_documents', |
|
| 806 | - 'tx_dlf_relations', |
|
| 807 | - 'tx_dlf_collections', |
|
| 808 | - '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'), |
|
| 809 | - 'tx_dlf_documents.uid', |
|
| 810 | - 'tx_dlf_documents.tstamp', |
|
| 811 | - '1' |
|
| 812 | - ); |
|
| 803 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 804 | + 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 805 | + 'tx_dlf_documents', |
|
| 806 | + 'tx_dlf_relations', |
|
| 807 | + 'tx_dlf_collections', |
|
| 808 | + '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'), |
|
| 809 | + 'tx_dlf_documents.uid', |
|
| 810 | + 'tx_dlf_documents.tstamp', |
|
| 811 | + '1' |
|
| 812 | + ); |
|
| 813 | 813 | |
| 814 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 814 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 815 | 815 | |
| 816 | - return $this->error('idDoesNotExist'); |
|
| 816 | + return $this->error('idDoesNotExist'); |
|
| 817 | 817 | |
| 818 | - } else { |
|
| 818 | + } else { |
|
| 819 | 819 | |
| 820 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 820 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 821 | 821 | |
| 822 | - // Check for required fields. |
|
| 823 | - foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
|
| 822 | + // Check for required fields. |
|
| 823 | + foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
|
| 824 | 824 | |
| 825 | - if (empty($resArray[$required])) { |
|
| 825 | + if (empty($resArray[$required])) { |
|
| 826 | 826 | |
| 827 | - return $this->error('cannotDisseminateFormat'); |
|
| 827 | + return $this->error('cannotDisseminateFormat'); |
|
| 828 | 828 | |
| 829 | - } |
|
| 829 | + } |
|
| 830 | 830 | |
| 831 | - } |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | - // Add record node. |
|
| 834 | - $GetRecord = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'GetRecord'); |
|
| 833 | + // Add record node. |
|
| 834 | + $GetRecord = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'GetRecord'); |
|
| 835 | 835 | |
| 836 | - $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 836 | + $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 837 | 837 | |
| 838 | - // Add header node. |
|
| 839 | - $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 838 | + // Add header node. |
|
| 839 | + $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 840 | 840 | |
| 841 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 841 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 842 | 842 | |
| 843 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 843 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 844 | 844 | |
| 845 | - // Handle deleted documents. |
|
| 846 | - // TODO: Use TYPO3 API functions here! |
|
| 847 | - if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 845 | + // Handle deleted documents. |
|
| 846 | + // TODO: Use TYPO3 API functions here! |
|
| 847 | + if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 848 | 848 | |
| 849 | - $header->setAttribute('status', 'deleted'); |
|
| 849 | + $header->setAttribute('status', 'deleted'); |
|
| 850 | 850 | |
| 851 | - $record->appendChild($header); |
|
| 851 | + $record->appendChild($header); |
|
| 852 | 852 | |
| 853 | - } else { |
|
| 853 | + } else { |
|
| 854 | 854 | |
| 855 | - foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 855 | + foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 856 | 856 | |
| 857 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 857 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 858 | 858 | |
| 859 | - } |
|
| 859 | + } |
|
| 860 | 860 | |
| 861 | - $record->appendChild($header); |
|
| 861 | + $record->appendChild($header); |
|
| 862 | 862 | |
| 863 | - // Add metadata node. |
|
| 864 | - $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata'); |
|
| 863 | + // Add metadata node. |
|
| 864 | + $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata'); |
|
| 865 | 865 | |
| 866 | - switch ($this->piVars['metadataPrefix']) { |
|
| 866 | + switch ($this->piVars['metadataPrefix']) { |
|
| 867 | 867 | |
| 868 | - case 'oai_dc': |
|
| 868 | + case 'oai_dc': |
|
| 869 | 869 | |
| 870 | - $metadata->appendChild($this->getDcData($resArray)); |
|
| 870 | + $metadata->appendChild($this->getDcData($resArray)); |
|
| 871 | 871 | |
| 872 | - break; |
|
| 872 | + break; |
|
| 873 | 873 | |
| 874 | - case 'epicur': |
|
| 874 | + case 'epicur': |
|
| 875 | 875 | |
| 876 | - $metadata->appendChild($this->getEpicurData($resArray)); |
|
| 876 | + $metadata->appendChild($this->getEpicurData($resArray)); |
|
| 877 | 877 | |
| 878 | - break; |
|
| 878 | + break; |
|
| 879 | 879 | |
| 880 | - case 'mets': |
|
| 880 | + case 'mets': |
|
| 881 | 881 | |
| 882 | - $metadata->appendChild($this->getMetsData($resArray)); |
|
| 882 | + $metadata->appendChild($this->getMetsData($resArray)); |
|
| 883 | 883 | |
| 884 | - break; |
|
| 884 | + break; |
|
| 885 | 885 | |
| 886 | - } |
|
| 886 | + } |
|
| 887 | 887 | |
| 888 | - $record->appendChild($metadata); |
|
| 888 | + $record->appendChild($metadata); |
|
| 889 | 889 | |
| 890 | - } |
|
| 890 | + } |
|
| 891 | 891 | |
| 892 | - $GetRecord->appendChild($record); |
|
| 892 | + $GetRecord->appendChild($record); |
|
| 893 | 893 | |
| 894 | - return $GetRecord; |
|
| 894 | + return $GetRecord; |
|
| 895 | 895 | |
| 896 | - } |
|
| 896 | + } |
|
| 897 | 897 | |
| 898 | - } |
|
| 898 | + } |
|
| 899 | 899 | |
| 900 | - } |
|
| 900 | + } |
|
| 901 | 901 | |
| 902 | - /** |
|
| 903 | - * Process verb "Identify" |
|
| 904 | - * |
|
| 905 | - * @access protected |
|
| 906 | - * |
|
| 907 | - * @return DOMElement XML node to add to the OAI response |
|
| 908 | - */ |
|
| 909 | - protected function verbIdentify() { |
|
| 902 | + /** |
|
| 903 | + * Process verb "Identify" |
|
| 904 | + * |
|
| 905 | + * @access protected |
|
| 906 | + * |
|
| 907 | + * @return DOMElement XML node to add to the OAI response |
|
| 908 | + */ |
|
| 909 | + protected function verbIdentify() { |
|
| 910 | 910 | |
| 911 | - // Check for invalid arguments. |
|
| 912 | - if (count($this->piVars) > 1) { |
|
| 911 | + // Check for invalid arguments. |
|
| 912 | + if (count($this->piVars) > 1) { |
|
| 913 | 913 | |
| 914 | - return $this->error('badArgument'); |
|
| 914 | + return $this->error('badArgument'); |
|
| 915 | 915 | |
| 916 | - } |
|
| 916 | + } |
|
| 917 | 917 | |
| 918 | - // Get repository name and administrative contact. |
|
| 919 | - // Use default values for an installation with incomplete plugin configuration. |
|
| 918 | + // Get repository name and administrative contact. |
|
| 919 | + // Use default values for an installation with incomplete plugin configuration. |
|
| 920 | 920 | |
| 921 | - $adminEmail = '[email protected]'; |
|
| 922 | - $repositoryName = 'Kitodo.Presentation OAI-PMH interface (incomplete configuration)'; |
|
| 921 | + $adminEmail = '[email protected]'; |
|
| 922 | + $repositoryName = 'Kitodo.Presentation OAI-PMH interface (incomplete configuration)'; |
|
| 923 | 923 | |
| 924 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 925 | - 'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact', |
|
| 926 | - 'tx_dlf_libraries', |
|
| 927 | - 'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
| 928 | - '', |
|
| 929 | - '', |
|
| 930 | - '' |
|
| 931 | - ); |
|
| 924 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 925 | + 'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact', |
|
| 926 | + 'tx_dlf_libraries', |
|
| 927 | + 'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
| 928 | + '', |
|
| 929 | + '', |
|
| 930 | + '' |
|
| 931 | + ); |
|
| 932 | 932 | |
| 933 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 933 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 934 | 934 | |
| 935 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 935 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 936 | 936 | |
| 937 | - $adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES); |
|
| 938 | - $repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES); |
|
| 937 | + $adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES); |
|
| 938 | + $repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES); |
|
| 939 | 939 | |
| 940 | - } else { |
|
| 940 | + } else { |
|
| 941 | 941 | |
| 942 | - if (TYPO3_DLOG) { |
|
| 942 | + if (TYPO3_DLOG) { |
|
| 943 | 943 | |
| 944 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration', |
|
| 945 | - $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
| 944 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration', |
|
| 945 | + $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
| 946 | 946 | |
| 947 | - } |
|
| 947 | + } |
|
| 948 | 948 | |
| 949 | - } |
|
| 949 | + } |
|
| 950 | 950 | |
| 951 | - // Get earliest datestamp. Use a default value if that fails. |
|
| 951 | + // Get earliest datestamp. Use a default value if that fails. |
|
| 952 | 952 | |
| 953 | - $earliestDatestamp = '0000-00-00T00:00:00Z'; |
|
| 953 | + $earliestDatestamp = '0000-00-00T00:00:00Z'; |
|
| 954 | 954 | |
| 955 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 956 | - 'tx_dlf_documents.tstamp AS tstamp', |
|
| 957 | - 'tx_dlf_documents', |
|
| 958 | - 'tx_dlf_documents.pid=' . intval($this->conf['pages']), |
|
| 959 | - '', |
|
| 960 | - 'tx_dlf_documents.tstamp ASC', |
|
| 961 | - '1' |
|
| 962 | - ); |
|
| 955 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 956 | + 'tx_dlf_documents.tstamp AS tstamp', |
|
| 957 | + 'tx_dlf_documents', |
|
| 958 | + 'tx_dlf_documents.pid=' . intval($this->conf['pages']), |
|
| 959 | + '', |
|
| 960 | + 'tx_dlf_documents.tstamp ASC', |
|
| 961 | + '1' |
|
| 962 | + ); |
|
| 963 | 963 | |
| 964 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 964 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 965 | 965 | |
| 966 | - list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 967 | - $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp); |
|
| 966 | + list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 967 | + $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp); |
|
| 968 | 968 | |
| 969 | - } else { |
|
| 969 | + } else { |
|
| 970 | 970 | |
| 971 | - if (TYPO3_DLOG) { |
|
| 971 | + if (TYPO3_DLOG) { |
|
| 972 | 972 | |
| 973 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' . |
|
| 974 | - $this->conf['pages'] . '"', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
| 973 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' . |
|
| 974 | + $this->conf['pages'] . '"', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
| 975 | 975 | |
| 976 | - } |
|
| 976 | + } |
|
| 977 | 977 | |
| 978 | - } |
|
| 978 | + } |
|
| 979 | 979 | |
| 980 | - $linkConf = array ( |
|
| 981 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
| 982 | - 'forceAbsoluteUrl' => 1 |
|
| 983 | - ); |
|
| 984 | - $baseURL = htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES); |
|
| 980 | + $linkConf = array ( |
|
| 981 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
| 982 | + 'forceAbsoluteUrl' => 1 |
|
| 983 | + ); |
|
| 984 | + $baseURL = htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES); |
|
| 985 | 985 | |
| 986 | - // Add identification node. |
|
| 987 | - $Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify'); |
|
| 988 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 989 | - 'repositoryName', $repositoryName)); |
|
| 990 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 991 | - 'baseURL', $baseURL)); |
|
| 992 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 993 | - 'protocolVersion', '2.0')); |
|
| 994 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 995 | - 'adminEmail', $adminEmail)); |
|
| 996 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 997 | - 'earliestDatestamp', $earliestDatestamp)); |
|
| 998 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 999 | - 'deletedRecord', 'transient')); |
|
| 1000 | - $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 1001 | - 'granularity', 'YYYY-MM-DDThh:mm:ssZ')); |
|
| 986 | + // Add identification node. |
|
| 987 | + $Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify'); |
|
| 988 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 989 | + 'repositoryName', $repositoryName)); |
|
| 990 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 991 | + 'baseURL', $baseURL)); |
|
| 992 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 993 | + 'protocolVersion', '2.0')); |
|
| 994 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 995 | + 'adminEmail', $adminEmail)); |
|
| 996 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 997 | + 'earliestDatestamp', $earliestDatestamp)); |
|
| 998 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 999 | + 'deletedRecord', 'transient')); |
|
| 1000 | + $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', |
|
| 1001 | + 'granularity', 'YYYY-MM-DDThh:mm:ssZ')); |
|
| 1002 | 1002 | |
| 1003 | - return $Identify; |
|
| 1004 | - } |
|
| 1003 | + return $Identify; |
|
| 1004 | + } |
|
| 1005 | 1005 | |
| 1006 | - /** |
|
| 1007 | - * Process verb "ListIdentifiers" |
|
| 1008 | - * |
|
| 1009 | - * @access protected |
|
| 1010 | - * |
|
| 1011 | - * @return string Substitution for subpart "###RESPONSE###" |
|
| 1012 | - */ |
|
| 1013 | - protected function verbListIdentifiers() { |
|
| 1006 | + /** |
|
| 1007 | + * Process verb "ListIdentifiers" |
|
| 1008 | + * |
|
| 1009 | + * @access protected |
|
| 1010 | + * |
|
| 1011 | + * @return string Substitution for subpart "###RESPONSE###" |
|
| 1012 | + */ |
|
| 1013 | + protected function verbListIdentifiers() { |
|
| 1014 | 1014 | |
| 1015 | - // Check for invalid arguments. |
|
| 1016 | - if (!empty($this->piVars['resumptionToken'])) { |
|
| 1015 | + // Check for invalid arguments. |
|
| 1016 | + if (!empty($this->piVars['resumptionToken'])) { |
|
| 1017 | 1017 | |
| 1018 | - // "resumptionToken" is an exclusive argument. |
|
| 1019 | - if (count($this->piVars) > 2) { |
|
| 1018 | + // "resumptionToken" is an exclusive argument. |
|
| 1019 | + if (count($this->piVars) > 2) { |
|
| 1020 | 1020 | |
| 1021 | - return $this->error('badArgument'); |
|
| 1021 | + return $this->error('badArgument'); |
|
| 1022 | 1022 | |
| 1023 | - } else { |
|
| 1023 | + } else { |
|
| 1024 | 1024 | |
| 1025 | - return $this->resume(); |
|
| 1025 | + return $this->resume(); |
|
| 1026 | 1026 | |
| 1027 | - } |
|
| 1027 | + } |
|
| 1028 | 1028 | |
| 1029 | - } elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) { |
|
| 1029 | + } elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) { |
|
| 1030 | 1030 | |
| 1031 | - // "metadataPrefix" is required and "identifier" is not allowed. |
|
| 1032 | - return $this->error('badArgument'); |
|
| 1031 | + // "metadataPrefix" is required and "identifier" is not allowed. |
|
| 1032 | + return $this->error('badArgument'); |
|
| 1033 | 1033 | |
| 1034 | - } else { |
|
| 1034 | + } else { |
|
| 1035 | 1035 | |
| 1036 | - $where = ''; |
|
| 1036 | + $where = ''; |
|
| 1037 | 1037 | |
| 1038 | - // Check "metadataPrefix" for valid value. |
|
| 1039 | - if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) { |
|
| 1038 | + // Check "metadataPrefix" for valid value. |
|
| 1039 | + if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) { |
|
| 1040 | 1040 | |
| 1041 | - return $this->error('cannotDisseminateFormat'); |
|
| 1041 | + return $this->error('cannotDisseminateFormat'); |
|
| 1042 | 1042 | |
| 1043 | - } else { |
|
| 1043 | + } else { |
|
| 1044 | 1044 | |
| 1045 | - // Check for required fields. |
|
| 1046 | - foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
|
| 1045 | + // Check for required fields. |
|
| 1046 | + foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
|
| 1047 | 1047 | |
| 1048 | - $where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\''; |
|
| 1048 | + $where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\''; |
|
| 1049 | 1049 | |
| 1050 | - } |
|
| 1050 | + } |
|
| 1051 | 1051 | |
| 1052 | - } |
|
| 1052 | + } |
|
| 1053 | 1053 | |
| 1054 | - // Check "set" for valid value. |
|
| 1055 | - if (!empty($this->piVars['set'])) { |
|
| 1054 | + // Check "set" for valid value. |
|
| 1055 | + if (!empty($this->piVars['set'])) { |
|
| 1056 | 1056 | |
| 1057 | - // Get set information. |
|
| 1058 | - $additionalWhere = ''; |
|
| 1057 | + // Get set information. |
|
| 1058 | + $additionalWhere = ''; |
|
| 1059 | 1059 | |
| 1060 | - if (!$this->conf['show_userdefined']) { |
|
| 1060 | + if (!$this->conf['show_userdefined']) { |
|
| 1061 | 1061 | |
| 1062 | - $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1062 | + $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1063 | 1063 | |
| 1064 | - } |
|
| 1064 | + } |
|
| 1065 | 1065 | |
| 1066 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1067 | - 'tx_dlf_collections.uid AS uid', |
|
| 1068 | - 'tx_dlf_collections', |
|
| 1069 | - 'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 1070 | - '', |
|
| 1071 | - '', |
|
| 1072 | - '1' |
|
| 1073 | - ); |
|
| 1066 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1067 | + 'tx_dlf_collections.uid AS uid', |
|
| 1068 | + 'tx_dlf_collections', |
|
| 1069 | + 'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 1070 | + '', |
|
| 1071 | + '', |
|
| 1072 | + '1' |
|
| 1073 | + ); |
|
| 1074 | 1074 | |
| 1075 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1075 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1076 | 1076 | |
| 1077 | - return $this->error('noSetHierarchy'); |
|
| 1077 | + return $this->error('noSetHierarchy'); |
|
| 1078 | 1078 | |
| 1079 | - } else { |
|
| 1079 | + } else { |
|
| 1080 | 1080 | |
| 1081 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 1081 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 1082 | 1082 | |
| 1083 | - $where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']); |
|
| 1083 | + $where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']); |
|
| 1084 | 1084 | |
| 1085 | - } |
|
| 1085 | + } |
|
| 1086 | 1086 | |
| 1087 | - } |
|
| 1087 | + } |
|
| 1088 | 1088 | |
| 1089 | - // Check "from" for valid value. |
|
| 1090 | - if (!empty($this->piVars['from'])) { |
|
| 1089 | + // Check "from" for valid value. |
|
| 1090 | + if (!empty($this->piVars['from'])) { |
|
| 1091 | 1091 | |
| 1092 | - if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) { |
|
| 1092 | + if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) { |
|
| 1093 | 1093 | |
| 1094 | - $from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900); |
|
| 1094 | + $from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900); |
|
| 1095 | 1095 | |
| 1096 | - } else { |
|
| 1096 | + } else { |
|
| 1097 | 1097 | |
| 1098 | - return $this->error('badArgument'); |
|
| 1098 | + return $this->error('badArgument'); |
|
| 1099 | 1099 | |
| 1100 | - } |
|
| 1100 | + } |
|
| 1101 | 1101 | |
| 1102 | - $where .= ' AND tx_dlf_documents.tstamp>='.intval($from); |
|
| 1102 | + $where .= ' AND tx_dlf_documents.tstamp>='.intval($from); |
|
| 1103 | 1103 | |
| 1104 | - } |
|
| 1104 | + } |
|
| 1105 | 1105 | |
| 1106 | - // Check "until" for valid value. |
|
| 1107 | - if (!empty($this->piVars['until'])) { |
|
| 1106 | + // Check "until" for valid value. |
|
| 1107 | + if (!empty($this->piVars['until'])) { |
|
| 1108 | 1108 | |
| 1109 | - if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) { |
|
| 1109 | + if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) { |
|
| 1110 | 1110 | |
| 1111 | - $until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900); |
|
| 1111 | + $until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900); |
|
| 1112 | 1112 | |
| 1113 | - } else { |
|
| 1113 | + } else { |
|
| 1114 | 1114 | |
| 1115 | - return $this->error('badArgument'); |
|
| 1115 | + return $this->error('badArgument'); |
|
| 1116 | 1116 | |
| 1117 | - } |
|
| 1117 | + } |
|
| 1118 | 1118 | |
| 1119 | - if (!empty($from) && $from > $until) { |
|
| 1119 | + if (!empty($from) && $from > $until) { |
|
| 1120 | 1120 | |
| 1121 | - return $this->error('badArgument'); |
|
| 1121 | + return $this->error('badArgument'); |
|
| 1122 | 1122 | |
| 1123 | - } |
|
| 1123 | + } |
|
| 1124 | 1124 | |
| 1125 | - $where .= ' AND tx_dlf_documents.tstamp<='.intval($until); |
|
| 1125 | + $where .= ' AND tx_dlf_documents.tstamp<='.intval($until); |
|
| 1126 | 1126 | |
| 1127 | - } |
|
| 1127 | + } |
|
| 1128 | 1128 | |
| 1129 | - // Check "from" and "until" for same granularity. |
|
| 1130 | - if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) { |
|
| 1129 | + // Check "from" and "until" for same granularity. |
|
| 1130 | + if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) { |
|
| 1131 | 1131 | |
| 1132 | - if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) { |
|
| 1132 | + if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) { |
|
| 1133 | 1133 | |
| 1134 | - return $this->error('badArgument'); |
|
| 1134 | + return $this->error('badArgument'); |
|
| 1135 | 1135 | |
| 1136 | - } |
|
| 1136 | + } |
|
| 1137 | 1137 | |
| 1138 | - } |
|
| 1138 | + } |
|
| 1139 | 1139 | |
| 1140 | - } |
|
| 1140 | + } |
|
| 1141 | 1141 | |
| 1142 | - // Select records from database. |
|
| 1143 | - if (!$this->conf['show_userdefined']) { |
|
| 1142 | + // Select records from database. |
|
| 1143 | + if (!$this->conf['show_userdefined']) { |
|
| 1144 | 1144 | |
| 1145 | - $where .= ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1145 | + $where .= ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1146 | 1146 | |
| 1147 | - } |
|
| 1147 | + } |
|
| 1148 | 1148 | |
| 1149 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1150 | - 'tx_dlf_documents.uid', |
|
| 1151 | - 'tx_dlf_documents', |
|
| 1152 | - 'tx_dlf_relations', |
|
| 1153 | - 'tx_dlf_collections', |
|
| 1154 | - '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'), |
|
| 1155 | - 'tx_dlf_documents.uid', |
|
| 1156 | - 'tx_dlf_documents.tstamp', |
|
| 1157 | - '' |
|
| 1158 | - ); |
|
| 1149 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1150 | + 'tx_dlf_documents.uid', |
|
| 1151 | + 'tx_dlf_documents', |
|
| 1152 | + 'tx_dlf_relations', |
|
| 1153 | + 'tx_dlf_collections', |
|
| 1154 | + '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'), |
|
| 1155 | + 'tx_dlf_documents.uid', |
|
| 1156 | + 'tx_dlf_documents.tstamp', |
|
| 1157 | + '' |
|
| 1158 | + ); |
|
| 1159 | 1159 | |
| 1160 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1160 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1161 | 1161 | |
| 1162 | - return $this->error('noRecordsMatch'); |
|
| 1162 | + return $this->error('noRecordsMatch'); |
|
| 1163 | 1163 | |
| 1164 | - } else { |
|
| 1164 | + } else { |
|
| 1165 | 1165 | |
| 1166 | - // Build result set. |
|
| 1167 | - $results = array (); |
|
| 1166 | + // Build result set. |
|
| 1167 | + $results = array (); |
|
| 1168 | 1168 | |
| 1169 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1169 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1170 | 1170 | |
| 1171 | - // Save only UIDs for resumption token. |
|
| 1172 | - $results[] = $resArray['uid']; |
|
| 1171 | + // Save only UIDs for resumption token. |
|
| 1172 | + $results[] = $resArray['uid']; |
|
| 1173 | 1173 | |
| 1174 | - } |
|
| 1174 | + } |
|
| 1175 | 1175 | |
| 1176 | - if (empty($results)) { |
|
| 1176 | + if (empty($results)) { |
|
| 1177 | 1177 | |
| 1178 | - return $this->error('noRecordsMatch'); |
|
| 1178 | + return $this->error('noRecordsMatch'); |
|
| 1179 | 1179 | |
| 1180 | - } |
|
| 1180 | + } |
|
| 1181 | 1181 | |
| 1182 | - $complete = FALSE; |
|
| 1182 | + $complete = FALSE; |
|
| 1183 | 1183 | |
| 1184 | - $todo = array (); |
|
| 1184 | + $todo = array (); |
|
| 1185 | 1185 | |
| 1186 | - $ListIdentifiers = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListIdentifiers'); |
|
| 1186 | + $ListIdentifiers = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListIdentifiers'); |
|
| 1187 | 1187 | |
| 1188 | - for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) { |
|
| 1188 | + for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) { |
|
| 1189 | 1189 | |
| 1190 | - $todo[] = $results[$i]; |
|
| 1190 | + $todo[] = $results[$i]; |
|
| 1191 | 1191 | |
| 1192 | - if (empty($results[$i + 1])) { |
|
| 1192 | + if (empty($results[$i + 1])) { |
|
| 1193 | 1193 | |
| 1194 | - $complete = TRUE; |
|
| 1194 | + $complete = TRUE; |
|
| 1195 | 1195 | |
| 1196 | - break; |
|
| 1196 | + break; |
|
| 1197 | 1197 | |
| 1198 | - } |
|
| 1198 | + } |
|
| 1199 | 1199 | |
| 1200 | - } |
|
| 1200 | + } |
|
| 1201 | 1201 | |
| 1202 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1203 | - 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 1204 | - 'tx_dlf_documents', |
|
| 1205 | - 'tx_dlf_relations', |
|
| 1206 | - 'tx_dlf_collections', |
|
| 1207 | - 'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') 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'), |
|
| 1208 | - 'tx_dlf_documents.uid', |
|
| 1209 | - 'tx_dlf_documents.tstamp', |
|
| 1210 | - $this->conf['limit'] |
|
| 1211 | - ); |
|
| 1202 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1203 | + 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 1204 | + 'tx_dlf_documents', |
|
| 1205 | + 'tx_dlf_relations', |
|
| 1206 | + 'tx_dlf_collections', |
|
| 1207 | + 'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') 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'), |
|
| 1208 | + 'tx_dlf_documents.uid', |
|
| 1209 | + 'tx_dlf_documents.tstamp', |
|
| 1210 | + $this->conf['limit'] |
|
| 1211 | + ); |
|
| 1212 | 1212 | |
| 1213 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1213 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1214 | 1214 | |
| 1215 | - $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 1215 | + $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 1216 | 1216 | |
| 1217 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1217 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1218 | 1218 | |
| 1219 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 1219 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 1220 | 1220 | |
| 1221 | - // Check if document is deleted or hidden. |
|
| 1222 | - // TODO: Use TYPO3 API functions here! |
|
| 1223 | - if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 1221 | + // Check if document is deleted or hidden. |
|
| 1222 | + // TODO: Use TYPO3 API functions here! |
|
| 1223 | + if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 1224 | 1224 | |
| 1225 | - // Add "deleted" status. |
|
| 1226 | - $header->setAttribute('status', 'deleted'); |
|
| 1225 | + // Add "deleted" status. |
|
| 1226 | + $header->setAttribute('status', 'deleted'); |
|
| 1227 | 1227 | |
| 1228 | - } else { |
|
| 1228 | + } else { |
|
| 1229 | 1229 | |
| 1230 | - // Add sets. |
|
| 1231 | - foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 1230 | + // Add sets. |
|
| 1231 | + foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 1232 | 1232 | |
| 1233 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 1233 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 1234 | 1234 | |
| 1235 | - } |
|
| 1235 | + } |
|
| 1236 | 1236 | |
| 1237 | - } |
|
| 1237 | + } |
|
| 1238 | 1238 | |
| 1239 | - $ListIdentifiers->appendChild($header); |
|
| 1239 | + $ListIdentifiers->appendChild($header); |
|
| 1240 | 1240 | |
| 1241 | - } |
|
| 1241 | + } |
|
| 1242 | 1242 | |
| 1243 | - if (!$complete) { |
|
| 1243 | + if (!$complete) { |
|
| 1244 | 1244 | |
| 1245 | - // Save result set as list object. |
|
| 1246 | - $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
| 1245 | + // Save result set as list object. |
|
| 1246 | + $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
| 1247 | 1247 | |
| 1248 | - $resultSet->reset(); |
|
| 1248 | + $resultSet->reset(); |
|
| 1249 | 1249 | |
| 1250 | - $resultSet->add($results); |
|
| 1250 | + $resultSet->add($results); |
|
| 1251 | 1251 | |
| 1252 | - // Save result set to database and generate resumption token. |
|
| 1253 | - $token = uniqid(); |
|
| 1252 | + // Save result set to database and generate resumption token. |
|
| 1253 | + $token = uniqid(); |
|
| 1254 | 1254 | |
| 1255 | - $resultSet->metadata = array ( |
|
| 1256 | - 'offset' => intval($this->conf['limit']), |
|
| 1257 | - 'metadataPrefix' => $this->piVars['metadataPrefix'], |
|
| 1258 | - ); |
|
| 1255 | + $resultSet->metadata = array ( |
|
| 1256 | + 'offset' => intval($this->conf['limit']), |
|
| 1257 | + 'metadataPrefix' => $this->piVars['metadataPrefix'], |
|
| 1258 | + ); |
|
| 1259 | 1259 | |
| 1260 | - $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery( |
|
| 1261 | - 'tx_dlf_tokens', |
|
| 1262 | - array ( |
|
| 1263 | - 'tstamp' => $GLOBALS['EXEC_TIME'], |
|
| 1264 | - 'token' => $token, |
|
| 1265 | - 'options' => serialize($resultSet), |
|
| 1266 | - 'ident' => 'oai', |
|
| 1267 | - ) |
|
| 1268 | - ); |
|
| 1260 | + $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery( |
|
| 1261 | + 'tx_dlf_tokens', |
|
| 1262 | + array ( |
|
| 1263 | + 'tstamp' => $GLOBALS['EXEC_TIME'], |
|
| 1264 | + 'token' => $token, |
|
| 1265 | + 'options' => serialize($resultSet), |
|
| 1266 | + 'ident' => 'oai', |
|
| 1267 | + ) |
|
| 1268 | + ); |
|
| 1269 | 1269 | |
| 1270 | - if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) { |
|
| 1270 | + if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) { |
|
| 1271 | 1271 | |
| 1272 | - $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8')); |
|
| 1272 | + $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8')); |
|
| 1273 | 1273 | |
| 1274 | - $resumptionToken->setAttribute('cursor', '0'); |
|
| 1274 | + $resumptionToken->setAttribute('cursor', '0'); |
|
| 1275 | 1275 | |
| 1276 | - $resumptionToken->setAttribute('completeListSize', count($resultSet)); |
|
| 1276 | + $resumptionToken->setAttribute('completeListSize', count($resultSet)); |
|
| 1277 | 1277 | |
| 1278 | - $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 1278 | + $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 1279 | 1279 | |
| 1280 | - $ListIdentifiers->appendChild($resumptionToken); |
|
| 1280 | + $ListIdentifiers->appendChild($resumptionToken); |
|
| 1281 | 1281 | |
| 1282 | - } else { |
|
| 1282 | + } else { |
|
| 1283 | 1283 | |
| 1284 | - if (TYPO3_DLOG) { |
|
| 1284 | + if (TYPO3_DLOG) { |
|
| 1285 | 1285 | |
| 1286 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListIdentifiers()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 1286 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListIdentifiers()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 1287 | 1287 | |
| 1288 | - } |
|
| 1288 | + } |
|
| 1289 | 1289 | |
| 1290 | - } |
|
| 1290 | + } |
|
| 1291 | 1291 | |
| 1292 | - } |
|
| 1292 | + } |
|
| 1293 | 1293 | |
| 1294 | - return $ListIdentifiers; |
|
| 1294 | + return $ListIdentifiers; |
|
| 1295 | 1295 | |
| 1296 | - } |
|
| 1296 | + } |
|
| 1297 | 1297 | |
| 1298 | - } |
|
| 1298 | + } |
|
| 1299 | 1299 | |
| 1300 | - /** |
|
| 1301 | - * Process verb "ListMetadataFormats" |
|
| 1302 | - * |
|
| 1303 | - * @access protected |
|
| 1304 | - * |
|
| 1305 | - * @return DOMElement XML node to add to the OAI response |
|
| 1306 | - */ |
|
| 1307 | - protected function verbListMetadataFormats() { |
|
| 1300 | + /** |
|
| 1301 | + * Process verb "ListMetadataFormats" |
|
| 1302 | + * |
|
| 1303 | + * @access protected |
|
| 1304 | + * |
|
| 1305 | + * @return DOMElement XML node to add to the OAI response |
|
| 1306 | + */ |
|
| 1307 | + protected function verbListMetadataFormats() { |
|
| 1308 | 1308 | |
| 1309 | - $resArray = array (); |
|
| 1309 | + $resArray = array (); |
|
| 1310 | 1310 | |
| 1311 | - // Check for invalid arguments. |
|
| 1312 | - if (count($this->piVars) > 1) { |
|
| 1311 | + // Check for invalid arguments. |
|
| 1312 | + if (count($this->piVars) > 1) { |
|
| 1313 | 1313 | |
| 1314 | - if (empty($this->piVars['identifier']) || count($this->piVars) > 2) { |
|
| 1314 | + if (empty($this->piVars['identifier']) || count($this->piVars) > 2) { |
|
| 1315 | 1315 | |
| 1316 | - return $this->error('badArgument'); |
|
| 1316 | + return $this->error('badArgument'); |
|
| 1317 | 1317 | |
| 1318 | - } else { |
|
| 1318 | + } else { |
|
| 1319 | 1319 | |
| 1320 | - // Check given identifier. |
|
| 1321 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1322 | - 'tx_dlf_documents.*', |
|
| 1323 | - 'tx_dlf_documents', |
|
| 1324 | - 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents'), |
|
| 1325 | - '', |
|
| 1326 | - '', |
|
| 1327 | - '1' |
|
| 1328 | - ); |
|
| 1320 | + // Check given identifier. |
|
| 1321 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1322 | + 'tx_dlf_documents.*', |
|
| 1323 | + 'tx_dlf_documents', |
|
| 1324 | + 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['identifier'], 'tx_dlf_documents'), |
|
| 1325 | + '', |
|
| 1326 | + '', |
|
| 1327 | + '1' |
|
| 1328 | + ); |
|
| 1329 | 1329 | |
| 1330 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1330 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1331 | 1331 | |
| 1332 | - return $this->error('idDoesNotExist'); |
|
| 1332 | + return $this->error('idDoesNotExist'); |
|
| 1333 | 1333 | |
| 1334 | - } else { |
|
| 1334 | + } else { |
|
| 1335 | 1335 | |
| 1336 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 1336 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 1337 | 1337 | |
| 1338 | - } |
|
| 1338 | + } |
|
| 1339 | 1339 | |
| 1340 | - } |
|
| 1340 | + } |
|
| 1341 | 1341 | |
| 1342 | - } |
|
| 1342 | + } |
|
| 1343 | 1343 | |
| 1344 | - // Add metadata formats node. |
|
| 1345 | - $ListMetadaFormats = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListMetadataFormats'); |
|
| 1344 | + // Add metadata formats node. |
|
| 1345 | + $ListMetadaFormats = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListMetadataFormats'); |
|
| 1346 | 1346 | |
| 1347 | - foreach ($this->formats as $prefix => $details) { |
|
| 1347 | + foreach ($this->formats as $prefix => $details) { |
|
| 1348 | 1348 | |
| 1349 | - // Check for required fields. |
|
| 1350 | - if (!empty($resArray)) { |
|
| 1349 | + // Check for required fields. |
|
| 1350 | + if (!empty($resArray)) { |
|
| 1351 | 1351 | |
| 1352 | - foreach ($details['requiredFields'] as $required) { |
|
| 1352 | + foreach ($details['requiredFields'] as $required) { |
|
| 1353 | 1353 | |
| 1354 | - if (empty($resArray[$required])) { |
|
| 1354 | + if (empty($resArray[$required])) { |
|
| 1355 | 1355 | |
| 1356 | - // Skip metadata formats whose requirements are not met. |
|
| 1357 | - continue 2; |
|
| 1356 | + // Skip metadata formats whose requirements are not met. |
|
| 1357 | + continue 2; |
|
| 1358 | 1358 | |
| 1359 | - } |
|
| 1359 | + } |
|
| 1360 | 1360 | |
| 1361 | - } |
|
| 1361 | + } |
|
| 1362 | 1362 | |
| 1363 | - } |
|
| 1363 | + } |
|
| 1364 | 1364 | |
| 1365 | - // Add format node. |
|
| 1366 | - $format = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataFormat'); |
|
| 1365 | + // Add format node. |
|
| 1366 | + $format = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataFormat'); |
|
| 1367 | 1367 | |
| 1368 | - $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataPrefix', htmlspecialchars($prefix, ENT_NOQUOTES, 'UTF-8'))); |
|
| 1368 | + $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataPrefix', htmlspecialchars($prefix, ENT_NOQUOTES, 'UTF-8'))); |
|
| 1369 | 1369 | |
| 1370 | - $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'schema', htmlspecialchars($details['schema'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1370 | + $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'schema', htmlspecialchars($details['schema'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1371 | 1371 | |
| 1372 | - $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataNamespace', htmlspecialchars($details['namespace'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1372 | + $format->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadataNamespace', htmlspecialchars($details['namespace'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1373 | 1373 | |
| 1374 | - $ListMetadaFormats->appendChild($format); |
|
| 1374 | + $ListMetadaFormats->appendChild($format); |
|
| 1375 | 1375 | |
| 1376 | - } |
|
| 1376 | + } |
|
| 1377 | 1377 | |
| 1378 | - return $ListMetadaFormats; |
|
| 1378 | + return $ListMetadaFormats; |
|
| 1379 | 1379 | |
| 1380 | - } |
|
| 1380 | + } |
|
| 1381 | 1381 | |
| 1382 | - /** |
|
| 1383 | - * Process verb "ListRecords" |
|
| 1384 | - * |
|
| 1385 | - * @access protected |
|
| 1386 | - * |
|
| 1387 | - * @return string Substitution for subpart "###RESPONSE###" |
|
| 1388 | - */ |
|
| 1389 | - protected function verbListRecords() { |
|
| 1382 | + /** |
|
| 1383 | + * Process verb "ListRecords" |
|
| 1384 | + * |
|
| 1385 | + * @access protected |
|
| 1386 | + * |
|
| 1387 | + * @return string Substitution for subpart "###RESPONSE###" |
|
| 1388 | + */ |
|
| 1389 | + protected function verbListRecords() { |
|
| 1390 | 1390 | |
| 1391 | - // Check for invalid arguments. |
|
| 1392 | - if (!empty($this->piVars['resumptionToken'])) { |
|
| 1391 | + // Check for invalid arguments. |
|
| 1392 | + if (!empty($this->piVars['resumptionToken'])) { |
|
| 1393 | 1393 | |
| 1394 | - // "resumptionToken" is an exclusive argument. |
|
| 1395 | - if (count($this->piVars) > 2) { |
|
| 1394 | + // "resumptionToken" is an exclusive argument. |
|
| 1395 | + if (count($this->piVars) > 2) { |
|
| 1396 | 1396 | |
| 1397 | - return $this->error('badArgument'); |
|
| 1397 | + return $this->error('badArgument'); |
|
| 1398 | 1398 | |
| 1399 | - } else { |
|
| 1399 | + } else { |
|
| 1400 | 1400 | |
| 1401 | - return $this->resume(); |
|
| 1401 | + return $this->resume(); |
|
| 1402 | 1402 | |
| 1403 | - } |
|
| 1403 | + } |
|
| 1404 | 1404 | |
| 1405 | - } elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) { |
|
| 1405 | + } elseif (empty($this->piVars['metadataPrefix']) || !empty($this->piVars['identifier'])) { |
|
| 1406 | 1406 | |
| 1407 | - // "metadataPrefix" is required and "identifier" is not allowed. |
|
| 1408 | - return $this->error('badArgument'); |
|
| 1407 | + // "metadataPrefix" is required and "identifier" is not allowed. |
|
| 1408 | + return $this->error('badArgument'); |
|
| 1409 | 1409 | |
| 1410 | - } else { |
|
| 1410 | + } else { |
|
| 1411 | 1411 | |
| 1412 | - $where = ''; |
|
| 1412 | + $where = ''; |
|
| 1413 | 1413 | |
| 1414 | - // Check "metadataPrefix" for valid value. |
|
| 1415 | - if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) { |
|
| 1414 | + // Check "metadataPrefix" for valid value. |
|
| 1415 | + if (!in_array($this->piVars['metadataPrefix'], array_keys($this->formats))) { |
|
| 1416 | 1416 | |
| 1417 | - return $this->error('cannotDisseminateFormat'); |
|
| 1417 | + return $this->error('cannotDisseminateFormat'); |
|
| 1418 | 1418 | |
| 1419 | - } else { |
|
| 1419 | + } else { |
|
| 1420 | 1420 | |
| 1421 | - // Check for required fields. |
|
| 1422 | - foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
|
| 1421 | + // Check for required fields. |
|
| 1422 | + foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) { |
|
| 1423 | 1423 | |
| 1424 | - $where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\''; |
|
| 1424 | + $where .= ' AND NOT tx_dlf_documents.'.$required.'=\'\''; |
|
| 1425 | 1425 | |
| 1426 | - } |
|
| 1426 | + } |
|
| 1427 | 1427 | |
| 1428 | - } |
|
| 1428 | + } |
|
| 1429 | 1429 | |
| 1430 | - // Check "set" for valid value. |
|
| 1431 | - if (!empty($this->piVars['set'])) { |
|
| 1430 | + // Check "set" for valid value. |
|
| 1431 | + if (!empty($this->piVars['set'])) { |
|
| 1432 | 1432 | |
| 1433 | - // Get set information. |
|
| 1434 | - $additionalWhere = ''; |
|
| 1433 | + // Get set information. |
|
| 1434 | + $additionalWhere = ''; |
|
| 1435 | 1435 | |
| 1436 | - if (!$this->conf['show_userdefined']) { |
|
| 1436 | + if (!$this->conf['show_userdefined']) { |
|
| 1437 | 1437 | |
| 1438 | - $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1438 | + $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1439 | 1439 | |
| 1440 | - } |
|
| 1440 | + } |
|
| 1441 | 1441 | |
| 1442 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1443 | - 'tx_dlf_collections.uid AS uid', |
|
| 1444 | - 'tx_dlf_collections', |
|
| 1445 | - 'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 1446 | - '', |
|
| 1447 | - '', |
|
| 1448 | - '1' |
|
| 1449 | - ); |
|
| 1442 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1443 | + 'tx_dlf_collections.uid AS uid', |
|
| 1444 | + 'tx_dlf_collections', |
|
| 1445 | + 'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 1446 | + '', |
|
| 1447 | + '', |
|
| 1448 | + '1' |
|
| 1449 | + ); |
|
| 1450 | 1450 | |
| 1451 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1451 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1452 | 1452 | |
| 1453 | - return $this->error('noSetHierarchy'); |
|
| 1453 | + return $this->error('noSetHierarchy'); |
|
| 1454 | 1454 | |
| 1455 | - } else { |
|
| 1455 | + } else { |
|
| 1456 | 1456 | |
| 1457 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 1457 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 1458 | 1458 | |
| 1459 | - $where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']); |
|
| 1459 | + $where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']); |
|
| 1460 | 1460 | |
| 1461 | - } |
|
| 1461 | + } |
|
| 1462 | 1462 | |
| 1463 | - } |
|
| 1463 | + } |
|
| 1464 | 1464 | |
| 1465 | - // Check "from" for valid value. |
|
| 1466 | - if (!empty($this->piVars['from'])) { |
|
| 1465 | + // Check "from" for valid value. |
|
| 1466 | + if (!empty($this->piVars['from'])) { |
|
| 1467 | 1467 | |
| 1468 | - if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) { |
|
| 1468 | + if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) { |
|
| 1469 | 1469 | |
| 1470 | - $from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900); |
|
| 1470 | + $from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900); |
|
| 1471 | 1471 | |
| 1472 | - } else { |
|
| 1472 | + } else { |
|
| 1473 | 1473 | |
| 1474 | - return $this->error('badArgument'); |
|
| 1474 | + return $this->error('badArgument'); |
|
| 1475 | 1475 | |
| 1476 | - } |
|
| 1476 | + } |
|
| 1477 | 1477 | |
| 1478 | - $where .= ' AND tx_dlf_documents.tstamp>='.intval($from); |
|
| 1478 | + $where .= ' AND tx_dlf_documents.tstamp>='.intval($from); |
|
| 1479 | 1479 | |
| 1480 | - } |
|
| 1480 | + } |
|
| 1481 | 1481 | |
| 1482 | - // Check "until" for valid value. |
|
| 1483 | - if (!empty($this->piVars['until'])) { |
|
| 1482 | + // Check "until" for valid value. |
|
| 1483 | + if (!empty($this->piVars['until'])) { |
|
| 1484 | 1484 | |
| 1485 | - if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) { |
|
| 1485 | + if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) { |
|
| 1486 | 1486 | |
| 1487 | - $until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900); |
|
| 1487 | + $until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900); |
|
| 1488 | 1488 | |
| 1489 | - } else { |
|
| 1489 | + } else { |
|
| 1490 | 1490 | |
| 1491 | - return $this->error('badArgument'); |
|
| 1491 | + return $this->error('badArgument'); |
|
| 1492 | 1492 | |
| 1493 | - } |
|
| 1493 | + } |
|
| 1494 | 1494 | |
| 1495 | - if (!empty($from) && $from > $until) { |
|
| 1495 | + if (!empty($from) && $from > $until) { |
|
| 1496 | 1496 | |
| 1497 | - return $this->error('badArgument'); |
|
| 1497 | + return $this->error('badArgument'); |
|
| 1498 | 1498 | |
| 1499 | - } |
|
| 1499 | + } |
|
| 1500 | 1500 | |
| 1501 | - $where .= ' AND tx_dlf_documents.tstamp<='.intval($until); |
|
| 1501 | + $where .= ' AND tx_dlf_documents.tstamp<='.intval($until); |
|
| 1502 | 1502 | |
| 1503 | - } |
|
| 1503 | + } |
|
| 1504 | 1504 | |
| 1505 | - // Check "from" and "until" for same granularity. |
|
| 1506 | - if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) { |
|
| 1505 | + // Check "from" and "until" for same granularity. |
|
| 1506 | + if (!empty($this->piVars['from']) && !empty($this->piVars['until'])) { |
|
| 1507 | 1507 | |
| 1508 | - if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) { |
|
| 1508 | + if (strlen($this->piVars['from']) != strlen($this->piVars['until'])) { |
|
| 1509 | 1509 | |
| 1510 | - return $this->error('badArgument'); |
|
| 1510 | + return $this->error('badArgument'); |
|
| 1511 | 1511 | |
| 1512 | - } |
|
| 1512 | + } |
|
| 1513 | 1513 | |
| 1514 | - } |
|
| 1514 | + } |
|
| 1515 | 1515 | |
| 1516 | - } |
|
| 1516 | + } |
|
| 1517 | 1517 | |
| 1518 | - // Select records from database. |
|
| 1519 | - if (!$this->conf['show_userdefined']) { |
|
| 1518 | + // Select records from database. |
|
| 1519 | + if (!$this->conf['show_userdefined']) { |
|
| 1520 | 1520 | |
| 1521 | - $where .= ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1521 | + $where .= ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1522 | 1522 | |
| 1523 | - } |
|
| 1523 | + } |
|
| 1524 | 1524 | |
| 1525 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1526 | - 'tx_dlf_documents.uid', |
|
| 1527 | - 'tx_dlf_documents', |
|
| 1528 | - 'tx_dlf_relations', |
|
| 1529 | - 'tx_dlf_collections', |
|
| 1530 | - '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'), |
|
| 1531 | - 'tx_dlf_documents.uid', |
|
| 1532 | - 'tx_dlf_documents.tstamp', |
|
| 1533 | - '' |
|
| 1534 | - ); |
|
| 1525 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1526 | + 'tx_dlf_documents.uid', |
|
| 1527 | + 'tx_dlf_documents', |
|
| 1528 | + 'tx_dlf_relations', |
|
| 1529 | + 'tx_dlf_collections', |
|
| 1530 | + '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'), |
|
| 1531 | + 'tx_dlf_documents.uid', |
|
| 1532 | + 'tx_dlf_documents.tstamp', |
|
| 1533 | + '' |
|
| 1534 | + ); |
|
| 1535 | 1535 | |
| 1536 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1536 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1537 | 1537 | |
| 1538 | - return $this->error('noRecordsMatch'); |
|
| 1538 | + return $this->error('noRecordsMatch'); |
|
| 1539 | 1539 | |
| 1540 | - } else { |
|
| 1540 | + } else { |
|
| 1541 | 1541 | |
| 1542 | - // Build result set. |
|
| 1543 | - $results = array (); |
|
| 1542 | + // Build result set. |
|
| 1543 | + $results = array (); |
|
| 1544 | 1544 | |
| 1545 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1545 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1546 | 1546 | |
| 1547 | - // Save only UIDs for resumption token. |
|
| 1548 | - $results[] = $resArray['uid']; |
|
| 1547 | + // Save only UIDs for resumption token. |
|
| 1548 | + $results[] = $resArray['uid']; |
|
| 1549 | 1549 | |
| 1550 | - } |
|
| 1550 | + } |
|
| 1551 | 1551 | |
| 1552 | - $complete = FALSE; |
|
| 1552 | + $complete = FALSE; |
|
| 1553 | 1553 | |
| 1554 | - $todo = array (); |
|
| 1554 | + $todo = array (); |
|
| 1555 | 1555 | |
| 1556 | - $ListRecords = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListRecords'); |
|
| 1556 | + $ListRecords = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListRecords'); |
|
| 1557 | 1557 | |
| 1558 | - for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) { |
|
| 1558 | + for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) { |
|
| 1559 | 1559 | |
| 1560 | - $todo[] = $results[$i]; |
|
| 1560 | + $todo[] = $results[$i]; |
|
| 1561 | 1561 | |
| 1562 | - if (empty($results[$i + 1])) { |
|
| 1562 | + if (empty($results[$i + 1])) { |
|
| 1563 | 1563 | |
| 1564 | - $complete = TRUE; |
|
| 1564 | + $complete = TRUE; |
|
| 1565 | 1565 | |
| 1566 | - break; |
|
| 1566 | + break; |
|
| 1567 | 1567 | |
| 1568 | - } |
|
| 1568 | + } |
|
| 1569 | 1569 | |
| 1570 | - } |
|
| 1570 | + } |
|
| 1571 | 1571 | |
| 1572 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1573 | - 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 1574 | - 'tx_dlf_documents', |
|
| 1575 | - 'tx_dlf_relations', |
|
| 1576 | - 'tx_dlf_collections', |
|
| 1577 | - 'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') 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'), |
|
| 1578 | - 'tx_dlf_documents.uid', |
|
| 1579 | - 'tx_dlf_documents.tstamp', |
|
| 1580 | - $this->conf['limit'] |
|
| 1581 | - ); |
|
| 1572 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 1573 | + 'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections', |
|
| 1574 | + 'tx_dlf_documents', |
|
| 1575 | + 'tx_dlf_relations', |
|
| 1576 | + 'tx_dlf_collections', |
|
| 1577 | + 'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($todo)).') 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'), |
|
| 1578 | + 'tx_dlf_documents.uid', |
|
| 1579 | + 'tx_dlf_documents.tstamp', |
|
| 1580 | + $this->conf['limit'] |
|
| 1581 | + ); |
|
| 1582 | 1582 | |
| 1583 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1583 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1584 | 1584 | |
| 1585 | - // Add record node. |
|
| 1586 | - $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 1585 | + // Add record node. |
|
| 1586 | + $record = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'record'); |
|
| 1587 | 1587 | |
| 1588 | - // Add header node. |
|
| 1589 | - $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 1588 | + // Add header node. |
|
| 1589 | + $header = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'header'); |
|
| 1590 | 1590 | |
| 1591 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1591 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'identifier', htmlspecialchars($resArray['record_id'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1592 | 1592 | |
| 1593 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 1593 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'datestamp', gmdate('Y-m-d\TH:i:s\Z', $resArray['tstamp']))); |
|
| 1594 | 1594 | |
| 1595 | - // Check if document is deleted or hidden. |
|
| 1596 | - // TODO: Use TYPO3 API functions here! |
|
| 1597 | - if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 1595 | + // Check if document is deleted or hidden. |
|
| 1596 | + // TODO: Use TYPO3 API functions here! |
|
| 1597 | + if ($resArray['deleted'] || $resArray['hidden']) { |
|
| 1598 | 1598 | |
| 1599 | - // Add "deleted" status. |
|
| 1600 | - $header->setAttribute('status', 'deleted'); |
|
| 1599 | + // Add "deleted" status. |
|
| 1600 | + $header->setAttribute('status', 'deleted'); |
|
| 1601 | 1601 | |
| 1602 | - $record->appendChild($header); |
|
| 1602 | + $record->appendChild($header); |
|
| 1603 | 1603 | |
| 1604 | - } else { |
|
| 1604 | + } else { |
|
| 1605 | 1605 | |
| 1606 | - // Add sets. |
|
| 1607 | - foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 1606 | + // Add sets. |
|
| 1607 | + foreach (explode(' ', $resArray['collections']) as $spec) { |
|
| 1608 | 1608 | |
| 1609 | - $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 1609 | + $header->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($spec, ENT_NOQUOTES, 'UTF-8'))); |
|
| 1610 | 1610 | |
| 1611 | - } |
|
| 1611 | + } |
|
| 1612 | 1612 | |
| 1613 | - $record->appendChild($header); |
|
| 1613 | + $record->appendChild($header); |
|
| 1614 | 1614 | |
| 1615 | - // Add metadata node. |
|
| 1616 | - $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata'); |
|
| 1615 | + // Add metadata node. |
|
| 1616 | + $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata'); |
|
| 1617 | 1617 | |
| 1618 | - switch ($this->piVars['metadataPrefix']) { |
|
| 1618 | + switch ($this->piVars['metadataPrefix']) { |
|
| 1619 | 1619 | |
| 1620 | - case 'oai_dc': |
|
| 1620 | + case 'oai_dc': |
|
| 1621 | 1621 | |
| 1622 | - $metadata->appendChild($this->getDcData($resArray)); |
|
| 1622 | + $metadata->appendChild($this->getDcData($resArray)); |
|
| 1623 | 1623 | |
| 1624 | - break; |
|
| 1624 | + break; |
|
| 1625 | 1625 | |
| 1626 | - case 'epicur': |
|
| 1626 | + case 'epicur': |
|
| 1627 | 1627 | |
| 1628 | - $metadata->appendChild($this->getEpicurData($resArray)); |
|
| 1628 | + $metadata->appendChild($this->getEpicurData($resArray)); |
|
| 1629 | 1629 | |
| 1630 | - break; |
|
| 1630 | + break; |
|
| 1631 | 1631 | |
| 1632 | - case 'mets': |
|
| 1632 | + case 'mets': |
|
| 1633 | 1633 | |
| 1634 | - $metadata->appendChild($this->getMetsData($resArray)); |
|
| 1634 | + $metadata->appendChild($this->getMetsData($resArray)); |
|
| 1635 | 1635 | |
| 1636 | - break; |
|
| 1636 | + break; |
|
| 1637 | 1637 | |
| 1638 | - } |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | - $record->appendChild($metadata); |
|
| 1640 | + $record->appendChild($metadata); |
|
| 1641 | 1641 | |
| 1642 | - } |
|
| 1642 | + } |
|
| 1643 | 1643 | |
| 1644 | - $ListRecords->appendChild($record); |
|
| 1644 | + $ListRecords->appendChild($record); |
|
| 1645 | 1645 | |
| 1646 | - } |
|
| 1646 | + } |
|
| 1647 | 1647 | |
| 1648 | - if (!$complete) { |
|
| 1648 | + if (!$complete) { |
|
| 1649 | 1649 | |
| 1650 | - // Save result set as list object. |
|
| 1651 | - $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
| 1650 | + // Save result set as list object. |
|
| 1651 | + $resultSet = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
| 1652 | 1652 | |
| 1653 | - $resultSet->reset(); |
|
| 1653 | + $resultSet->reset(); |
|
| 1654 | 1654 | |
| 1655 | - $resultSet->add($results); |
|
| 1655 | + $resultSet->add($results); |
|
| 1656 | 1656 | |
| 1657 | - // Save result set to database and generate resumption token. |
|
| 1658 | - $token = uniqid(); |
|
| 1657 | + // Save result set to database and generate resumption token. |
|
| 1658 | + $token = uniqid(); |
|
| 1659 | 1659 | |
| 1660 | - $resultSet->metadata = array ( |
|
| 1661 | - 'offset' => intval($this->conf['limit']), |
|
| 1662 | - 'metadataPrefix' => $this->piVars['metadataPrefix'], |
|
| 1663 | - ); |
|
| 1660 | + $resultSet->metadata = array ( |
|
| 1661 | + 'offset' => intval($this->conf['limit']), |
|
| 1662 | + 'metadataPrefix' => $this->piVars['metadataPrefix'], |
|
| 1663 | + ); |
|
| 1664 | 1664 | |
| 1665 | - $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery( |
|
| 1666 | - 'tx_dlf_tokens', |
|
| 1667 | - array ( |
|
| 1668 | - 'tstamp' => $GLOBALS['EXEC_TIME'], |
|
| 1669 | - 'token' => $token, |
|
| 1670 | - 'options' => serialize($resultSet), |
|
| 1671 | - 'ident' => 'oai', |
|
| 1672 | - ) |
|
| 1673 | - ); |
|
| 1665 | + $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery( |
|
| 1666 | + 'tx_dlf_tokens', |
|
| 1667 | + array ( |
|
| 1668 | + 'tstamp' => $GLOBALS['EXEC_TIME'], |
|
| 1669 | + 'token' => $token, |
|
| 1670 | + 'options' => serialize($resultSet), |
|
| 1671 | + 'ident' => 'oai', |
|
| 1672 | + ) |
|
| 1673 | + ); |
|
| 1674 | 1674 | |
| 1675 | - if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) { |
|
| 1675 | + if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) { |
|
| 1676 | 1676 | |
| 1677 | - $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8')); |
|
| 1677 | + $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8')); |
|
| 1678 | 1678 | |
| 1679 | - $resumptionToken->setAttribute('cursor', '0'); |
|
| 1679 | + $resumptionToken->setAttribute('cursor', '0'); |
|
| 1680 | 1680 | |
| 1681 | - $resumptionToken->setAttribute('completeListSize', count($resultSet)); |
|
| 1681 | + $resumptionToken->setAttribute('completeListSize', count($resultSet)); |
|
| 1682 | 1682 | |
| 1683 | - $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 1683 | + $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired'])); |
|
| 1684 | 1684 | |
| 1685 | - $ListRecords->appendChild($resumptionToken); |
|
| 1685 | + $ListRecords->appendChild($resumptionToken); |
|
| 1686 | 1686 | |
| 1687 | - } else { |
|
| 1687 | + } else { |
|
| 1688 | 1688 | |
| 1689 | - if (TYPO3_DLOG) { |
|
| 1689 | + if (TYPO3_DLOG) { |
|
| 1690 | 1690 | |
| 1691 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListRecords()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 1691 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_oai->verbListRecords()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 1692 | 1692 | |
| 1693 | - } |
|
| 1693 | + } |
|
| 1694 | 1694 | |
| 1695 | - } |
|
| 1695 | + } |
|
| 1696 | 1696 | |
| 1697 | - } |
|
| 1697 | + } |
|
| 1698 | 1698 | |
| 1699 | - return $ListRecords; |
|
| 1699 | + return $ListRecords; |
|
| 1700 | 1700 | |
| 1701 | - } |
|
| 1701 | + } |
|
| 1702 | 1702 | |
| 1703 | - } |
|
| 1703 | + } |
|
| 1704 | 1704 | |
| 1705 | - /** |
|
| 1706 | - * Process verb "ListSets" |
|
| 1707 | - * |
|
| 1708 | - * @access protected |
|
| 1709 | - * |
|
| 1710 | - * @return string Substitution for subpart "###RESPONSE###" |
|
| 1711 | - */ |
|
| 1712 | - protected function verbListSets() { |
|
| 1705 | + /** |
|
| 1706 | + * Process verb "ListSets" |
|
| 1707 | + * |
|
| 1708 | + * @access protected |
|
| 1709 | + * |
|
| 1710 | + * @return string Substitution for subpart "###RESPONSE###" |
|
| 1711 | + */ |
|
| 1712 | + protected function verbListSets() { |
|
| 1713 | 1713 | |
| 1714 | - // Check for invalid arguments. |
|
| 1715 | - if (count($this->piVars) > 1) { |
|
| 1714 | + // Check for invalid arguments. |
|
| 1715 | + if (count($this->piVars) > 1) { |
|
| 1716 | 1716 | |
| 1717 | - if (!empty($this->piVars['resumptionToken'])) { |
|
| 1717 | + if (!empty($this->piVars['resumptionToken'])) { |
|
| 1718 | 1718 | |
| 1719 | - return $this->error('badResumptionToken'); |
|
| 1719 | + return $this->error('badResumptionToken'); |
|
| 1720 | 1720 | |
| 1721 | - } else { |
|
| 1721 | + } else { |
|
| 1722 | 1722 | |
| 1723 | - return $this->error('badArgument'); |
|
| 1723 | + return $this->error('badArgument'); |
|
| 1724 | 1724 | |
| 1725 | - } |
|
| 1725 | + } |
|
| 1726 | 1726 | |
| 1727 | - } |
|
| 1727 | + } |
|
| 1728 | 1728 | |
| 1729 | - // Get set information. |
|
| 1730 | - $additionalWhere = ''; |
|
| 1729 | + // Get set information. |
|
| 1730 | + $additionalWhere = ''; |
|
| 1731 | 1731 | |
| 1732 | - if (!$this->conf['show_userdefined']) { |
|
| 1732 | + if (!$this->conf['show_userdefined']) { |
|
| 1733 | 1733 | |
| 1734 | - $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1734 | + $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; |
|
| 1735 | 1735 | |
| 1736 | - } |
|
| 1736 | + } |
|
| 1737 | 1737 | |
| 1738 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1739 | - 'tx_dlf_collections.oai_name AS oai_name,tx_dlf_collections.label AS label', |
|
| 1740 | - 'tx_dlf_collections', |
|
| 1741 | - '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']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 1742 | - 'tx_dlf_collections.oai_name', |
|
| 1743 | - 'tx_dlf_collections.oai_name', |
|
| 1744 | - '' |
|
| 1745 | - ); |
|
| 1738 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 1739 | + 'tx_dlf_collections.oai_name AS oai_name,tx_dlf_collections.label AS label', |
|
| 1740 | + 'tx_dlf_collections', |
|
| 1741 | + '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']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 1742 | + 'tx_dlf_collections.oai_name', |
|
| 1743 | + 'tx_dlf_collections.oai_name', |
|
| 1744 | + '' |
|
| 1745 | + ); |
|
| 1746 | 1746 | |
| 1747 | - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1747 | + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 1748 | 1748 | |
| 1749 | - return $this->error('noSetHierarchy'); |
|
| 1749 | + return $this->error('noSetHierarchy'); |
|
| 1750 | 1750 | |
| 1751 | - } |
|
| 1751 | + } |
|
| 1752 | 1752 | |
| 1753 | - // Add set list node. |
|
| 1754 | - $ListSets = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListSets'); |
|
| 1753 | + // Add set list node. |
|
| 1754 | + $ListSets = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'ListSets'); |
|
| 1755 | 1755 | |
| 1756 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1756 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 1757 | 1757 | |
| 1758 | - // Add set node. |
|
| 1759 | - $set = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'set'); |
|
| 1758 | + // Add set node. |
|
| 1759 | + $set = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'set'); |
|
| 1760 | 1760 | |
| 1761 | - $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($resArray['oai_name'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1761 | + $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setSpec', htmlspecialchars($resArray['oai_name'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1762 | 1762 | |
| 1763 | - $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setName', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1763 | + $set->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'setName', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 1764 | 1764 | |
| 1765 | - $ListSets->appendChild($set); |
|
| 1765 | + $ListSets->appendChild($set); |
|
| 1766 | 1766 | |
| 1767 | - } |
|
| 1767 | + } |
|
| 1768 | 1768 | |
| 1769 | - return $ListSets; |
|
| 1769 | + return $ListSets; |
|
| 1770 | 1770 | |
| 1771 | - } |
|
| 1771 | + } |
|
| 1772 | 1772 | |
| 1773 | 1773 | } |
@@ -20,43 +20,43 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
| 22 | 22 | |
| 23 | - public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php'; |
|
| 23 | + public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php'; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The main method of the PlugIn |
|
| 27 | - * |
|
| 28 | - * @access public |
|
| 29 | - * |
|
| 30 | - * @param string $content: The PlugIn content |
|
| 31 | - * @param array $conf: The PlugIn configuration |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function main($content = '', $conf = array ()) { |
|
| 25 | + /** |
|
| 26 | + * The main method of the PlugIn |
|
| 27 | + * |
|
| 28 | + * @access public |
|
| 29 | + * |
|
| 30 | + * @param string $content: The PlugIn content |
|
| 31 | + * @param array $conf: The PlugIn configuration |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function main($content = '', $conf = array ()) { |
|
| 36 | 36 | |
| 37 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') { |
|
| 37 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') { |
|
| 38 | 38 | |
| 39 | - $core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed')); |
|
| 39 | + $core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed')); |
|
| 40 | 40 | |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - if (!empty($core)) { |
|
| 43 | + if (!empty($core)) { |
|
| 44 | 44 | |
| 45 | - $url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q')); |
|
| 45 | + $url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q')); |
|
| 46 | 46 | |
| 47 | - if ($stream = fopen($url, 'r')) { |
|
| 47 | + if ($stream = fopen($url, 'r')) { |
|
| 48 | 48 | |
| 49 | - $content .= stream_get_contents($stream); |
|
| 49 | + $content .= stream_get_contents($stream); |
|
| 50 | 50 | |
| 51 | - fclose($stream); |
|
| 51 | + fclose($stream); |
|
| 52 | 52 | |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - echo $content; |
|
| 57 | + echo $content; |
|
| 58 | 58 | |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -19,66 +19,66 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_toolbox extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/toolbox/class.tx_dlf_toolbox.php'; |
|
| 22 | + public $scriptRelPath = 'plugins/toolbox/class.tx_dlf_toolbox.php'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The main method of the PlugIn |
|
| 26 | - * |
|
| 27 | - * @access public |
|
| 28 | - * |
|
| 29 | - * @param string $content: The PlugIn content |
|
| 30 | - * @param array $conf: The PlugIn configuration |
|
| 31 | - * |
|
| 32 | - * @return string The content that is displayed on the website |
|
| 33 | - */ |
|
| 34 | - public function main($content, $conf) { |
|
| 24 | + /** |
|
| 25 | + * The main method of the PlugIn |
|
| 26 | + * |
|
| 27 | + * @access public |
|
| 28 | + * |
|
| 29 | + * @param string $content: The PlugIn content |
|
| 30 | + * @param array $conf: The PlugIn configuration |
|
| 31 | + * |
|
| 32 | + * @return string The content that is displayed on the website |
|
| 33 | + */ |
|
| 34 | + public function main($content, $conf) { |
|
| 35 | 35 | |
| 36 | - $this->init($conf); |
|
| 36 | + $this->init($conf); |
|
| 37 | 37 | |
| 38 | - // Quit without doing anything if required variable is not set. |
|
| 39 | - if (empty($this->piVars['id'])) { |
|
| 38 | + // Quit without doing anything if required variable is not set. |
|
| 39 | + if (empty($this->piVars['id'])) { |
|
| 40 | 40 | |
| 41 | - return $content; |
|
| 41 | + return $content; |
|
| 42 | 42 | |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - // Load template file. |
|
| 46 | - if (!empty($this->conf['templateFile'])) { |
|
| 45 | + // Load template file. |
|
| 46 | + if (!empty($this->conf['templateFile'])) { |
|
| 47 | 47 | |
| 48 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 48 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 49 | 49 | |
| 50 | - } else { |
|
| 50 | + } else { |
|
| 51 | 51 | |
| 52 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/template.tmpl'), '###TEMPLATE###'); |
|
| 52 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/template.tmpl'), '###TEMPLATE###'); |
|
| 53 | 53 | |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - // Build data array. |
|
| 57 | - $data = array ( |
|
| 58 | - 'conf' => $this->conf, |
|
| 59 | - 'piVars' => $this->piVars, |
|
| 60 | - ); |
|
| 56 | + // Build data array. |
|
| 57 | + $data = array ( |
|
| 58 | + 'conf' => $this->conf, |
|
| 59 | + 'piVars' => $this->piVars, |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | - // Get template subpart for tools. |
|
| 63 | - $subpart = $this->cObj->getSubpart($this->template, '###TOOLS###'); |
|
| 62 | + // Get template subpart for tools. |
|
| 63 | + $subpart = $this->cObj->getSubpart($this->template, '###TOOLS###'); |
|
| 64 | 64 | |
| 65 | - $tools = explode(',', $this->conf['tools']); |
|
| 65 | + $tools = explode(',', $this->conf['tools']); |
|
| 66 | 66 | |
| 67 | - // Add the tools to the toolbox. |
|
| 68 | - foreach ($tools as $tool) { |
|
| 67 | + // Add the tools to the toolbox. |
|
| 68 | + foreach ($tools as $tool) { |
|
| 69 | 69 | |
| 70 | - $tool = trim($tool); |
|
| 70 | + $tool = trim($tool); |
|
| 71 | 71 | |
| 72 | - $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); |
|
| 72 | + $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); |
|
| 73 | 73 | |
| 74 | - $cObj->data = $data; |
|
| 74 | + $cObj->data = $data; |
|
| 75 | 75 | |
| 76 | - $content .= $this->cObj->substituteMarkerArray($subpart, array ('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool.'.']))); |
|
| 76 | + $content .= $this->cObj->substituteMarkerArray($subpart, array ('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool.'.']))); |
|
| 77 | 77 | |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - return $this->pi_wrapInBaseClass($this->cObj->substituteSubpart($this->template, '###TOOLS###', $content, TRUE)); |
|
| 80 | + return $this->pi_wrapInBaseClass($this->cObj->substituteSubpart($this->template, '###TOOLS###', $content, TRUE)); |
|
| 81 | 81 | |
| 82 | - } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | } |
@@ -19,54 +19,54 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_toolsImagemanipulation extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php'; |
|
| 22 | + public $scriptRelPath = 'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The main method of the PlugIn |
|
| 26 | - * |
|
| 27 | - * @access public |
|
| 28 | - * |
|
| 29 | - * @param string $content: The PlugIn content |
|
| 30 | - * @param array $conf: The PlugIn configuration |
|
| 31 | - * |
|
| 32 | - * @return string The content that is displayed on the website |
|
| 33 | - */ |
|
| 34 | - public function main($content, $conf) { |
|
| 24 | + /** |
|
| 25 | + * The main method of the PlugIn |
|
| 26 | + * |
|
| 27 | + * @access public |
|
| 28 | + * |
|
| 29 | + * @param string $content: The PlugIn content |
|
| 30 | + * @param array $conf: The PlugIn configuration |
|
| 31 | + * |
|
| 32 | + * @return string The content that is displayed on the website |
|
| 33 | + */ |
|
| 34 | + public function main($content, $conf) { |
|
| 35 | 35 | |
| 36 | - $this->init($conf); |
|
| 36 | + $this->init($conf); |
|
| 37 | 37 | |
| 38 | - // Merge configuration with conf array of toolbox. |
|
| 39 | - $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); |
|
| 38 | + // Merge configuration with conf array of toolbox. |
|
| 39 | + $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); |
|
| 40 | 40 | |
| 41 | - // Load current document. |
|
| 42 | - $this->loadDocument(); |
|
| 41 | + // Load current document. |
|
| 42 | + $this->loadDocument(); |
|
| 43 | 43 | |
| 44 | - // Load template file. |
|
| 45 | - if (!empty($this->conf['toolTemplateFile'])) { |
|
| 44 | + // Load template file. |
|
| 45 | + if (!empty($this->conf['toolTemplateFile'])) { |
|
| 46 | 46 | |
| 47 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
| 47 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
| 48 | 48 | |
| 49 | - } else { |
|
| 49 | + } else { |
|
| 50 | 50 | |
| 51 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagemanipulation/template.tmpl'), '###TEMPLATE###'); |
|
| 51 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagemanipulation/template.tmpl'), '###TEMPLATE###'); |
|
| 52 | 52 | |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - $markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:' |
|
| 56 | - .$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:' |
|
| 57 | - .$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:' |
|
| 58 | - .$this->pi_getLL('reset', '', TRUE).';saturation:' |
|
| 59 | - .$this->pi_getLL('saturation', '', TRUE).';hue:' |
|
| 60 | - .$this->pi_getLL('hue', '', TRUE).';contrast:' |
|
| 61 | - .$this->pi_getLL('contrast', '', TRUE).';brightness:' |
|
| 62 | - .$this->pi_getLL('brightness', '', TRUE).';invert:' |
|
| 63 | - .$this->pi_getLL('invert', '', TRUE).'" title="' |
|
| 64 | - .$this->pi_getLL('no-support', '', TRUE).'"></span>'; |
|
| 55 | + $markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:' |
|
| 56 | + .$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:' |
|
| 57 | + .$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:' |
|
| 58 | + .$this->pi_getLL('reset', '', TRUE).';saturation:' |
|
| 59 | + .$this->pi_getLL('saturation', '', TRUE).';hue:' |
|
| 60 | + .$this->pi_getLL('hue', '', TRUE).';contrast:' |
|
| 61 | + .$this->pi_getLL('contrast', '', TRUE).';brightness:' |
|
| 62 | + .$this->pi_getLL('brightness', '', TRUE).';invert:' |
|
| 63 | + .$this->pi_getLL('invert', '', TRUE).'" title="' |
|
| 64 | + .$this->pi_getLL('no-support', '', TRUE).'"></span>'; |
|
| 65 | 65 | |
| 66 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 66 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 67 | 67 | |
| 68 | - return $this->pi_wrapInBaseClass($content); |
|
| 68 | + return $this->pi_wrapInBaseClass($content); |
|
| 69 | 69 | |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | } |
@@ -19,111 +19,111 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_statistics extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php'; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * The main method of the PlugIn |
|
| 26 | - * |
|
| 27 | - * @access public |
|
| 28 | - * |
|
| 29 | - * @param string $content: The PlugIn content |
|
| 30 | - * @param array $conf: The PlugIn configuration |
|
| 31 | - * |
|
| 32 | - * @return string The content that is displayed on the website |
|
| 33 | - */ |
|
| 34 | - public function main($content, $conf) { |
|
| 35 | - |
|
| 36 | - $this->init($conf); |
|
| 37 | - |
|
| 38 | - // Turn cache on. |
|
| 39 | - $this->setCache(TRUE); |
|
| 40 | - |
|
| 41 | - // Quit without doing anything if required configuration variables are not set. |
|
| 42 | - if (empty($this->conf['pages'])) { |
|
| 43 | - |
|
| 44 | - if (TYPO3_DLOG) { |
|
| 45 | - |
|
| 46 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
| 47 | - |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - return $content; |
|
| 51 | - |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - // Get description. |
|
| 55 | - $content .= $this->pi_RTEcssText($this->conf['description']); |
|
| 56 | - |
|
| 57 | - // Check for selected collections. |
|
| 58 | - if ($this->conf['collections']) { |
|
| 59 | - |
|
| 60 | - // Include only selected collections. |
|
| 61 | - $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 62 | - 'tx_dlf_documents.uid AS uid', |
|
| 63 | - 'tx_dlf_documents', |
|
| 64 | - 'tx_dlf_relations', |
|
| 65 | - 'tx_dlf_collections', |
|
| 66 | - 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 67 | - 'tx_dlf_documents.uid', |
|
| 68 | - '', |
|
| 69 | - '' |
|
| 70 | - ); |
|
| 71 | - |
|
| 72 | - $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 73 | - 'tx_dlf_documents.uid AS uid', |
|
| 74 | - 'tx_dlf_documents', |
|
| 75 | - 'tx_dlf_relations', |
|
| 76 | - 'tx_dlf_collections', |
|
| 77 | - 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 78 | - 'tx_dlf_documents.uid', |
|
| 79 | - '', |
|
| 80 | - '' |
|
| 81 | - ); |
|
| 82 | - |
|
| 83 | - } else { |
|
| 84 | - |
|
| 85 | - // Include all collections. |
|
| 86 | - $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 87 | - 'tx_dlf_documents.uid AS uid', |
|
| 88 | - 'tx_dlf_documents', |
|
| 89 | - 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 90 | - '', |
|
| 91 | - '', |
|
| 92 | - '' |
|
| 93 | - ); |
|
| 94 | - |
|
| 95 | - $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 96 | - 'tx_dlf_documents.uid AS uid', |
|
| 97 | - 'tx_dlf_documents', |
|
| 98 | - 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 99 | - '', |
|
| 100 | - '', |
|
| 101 | - '' |
|
| 102 | - ); |
|
| 103 | - |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles); |
|
| 107 | - |
|
| 108 | - $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes); |
|
| 109 | - |
|
| 110 | - // Set replacements. |
|
| 111 | - $replace = array ( |
|
| 112 | - 'key' => array ( |
|
| 113 | - '###TITLES###', |
|
| 114 | - '###VOLUMES###' |
|
| 115 | - ), |
|
| 116 | - 'value' => array ( |
|
| 117 | - $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), |
|
| 118 | - $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE)) |
|
| 119 | - ) |
|
| 120 | - ); |
|
| 121 | - |
|
| 122 | - // Apply replacements. |
|
| 123 | - $content = str_replace($replace['key'], $replace['value'], $content); |
|
| 124 | - |
|
| 125 | - return $this->pi_wrapInBaseClass($content); |
|
| 126 | - |
|
| 127 | - } |
|
| 22 | + public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php'; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * The main method of the PlugIn |
|
| 26 | + * |
|
| 27 | + * @access public |
|
| 28 | + * |
|
| 29 | + * @param string $content: The PlugIn content |
|
| 30 | + * @param array $conf: The PlugIn configuration |
|
| 31 | + * |
|
| 32 | + * @return string The content that is displayed on the website |
|
| 33 | + */ |
|
| 34 | + public function main($content, $conf) { |
|
| 35 | + |
|
| 36 | + $this->init($conf); |
|
| 37 | + |
|
| 38 | + // Turn cache on. |
|
| 39 | + $this->setCache(TRUE); |
|
| 40 | + |
|
| 41 | + // Quit without doing anything if required configuration variables are not set. |
|
| 42 | + if (empty($this->conf['pages'])) { |
|
| 43 | + |
|
| 44 | + if (TYPO3_DLOG) { |
|
| 45 | + |
|
| 46 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
| 47 | + |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + return $content; |
|
| 51 | + |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + // Get description. |
|
| 55 | + $content .= $this->pi_RTEcssText($this->conf['description']); |
|
| 56 | + |
|
| 57 | + // Check for selected collections. |
|
| 58 | + if ($this->conf['collections']) { |
|
| 59 | + |
|
| 60 | + // Include only selected collections. |
|
| 61 | + $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 62 | + 'tx_dlf_documents.uid AS uid', |
|
| 63 | + 'tx_dlf_documents', |
|
| 64 | + 'tx_dlf_relations', |
|
| 65 | + 'tx_dlf_collections', |
|
| 66 | + 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 67 | + 'tx_dlf_documents.uid', |
|
| 68 | + '', |
|
| 69 | + '' |
|
| 70 | + ); |
|
| 71 | + |
|
| 72 | + $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 73 | + 'tx_dlf_documents.uid AS uid', |
|
| 74 | + 'tx_dlf_documents', |
|
| 75 | + 'tx_dlf_relations', |
|
| 76 | + 'tx_dlf_collections', |
|
| 77 | + 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 78 | + 'tx_dlf_documents.uid', |
|
| 79 | + '', |
|
| 80 | + '' |
|
| 81 | + ); |
|
| 82 | + |
|
| 83 | + } else { |
|
| 84 | + |
|
| 85 | + // Include all collections. |
|
| 86 | + $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 87 | + 'tx_dlf_documents.uid AS uid', |
|
| 88 | + 'tx_dlf_documents', |
|
| 89 | + 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 90 | + '', |
|
| 91 | + '', |
|
| 92 | + '' |
|
| 93 | + ); |
|
| 94 | + |
|
| 95 | + $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 96 | + 'tx_dlf_documents.uid AS uid', |
|
| 97 | + 'tx_dlf_documents', |
|
| 98 | + 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 99 | + '', |
|
| 100 | + '', |
|
| 101 | + '' |
|
| 102 | + ); |
|
| 103 | + |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles); |
|
| 107 | + |
|
| 108 | + $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes); |
|
| 109 | + |
|
| 110 | + // Set replacements. |
|
| 111 | + $replace = array ( |
|
| 112 | + 'key' => array ( |
|
| 113 | + '###TITLES###', |
|
| 114 | + '###VOLUMES###' |
|
| 115 | + ), |
|
| 116 | + 'value' => array ( |
|
| 117 | + $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), |
|
| 118 | + $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE)) |
|
| 119 | + ) |
|
| 120 | + ); |
|
| 121 | + |
|
| 122 | + // Apply replacements. |
|
| 123 | + $content = str_replace($replace['key'], $replace['value'], $content); |
|
| 124 | + |
|
| 125 | + return $this->pi_wrapInBaseClass($content); |
|
| 126 | + |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | } |
@@ -19,61 +19,61 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_validator extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php'; |
|
| 22 | + public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The main method of the PlugIn |
|
| 26 | - * |
|
| 27 | - * @access public |
|
| 28 | - * |
|
| 29 | - * @param string $content: The PlugIn content |
|
| 30 | - * @param array $conf: The PlugIn configuration |
|
| 31 | - * |
|
| 32 | - * @return string The content that is displayed on the website |
|
| 33 | - */ |
|
| 34 | - public function main($content, $conf) { |
|
| 24 | + /** |
|
| 25 | + * The main method of the PlugIn |
|
| 26 | + * |
|
| 27 | + * @access public |
|
| 28 | + * |
|
| 29 | + * @param string $content: The PlugIn content |
|
| 30 | + * @param array $conf: The PlugIn configuration |
|
| 31 | + * |
|
| 32 | + * @return string The content that is displayed on the website |
|
| 33 | + */ |
|
| 34 | + public function main($content, $conf) { |
|
| 35 | 35 | |
| 36 | - $this->init($conf); |
|
| 36 | + $this->init($conf); |
|
| 37 | 37 | |
| 38 | - // Disable caching for this plugin. |
|
| 39 | - $this->setCache(FALSE); |
|
| 38 | + // Disable caching for this plugin. |
|
| 39 | + $this->setCache(FALSE); |
|
| 40 | 40 | |
| 41 | - // Load template file. |
|
| 42 | - if (!empty($this->conf['templateFile'])) { |
|
| 41 | + // Load template file. |
|
| 42 | + if (!empty($this->conf['templateFile'])) { |
|
| 43 | 43 | |
| 44 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 44 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 45 | 45 | |
| 46 | - } else { |
|
| 46 | + } else { |
|
| 47 | 47 | |
| 48 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###'); |
|
| 48 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###'); |
|
| 49 | 49 | |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // Load current document. |
|
| 53 | - $this->loadDocument(); |
|
| 52 | + // Load current document. |
|
| 53 | + $this->loadDocument(); |
|
| 54 | 54 | |
| 55 | - if ($this->doc === NULL) { |
|
| 55 | + if ($this->doc === NULL) { |
|
| 56 | 56 | |
| 57 | - // Document could not be loaded. |
|
| 58 | - // Check: |
|
| 59 | - // - if document location is valid URL |
|
| 60 | - // - if document location is reachable |
|
| 61 | - // - if document is well-formed XML |
|
| 62 | - // - if document has METS node |
|
| 57 | + // Document could not be loaded. |
|
| 58 | + // Check: |
|
| 59 | + // - if document location is valid URL |
|
| 60 | + // - if document location is reachable |
|
| 61 | + // - if document is well-formed XML |
|
| 62 | + // - if document has METS node |
|
| 63 | 63 | |
| 64 | - } else { |
|
| 64 | + } else { |
|
| 65 | 65 | |
| 66 | - // Document loaded. |
|
| 67 | - // Check: |
|
| 68 | - // - if document is valid METS document |
|
| 69 | - // - if document contains supported metadata schema |
|
| 70 | - // - if document's metadata are valid |
|
| 71 | - // - if document provides configured mandatory fields |
|
| 66 | + // Document loaded. |
|
| 67 | + // Check: |
|
| 68 | + // - if document is valid METS document |
|
| 69 | + // - if document contains supported metadata schema |
|
| 70 | + // - if document's metadata are valid |
|
| 71 | + // - if document provides configured mandatory fields |
|
| 72 | 72 | |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $this->pi_wrapInBaseClass($content); |
|
| 75 | + return $this->pi_wrapInBaseClass($content); |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | } |
@@ -20,406 +20,406 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class tx_dlf_newspaper extends tx_dlf_plugin { |
| 22 | 22 | |
| 23 | - public $extKey = 'dlf'; |
|
| 23 | + public $extKey = 'dlf'; |
|
| 24 | 24 | |
| 25 | - public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php'; |
|
| 25 | + public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * The main method of the PlugIn |
|
| 29 | - * |
|
| 30 | - * @access public |
|
| 31 | - * |
|
| 32 | - * @param string $content: The PlugIn content |
|
| 33 | - * @param array $conf: The PlugIn configuration |
|
| 34 | - * |
|
| 35 | - * @return string The content that is displayed on the website |
|
| 36 | - */ |
|
| 37 | - public function main($content, $conf) { |
|
| 27 | + /** |
|
| 28 | + * The main method of the PlugIn |
|
| 29 | + * |
|
| 30 | + * @access public |
|
| 31 | + * |
|
| 32 | + * @param string $content: The PlugIn content |
|
| 33 | + * @param array $conf: The PlugIn configuration |
|
| 34 | + * |
|
| 35 | + * @return string The content that is displayed on the website |
|
| 36 | + */ |
|
| 37 | + public function main($content, $conf) { |
|
| 38 | 38 | |
| 39 | - // Nothing to do here. |
|
| 40 | - return $content; |
|
| 39 | + // Nothing to do here. |
|
| 40 | + return $content; |
|
| 41 | 41 | |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * The Calendar Method |
|
| 46 | - * |
|
| 47 | - * @access public |
|
| 48 | - * |
|
| 49 | - * @param string $content: The PlugIn content |
|
| 50 | - * @param array $conf: The PlugIn configuration |
|
| 51 | - * |
|
| 52 | - * @return string The content that is displayed on the website |
|
| 53 | - */ |
|
| 54 | - public function calendar($content, $conf) { |
|
| 44 | + /** |
|
| 45 | + * The Calendar Method |
|
| 46 | + * |
|
| 47 | + * @access public |
|
| 48 | + * |
|
| 49 | + * @param string $content: The PlugIn content |
|
| 50 | + * @param array $conf: The PlugIn configuration |
|
| 51 | + * |
|
| 52 | + * @return string The content that is displayed on the website |
|
| 53 | + */ |
|
| 54 | + public function calendar($content, $conf) { |
|
| 55 | 55 | |
| 56 | - $this->init($conf); |
|
| 56 | + $this->init($conf); |
|
| 57 | 57 | |
| 58 | - // Load current document. |
|
| 59 | - $this->loadDocument(); |
|
| 58 | + // Load current document. |
|
| 59 | + $this->loadDocument(); |
|
| 60 | 60 | |
| 61 | - if ($this->doc === NULL) { |
|
| 61 | + if ($this->doc === NULL) { |
|
| 62 | 62 | |
| 63 | - // Quit without doing anything if required variables are not set. |
|
| 64 | - return $content; |
|
| 63 | + // Quit without doing anything if required variables are not set. |
|
| 64 | + return $content; |
|
| 65 | 65 | |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - // Load template file. |
|
| 69 | - if (!empty($this->conf['templateFile'])) { |
|
| 68 | + // Load template file. |
|
| 69 | + if (!empty($this->conf['templateFile'])) { |
|
| 70 | 70 | |
| 71 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###'); |
|
| 71 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###'); |
|
| 72 | 72 | |
| 73 | - } else { |
|
| 73 | + } else { |
|
| 74 | 74 | |
| 75 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###'); |
|
| 75 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###'); |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - // Get all children of year anchor. |
|
| 80 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 81 | - 'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title, tx_dlf_documents.year AS year', |
|
| 82 | - 'tx_dlf_documents', |
|
| 83 | - '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('issue', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 84 | - '', |
|
| 85 | - 'title ASC', |
|
| 86 | - '' |
|
| 87 | - ); |
|
| 79 | + // Get all children of year anchor. |
|
| 80 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 81 | + 'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title, tx_dlf_documents.year AS year', |
|
| 82 | + 'tx_dlf_documents', |
|
| 83 | + '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('issue', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 84 | + '', |
|
| 85 | + 'title ASC', |
|
| 86 | + '' |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - // Process results. |
|
| 90 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 89 | + // Process results. |
|
| 90 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 91 | 91 | |
| 92 | - $issues[] = array ( |
|
| 93 | - 'uid' => $resArray['uid'], |
|
| 94 | - 'title' => $resArray['title'], |
|
| 95 | - 'year' => $resArray['year'] |
|
| 96 | - ); |
|
| 92 | + $issues[] = array ( |
|
| 93 | + 'uid' => $resArray['uid'], |
|
| 94 | + 'title' => $resArray['title'], |
|
| 95 | + 'year' => $resArray['year'] |
|
| 96 | + ); |
|
| 97 | 97 | |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - // We need an array of issues with month number as key. |
|
| 101 | - $calendarIssues = array (); |
|
| 100 | + // We need an array of issues with month number as key. |
|
| 101 | + $calendarIssues = array (); |
|
| 102 | 102 | |
| 103 | - foreach ($issues as $issue) { |
|
| 103 | + foreach ($issues as $issue) { |
|
| 104 | 104 | |
| 105 | - $calendarIssues[date('n', strtotime($issue['year']))][date('j', strtotime($issue['year']))][] = $issue; |
|
| 105 | + $calendarIssues[date('n', strtotime($issue['year']))][date('j', strtotime($issue['year']))][] = $issue; |
|
| 106 | 106 | |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - $allIssues = array (); |
|
| 109 | + $allIssues = array (); |
|
| 110 | 110 | |
| 111 | - // Get subpart templates. |
|
| 112 | - $subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###'); |
|
| 111 | + // Get subpart templates. |
|
| 112 | + $subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###'); |
|
| 113 | 113 | |
| 114 | - $subparts['month'] = $this->cObj->getSubpart($this->template, '###CALMONTH###'); |
|
| 114 | + $subparts['month'] = $this->cObj->getSubpart($this->template, '###CALMONTH###'); |
|
| 115 | 115 | |
| 116 | - $subparts['week'] = $this->cObj->getSubpart($subparts['month'], '###CALWEEK###'); |
|
| 116 | + $subparts['week'] = $this->cObj->getSubpart($subparts['month'], '###CALWEEK###'); |
|
| 117 | 117 | |
| 118 | - $subparts['singleday'] = $this->cObj->getSubpart($subparts['list'], '###SINGLEDAY###'); |
|
| 118 | + $subparts['singleday'] = $this->cObj->getSubpart($subparts['list'], '###SINGLEDAY###'); |
|
| 119 | 119 | |
| 120 | - // Build calendar for given year. |
|
| 121 | - $year = date('Y', strtotime($issues[0]['year'])); |
|
| 120 | + // Build calendar for given year. |
|
| 121 | + $year = date('Y', strtotime($issues[0]['year'])); |
|
| 122 | 122 | |
| 123 | - for ($i = 0; $i <= 11; $i++) { |
|
| 123 | + for ($i = 0; $i <= 11; $i++) { |
|
| 124 | 124 | |
| 125 | - $markerArray = array ( |
|
| 126 | - '###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')), |
|
| 127 | - '###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')), |
|
| 128 | - '###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')), |
|
| 129 | - '###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')), |
|
| 130 | - '###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')), |
|
| 131 | - '###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')), |
|
| 132 | - '###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')), |
|
| 133 | - '###MONTHNAME###' => strftime('%B', strtotime($year . '-' . ($i + 1) . '-1')) |
|
| 134 | - ); |
|
| 125 | + $markerArray = array ( |
|
| 126 | + '###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')), |
|
| 127 | + '###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')), |
|
| 128 | + '###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')), |
|
| 129 | + '###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')), |
|
| 130 | + '###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')), |
|
| 131 | + '###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')), |
|
| 132 | + '###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')), |
|
| 133 | + '###MONTHNAME###' => strftime('%B', strtotime($year . '-' . ($i + 1) . '-1')) |
|
| 134 | + ); |
|
| 135 | 135 | |
| 136 | - // Reset week content of new month. |
|
| 137 | - $subWeekPartContent = ''; |
|
| 136 | + // Reset week content of new month. |
|
| 137 | + $subWeekPartContent = ''; |
|
| 138 | 138 | |
| 139 | - $firstOfMonth = strtotime($year . '-' . ($i + 1) . '-1'); |
|
| 140 | - $lastOfMonth = strtotime('last day of', ($firstOfMonth)); |
|
| 141 | - $firstOfMonthStart = strtotime('last Monday', $firstOfMonth); |
|
| 139 | + $firstOfMonth = strtotime($year . '-' . ($i + 1) . '-1'); |
|
| 140 | + $lastOfMonth = strtotime('last day of', ($firstOfMonth)); |
|
| 141 | + $firstOfMonthStart = strtotime('last Monday', $firstOfMonth); |
|
| 142 | 142 | |
| 143 | - // There are never more than 6 weeks in a month. |
|
| 144 | - for ($j = 0; $j <= 5; $j++) { |
|
| 143 | + // There are never more than 6 weeks in a month. |
|
| 144 | + for ($j = 0; $j <= 5; $j++) { |
|
| 145 | 145 | |
| 146 | - $firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart); |
|
| 146 | + $firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart); |
|
| 147 | 147 | |
| 148 | - $weekArray = array( |
|
| 149 | - '###DAYMON###' => ' ', |
|
| 150 | - '###DAYTUE###' => ' ', |
|
| 151 | - '###DAYWED###' => ' ', |
|
| 152 | - '###DAYTHU###' => ' ', |
|
| 153 | - '###DAYFRI###' => ' ', |
|
| 154 | - '###DAYSAT###' => ' ', |
|
| 155 | - '###DAYSUN###' => ' ', |
|
| 156 | - ); |
|
| 148 | + $weekArray = array( |
|
| 149 | + '###DAYMON###' => ' ', |
|
| 150 | + '###DAYTUE###' => ' ', |
|
| 151 | + '###DAYWED###' => ' ', |
|
| 152 | + '###DAYTHU###' => ' ', |
|
| 153 | + '###DAYFRI###' => ' ', |
|
| 154 | + '###DAYSAT###' => ' ', |
|
| 155 | + '###DAYSUN###' => ' ', |
|
| 156 | + ); |
|
| 157 | 157 | |
| 158 | - // Every week has seven days. ;-) |
|
| 159 | - for ($k = 0; $k <= 6; $k++) { |
|
| 158 | + // Every week has seven days. ;-) |
|
| 159 | + for ($k = 0; $k <= 6; $k++) { |
|
| 160 | 160 | |
| 161 | - $currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek); |
|
| 161 | + $currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek); |
|
| 162 | 162 | |
| 163 | - if ($currentDayTime >= $firstOfMonth && $currentDayTime <= $lastOfMonth) { |
|
| 163 | + if ($currentDayTime >= $firstOfMonth && $currentDayTime <= $lastOfMonth) { |
|
| 164 | 164 | |
| 165 | - $dayLinks = ''; |
|
| 165 | + $dayLinks = ''; |
|
| 166 | 166 | |
| 167 | - $dayLinksText = array (); |
|
| 167 | + $dayLinksText = array (); |
|
| 168 | 168 | |
| 169 | - $dayLinksList = ''; |
|
| 169 | + $dayLinksList = ''; |
|
| 170 | 170 | |
| 171 | - $currentMonth = date('n', $currentDayTime); |
|
| 171 | + $currentMonth = date('n', $currentDayTime); |
|
| 172 | 172 | |
| 173 | - if (is_array($calendarIssues[$currentMonth])) { |
|
| 173 | + if (is_array($calendarIssues[$currentMonth])) { |
|
| 174 | 174 | |
| 175 | - foreach ($calendarIssues[$currentMonth] as $id => $day) { |
|
| 175 | + foreach ($calendarIssues[$currentMonth] as $id => $day) { |
|
| 176 | 176 | |
| 177 | - if ($id == date('j', $currentDayTime)) { |
|
| 177 | + if ($id == date('j', $currentDayTime)) { |
|
| 178 | 178 | |
| 179 | - $dayLinks = $id; |
|
| 179 | + $dayLinks = $id; |
|
| 180 | 180 | |
| 181 | - foreach ($day as $issue) { |
|
| 181 | + foreach ($day as $issue) { |
|
| 182 | 182 | |
| 183 | - $dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title']; |
|
| 183 | + $dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title']; |
|
| 184 | 184 | |
| 185 | - $linkConf = array ( |
|
| 186 | - 'useCacheHash' => 1, |
|
| 187 | - 'parameter' => $this->conf['targetPid'], |
|
| 188 | - 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($issue['uid']), |
|
| 189 | - 'ATagParams' => ' class="title"', |
|
| 190 | - ); |
|
| 185 | + $linkConf = array ( |
|
| 186 | + 'useCacheHash' => 1, |
|
| 187 | + 'parameter' => $this->conf['targetPid'], |
|
| 188 | + 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($issue['uid']), |
|
| 189 | + 'ATagParams' => ' class="title"', |
|
| 190 | + ); |
|
| 191 | 191 | |
| 192 | - $dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf); |
|
| 192 | + $dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf); |
|
| 193 | 193 | |
| 194 | - // Save issues for list view. |
|
| 195 | - $allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf); |
|
| 196 | - } |
|
| 197 | - } |
|
| 194 | + // Save issues for list view. |
|
| 195 | + $allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - } |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - if (!empty($dayLinksText)) { |
|
| 201 | + if (!empty($dayLinksText)) { |
|
| 202 | 202 | |
| 203 | - $dayLinksList = '<ul>'; |
|
| 203 | + $dayLinksList = '<ul>'; |
|
| 204 | 204 | |
| 205 | - foreach ($dayLinksText as $link) { |
|
| 205 | + foreach ($dayLinksText as $link) { |
|
| 206 | 206 | |
| 207 | - $dayLinksList .= '<li>'.$link.'</li>'; |
|
| 207 | + $dayLinksList .= '<li>'.$link.'</li>'; |
|
| 208 | 208 | |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - $dayLinksList .= '</ul>'; |
|
| 211 | + $dayLinksList .= '</ul>'; |
|
| 212 | 212 | |
| 213 | - } |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - $dayLinkDiv = '<div class="issues"><h4>' . strftime('%d', $currentDayTime) . '</h4><div>'.$dayLinksList.'</div></div>'; |
|
| 216 | - } |
|
| 215 | + $dayLinkDiv = '<div class="issues"><h4>' . strftime('%d', $currentDayTime) . '</h4><div>'.$dayLinksList.'</div></div>'; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) { |
|
| 218 | + switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) { |
|
| 219 | 219 | |
| 220 | - case '0': $weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 221 | - break; |
|
| 220 | + case '0': $weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 221 | + break; |
|
| 222 | 222 | |
| 223 | - case '1': $weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 224 | - break; |
|
| 223 | + case '1': $weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 224 | + break; |
|
| 225 | 225 | |
| 226 | - case '2': $weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 227 | - break; |
|
| 226 | + case '2': $weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 227 | + break; |
|
| 228 | 228 | |
| 229 | - case '3': $weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 230 | - break; |
|
| 229 | + case '3': $weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 230 | + break; |
|
| 231 | 231 | |
| 232 | - case '4': $weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 233 | - break; |
|
| 232 | + case '4': $weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 233 | + break; |
|
| 234 | 234 | |
| 235 | - case '5': $weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 236 | - break; |
|
| 235 | + case '5': $weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 236 | + break; |
|
| 237 | 237 | |
| 238 | - case '6': $weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 239 | - break; |
|
| 238 | + case '6': $weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); |
|
| 239 | + break; |
|
| 240 | 240 | |
| 241 | - } |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - } |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - } |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - // Fill the weeks. |
|
| 248 | - $subWeekPartContent .= $this->cObj->substituteMarkerArray($subparts['week'], $weekArray); |
|
| 247 | + // Fill the weeks. |
|
| 248 | + $subWeekPartContent .= $this->cObj->substituteMarkerArray($subparts['week'], $weekArray); |
|
| 249 | 249 | |
| 250 | - } |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - // Fill the month markers. |
|
| 253 | - $subPartContent .= $this->cObj->substituteMarkerArray($subparts['month'], $markerArray); |
|
| 252 | + // Fill the month markers. |
|
| 253 | + $subPartContent .= $this->cObj->substituteMarkerArray($subparts['month'], $markerArray); |
|
| 254 | 254 | |
| 255 | - // Fill the week markers with the week entries. |
|
| 256 | - $subPartContent = $this->cObj->substituteSubpart($subPartContent, '###CALWEEK###', $subWeekPartContent); |
|
| 257 | - } |
|
| 255 | + // Fill the week markers with the week entries. |
|
| 256 | + $subPartContent = $this->cObj->substituteSubpart($subPartContent, '###CALWEEK###', $subWeekPartContent); |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - // Link to years overview |
|
| 260 | - $linkConf = array ( |
|
| 261 | - 'useCacheHash' => 1, |
|
| 262 | - 'parameter' => $this->conf['targetPid'], |
|
| 263 | - 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->parentId), |
|
| 264 | - ); |
|
| 259 | + // Link to years overview |
|
| 260 | + $linkConf = array ( |
|
| 261 | + 'useCacheHash' => 1, |
|
| 262 | + 'parameter' => $this->conf['targetPid'], |
|
| 263 | + 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->parentId), |
|
| 264 | + ); |
|
| 265 | 265 | |
| 266 | - $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' . $this->doc->getTitle($this->doc->parentId), $linkConf); |
|
| 266 | + $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' . $this->doc->getTitle($this->doc->parentId), $linkConf); |
|
| 267 | 267 | |
| 268 | - // Link to current year. |
|
| 269 | - $linkConf = array ( |
|
| 270 | - 'useCacheHash' => 1, |
|
| 271 | - 'parameter' => $this->conf['targetPid'], |
|
| 272 | - 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->uid), |
|
| 273 | - ); |
|
| 268 | + // Link to current year. |
|
| 269 | + $linkConf = array ( |
|
| 270 | + 'useCacheHash' => 1, |
|
| 271 | + 'parameter' => $this->conf['targetPid'], |
|
| 272 | + 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->uid), |
|
| 273 | + ); |
|
| 274 | 274 | |
| 275 | - $yearLink = $this->cObj->typoLink($year, $linkConf); |
|
| 275 | + $yearLink = $this->cObj->typoLink($year, $linkConf); |
|
| 276 | 276 | |
| 277 | - // Prepare list as alternative of the calendar view. |
|
| 278 | - foreach($allIssues as $dayTime => $issues) { |
|
| 277 | + // Prepare list as alternative of the calendar view. |
|
| 278 | + foreach($allIssues as $dayTime => $issues) { |
|
| 279 | 279 | |
| 280 | - $markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTime); |
|
| 280 | + $markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTime); |
|
| 281 | 281 | |
| 282 | - $markerArrayDay['###ITEMS###'] = ''; |
|
| 282 | + $markerArrayDay['###ITEMS###'] = ''; |
|
| 283 | 283 | |
| 284 | - foreach ($issues as $issue) { |
|
| 284 | + foreach ($issues as $issue) { |
|
| 285 | 285 | |
| 286 | - $markerArrayDay['###ITEMS###'] .= $issue; |
|
| 286 | + $markerArrayDay['###ITEMS###'] .= $issue; |
|
| 287 | 287 | |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - $subPartContentList .= $this->cObj->substituteMarkerArray($subparts['singleday'], $markerArrayDay); |
|
| 290 | + $subPartContentList .= $this->cObj->substituteMarkerArray($subparts['singleday'], $markerArrayDay); |
|
| 291 | 291 | |
| 292 | - } |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | - $this->template = $this->cObj->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList); |
|
| 294 | + $this->template = $this->cObj->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList); |
|
| 295 | 295 | |
| 296 | - if (count($allIssues) < 6) { |
|
| 296 | + if (count($allIssues) < 6) { |
|
| 297 | 297 | |
| 298 | - $listViewActive = TRUE; |
|
| 298 | + $listViewActive = TRUE; |
|
| 299 | 299 | |
| 300 | - } else { |
|
| 300 | + } else { |
|
| 301 | 301 | |
| 302 | - $listViewActive = FALSE; |
|
| 302 | + $listViewActive = FALSE; |
|
| 303 | 303 | |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | - $markerArray = array ( |
|
| 307 | - '###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active', |
|
| 308 | - '###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '', |
|
| 309 | - '###CALYEAR###' => $yearLink, |
|
| 310 | - '###CALALLYEARS###' => $allYearsLink, |
|
| 311 | - '###LABEL_CALENDAR###' => $this->pi_getLL('label.view_calendar'), |
|
| 312 | - '###LABEL_LIST_VIEW###' => $this->pi_getLL('label.view_list'), |
|
| 313 | - ); |
|
| 306 | + $markerArray = array ( |
|
| 307 | + '###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active', |
|
| 308 | + '###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '', |
|
| 309 | + '###CALYEAR###' => $yearLink, |
|
| 310 | + '###CALALLYEARS###' => $allYearsLink, |
|
| 311 | + '###LABEL_CALENDAR###' => $this->pi_getLL('label.view_calendar'), |
|
| 312 | + '###LABEL_LIST_VIEW###' => $this->pi_getLL('label.view_list'), |
|
| 313 | + ); |
|
| 314 | 314 | |
| 315 | - $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 315 | + $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 316 | 316 | |
| 317 | - return $this->cObj->substituteSubpart($this->template, '###CALMONTH###', $subPartContent); |
|
| 317 | + return $this->cObj->substituteSubpart($this->template, '###CALMONTH###', $subPartContent); |
|
| 318 | 318 | |
| 319 | - } |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - /** |
|
| 322 | - * The Year Method |
|
| 323 | - * |
|
| 324 | - * @access public |
|
| 325 | - * |
|
| 326 | - * @param string $content: The PlugIn content |
|
| 327 | - * @param array $conf: The PlugIn configuration |
|
| 328 | - * |
|
| 329 | - * @return string The content that is displayed on the website |
|
| 330 | - */ |
|
| 331 | - public function years($content, $conf) { |
|
| 321 | + /** |
|
| 322 | + * The Year Method |
|
| 323 | + * |
|
| 324 | + * @access public |
|
| 325 | + * |
|
| 326 | + * @param string $content: The PlugIn content |
|
| 327 | + * @param array $conf: The PlugIn configuration |
|
| 328 | + * |
|
| 329 | + * @return string The content that is displayed on the website |
|
| 330 | + */ |
|
| 331 | + public function years($content, $conf) { |
|
| 332 | 332 | |
| 333 | - $this->init($conf); |
|
| 333 | + $this->init($conf); |
|
| 334 | 334 | |
| 335 | - // Load current document. |
|
| 336 | - $this->loadDocument(); |
|
| 335 | + // Load current document. |
|
| 336 | + $this->loadDocument(); |
|
| 337 | 337 | |
| 338 | - if ($this->doc === NULL) { |
|
| 338 | + if ($this->doc === NULL) { |
|
| 339 | 339 | |
| 340 | - // Quit without doing anything if required variables are not set. |
|
| 341 | - return $content; |
|
| 340 | + // Quit without doing anything if required variables are not set. |
|
| 341 | + return $content; |
|
| 342 | 342 | |
| 343 | - } |
|
| 343 | + } |
|
| 344 | 344 | |
| 345 | - // Load template file. |
|
| 346 | - if (!empty($this->conf['templateFile'])) { |
|
| 345 | + // Load template file. |
|
| 346 | + if (!empty($this->conf['templateFile'])) { |
|
| 347 | 347 | |
| 348 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###'); |
|
| 348 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###'); |
|
| 349 | 349 | |
| 350 | - } else { |
|
| 350 | + } else { |
|
| 351 | 351 | |
| 352 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###'); |
|
| 352 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###'); |
|
| 353 | 353 | |
| 354 | - } |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | - // Get subpart templates |
|
| 357 | - $subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###'); |
|
| 356 | + // Get subpart templates |
|
| 357 | + $subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###'); |
|
| 358 | 358 | |
| 359 | - // get the title of the anchor file |
|
| 360 | - $titleAnchor = $this->doc->getTitle($this->doc->uid); |
|
| 359 | + // get the title of the anchor file |
|
| 360 | + $titleAnchor = $this->doc->getTitle($this->doc->uid); |
|
| 361 | 361 | |
| 362 | - // get all children of anchor. this should be the year anchor documents |
|
| 363 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 364 | - 'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title', |
|
| 365 | - 'tx_dlf_documents', |
|
| 366 | - '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('year', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 367 | - '', |
|
| 368 | - 'title ASC', |
|
| 369 | - '' |
|
| 370 | - ); |
|
| 362 | + // get all children of anchor. this should be the year anchor documents |
|
| 363 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 364 | + 'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title', |
|
| 365 | + 'tx_dlf_documents', |
|
| 366 | + '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('year', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 367 | + '', |
|
| 368 | + 'title ASC', |
|
| 369 | + '' |
|
| 370 | + ); |
|
| 371 | 371 | |
| 372 | - // Process results. |
|
| 373 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 372 | + // Process results. |
|
| 373 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 374 | 374 | |
| 375 | - $years[] = array ( |
|
| 376 | - 'title' => $resArray['title'], |
|
| 377 | - 'uid' => $resArray['uid'] |
|
| 378 | - ); |
|
| 375 | + $years[] = array ( |
|
| 376 | + 'title' => $resArray['title'], |
|
| 377 | + 'uid' => $resArray['uid'] |
|
| 378 | + ); |
|
| 379 | 379 | |
| 380 | - } |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | - $subYearPartContent = ''; |
|
| 382 | + $subYearPartContent = ''; |
|
| 383 | 383 | |
| 384 | - if (count($years) > 0) { |
|
| 384 | + if (count($years) > 0) { |
|
| 385 | 385 | |
| 386 | - foreach ($years as $id => $year) { |
|
| 386 | + foreach ($years as $id => $year) { |
|
| 387 | 387 | |
| 388 | - $linkConf = array( |
|
| 389 | - 'useCacheHash' => 1, |
|
| 390 | - 'parameter' => $this->conf['targetPid'], |
|
| 391 | - 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($year['uid']), |
|
| 392 | - 'title' => $titleAnchor . ': ' . $year['title'] |
|
| 393 | - ); |
|
| 388 | + $linkConf = array( |
|
| 389 | + 'useCacheHash' => 1, |
|
| 390 | + 'parameter' => $this->conf['targetPid'], |
|
| 391 | + 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($year['uid']), |
|
| 392 | + 'title' => $titleAnchor . ': ' . $year['title'] |
|
| 393 | + ); |
|
| 394 | 394 | |
| 395 | - $yearArray = array( |
|
| 396 | - '###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf), |
|
| 397 | - ); |
|
| 395 | + $yearArray = array( |
|
| 396 | + '###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf), |
|
| 397 | + ); |
|
| 398 | 398 | |
| 399 | - $subYearPartContent .= $this->cObj->substituteMarkerArray($subparts['year'], $yearArray); |
|
| 399 | + $subYearPartContent .= $this->cObj->substituteMarkerArray($subparts['year'], $yearArray); |
|
| 400 | 400 | |
| 401 | - } |
|
| 402 | - } |
|
| 401 | + } |
|
| 402 | + } |
|
| 403 | 403 | |
| 404 | - // link to years overview (should be itself here) |
|
| 405 | - $linkConf = array ( |
|
| 406 | - 'useCacheHash' => 1, |
|
| 407 | - 'parameter' => $this->conf['targetPid'], |
|
| 408 | - 'additionalParams' => '&' . $this->prefixId . '[id]=' . $this->doc->uid, |
|
| 409 | - ); |
|
| 410 | - $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' .$this->doc->getTitle($this->doc->uid), $linkConf); |
|
| 404 | + // link to years overview (should be itself here) |
|
| 405 | + $linkConf = array ( |
|
| 406 | + 'useCacheHash' => 1, |
|
| 407 | + 'parameter' => $this->conf['targetPid'], |
|
| 408 | + 'additionalParams' => '&' . $this->prefixId . '[id]=' . $this->doc->uid, |
|
| 409 | + ); |
|
| 410 | + $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' .$this->doc->getTitle($this->doc->uid), $linkConf); |
|
| 411 | 411 | |
| 412 | - // Fill markers. |
|
| 413 | - $markerArray = array ( |
|
| 414 | - '###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'), |
|
| 415 | - '###CALALLYEARS###' => $allYearsLink |
|
| 416 | - ); |
|
| 412 | + // Fill markers. |
|
| 413 | + $markerArray = array ( |
|
| 414 | + '###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'), |
|
| 415 | + '###CALALLYEARS###' => $allYearsLink |
|
| 416 | + ); |
|
| 417 | 417 | |
| 418 | - $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 418 | + $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 419 | 419 | |
| 420 | - // fill the week markers |
|
| 421 | - return $this->cObj->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent); |
|
| 420 | + // fill the week markers |
|
| 421 | + return $this->cObj->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent); |
|
| 422 | 422 | |
| 423 | - } |
|
| 423 | + } |
|
| 424 | 424 | |
| 425 | 425 | } |
@@ -19,210 +19,210 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_feeds extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php'; |
|
| 22 | + public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The main method of the PlugIn |
|
| 26 | - * |
|
| 27 | - * @access public |
|
| 28 | - * |
|
| 29 | - * @param string $content: The PlugIn content |
|
| 30 | - * @param array $conf: The PlugIn configuration |
|
| 31 | - * |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function main($content, $conf) { |
|
| 24 | + /** |
|
| 25 | + * The main method of the PlugIn |
|
| 26 | + * |
|
| 27 | + * @access public |
|
| 28 | + * |
|
| 29 | + * @param string $content: The PlugIn content |
|
| 30 | + * @param array $conf: The PlugIn configuration |
|
| 31 | + * |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function main($content, $conf) { |
|
| 35 | 35 | |
| 36 | - $this->init($conf); |
|
| 36 | + $this->init($conf); |
|
| 37 | 37 | |
| 38 | - // Don't cache the output. |
|
| 39 | - $this->setCache(FALSE); |
|
| 38 | + // Don't cache the output. |
|
| 39 | + $this->setCache(FALSE); |
|
| 40 | 40 | |
| 41 | - // Create XML document. |
|
| 42 | - $rss = new DOMDocument('1.0', 'utf-8'); |
|
| 41 | + // Create XML document. |
|
| 42 | + $rss = new DOMDocument('1.0', 'utf-8'); |
|
| 43 | 43 | |
| 44 | - // Add mandatory root element. |
|
| 45 | - $root = $rss->createElement('rss'); |
|
| 44 | + // Add mandatory root element. |
|
| 45 | + $root = $rss->createElement('rss'); |
|
| 46 | 46 | |
| 47 | - $root->setAttribute('version', '2.0'); |
|
| 47 | + $root->setAttribute('version', '2.0'); |
|
| 48 | 48 | |
| 49 | - // Add channel element. |
|
| 50 | - $channel = $rss->createElement('channel'); |
|
| 49 | + // Add channel element. |
|
| 50 | + $channel = $rss->createElement('channel'); |
|
| 51 | 51 | |
| 52 | - $channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 52 | + $channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 53 | 53 | |
| 54 | - $channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8'))); |
|
| 54 | + $channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8'))); |
|
| 55 | 55 | |
| 56 | - if (!empty($this->conf['description'])) { |
|
| 56 | + if (!empty($this->conf['description'])) { |
|
| 57 | 57 | |
| 58 | - $channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8'))); |
|
| 58 | + $channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8'))); |
|
| 59 | 59 | |
| 60 | - } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 63 | - 'tx_dlf_libraries.label AS label', |
|
| 64 | - 'tx_dlf_libraries', |
|
| 65 | - 'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
| 66 | - '', |
|
| 67 | - '', |
|
| 68 | - '1' |
|
| 69 | - ); |
|
| 62 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 63 | + 'tx_dlf_libraries.label AS label', |
|
| 64 | + 'tx_dlf_libraries', |
|
| 65 | + 'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
| 66 | + '', |
|
| 67 | + '', |
|
| 68 | + '1' |
|
| 69 | + ); |
|
| 70 | 70 | |
| 71 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 71 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 72 | 72 | |
| 73 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 73 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
| 74 | 74 | |
| 75 | - $channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 75 | + $channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME']))); |
|
| 79 | + $channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME']))); |
|
| 80 | 80 | |
| 81 | - $channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 81 | + $channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 82 | 82 | |
| 83 | - // Add item elements. |
|
| 84 | - if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) { |
|
| 83 | + // Add item elements. |
|
| 84 | + if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) { |
|
| 85 | 85 | |
| 86 | - $additionalWhere = ''; |
|
| 86 | + $additionalWhere = ''; |
|
| 87 | 87 | |
| 88 | - // Check for pre-selected collections. |
|
| 89 | - if (!empty($this->piVars['collection'])) { |
|
| 88 | + // Check for pre-selected collections. |
|
| 89 | + if (!empty($this->piVars['collection'])) { |
|
| 90 | 90 | |
| 91 | - $additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']); |
|
| 91 | + $additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']); |
|
| 92 | 92 | |
| 93 | - } elseif (!empty($this->conf['collections'])) { |
|
| 93 | + } elseif (!empty($this->conf['collections'])) { |
|
| 94 | 94 | |
| 95 | - $additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')'; |
|
| 95 | + $additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')'; |
|
| 96 | 96 | |
| 97 | - } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 100 | - 'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate', |
|
| 101 | - 'tx_dlf_documents', |
|
| 102 | - 'tx_dlf_relations', |
|
| 103 | - 'tx_dlf_collections', |
|
| 104 | - 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 105 | - 'tx_dlf_documents.uid', |
|
| 106 | - 'tx_dlf_documents.tstamp DESC', |
|
| 107 | - intval($this->conf['limit']) |
|
| 108 | - ); |
|
| 99 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
| 100 | + 'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate', |
|
| 101 | + 'tx_dlf_documents', |
|
| 102 | + 'tx_dlf_relations', |
|
| 103 | + 'tx_dlf_collections', |
|
| 104 | + 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 105 | + 'tx_dlf_documents.uid', |
|
| 106 | + 'tx_dlf_documents.tstamp DESC', |
|
| 107 | + intval($this->conf['limit']) |
|
| 108 | + ); |
|
| 109 | 109 | |
| 110 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 110 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 111 | 111 | |
| 112 | - // Add each record as item element. |
|
| 113 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 112 | + // Add each record as item element. |
|
| 113 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 114 | 114 | |
| 115 | - $item = $rss->createElement('item'); |
|
| 115 | + $item = $rss->createElement('item'); |
|
| 116 | 116 | |
| 117 | - $title = ''; |
|
| 117 | + $title = ''; |
|
| 118 | 118 | |
| 119 | - // Get title of superior document. |
|
| 120 | - if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) { |
|
| 119 | + // Get title of superior document. |
|
| 120 | + if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) { |
|
| 121 | 121 | |
| 122 | - $superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE); |
|
| 122 | + $superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE); |
|
| 123 | 123 | |
| 124 | - if (!empty($superiorTitle)) { |
|
| 124 | + if (!empty($superiorTitle)) { |
|
| 125 | 125 | |
| 126 | - $title .= '['.$superiorTitle.']'; |
|
| 126 | + $title .= '['.$superiorTitle.']'; |
|
| 127 | 127 | |
| 128 | - } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - } |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - // Get title of document. |
|
| 133 | - if (!empty($resArray['title'])) { |
|
| 132 | + // Get title of document. |
|
| 133 | + if (!empty($resArray['title'])) { |
|
| 134 | 134 | |
| 135 | - $title .= ' '.$resArray['title']; |
|
| 135 | + $title .= ' '.$resArray['title']; |
|
| 136 | 136 | |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - // Set default title if empty. |
|
| 140 | - if (empty($title)) { |
|
| 139 | + // Set default title if empty. |
|
| 140 | + if (empty($title)) { |
|
| 141 | 141 | |
| 142 | - $title = $this->pi_getLL('noTitle'); |
|
| 142 | + $title = $this->pi_getLL('noTitle'); |
|
| 143 | 143 | |
| 144 | - } |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - // Append volume information. |
|
| 147 | - if (!empty($resArray['volume'])) { |
|
| 146 | + // Append volume information. |
|
| 147 | + if (!empty($resArray['volume'])) { |
|
| 148 | 148 | |
| 149 | - $title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume']; |
|
| 149 | + $title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume']; |
|
| 150 | 150 | |
| 151 | - } |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - // Is this document new or updated? |
|
| 154 | - if ($resArray['crdate'] == $resArray['tstamp']) { |
|
| 153 | + // Is this document new or updated? |
|
| 154 | + if ($resArray['crdate'] == $resArray['tstamp']) { |
|
| 155 | 155 | |
| 156 | - $title = $this->pi_getLL('new').' '.trim($title); |
|
| 156 | + $title = $this->pi_getLL('new').' '.trim($title); |
|
| 157 | 157 | |
| 158 | - } else { |
|
| 158 | + } else { |
|
| 159 | 159 | |
| 160 | - $title = $this->pi_getLL('update').' '.trim($title); |
|
| 160 | + $title = $this->pi_getLL('update').' '.trim($title); |
|
| 161 | 161 | |
| 162 | - } |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - $item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'))); |
|
| 164 | + $item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'))); |
|
| 165 | 165 | |
| 166 | - // Add link. |
|
| 167 | - $linkConf = array ( |
|
| 168 | - 'parameter' => $this->conf['targetPid'], |
|
| 169 | - 'forceAbsoluteUrl' => 1, |
|
| 170 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE) |
|
| 171 | - ); |
|
| 166 | + // Add link. |
|
| 167 | + $linkConf = array ( |
|
| 168 | + 'parameter' => $this->conf['targetPid'], |
|
| 169 | + 'forceAbsoluteUrl' => 1, |
|
| 170 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE) |
|
| 171 | + ); |
|
| 172 | 172 | |
| 173 | - $item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'))); |
|
| 173 | + $item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'))); |
|
| 174 | 174 | |
| 175 | - // Add author if applicable. |
|
| 176 | - if (!empty($resArray['author'])) { |
|
| 175 | + // Add author if applicable. |
|
| 176 | + if (!empty($resArray['author'])) { |
|
| 177 | 177 | |
| 178 | - $item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 178 | + $item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 179 | 179 | |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - // Add online publication date. |
|
| 183 | - $item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate']))); |
|
| 182 | + // Add online publication date. |
|
| 183 | + $item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate']))); |
|
| 184 | 184 | |
| 185 | - // Add internal record identifier. |
|
| 186 | - $item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 185 | + // Add internal record identifier. |
|
| 186 | + $item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8'))); |
|
| 187 | 187 | |
| 188 | - $channel->appendChild($item); |
|
| 188 | + $channel->appendChild($item); |
|
| 189 | 189 | |
| 190 | - } |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - } |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - $root->appendChild($channel); |
|
| 196 | + $root->appendChild($channel); |
|
| 197 | 197 | |
| 198 | - // Build XML output. |
|
| 199 | - $rss->appendChild($root); |
|
| 198 | + // Build XML output. |
|
| 199 | + $rss->appendChild($root); |
|
| 200 | 200 | |
| 201 | - $content = $rss->saveXML(); |
|
| 201 | + $content = $rss->saveXML(); |
|
| 202 | 202 | |
| 203 | - // Clean output buffer. |
|
| 204 | - \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
| 203 | + // Clean output buffer. |
|
| 204 | + \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
| 205 | 205 | |
| 206 | - // Send headers. |
|
| 207 | - header('HTTP/1.1 200 OK'); |
|
| 206 | + // Send headers. |
|
| 207 | + header('HTTP/1.1 200 OK'); |
|
| 208 | 208 | |
| 209 | - header('Cache-Control: no-cache'); |
|
| 209 | + header('Cache-Control: no-cache'); |
|
| 210 | 210 | |
| 211 | - header('Content-Length: '.strlen($content)); |
|
| 211 | + header('Content-Length: '.strlen($content)); |
|
| 212 | 212 | |
| 213 | - header('Content-Type: application/rss+xml; charset=utf-8'); |
|
| 213 | + header('Content-Type: application/rss+xml; charset=utf-8'); |
|
| 214 | 214 | |
| 215 | - header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 215 | + header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 216 | 216 | |
| 217 | - header('Expires: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 217 | + header('Expires: '.date('r', $GLOBALS['EXEC_TIME'])); |
|
| 218 | 218 | |
| 219 | - echo $content; |
|
| 219 | + echo $content; |
|
| 220 | 220 | |
| 221 | - // Flush output buffer and end script processing. |
|
| 222 | - ob_end_flush(); |
|
| 221 | + // Flush output buffer and end script processing. |
|
| 222 | + ob_end_flush(); |
|
| 223 | 223 | |
| 224 | - exit; |
|
| 224 | + exit; |
|
| 225 | 225 | |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | } |
@@ -20,391 +20,391 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class tx_dlf_metadata extends tx_dlf_plugin { |
| 22 | 22 | |
| 23 | - public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; |
|
| 23 | + public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * This holds the hook objects |
|
| 27 | - * |
|
| 28 | - * @var array |
|
| 29 | - * @access protected |
|
| 30 | - */ |
|
| 31 | - protected $hookObjects = array (); |
|
| 25 | + /** |
|
| 26 | + * This holds the hook objects |
|
| 27 | + * |
|
| 28 | + * @var array |
|
| 29 | + * @access protected |
|
| 30 | + */ |
|
| 31 | + protected $hookObjects = array (); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * The main method of the PlugIn |
|
| 35 | - * |
|
| 36 | - * @access public |
|
| 37 | - * |
|
| 38 | - * @param string $content: The PlugIn content |
|
| 39 | - * @param array $conf: The PlugIn configuration |
|
| 40 | - * |
|
| 41 | - * @return string The content that is displayed on the website |
|
| 42 | - */ |
|
| 43 | - public function main($content, $conf) { |
|
| 33 | + /** |
|
| 34 | + * The main method of the PlugIn |
|
| 35 | + * |
|
| 36 | + * @access public |
|
| 37 | + * |
|
| 38 | + * @param string $content: The PlugIn content |
|
| 39 | + * @param array $conf: The PlugIn configuration |
|
| 40 | + * |
|
| 41 | + * @return string The content that is displayed on the website |
|
| 42 | + */ |
|
| 43 | + public function main($content, $conf) { |
|
| 44 | 44 | |
| 45 | - $this->init($conf); |
|
| 45 | + $this->init($conf); |
|
| 46 | 46 | |
| 47 | - // Turn cache on. |
|
| 48 | - $this->setCache(TRUE); |
|
| 47 | + // Turn cache on. |
|
| 48 | + $this->setCache(TRUE); |
|
| 49 | 49 | |
| 50 | - // Load current document. |
|
| 51 | - $this->loadDocument(); |
|
| 50 | + // Load current document. |
|
| 51 | + $this->loadDocument(); |
|
| 52 | 52 | |
| 53 | - if ($this->doc === NULL) { |
|
| 53 | + if ($this->doc === NULL) { |
|
| 54 | 54 | |
| 55 | - // Quit without doing anything if required variables are not set. |
|
| 56 | - return $content; |
|
| 55 | + // Quit without doing anything if required variables are not set. |
|
| 56 | + return $content; |
|
| 57 | 57 | |
| 58 | - } else { |
|
| 58 | + } else { |
|
| 59 | 59 | |
| 60 | - // Set default values if not set. |
|
| 61 | - if (!isset($this->conf['rootline'])) { |
|
| 60 | + // Set default values if not set. |
|
| 61 | + if (!isset($this->conf['rootline'])) { |
|
| 62 | 62 | |
| 63 | - $this->conf['rootline'] = 0; |
|
| 63 | + $this->conf['rootline'] = 0; |
|
| 64 | 64 | |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $metadata = array (); |
|
| 69 | + $metadata = array (); |
|
| 70 | 70 | |
| 71 | - if ($this->conf['rootline'] < 2) { |
|
| 71 | + if ($this->conf['rootline'] < 2) { |
|
| 72 | 72 | |
| 73 | - // Get current structure's @ID. |
|
| 74 | - $ids = array (); |
|
| 73 | + // Get current structure's @ID. |
|
| 74 | + $ids = array (); |
|
| 75 | 75 | |
| 76 | - if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
|
| 76 | + if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
|
| 77 | 77 | |
| 78 | - foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { |
|
| 78 | + foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { |
|
| 79 | 79 | |
| 80 | - $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
|
| 80 | + $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
|
| 81 | 81 | |
| 82 | - $ids[$count][] = $logId; |
|
| 82 | + $ids[$count][] = $logId; |
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - ksort($ids); |
|
| 88 | + ksort($ids); |
|
| 89 | 89 | |
| 90 | - reset($ids); |
|
| 90 | + reset($ids); |
|
| 91 | 91 | |
| 92 | - // Check if we should display all metadata up to the root. |
|
| 93 | - if ($this->conf['rootline'] == 1) { |
|
| 92 | + // Check if we should display all metadata up to the root. |
|
| 93 | + if ($this->conf['rootline'] == 1) { |
|
| 94 | 94 | |
| 95 | - foreach ($ids as $id) { |
|
| 95 | + foreach ($ids as $id) { |
|
| 96 | 96 | |
| 97 | - foreach ($id as $sid) { |
|
| 97 | + foreach ($id as $sid) { |
|
| 98 | 98 | |
| 99 | - $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
| 99 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
| 100 | 100 | |
| 101 | - if (!empty($data)) { |
|
| 101 | + if (!empty($data)) { |
|
| 102 | 102 | |
| 103 | - $data['_id'] = $sid; |
|
| 103 | + $data['_id'] = $sid; |
|
| 104 | 104 | |
| 105 | - $metadata[] = $data; |
|
| 105 | + $metadata[] = $data; |
|
| 106 | 106 | |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - } else { |
|
| 113 | + } else { |
|
| 114 | 114 | |
| 115 | - $id = array_pop($ids); |
|
| 115 | + $id = array_pop($ids); |
|
| 116 | 116 | |
| 117 | - if (is_array($id)) { |
|
| 117 | + if (is_array($id)) { |
|
| 118 | 118 | |
| 119 | - foreach ($id as $sid) { |
|
| 119 | + foreach ($id as $sid) { |
|
| 120 | 120 | |
| 121 | - $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
| 121 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
| 122 | 122 | |
| 123 | - if (!empty($data)) { |
|
| 123 | + if (!empty($data)) { |
|
| 124 | 124 | |
| 125 | - $data['_id'] = $sid; |
|
| 125 | + $data['_id'] = $sid; |
|
| 126 | 126 | |
| 127 | - $metadata[] = $data; |
|
| 127 | + $metadata[] = $data; |
|
| 128 | 128 | |
| 129 | - } |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - } |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - // Get titledata? |
|
| 140 | - if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { |
|
| 139 | + // Get titledata? |
|
| 140 | + if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { |
|
| 141 | 141 | |
| 142 | - $data = $this->doc->getTitleData($this->conf['pages']); |
|
| 142 | + $data = $this->doc->getTitleData($this->conf['pages']); |
|
| 143 | 143 | |
| 144 | - $data['_id'] = $this->doc->toplevelId; |
|
| 144 | + $data['_id'] = $this->doc->toplevelId; |
|
| 145 | 145 | |
| 146 | - array_unshift($metadata, $data); |
|
| 146 | + array_unshift($metadata, $data); |
|
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - if (empty($metadata)) { |
|
| 150 | + if (empty($metadata)) { |
|
| 151 | 151 | |
| 152 | - if (TYPO3_DLOG) { |
|
| 152 | + if (TYPO3_DLOG) { |
|
| 153 | 153 | |
| 154 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
| 154 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
| 155 | 155 | |
| 156 | - } |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - return $content; |
|
| 158 | + return $content; |
|
| 159 | 159 | |
| 160 | - } |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - ksort($metadata); |
|
| 162 | + ksort($metadata); |
|
| 163 | 163 | |
| 164 | - // Get hook objects. |
|
| 165 | - $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); |
|
| 164 | + // Get hook objects. |
|
| 165 | + $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); |
|
| 166 | 166 | |
| 167 | - // Hook for getting a customized title bar (requested by SBB). |
|
| 168 | - foreach ($this->hookObjects as $hookObj) { |
|
| 167 | + // Hook for getting a customized title bar (requested by SBB). |
|
| 168 | + foreach ($this->hookObjects as $hookObj) { |
|
| 169 | 169 | |
| 170 | - if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { |
|
| 170 | + if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { |
|
| 171 | 171 | |
| 172 | - $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); |
|
| 172 | + $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); |
|
| 173 | 173 | |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - $content .= $this->printMetadata($metadata); |
|
| 178 | + $content .= $this->printMetadata($metadata); |
|
| 179 | 179 | |
| 180 | - return $this->pi_wrapInBaseClass($content); |
|
| 180 | + return $this->pi_wrapInBaseClass($content); |
|
| 181 | 181 | |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - /** |
|
| 185 | - * Prepares the metadata array for output |
|
| 186 | - * |
|
| 187 | - * @access protected |
|
| 188 | - * |
|
| 189 | - * @param array $metadataArray: The metadata array |
|
| 190 | - * |
|
| 191 | - * @return string The metadata array ready for output |
|
| 192 | - */ |
|
| 193 | - protected function printMetadata(array $metadataArray) { |
|
| 184 | + /** |
|
| 185 | + * Prepares the metadata array for output |
|
| 186 | + * |
|
| 187 | + * @access protected |
|
| 188 | + * |
|
| 189 | + * @param array $metadataArray: The metadata array |
|
| 190 | + * |
|
| 191 | + * @return string The metadata array ready for output |
|
| 192 | + */ |
|
| 193 | + protected function printMetadata(array $metadataArray) { |
|
| 194 | 194 | |
| 195 | - // Load template file. |
|
| 196 | - if (!empty($this->conf['templateFile'])) { |
|
| 195 | + // Load template file. |
|
| 196 | + if (!empty($this->conf['templateFile'])) { |
|
| 197 | 197 | |
| 198 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 198 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 199 | 199 | |
| 200 | - } else { |
|
| 200 | + } else { |
|
| 201 | 201 | |
| 202 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); |
|
| 202 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); |
|
| 203 | 203 | |
| 204 | - } |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - $output = ''; |
|
| 206 | + $output = ''; |
|
| 207 | 207 | |
| 208 | - $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
|
| 208 | + $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
|
| 209 | 209 | |
| 210 | - // Get list of metadata to show. |
|
| 211 | - $metaList = array (); |
|
| 210 | + // Get list of metadata to show. |
|
| 211 | + $metaList = array (); |
|
| 212 | 212 | |
| 213 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 214 | - 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
|
| 215 | - 'tx_dlf_metadata', |
|
| 216 | - 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))', |
|
| 217 | - '', |
|
| 218 | - 'tx_dlf_metadata.sorting', |
|
| 219 | - '' |
|
| 220 | - ); |
|
| 213 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 214 | + 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
|
| 215 | + 'tx_dlf_metadata', |
|
| 216 | + 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))', |
|
| 217 | + '', |
|
| 218 | + 'tx_dlf_metadata.sorting', |
|
| 219 | + '' |
|
| 220 | + ); |
|
| 221 | 221 | |
| 222 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 222 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 223 | 223 | |
| 224 | - if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { |
|
| 224 | + if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { |
|
| 225 | 225 | |
| 226 | - $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); |
|
| 226 | + $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); |
|
| 227 | 227 | |
| 228 | - } |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | - if ($resArray) { |
|
| 231 | - // get correct language uid for translated realurl link |
|
| 232 | - $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; |
|
| 230 | + if ($resArray) { |
|
| 231 | + // get correct language uid for translated realurl link |
|
| 232 | + $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; |
|
| 233 | 233 | |
| 234 | - // do stuff with the row entry data like built HTML or prepare further usage |
|
| 235 | - if ($this->conf['showFull'] || $resArray['is_listed']) { |
|
| 234 | + // do stuff with the row entry data like built HTML or prepare further usage |
|
| 235 | + if ($this->conf['showFull'] || $resArray['is_listed']) { |
|
| 236 | 236 | |
| 237 | - $metaList[$resArray['index_name']] = array ( |
|
| 238 | - 'wrap' => $resArray['wrap'], |
|
| 239 | - 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
| 240 | - ); |
|
| 237 | + $metaList[$resArray['index_name']] = array ( |
|
| 238 | + 'wrap' => $resArray['wrap'], |
|
| 239 | + 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
| 240 | + ); |
|
| 241 | 241 | |
| 242 | - } |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - } |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - } |
|
| 246 | + } |
|
| 247 | 247 | |
| 248 | - // Get list of collections to show. |
|
| 249 | - $collList = array (); |
|
| 248 | + // Get list of collections to show. |
|
| 249 | + $collList = array (); |
|
| 250 | 250 | |
| 251 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 252 | - 'tx_dlf_collections.index_name AS index_name', |
|
| 253 | - 'tx_dlf_collections', |
|
| 254 | - 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 255 | - '', |
|
| 256 | - '', |
|
| 257 | - '' |
|
| 258 | - ); |
|
| 251 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 252 | + 'tx_dlf_collections.index_name AS index_name', |
|
| 253 | + 'tx_dlf_collections', |
|
| 254 | + 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 255 | + '', |
|
| 256 | + '', |
|
| 257 | + '' |
|
| 258 | + ); |
|
| 259 | 259 | |
| 260 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 260 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
| 261 | 261 | |
| 262 | - $collList[] = $resArray['index_name']; |
|
| 262 | + $collList[] = $resArray['index_name']; |
|
| 263 | 263 | |
| 264 | - } |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | - // Save original data array. |
|
| 267 | - $cObjData = $this->cObj->data; |
|
| 266 | + // Save original data array. |
|
| 267 | + $cObjData = $this->cObj->data; |
|
| 268 | 268 | |
| 269 | - // Parse the metadata arrays. |
|
| 270 | - foreach ($metadataArray as $metadata) { |
|
| 269 | + // Parse the metadata arrays. |
|
| 270 | + foreach ($metadataArray as $metadata) { |
|
| 271 | 271 | |
| 272 | - $markerArray['###METADATA###'] = ''; |
|
| 272 | + $markerArray['###METADATA###'] = ''; |
|
| 273 | 273 | |
| 274 | - // Reset content object's data array. |
|
| 275 | - $this->cObj->data = $cObjData; |
|
| 274 | + // Reset content object's data array. |
|
| 275 | + $this->cObj->data = $cObjData; |
|
| 276 | 276 | |
| 277 | - // Load all the metadata values into the content object's data array. |
|
| 278 | - foreach ($metadata as $index_name => $value) { |
|
| 277 | + // Load all the metadata values into the content object's data array. |
|
| 278 | + foreach ($metadata as $index_name => $value) { |
|
| 279 | 279 | |
| 280 | - if (is_array($value)) { |
|
| 280 | + if (is_array($value)) { |
|
| 281 | 281 | |
| 282 | - $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
|
| 282 | + $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
|
| 283 | 283 | |
| 284 | - } else { |
|
| 284 | + } else { |
|
| 285 | 285 | |
| 286 | - $this->cObj->data[$index_name] = $value; |
|
| 286 | + $this->cObj->data[$index_name] = $value; |
|
| 287 | 287 | |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - } |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - // Process each metadate. |
|
| 293 | - foreach ($metaList as $index_name => $metaConf) { |
|
| 292 | + // Process each metadate. |
|
| 293 | + foreach ($metaList as $index_name => $metaConf) { |
|
| 294 | 294 | |
| 295 | - $parsedValue = ''; |
|
| 295 | + $parsedValue = ''; |
|
| 296 | 296 | |
| 297 | - $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
| 297 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
| 298 | 298 | |
| 299 | - do { |
|
| 299 | + do { |
|
| 300 | 300 | |
| 301 | - $value = @array_shift($metadata[$index_name]); |
|
| 301 | + $value = @array_shift($metadata[$index_name]); |
|
| 302 | 302 | |
| 303 | - if ($index_name == 'title') { |
|
| 303 | + if ($index_name == 'title') { |
|
| 304 | 304 | |
| 305 | - // Get title of parent document if needed. |
|
| 306 | - if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
|
| 305 | + // Get title of parent document if needed. |
|
| 306 | + if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
|
| 307 | 307 | |
| 308 | - $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); |
|
| 308 | + $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); |
|
| 309 | 309 | |
| 310 | - if (!empty($superiorTitle)) { |
|
| 310 | + if (!empty($superiorTitle)) { |
|
| 311 | 311 | |
| 312 | - $value = '['.$superiorTitle.']'; |
|
| 312 | + $value = '['.$superiorTitle.']'; |
|
| 313 | 313 | |
| 314 | - } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | - } |
|
| 316 | + } |
|
| 317 | 317 | |
| 318 | - if (!empty($value)) { |
|
| 318 | + if (!empty($value)) { |
|
| 319 | 319 | |
| 320 | - $value = htmlspecialchars($value); |
|
| 320 | + $value = htmlspecialchars($value); |
|
| 321 | 321 | |
| 322 | - // Link title to pageview. |
|
| 323 | - if ($this->conf['linkTitle'] && $metadata['_id']) { |
|
| 322 | + // Link title to pageview. |
|
| 323 | + if ($this->conf['linkTitle'] && $metadata['_id']) { |
|
| 324 | 324 | |
| 325 | - $details = $this->doc->getLogicalStructure($metadata['_id']); |
|
| 325 | + $details = $this->doc->getLogicalStructure($metadata['_id']); |
|
| 326 | 326 | |
| 327 | - $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
| 327 | + $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
| 328 | 328 | |
| 329 | - } |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - } elseif ($index_name == 'owner' && !empty($value)) { |
|
| 333 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
| 334 | 334 | |
| 335 | - // Translate name of holding library. |
|
| 336 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
| 335 | + // Translate name of holding library. |
|
| 336 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
| 337 | 337 | |
| 338 | - } elseif ($index_name == 'type' && !empty($value)) { |
|
| 338 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
| 339 | 339 | |
| 340 | - // Translate document type. |
|
| 341 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
| 340 | + // Translate document type. |
|
| 341 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
| 342 | 342 | |
| 343 | - } elseif ($index_name == 'collection' && !empty($value)) { |
|
| 343 | + } elseif ($index_name == 'collection' && !empty($value)) { |
|
| 344 | 344 | |
| 345 | - // Check if collections isn't hidden. |
|
| 346 | - if (in_array($value, $collList)) { |
|
| 345 | + // Check if collections isn't hidden. |
|
| 346 | + if (in_array($value, $collList)) { |
|
| 347 | 347 | |
| 348 | - // Translate collection. |
|
| 349 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
| 348 | + // Translate collection. |
|
| 349 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
| 350 | 350 | |
| 351 | - } else { |
|
| 351 | + } else { |
|
| 352 | 352 | |
| 353 | - $value = ''; |
|
| 353 | + $value = ''; |
|
| 354 | 354 | |
| 355 | - } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - } elseif ($index_name == 'language' && !empty($value)) { |
|
| 357 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
| 358 | 358 | |
| 359 | - // Translate ISO 639 language code. |
|
| 360 | - $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
| 359 | + // Translate ISO 639 language code. |
|
| 360 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
| 361 | 361 | |
| 362 | - } elseif (!empty($value)) { |
|
| 362 | + } elseif (!empty($value)) { |
|
| 363 | 363 | |
| 364 | - // Sanitize value for output. |
|
| 365 | - $value = htmlspecialchars($value); |
|
| 364 | + // Sanitize value for output. |
|
| 365 | + $value = htmlspecialchars($value); |
|
| 366 | 366 | |
| 367 | - } |
|
| 367 | + } |
|
| 368 | 368 | |
| 369 | - // Hook for getting a customized value (requested by SBB). |
|
| 370 | - foreach ($this->hookObjects as $hookObj) { |
|
| 369 | + // Hook for getting a customized value (requested by SBB). |
|
| 370 | + foreach ($this->hookObjects as $hookObj) { |
|
| 371 | 371 | |
| 372 | - if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { |
|
| 372 | + if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { |
|
| 373 | 373 | |
| 374 | - $hookObj->printMetadata_customizeMetadata($value); |
|
| 374 | + $hookObj->printMetadata_customizeMetadata($value); |
|
| 375 | 375 | |
| 376 | - } |
|
| 376 | + } |
|
| 377 | 377 | |
| 378 | - } |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | - $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
| 380 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
| 381 | 381 | |
| 382 | - if (!empty($value)) { |
|
| 382 | + if (!empty($value)) { |
|
| 383 | 383 | |
| 384 | - $parsedValue .= $value; |
|
| 384 | + $parsedValue .= $value; |
|
| 385 | 385 | |
| 386 | - } |
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | - } while (count($metadata[$index_name])); |
|
| 388 | + } while (count($metadata[$index_name])); |
|
| 389 | 389 | |
| 390 | - if (!empty($parsedValue)) { |
|
| 390 | + if (!empty($parsedValue)) { |
|
| 391 | 391 | |
| 392 | - $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
| 392 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
| 393 | 393 | |
| 394 | - $field .= $parsedValue; |
|
| 394 | + $field .= $parsedValue; |
|
| 395 | 395 | |
| 396 | - $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
| 396 | + $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
| 397 | 397 | |
| 398 | - } |
|
| 398 | + } |
|
| 399 | 399 | |
| 400 | - } |
|
| 400 | + } |
|
| 401 | 401 | |
| 402 | - $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); |
|
| 402 | + $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); |
|
| 403 | 403 | |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | - return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); |
|
| 406 | + return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); |
|
| 407 | 407 | |
| 408 | - } |
|
| 408 | + } |
|
| 409 | 409 | |
| 410 | 410 | } |