We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -12,328 +12,328 @@ |
||
| 12 | 12 | // Define metadata elements. |
| 13 | 13 | // @see http://dfg-viewer.de/en/profile-of-the-metadata/ |
| 14 | 14 | $metadata = array ( |
| 15 | - 'type' => array ( |
|
| 16 | - 'format' => array (), |
|
| 17 | - 'default_value' => '', |
|
| 18 | - 'wrap' => '', |
|
| 19 | - 'index_tokenized' => 0, |
|
| 20 | - 'index_stored' => 1, |
|
| 21 | - 'index_indexed' => 0, |
|
| 22 | - 'index_boost' => 1.00, |
|
| 23 | - 'is_sortable' => 1, |
|
| 24 | - 'is_facet' => 1, |
|
| 25 | - 'is_listed' => 1, |
|
| 26 | - 'index_autocomplete' => 0, |
|
| 27 | - ), |
|
| 28 | - 'title' => array ( |
|
| 29 | - 'format' => array ( |
|
| 30 | - array ( |
|
| 31 | - 'encoded' => 1, |
|
| 32 | - 'xpath' => 'concat(./mods:titleInfo/mods:nonSort," ",./mods:titleInfo/mods:title)', |
|
| 33 | - 'xpath_sorting' => './mods:titleInfo/mods:title', |
|
| 34 | - ), |
|
| 35 | - array ( |
|
| 36 | - 'encoded' => 2, |
|
| 37 | - 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:note[@type="caption"]', |
|
| 38 | - 'xpath_sorting' => '', |
|
| 39 | - ), |
|
| 40 | - ), |
|
| 41 | - 'default_value' => '', |
|
| 42 | - 'wrap' => "key.wrap = <dt class=\"tx-dlf-metadata-title\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-title\">|</dd>", |
|
| 43 | - 'index_tokenized' => 1, |
|
| 44 | - 'index_stored' => 1, |
|
| 45 | - 'index_indexed' => 1, |
|
| 46 | - 'index_boost' => 2.00, |
|
| 47 | - 'is_sortable' => 1, |
|
| 48 | - 'is_facet' => 0, |
|
| 49 | - 'is_listed' => 1, |
|
| 50 | - 'index_autocomplete' => 1, |
|
| 51 | - ), |
|
| 52 | - 'volume' => array ( |
|
| 53 | - 'format' => array ( |
|
| 54 | - array ( |
|
| 55 | - 'encoded' => 1, |
|
| 56 | - 'xpath' => './mods:part/mods:detail/mods:number', |
|
| 57 | - 'xpath_sorting' => './mods:part[@type="host"]/@order', |
|
| 58 | - ), |
|
| 59 | - ), |
|
| 60 | - 'default_value' => '', |
|
| 61 | - 'wrap' => '', |
|
| 62 | - 'index_tokenized' => 0, |
|
| 63 | - 'index_stored' => 1, |
|
| 64 | - 'index_indexed' => 0, |
|
| 65 | - 'index_boost' => 1.00, |
|
| 66 | - 'is_sortable' => 1, |
|
| 67 | - 'is_facet' => 0, |
|
| 68 | - 'is_listed' => 1, |
|
| 69 | - 'index_autocomplete' => 0, |
|
| 70 | - ), |
|
| 71 | - 'author' => array ( |
|
| 72 | - 'format' => array ( |
|
| 73 | - array ( |
|
| 74 | - 'encoded' => 2, |
|
| 75 | - 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:name', |
|
| 76 | - 'xpath_sorting' => '', |
|
| 77 | - ), |
|
| 78 | - ), |
|
| 79 | - 'default_value' => '', |
|
| 80 | - 'wrap' => '', |
|
| 81 | - 'index_tokenized' => 1, |
|
| 82 | - 'index_stored' => 1, |
|
| 83 | - 'index_indexed' => 1, |
|
| 84 | - 'index_boost' => 2.00, |
|
| 85 | - 'is_sortable' => 1, |
|
| 86 | - 'is_facet' => 1, |
|
| 87 | - 'is_listed' => 1, |
|
| 88 | - 'index_autocomplete' => 1, |
|
| 89 | - ), |
|
| 90 | - 'place' => array ( |
|
| 91 | - 'format' => array ( |
|
| 92 | - array ( |
|
| 93 | - 'encoded' => 2, |
|
| 94 | - 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origPlace', |
|
| 95 | - 'xpath_sorting' => '', |
|
| 96 | - ), |
|
| 97 | - ), |
|
| 98 | - 'default_value' => '', |
|
| 99 | - 'wrap' => '', |
|
| 100 | - 'index_tokenized' => 1, |
|
| 101 | - 'index_stored' => 1, |
|
| 102 | - 'index_indexed' => 1, |
|
| 103 | - 'index_boost' => 1.00, |
|
| 104 | - 'is_sortable' => 1, |
|
| 105 | - 'is_facet' => 1, |
|
| 106 | - 'is_listed' => 1, |
|
| 107 | - 'index_autocomplete' => 0, |
|
| 108 | - ), |
|
| 109 | - 'year' => array ( |
|
| 110 | - 'format' => array ( |
|
| 111 | - array ( |
|
| 112 | - 'encoded' => 2, |
|
| 113 | - 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate', |
|
| 114 | - 'xpath_sorting' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate/@when', |
|
| 115 | - ), |
|
| 116 | - ), |
|
| 117 | - 'default_value' => '', |
|
| 118 | - 'wrap' => '', |
|
| 119 | - 'index_tokenized' => 0, |
|
| 120 | - 'index_stored' => 1, |
|
| 121 | - 'index_indexed' => 1, |
|
| 122 | - 'index_boost' => 1.00, |
|
| 123 | - 'is_sortable' => 1, |
|
| 124 | - 'is_facet' => 1, |
|
| 125 | - 'is_listed' => 1, |
|
| 126 | - 'index_autocomplete' => 0, |
|
| 127 | - ), |
|
| 128 | - 'language' => array ( |
|
| 129 | - 'format' => array ( |
|
| 130 | - array ( |
|
| 131 | - 'encoded' => 1, |
|
| 132 | - 'xpath' => './mods:language/mods:languageTerm', |
|
| 133 | - 'xpath_sorting' => '', |
|
| 134 | - ), |
|
| 135 | - ), |
|
| 136 | - 'default_value' => '', |
|
| 137 | - 'wrap' => '', |
|
| 138 | - 'index_tokenized' => 0, |
|
| 139 | - 'index_stored' => 0, |
|
| 140 | - 'index_indexed' => 1, |
|
| 141 | - 'index_boost' => 1.00, |
|
| 142 | - 'is_sortable' => 0, |
|
| 143 | - 'is_facet' => 1, |
|
| 144 | - 'is_listed' => 0, |
|
| 145 | - 'index_autocomplete' => 0, |
|
| 146 | - ), |
|
| 147 | - 'collection' => array ( |
|
| 148 | - 'format' => array ( |
|
| 149 | - array ( |
|
| 150 | - 'encoded' => 1, |
|
| 151 | - 'xpath' => './mods:classification', |
|
| 152 | - 'xpath_sorting' => '', |
|
| 153 | - ), |
|
| 154 | - array ( |
|
| 155 | - 'encoded' => 2, |
|
| 156 | - 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:msIdentifier/teihdr:collection', |
|
| 157 | - 'xpath_sorting' => '', |
|
| 158 | - ), |
|
| 159 | - ), |
|
| 160 | - 'default_value' => '', |
|
| 161 | - 'wrap' => '', |
|
| 162 | - 'index_tokenized' => 1, |
|
| 163 | - 'index_stored' => 0, |
|
| 164 | - 'index_indexed' => 1, |
|
| 165 | - 'index_boost' => 1.00, |
|
| 166 | - 'is_sortable' => 0, |
|
| 167 | - 'is_facet' => 1, |
|
| 168 | - 'is_listed' => 0, |
|
| 169 | - 'index_autocomplete' => 0, |
|
| 170 | - ), |
|
| 171 | - 'owner' => array ( |
|
| 172 | - 'format' => array ( |
|
| 173 | - array ( |
|
| 174 | - 'encoded' => 1, |
|
| 175 | - 'xpath' => './mods:name[./mods:role/mods:roleTerm="own"]/mods:displayForm', |
|
| 176 | - 'xpath_sorting' => '', |
|
| 177 | - ), |
|
| 178 | - array ( |
|
| 179 | - 'encoded' => 2, |
|
| 180 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:publisher', |
|
| 181 | - 'xpath_sorting' => '', |
|
| 182 | - ), |
|
| 183 | - ), |
|
| 184 | - 'default_value' => '', |
|
| 185 | - 'wrap' => '', |
|
| 186 | - 'index_tokenized' => 0, |
|
| 187 | - 'index_stored' => 0, |
|
| 188 | - 'index_indexed' => 1, |
|
| 189 | - 'index_boost' => 1.00, |
|
| 190 | - 'is_sortable' => 0, |
|
| 191 | - 'is_facet' => 1, |
|
| 192 | - 'is_listed' => 0, |
|
| 193 | - 'index_autocomplete' => 0, |
|
| 194 | - ), |
|
| 195 | - 'purl' => array ( |
|
| 196 | - 'format' => array ( |
|
| 197 | - array ( |
|
| 198 | - 'encoded' => 1, |
|
| 199 | - 'xpath' => './mods:identifier[@type="purl"]', |
|
| 200 | - 'xpath_sorting' => '', |
|
| 201 | - ), |
|
| 202 | - array ( |
|
| 203 | - 'encoded' => 2, |
|
| 204 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="purl"]', |
|
| 205 | - 'xpath_sorting' => '', |
|
| 206 | - ), |
|
| 207 | - ), |
|
| 208 | - 'default_value' => '', |
|
| 209 | - 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.wrap = <dd>|</dd>", |
|
| 210 | - 'index_tokenized' => 0, |
|
| 211 | - 'index_stored' => 0, |
|
| 212 | - 'index_indexed' => 0, |
|
| 213 | - 'index_boost' => 1.00, |
|
| 214 | - 'is_sortable' => 0, |
|
| 215 | - 'is_facet' => 0, |
|
| 216 | - 'is_listed' => 0, |
|
| 217 | - 'index_autocomplete' => 0, |
|
| 218 | - ), |
|
| 219 | - 'urn' => array ( |
|
| 220 | - 'format' => array ( |
|
| 221 | - array ( |
|
| 222 | - 'encoded' => 1, |
|
| 223 | - 'xpath' => './mods:identifier[@type="urn"]', |
|
| 224 | - 'xpath_sorting' => '', |
|
| 225 | - ), |
|
| 226 | - array ( |
|
| 227 | - 'encoded' => 2, |
|
| 228 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="urn"]', |
|
| 229 | - 'xpath_sorting' => '', |
|
| 230 | - ), |
|
| 231 | - ), |
|
| 232 | - 'default_value' => '', |
|
| 233 | - 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.typolink.parameter.prepend = TEXT\nvalue.typolink.parameter.prepend.value = http://nbn-resolving.de/\nvalue.wrap = <dd>|</dd>", |
|
| 234 | - 'index_tokenized' => 0, |
|
| 235 | - 'index_stored' => 0, |
|
| 236 | - 'index_indexed' => 1, |
|
| 237 | - 'index_boost' => 1.00, |
|
| 238 | - 'is_sortable' => 0, |
|
| 239 | - 'is_facet' => 0, |
|
| 240 | - 'is_listed' => 0, |
|
| 241 | - 'index_autocomplete' => 0, |
|
| 242 | - ), |
|
| 243 | - 'opac_id' => array ( |
|
| 244 | - 'format' => array ( |
|
| 245 | - array ( |
|
| 246 | - 'encoded' => 1, |
|
| 247 | - 'xpath' => './mods:identifier[@type="opac"]', |
|
| 248 | - 'xpath_sorting' => '', |
|
| 249 | - ), |
|
| 250 | - array ( |
|
| 251 | - 'encoded' => 2, |
|
| 252 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="opac"]', |
|
| 253 | - 'xpath_sorting' => '', |
|
| 254 | - ), |
|
| 255 | - ), |
|
| 256 | - 'default_value' => '', |
|
| 257 | - 'wrap' => '', |
|
| 258 | - 'index_tokenized' => 0, |
|
| 259 | - 'index_stored' => 0, |
|
| 260 | - 'index_indexed' => 1, |
|
| 261 | - 'index_boost' => 1.00, |
|
| 262 | - 'is_sortable' => 0, |
|
| 263 | - 'is_facet' => 0, |
|
| 264 | - 'is_listed' => 0, |
|
| 265 | - 'index_autocomplete' => 0, |
|
| 266 | - ), |
|
| 267 | - 'union_id' => array ( |
|
| 268 | - 'format' => array ( |
|
| 269 | - array ( |
|
| 270 | - 'encoded' => 1, |
|
| 271 | - 'xpath' => './mods:identifier[@type="ppn"]', |
|
| 272 | - 'xpath_sorting' => '', |
|
| 273 | - ), |
|
| 274 | - array ( |
|
| 275 | - 'encoded' => 2, |
|
| 276 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="mmid"]', |
|
| 277 | - 'xpath_sorting' => '', |
|
| 278 | - ), |
|
| 279 | - ), |
|
| 280 | - 'default_value' => '', |
|
| 281 | - 'wrap' => '', |
|
| 282 | - 'index_tokenized' => 0, |
|
| 283 | - 'index_stored' => 0, |
|
| 284 | - 'index_indexed' => 1, |
|
| 285 | - 'index_boost' => 1.00, |
|
| 286 | - 'is_sortable' => 0, |
|
| 287 | - 'is_facet' => 0, |
|
| 288 | - 'is_listed' => 0, |
|
| 289 | - 'index_autocomplete' => 0, |
|
| 290 | - ), |
|
| 291 | - 'record_id' => array ( |
|
| 292 | - 'format' => array ( |
|
| 293 | - array ( |
|
| 294 | - 'encoded' => 1, |
|
| 295 | - 'xpath' => './mods:recordInfo/mods:recordIdentifier', |
|
| 296 | - 'xpath_sorting' => '', |
|
| 297 | - ), |
|
| 298 | - array ( |
|
| 299 | - 'encoded' => 2, |
|
| 300 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="recordIdentifier"]', |
|
| 301 | - 'xpath_sorting' => '', |
|
| 302 | - ), |
|
| 303 | - ), |
|
| 304 | - 'default_value' => '', |
|
| 305 | - 'wrap' => '', |
|
| 306 | - 'index_tokenized' => 0, |
|
| 307 | - 'index_stored' => 0, |
|
| 308 | - 'index_indexed' => 1, |
|
| 309 | - 'index_boost' => 1.00, |
|
| 310 | - 'is_sortable' => 0, |
|
| 311 | - 'is_facet' => 0, |
|
| 312 | - 'is_listed' => 0, |
|
| 313 | - 'index_autocomplete' => 0, |
|
| 314 | - ), |
|
| 315 | - 'prod_id' => array ( |
|
| 316 | - 'format' => array ( |
|
| 317 | - array ( |
|
| 318 | - 'encoded' => 1, |
|
| 319 | - 'xpath' => './mods:identifier[@type="goobi"]', |
|
| 320 | - 'xpath_sorting' => '', |
|
| 321 | - ), |
|
| 322 | - array ( |
|
| 323 | - 'encoded' => 2, |
|
| 324 | - 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="goobi"]', |
|
| 325 | - 'xpath_sorting' => '', |
|
| 326 | - ), |
|
| 327 | - ), |
|
| 328 | - 'default_value' => '', |
|
| 329 | - 'wrap' => '', |
|
| 330 | - 'index_tokenized' => 0, |
|
| 331 | - 'index_stored' => 0, |
|
| 332 | - 'index_indexed' => 0, |
|
| 333 | - 'index_boost' => 0.00, |
|
| 334 | - 'is_sortable' => 0, |
|
| 335 | - 'is_facet' => 0, |
|
| 336 | - 'is_listed' => 0, |
|
| 337 | - 'index_autocomplete' => 0, |
|
| 338 | - ) |
|
| 15 | + 'type' => array ( |
|
| 16 | + 'format' => array (), |
|
| 17 | + 'default_value' => '', |
|
| 18 | + 'wrap' => '', |
|
| 19 | + 'index_tokenized' => 0, |
|
| 20 | + 'index_stored' => 1, |
|
| 21 | + 'index_indexed' => 0, |
|
| 22 | + 'index_boost' => 1.00, |
|
| 23 | + 'is_sortable' => 1, |
|
| 24 | + 'is_facet' => 1, |
|
| 25 | + 'is_listed' => 1, |
|
| 26 | + 'index_autocomplete' => 0, |
|
| 27 | + ), |
|
| 28 | + 'title' => array ( |
|
| 29 | + 'format' => array ( |
|
| 30 | + array ( |
|
| 31 | + 'encoded' => 1, |
|
| 32 | + 'xpath' => 'concat(./mods:titleInfo/mods:nonSort," ",./mods:titleInfo/mods:title)', |
|
| 33 | + 'xpath_sorting' => './mods:titleInfo/mods:title', |
|
| 34 | + ), |
|
| 35 | + array ( |
|
| 36 | + 'encoded' => 2, |
|
| 37 | + 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:note[@type="caption"]', |
|
| 38 | + 'xpath_sorting' => '', |
|
| 39 | + ), |
|
| 40 | + ), |
|
| 41 | + 'default_value' => '', |
|
| 42 | + 'wrap' => "key.wrap = <dt class=\"tx-dlf-metadata-title\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-title\">|</dd>", |
|
| 43 | + 'index_tokenized' => 1, |
|
| 44 | + 'index_stored' => 1, |
|
| 45 | + 'index_indexed' => 1, |
|
| 46 | + 'index_boost' => 2.00, |
|
| 47 | + 'is_sortable' => 1, |
|
| 48 | + 'is_facet' => 0, |
|
| 49 | + 'is_listed' => 1, |
|
| 50 | + 'index_autocomplete' => 1, |
|
| 51 | + ), |
|
| 52 | + 'volume' => array ( |
|
| 53 | + 'format' => array ( |
|
| 54 | + array ( |
|
| 55 | + 'encoded' => 1, |
|
| 56 | + 'xpath' => './mods:part/mods:detail/mods:number', |
|
| 57 | + 'xpath_sorting' => './mods:part[@type="host"]/@order', |
|
| 58 | + ), |
|
| 59 | + ), |
|
| 60 | + 'default_value' => '', |
|
| 61 | + 'wrap' => '', |
|
| 62 | + 'index_tokenized' => 0, |
|
| 63 | + 'index_stored' => 1, |
|
| 64 | + 'index_indexed' => 0, |
|
| 65 | + 'index_boost' => 1.00, |
|
| 66 | + 'is_sortable' => 1, |
|
| 67 | + 'is_facet' => 0, |
|
| 68 | + 'is_listed' => 1, |
|
| 69 | + 'index_autocomplete' => 0, |
|
| 70 | + ), |
|
| 71 | + 'author' => array ( |
|
| 72 | + 'format' => array ( |
|
| 73 | + array ( |
|
| 74 | + 'encoded' => 2, |
|
| 75 | + 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:name', |
|
| 76 | + 'xpath_sorting' => '', |
|
| 77 | + ), |
|
| 78 | + ), |
|
| 79 | + 'default_value' => '', |
|
| 80 | + 'wrap' => '', |
|
| 81 | + 'index_tokenized' => 1, |
|
| 82 | + 'index_stored' => 1, |
|
| 83 | + 'index_indexed' => 1, |
|
| 84 | + 'index_boost' => 2.00, |
|
| 85 | + 'is_sortable' => 1, |
|
| 86 | + 'is_facet' => 1, |
|
| 87 | + 'is_listed' => 1, |
|
| 88 | + 'index_autocomplete' => 1, |
|
| 89 | + ), |
|
| 90 | + 'place' => array ( |
|
| 91 | + 'format' => array ( |
|
| 92 | + array ( |
|
| 93 | + 'encoded' => 2, |
|
| 94 | + 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origPlace', |
|
| 95 | + 'xpath_sorting' => '', |
|
| 96 | + ), |
|
| 97 | + ), |
|
| 98 | + 'default_value' => '', |
|
| 99 | + 'wrap' => '', |
|
| 100 | + 'index_tokenized' => 1, |
|
| 101 | + 'index_stored' => 1, |
|
| 102 | + 'index_indexed' => 1, |
|
| 103 | + 'index_boost' => 1.00, |
|
| 104 | + 'is_sortable' => 1, |
|
| 105 | + 'is_facet' => 1, |
|
| 106 | + 'is_listed' => 1, |
|
| 107 | + 'index_autocomplete' => 0, |
|
| 108 | + ), |
|
| 109 | + 'year' => array ( |
|
| 110 | + 'format' => array ( |
|
| 111 | + array ( |
|
| 112 | + 'encoded' => 2, |
|
| 113 | + 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate', |
|
| 114 | + 'xpath_sorting' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate/@when', |
|
| 115 | + ), |
|
| 116 | + ), |
|
| 117 | + 'default_value' => '', |
|
| 118 | + 'wrap' => '', |
|
| 119 | + 'index_tokenized' => 0, |
|
| 120 | + 'index_stored' => 1, |
|
| 121 | + 'index_indexed' => 1, |
|
| 122 | + 'index_boost' => 1.00, |
|
| 123 | + 'is_sortable' => 1, |
|
| 124 | + 'is_facet' => 1, |
|
| 125 | + 'is_listed' => 1, |
|
| 126 | + 'index_autocomplete' => 0, |
|
| 127 | + ), |
|
| 128 | + 'language' => array ( |
|
| 129 | + 'format' => array ( |
|
| 130 | + array ( |
|
| 131 | + 'encoded' => 1, |
|
| 132 | + 'xpath' => './mods:language/mods:languageTerm', |
|
| 133 | + 'xpath_sorting' => '', |
|
| 134 | + ), |
|
| 135 | + ), |
|
| 136 | + 'default_value' => '', |
|
| 137 | + 'wrap' => '', |
|
| 138 | + 'index_tokenized' => 0, |
|
| 139 | + 'index_stored' => 0, |
|
| 140 | + 'index_indexed' => 1, |
|
| 141 | + 'index_boost' => 1.00, |
|
| 142 | + 'is_sortable' => 0, |
|
| 143 | + 'is_facet' => 1, |
|
| 144 | + 'is_listed' => 0, |
|
| 145 | + 'index_autocomplete' => 0, |
|
| 146 | + ), |
|
| 147 | + 'collection' => array ( |
|
| 148 | + 'format' => array ( |
|
| 149 | + array ( |
|
| 150 | + 'encoded' => 1, |
|
| 151 | + 'xpath' => './mods:classification', |
|
| 152 | + 'xpath_sorting' => '', |
|
| 153 | + ), |
|
| 154 | + array ( |
|
| 155 | + 'encoded' => 2, |
|
| 156 | + 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:msIdentifier/teihdr:collection', |
|
| 157 | + 'xpath_sorting' => '', |
|
| 158 | + ), |
|
| 159 | + ), |
|
| 160 | + 'default_value' => '', |
|
| 161 | + 'wrap' => '', |
|
| 162 | + 'index_tokenized' => 1, |
|
| 163 | + 'index_stored' => 0, |
|
| 164 | + 'index_indexed' => 1, |
|
| 165 | + 'index_boost' => 1.00, |
|
| 166 | + 'is_sortable' => 0, |
|
| 167 | + 'is_facet' => 1, |
|
| 168 | + 'is_listed' => 0, |
|
| 169 | + 'index_autocomplete' => 0, |
|
| 170 | + ), |
|
| 171 | + 'owner' => array ( |
|
| 172 | + 'format' => array ( |
|
| 173 | + array ( |
|
| 174 | + 'encoded' => 1, |
|
| 175 | + 'xpath' => './mods:name[./mods:role/mods:roleTerm="own"]/mods:displayForm', |
|
| 176 | + 'xpath_sorting' => '', |
|
| 177 | + ), |
|
| 178 | + array ( |
|
| 179 | + 'encoded' => 2, |
|
| 180 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:publisher', |
|
| 181 | + 'xpath_sorting' => '', |
|
| 182 | + ), |
|
| 183 | + ), |
|
| 184 | + 'default_value' => '', |
|
| 185 | + 'wrap' => '', |
|
| 186 | + 'index_tokenized' => 0, |
|
| 187 | + 'index_stored' => 0, |
|
| 188 | + 'index_indexed' => 1, |
|
| 189 | + 'index_boost' => 1.00, |
|
| 190 | + 'is_sortable' => 0, |
|
| 191 | + 'is_facet' => 1, |
|
| 192 | + 'is_listed' => 0, |
|
| 193 | + 'index_autocomplete' => 0, |
|
| 194 | + ), |
|
| 195 | + 'purl' => array ( |
|
| 196 | + 'format' => array ( |
|
| 197 | + array ( |
|
| 198 | + 'encoded' => 1, |
|
| 199 | + 'xpath' => './mods:identifier[@type="purl"]', |
|
| 200 | + 'xpath_sorting' => '', |
|
| 201 | + ), |
|
| 202 | + array ( |
|
| 203 | + 'encoded' => 2, |
|
| 204 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="purl"]', |
|
| 205 | + 'xpath_sorting' => '', |
|
| 206 | + ), |
|
| 207 | + ), |
|
| 208 | + 'default_value' => '', |
|
| 209 | + 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.wrap = <dd>|</dd>", |
|
| 210 | + 'index_tokenized' => 0, |
|
| 211 | + 'index_stored' => 0, |
|
| 212 | + 'index_indexed' => 0, |
|
| 213 | + 'index_boost' => 1.00, |
|
| 214 | + 'is_sortable' => 0, |
|
| 215 | + 'is_facet' => 0, |
|
| 216 | + 'is_listed' => 0, |
|
| 217 | + 'index_autocomplete' => 0, |
|
| 218 | + ), |
|
| 219 | + 'urn' => array ( |
|
| 220 | + 'format' => array ( |
|
| 221 | + array ( |
|
| 222 | + 'encoded' => 1, |
|
| 223 | + 'xpath' => './mods:identifier[@type="urn"]', |
|
| 224 | + 'xpath_sorting' => '', |
|
| 225 | + ), |
|
| 226 | + array ( |
|
| 227 | + 'encoded' => 2, |
|
| 228 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="urn"]', |
|
| 229 | + 'xpath_sorting' => '', |
|
| 230 | + ), |
|
| 231 | + ), |
|
| 232 | + 'default_value' => '', |
|
| 233 | + 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.typolink.parameter.prepend = TEXT\nvalue.typolink.parameter.prepend.value = http://nbn-resolving.de/\nvalue.wrap = <dd>|</dd>", |
|
| 234 | + 'index_tokenized' => 0, |
|
| 235 | + 'index_stored' => 0, |
|
| 236 | + 'index_indexed' => 1, |
|
| 237 | + 'index_boost' => 1.00, |
|
| 238 | + 'is_sortable' => 0, |
|
| 239 | + 'is_facet' => 0, |
|
| 240 | + 'is_listed' => 0, |
|
| 241 | + 'index_autocomplete' => 0, |
|
| 242 | + ), |
|
| 243 | + 'opac_id' => array ( |
|
| 244 | + 'format' => array ( |
|
| 245 | + array ( |
|
| 246 | + 'encoded' => 1, |
|
| 247 | + 'xpath' => './mods:identifier[@type="opac"]', |
|
| 248 | + 'xpath_sorting' => '', |
|
| 249 | + ), |
|
| 250 | + array ( |
|
| 251 | + 'encoded' => 2, |
|
| 252 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="opac"]', |
|
| 253 | + 'xpath_sorting' => '', |
|
| 254 | + ), |
|
| 255 | + ), |
|
| 256 | + 'default_value' => '', |
|
| 257 | + 'wrap' => '', |
|
| 258 | + 'index_tokenized' => 0, |
|
| 259 | + 'index_stored' => 0, |
|
| 260 | + 'index_indexed' => 1, |
|
| 261 | + 'index_boost' => 1.00, |
|
| 262 | + 'is_sortable' => 0, |
|
| 263 | + 'is_facet' => 0, |
|
| 264 | + 'is_listed' => 0, |
|
| 265 | + 'index_autocomplete' => 0, |
|
| 266 | + ), |
|
| 267 | + 'union_id' => array ( |
|
| 268 | + 'format' => array ( |
|
| 269 | + array ( |
|
| 270 | + 'encoded' => 1, |
|
| 271 | + 'xpath' => './mods:identifier[@type="ppn"]', |
|
| 272 | + 'xpath_sorting' => '', |
|
| 273 | + ), |
|
| 274 | + array ( |
|
| 275 | + 'encoded' => 2, |
|
| 276 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="mmid"]', |
|
| 277 | + 'xpath_sorting' => '', |
|
| 278 | + ), |
|
| 279 | + ), |
|
| 280 | + 'default_value' => '', |
|
| 281 | + 'wrap' => '', |
|
| 282 | + 'index_tokenized' => 0, |
|
| 283 | + 'index_stored' => 0, |
|
| 284 | + 'index_indexed' => 1, |
|
| 285 | + 'index_boost' => 1.00, |
|
| 286 | + 'is_sortable' => 0, |
|
| 287 | + 'is_facet' => 0, |
|
| 288 | + 'is_listed' => 0, |
|
| 289 | + 'index_autocomplete' => 0, |
|
| 290 | + ), |
|
| 291 | + 'record_id' => array ( |
|
| 292 | + 'format' => array ( |
|
| 293 | + array ( |
|
| 294 | + 'encoded' => 1, |
|
| 295 | + 'xpath' => './mods:recordInfo/mods:recordIdentifier', |
|
| 296 | + 'xpath_sorting' => '', |
|
| 297 | + ), |
|
| 298 | + array ( |
|
| 299 | + 'encoded' => 2, |
|
| 300 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="recordIdentifier"]', |
|
| 301 | + 'xpath_sorting' => '', |
|
| 302 | + ), |
|
| 303 | + ), |
|
| 304 | + 'default_value' => '', |
|
| 305 | + 'wrap' => '', |
|
| 306 | + 'index_tokenized' => 0, |
|
| 307 | + 'index_stored' => 0, |
|
| 308 | + 'index_indexed' => 1, |
|
| 309 | + 'index_boost' => 1.00, |
|
| 310 | + 'is_sortable' => 0, |
|
| 311 | + 'is_facet' => 0, |
|
| 312 | + 'is_listed' => 0, |
|
| 313 | + 'index_autocomplete' => 0, |
|
| 314 | + ), |
|
| 315 | + 'prod_id' => array ( |
|
| 316 | + 'format' => array ( |
|
| 317 | + array ( |
|
| 318 | + 'encoded' => 1, |
|
| 319 | + 'xpath' => './mods:identifier[@type="goobi"]', |
|
| 320 | + 'xpath_sorting' => '', |
|
| 321 | + ), |
|
| 322 | + array ( |
|
| 323 | + 'encoded' => 2, |
|
| 324 | + 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="goobi"]', |
|
| 325 | + 'xpath_sorting' => '', |
|
| 326 | + ), |
|
| 327 | + ), |
|
| 328 | + 'default_value' => '', |
|
| 329 | + 'wrap' => '', |
|
| 330 | + 'index_tokenized' => 0, |
|
| 331 | + 'index_stored' => 0, |
|
| 332 | + 'index_indexed' => 0, |
|
| 333 | + 'index_boost' => 0.00, |
|
| 334 | + 'is_sortable' => 0, |
|
| 335 | + 'is_facet' => 0, |
|
| 336 | + 'is_listed' => 0, |
|
| 337 | + 'index_autocomplete' => 0, |
|
| 338 | + ) |
|
| 339 | 339 | ); |
@@ -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 | } |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
| 956 | 956 | 'tx_dlf_documents.tstamp AS tstamp', |
| 957 | 957 | 'tx_dlf_documents', |
| 958 | - 'tx_dlf_documents.pid=' . intval($this->conf['pages']), |
|
| 958 | + 'tx_dlf_documents.pid='.intval($this->conf['pages']), |
|
| 959 | 959 | '', |
| 960 | 960 | 'tx_dlf_documents.tstamp ASC', |
| 961 | 961 | '1' |
@@ -970,8 +970,8 @@ discard block |
||
| 970 | 970 | |
| 971 | 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 | |
@@ -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 | } |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // Set default values if not set. |
| 53 | 53 | // $this->piVars['page'] may be integer or string (physical structure @ID) |
| 54 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 54 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 55 | 55 | |
| 56 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 56 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 57 | 57 | |
| 58 | 58 | } else { |
| 59 | 59 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) { |
| 121 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' . |
|
| 122 | - 'File not found in fileGrp "' . |
|
| 123 | - $this->conf['fileGrpDownload'] . '"', |
|
| 121 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] '. |
|
| 122 | + 'File not found in fileGrp "'. |
|
| 123 | + $this->conf['fileGrpDownload'].'"', |
|
| 124 | 124 | $this->extKey, |
| 125 | 125 | SYSLOG_SEVERITY_WARNING); |
| 126 | 126 | } |
@@ -129,18 +129,18 @@ discard block |
||
| 129 | 129 | if (!empty($page1Link)) { |
| 130 | 130 | if ($this->piVars['double']) { |
| 131 | 131 | $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''), |
| 132 | - array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); |
|
| 132 | + array ('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); |
|
| 133 | 133 | } else { |
| 134 | 134 | $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''), |
| 135 | - array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); |
|
| 135 | + array ('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | if (!empty($page2Link)) { |
| 139 | 139 | $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''), |
| 140 | - array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); |
|
| 140 | + array ('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return $page1Link . $page2Link; |
|
| 143 | + return $page1Link.$page2Link; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -20,182 +20,182 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class tx_dlf_toolsPdf extends tx_dlf_plugin { |
| 22 | 22 | |
| 23 | - public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php'; |
|
| 23 | + public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.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 string The content that is displayed on the website |
|
| 34 | - */ |
|
| 35 | - public function main($content, $conf) { |
|
| 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 string The content that is displayed on the website |
|
| 34 | + */ |
|
| 35 | + public function main($content, $conf) { |
|
| 36 | 36 | |
| 37 | - $this->init($conf); |
|
| 37 | + $this->init($conf); |
|
| 38 | 38 | |
| 39 | - // Merge configuration with conf array of toolbox. |
|
| 40 | - $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); |
|
| 39 | + // Merge configuration with conf array of toolbox. |
|
| 40 | + $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); |
|
| 41 | 41 | |
| 42 | - // Load current document. |
|
| 43 | - $this->loadDocument(); |
|
| 42 | + // Load current document. |
|
| 43 | + $this->loadDocument(); |
|
| 44 | 44 | |
| 45 | - if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) { |
|
| 45 | + if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) { |
|
| 46 | 46 | |
| 47 | - // Quit without doing anything if required variables are not set. |
|
| 48 | - return $content; |
|
| 47 | + // Quit without doing anything if required variables are not set. |
|
| 48 | + return $content; |
|
| 49 | 49 | |
| 50 | - } else { |
|
| 50 | + } else { |
|
| 51 | 51 | |
| 52 | - if (!empty($this->piVars['logicalPage'])) { |
|
| 52 | + if (!empty($this->piVars['logicalPage'])) { |
|
| 53 | 53 | |
| 54 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
| 55 | - // The logical page parameter should not appear again |
|
| 56 | - unset($this->piVars['logicalPage']); |
|
| 54 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
| 55 | + // The logical page parameter should not appear again |
|
| 56 | + unset($this->piVars['logicalPage']); |
|
| 57 | 57 | |
| 58 | - } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // Set default values if not set. |
|
| 61 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
| 62 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 60 | + // Set default values if not set. |
|
| 61 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
| 62 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 63 | 63 | |
| 64 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 64 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 65 | 65 | |
| 66 | - } else { |
|
| 66 | + } else { |
|
| 67 | 67 | |
| 68 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
| 68 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
| 69 | 69 | |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
| 72 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
| 73 | 73 | |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - // Load template file. |
|
| 77 | - if (!empty($this->conf['toolTemplateFile'])) { |
|
| 76 | + // Load template file. |
|
| 77 | + if (!empty($this->conf['toolTemplateFile'])) { |
|
| 78 | 78 | |
| 79 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
| 79 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
| 80 | 80 | |
| 81 | - } else { |
|
| 81 | + } else { |
|
| 82 | 82 | |
| 83 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###'); |
|
| 83 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###'); |
|
| 84 | 84 | |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - // Get single page downloads. |
|
| 88 | - $markerArray['###PAGE###'] = $this->getPageLink(); |
|
| 87 | + // Get single page downloads. |
|
| 88 | + $markerArray['###PAGE###'] = $this->getPageLink(); |
|
| 89 | 89 | |
| 90 | - // Get work download. |
|
| 91 | - $markerArray['###WORK###'] = $this->getWorkLink(); |
|
| 90 | + // Get work download. |
|
| 91 | + $markerArray['###WORK###'] = $this->getWorkLink(); |
|
| 92 | 92 | |
| 93 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 93 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 94 | 94 | |
| 95 | - return $this->pi_wrapInBaseClass($content); |
|
| 95 | + return $this->pi_wrapInBaseClass($content); |
|
| 96 | 96 | |
| 97 | - } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Get page's download link |
|
| 101 | - * |
|
| 102 | - * @access protected |
|
| 103 | - * |
|
| 104 | - * @return string Link to downloadable page |
|
| 105 | - */ |
|
| 106 | - protected function getPageLink() { |
|
| 99 | + /** |
|
| 100 | + * Get page's download link |
|
| 101 | + * |
|
| 102 | + * @access protected |
|
| 103 | + * |
|
| 104 | + * @return string Link to downloadable page |
|
| 105 | + */ |
|
| 106 | + protected function getPageLink() { |
|
| 107 | 107 | |
| 108 | - $page1Link = ''; |
|
| 109 | - $page2Link = ''; |
|
| 110 | - $pageNumber = $this->piVars['page']; |
|
| 108 | + $page1Link = ''; |
|
| 109 | + $page2Link = ''; |
|
| 110 | + $pageNumber = $this->piVars['page']; |
|
| 111 | 111 | |
| 112 | - // Get image link. |
|
| 113 | - $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]]; |
|
| 114 | - $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
| 115 | - if (!empty($file)) { |
|
| 116 | - $page1Link = $this->doc->getFileLocation($file); |
|
| 117 | - } |
|
| 112 | + // Get image link. |
|
| 113 | + $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]]; |
|
| 114 | + $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
| 115 | + if (!empty($file)) { |
|
| 116 | + $page1Link = $this->doc->getFileLocation($file); |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - // Get second page, too, if double page view is activated. |
|
| 120 | - if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) { |
|
| 121 | - $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]]; |
|
| 122 | - $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
| 123 | - if (!empty($file)) { |
|
| 124 | - $page2Link = $this->doc->getFileLocation($file); |
|
| 125 | - } |
|
| 126 | - } |
|
| 119 | + // Get second page, too, if double page view is activated. |
|
| 120 | + if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) { |
|
| 121 | + $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]]; |
|
| 122 | + $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
| 123 | + if (!empty($file)) { |
|
| 124 | + $page2Link = $this->doc->getFileLocation($file); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) { |
|
| 129 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' . |
|
| 130 | - 'File not found in fileGrp "' . |
|
| 131 | - $this->conf['fileGrpDownload'] . '"', |
|
| 132 | - $this->extKey, |
|
| 133 | - SYSLOG_SEVERITY_WARNING); |
|
| 134 | - } |
|
| 128 | + if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) { |
|
| 129 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' . |
|
| 130 | + 'File not found in fileGrp "' . |
|
| 131 | + $this->conf['fileGrpDownload'] . '"', |
|
| 132 | + $this->extKey, |
|
| 133 | + SYSLOG_SEVERITY_WARNING); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - // Wrap URLs with HTML. |
|
| 137 | - if (!empty($page1Link)) { |
|
| 138 | - if ($this->piVars['double']) { |
|
| 139 | - $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''), |
|
| 140 | - array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); |
|
| 141 | - } else { |
|
| 142 | - $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''), |
|
| 143 | - array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - if (!empty($page2Link)) { |
|
| 147 | - $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''), |
|
| 148 | - array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); |
|
| 149 | - } |
|
| 136 | + // Wrap URLs with HTML. |
|
| 137 | + if (!empty($page1Link)) { |
|
| 138 | + if ($this->piVars['double']) { |
|
| 139 | + $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''), |
|
| 140 | + array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); |
|
| 141 | + } else { |
|
| 142 | + $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''), |
|
| 143 | + array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + if (!empty($page2Link)) { |
|
| 147 | + $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''), |
|
| 148 | + array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - return $page1Link . $page2Link; |
|
| 152 | - } |
|
| 151 | + return $page1Link . $page2Link; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Get work's download link |
|
| 156 | - * |
|
| 157 | - * @access protected |
|
| 158 | - * |
|
| 159 | - * @return string Link to downloadable work |
|
| 160 | - */ |
|
| 161 | - protected function getWorkLink() { |
|
| 154 | + /** |
|
| 155 | + * Get work's download link |
|
| 156 | + * |
|
| 157 | + * @access protected |
|
| 158 | + * |
|
| 159 | + * @return string Link to downloadable work |
|
| 160 | + */ |
|
| 161 | + protected function getWorkLink() { |
|
| 162 | 162 | |
| 163 | - $workLink = ''; |
|
| 163 | + $workLink = ''; |
|
| 164 | 164 | |
| 165 | - // Get work link. |
|
| 166 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) { |
|
| 165 | + // Get work link. |
|
| 166 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) { |
|
| 167 | 167 | |
| 168 | - $workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]); |
|
| 168 | + $workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]); |
|
| 169 | 169 | |
| 170 | - } else { |
|
| 170 | + } else { |
|
| 171 | 171 | |
| 172 | - $details = $this->doc->getLogicalStructure($this->doc->toplevelId); |
|
| 172 | + $details = $this->doc->getLogicalStructure($this->doc->toplevelId); |
|
| 173 | 173 | |
| 174 | - if (!empty($details['files'][$this->conf['fileGrpDownload']])) { |
|
| 174 | + if (!empty($details['files'][$this->conf['fileGrpDownload']])) { |
|
| 175 | 175 | |
| 176 | - $workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]); |
|
| 176 | + $workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]); |
|
| 177 | 177 | |
| 178 | - } |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - // Wrap URLs with HTML. |
|
| 183 | - if (!empty($workLink)) { |
|
| 182 | + // Wrap URLs with HTML. |
|
| 183 | + if (!empty($workLink)) { |
|
| 184 | 184 | |
| 185 | - $workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', ''))); |
|
| 185 | + $workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', ''))); |
|
| 186 | 186 | |
| 187 | - } else { |
|
| 187 | + } else { |
|
| 188 | 188 | |
| 189 | - if (TYPO3_DLOG) { |
|
| 189 | + if (TYPO3_DLOG) { |
|
| 190 | 190 | |
| 191 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 191 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 192 | 192 | |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - } |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - return $workLink; |
|
| 197 | + return $workLink; |
|
| 198 | 198 | |
| 199 | - } |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | 201 | } |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | // Set default values if not set. |
| 52 | 52 | // $this->piVars['page'] may be integer or string (physical structure @ID) |
| 53 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 53 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 54 | 54 | |
| 55 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 55 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 56 | 56 | |
| 57 | 57 | } else { |
| 58 | 58 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Get left or single page download. |
| 79 | - $markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', '')); |
|
| 79 | + $markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', '')); |
|
| 80 | 80 | |
| 81 | 81 | // Get right page download. |
| 82 | 82 | $markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : ''; |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | $linkConf = array ( |
| 125 | 125 | 'parameter' => $image['url'], |
| 126 | - 'title' => $label . ' ' . $mimetypeLabel, |
|
| 126 | + 'title' => $label.' '.$mimetypeLabel, |
|
| 127 | 127 | 'additionalParams' => '', |
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | - $imageLink = $this->cObj->typoLink($label . ' ' . $mimetypeLabel, $linkConf); |
|
| 130 | + $imageLink = $this->cObj->typoLink($label.' '.$mimetypeLabel, $linkConf); |
|
| 131 | 131 | |
| 132 | 132 | break; |
| 133 | 133 | |
@@ -19,140 +19,140 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_toolsImagedownload extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php'; |
|
| 22 | + public $scriptRelPath = 'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.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 | - if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpsImageDownload'])) { |
|
| 44 | + if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpsImageDownload'])) { |
|
| 45 | 45 | |
| 46 | - // Quit without doing anything if required variables are not set. |
|
| 47 | - return $content; |
|
| 46 | + // Quit without doing anything if required variables are not set. |
|
| 47 | + return $content; |
|
| 48 | 48 | |
| 49 | - } else { |
|
| 49 | + } else { |
|
| 50 | 50 | |
| 51 | - if (!empty($this->piVars['logicalPage'])) { |
|
| 51 | + if (!empty($this->piVars['logicalPage'])) { |
|
| 52 | 52 | |
| 53 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
| 54 | - // The logical page parameter should not appear again |
|
| 55 | - unset($this->piVars['logicalPage']); |
|
| 53 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
| 54 | + // The logical page parameter should not appear again |
|
| 55 | + unset($this->piVars['logicalPage']); |
|
| 56 | 56 | |
| 57 | - } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - // Set default values if not set. |
|
| 60 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
| 61 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 59 | + // Set default values if not set. |
|
| 60 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
| 61 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 62 | 62 | |
| 63 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 63 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 64 | 64 | |
| 65 | - } else { |
|
| 65 | + } else { |
|
| 66 | 66 | |
| 67 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
| 67 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
| 71 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
| 72 | 72 | |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - // Load template file. |
|
| 76 | - if (!empty($this->conf['toolTemplateFile'])) { |
|
| 75 | + // Load template file. |
|
| 76 | + if (!empty($this->conf['toolTemplateFile'])) { |
|
| 77 | 77 | |
| 78 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
| 78 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
| 79 | 79 | |
| 80 | - } else { |
|
| 80 | + } else { |
|
| 81 | 81 | |
| 82 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagedownload/template.tmpl'), '###TEMPLATE###'); |
|
| 82 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagedownload/template.tmpl'), '###TEMPLATE###'); |
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - // Get left or single page download. |
|
| 87 | - $markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', '')); |
|
| 86 | + // Get left or single page download. |
|
| 87 | + $markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', '')); |
|
| 88 | 88 | |
| 89 | - // Get right page download. |
|
| 90 | - $markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : ''; |
|
| 89 | + // Get right page download. |
|
| 90 | + $markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : ''; |
|
| 91 | 91 | |
| 92 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 92 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
| 93 | 93 | |
| 94 | - return $this->pi_wrapInBaseClass($content); |
|
| 94 | + return $this->pi_wrapInBaseClass($content); |
|
| 95 | 95 | |
| 96 | - } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Get image's URL and MIME type |
|
| 101 | - * |
|
| 102 | - * @access protected |
|
| 103 | - * |
|
| 104 | - * @param integer $page: Page number |
|
| 105 | - * @param string $label: Link title and label |
|
| 106 | - * |
|
| 107 | - * @return string linkt to image file with given label |
|
| 108 | - */ |
|
| 109 | - protected function getImage($page, $label) { |
|
| 99 | + /** |
|
| 100 | + * Get image's URL and MIME type |
|
| 101 | + * |
|
| 102 | + * @access protected |
|
| 103 | + * |
|
| 104 | + * @param integer $page: Page number |
|
| 105 | + * @param string $label: Link title and label |
|
| 106 | + * |
|
| 107 | + * @return string linkt to image file with given label |
|
| 108 | + */ |
|
| 109 | + protected function getImage($page, $label) { |
|
| 110 | 110 | |
| 111 | - $image = array (); |
|
| 111 | + $image = array (); |
|
| 112 | 112 | |
| 113 | - // Get @USE value of METS fileGrp. |
|
| 114 | - $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpsImageDownload']); |
|
| 113 | + // Get @USE value of METS fileGrp. |
|
| 114 | + $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpsImageDownload']); |
|
| 115 | 115 | |
| 116 | - while ($fileGrp = @array_pop($fileGrps)) { |
|
| 116 | + while ($fileGrp = @array_pop($fileGrps)) { |
|
| 117 | 117 | |
| 118 | - // Get image link. |
|
| 119 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { |
|
| 118 | + // Get image link. |
|
| 119 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { |
|
| 120 | 120 | |
| 121 | - $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
| 121 | + $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
| 122 | 122 | |
| 123 | - $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
| 123 | + $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
| 124 | 124 | |
| 125 | - switch ($image['mimetype']) { |
|
| 126 | - case 'image/jpeg': $mimetypeLabel = '(JPG)'; |
|
| 127 | - break; |
|
| 128 | - case 'image/tiff': $mimetypeLabel = '(TIFF)'; |
|
| 129 | - break; |
|
| 130 | - default: $mimetypeLabel = ''; |
|
| 131 | - } |
|
| 132 | - $linkConf = array ( |
|
| 133 | - 'parameter' => $image['url'], |
|
| 134 | - 'title' => $label . ' ' . $mimetypeLabel, |
|
| 135 | - 'additionalParams' => '', |
|
| 136 | - ); |
|
| 125 | + switch ($image['mimetype']) { |
|
| 126 | + case 'image/jpeg': $mimetypeLabel = '(JPG)'; |
|
| 127 | + break; |
|
| 128 | + case 'image/tiff': $mimetypeLabel = '(TIFF)'; |
|
| 129 | + break; |
|
| 130 | + default: $mimetypeLabel = ''; |
|
| 131 | + } |
|
| 132 | + $linkConf = array ( |
|
| 133 | + 'parameter' => $image['url'], |
|
| 134 | + 'title' => $label . ' ' . $mimetypeLabel, |
|
| 135 | + 'additionalParams' => '', |
|
| 136 | + ); |
|
| 137 | 137 | |
| 138 | - $imageLink = $this->cObj->typoLink($label . ' ' . $mimetypeLabel, $linkConf); |
|
| 138 | + $imageLink = $this->cObj->typoLink($label . ' ' . $mimetypeLabel, $linkConf); |
|
| 139 | 139 | |
| 140 | - break; |
|
| 140 | + break; |
|
| 141 | 141 | |
| 142 | - } else { |
|
| 142 | + } else { |
|
| 143 | 143 | |
| 144 | - if (TYPO3_DLOG) { |
|
| 144 | + if (TYPO3_DLOG) { |
|
| 145 | 145 | |
| 146 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsImagedownload->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 146 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsImagedownload->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - } |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - return $imageLink; |
|
| 154 | + return $imageLink; |
|
| 155 | 155 | |
| 156 | - } |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | } |
@@ -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 | } |