|
1
|
|
|
<?php |
|
2
|
|
|
namespace Kitodo\Dlf\Plugin\Eid; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
|
8
|
|
|
* |
|
9
|
|
|
* @license GNU General Public License version 3 or later. |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
use Kitodo\Dlf\Common\Helper; |
|
15
|
|
|
use Kitodo\Dlf\Common\Solr; |
|
16
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* eID search in document for plugin 'Search' of the 'dlf' extension |
|
20
|
|
|
* |
|
21
|
|
|
* @author Alexander Bigga <[email protected]> |
|
22
|
|
|
* @package TYPO3 |
|
23
|
|
|
* @subpackage dlf |
|
24
|
|
|
* @access public |
|
25
|
|
|
*/ |
|
26
|
|
|
class SearchInDocument extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
|
27
|
|
|
public $scriptRelPath = 'Classes/Plugin/Eid/SearchInDocument.php'; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* The main method of the eID script |
|
31
|
|
|
* |
|
32
|
|
|
* @access public |
|
33
|
|
|
* |
|
34
|
|
|
* @param string $content: The PlugIn content |
|
35
|
|
|
* @param array $conf: The PlugIn configuration |
|
36
|
|
|
* |
|
37
|
|
|
* @return string JSON response of search suggestions |
|
38
|
|
|
*/ |
|
39
|
|
|
public function main($content = '', $conf = []) { |
|
|
|
|
|
|
40
|
|
|
if (GeneralUtility::_GP('encrypted') != '' |
|
41
|
|
|
&& GeneralUtility::_GP('hashed') != '') { |
|
42
|
|
|
$core = Helper::decrypt(GeneralUtility::_GP('encrypted'), GeneralUtility::_GP('hashed')); |
|
43
|
|
|
} |
|
44
|
|
|
if (!empty($core)) { |
|
45
|
|
|
$url = trim(Solr::getSolrUrl($core), '/').'/select?wt=json&q=fulltext:('.Solr::escapeQuery(GeneralUtility::_GP('q')).')%20AND%20uid:'.GeneralUtility::_GP('uid') |
|
46
|
|
|
.'&hl=on&hl.fl=fulltext&fl=uid,id,page&hl.method=fastVector' |
|
47
|
|
|
.'&start='.GeneralUtility::_GP('start').'&rows=20'; |
|
48
|
|
|
$output = GeneralUtility::getUrl($url); |
|
49
|
|
|
} |
|
50
|
|
|
echo $output; |
|
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.