5
xml - URL providing actual search
6
xslt - XSLT to process results (optional)
7
noprops - Do not pass current props to the proxying URL
8
nolimits - Do not pass limits to the proxying URL
9
searchprop - Search property (search by default)
13
class PROXYSearch extends SEARCHEngine {
14
function __construct(REQUEST $req = NULL, $opts = false) {
15
parent::__construct($req, $opts);
17
$this->modules = array("proxy");
20
function Search($search_string, $module, SEARCHFilter $filter = NULL, $opts = false) {
23
$xml = $this->GetOption("xml", $opts);
24
$xslt = $this->GetOption("xslt", $opts, "null");
25
$noprops = $this->GetOption("noprops", $opts);
26
$nolimits = $this->GetOption("nolimits", $opts);
27
$searchprop = $this->GetOption("searchprop", $opts, false);
30
if (preg_match("/^(services\/)?([\w\d_]+\.php)(\?(.*))?$/", $xml, $m)) {
31
$adei_url = $ADEI->GetBaseURL();
32
$xml_url = "{$adei_url}services/" . $m[2];
35
if (($opts)&&($opts['xml'])) {
36
throw new ADEIException(translate("Proxy-search is allowed to ADEI-services only"));
38
list($xml_url, $xml_props) = preg_split("/\?/", $xml, 2);
42
throw new ADEIException(translate("The proxy URL is required by search module"));
49
$props = $this->req->GetProps();
50
unset($props['search']);
51
unset($props['search_modules']);
54
if (($filter)&&(!$nolimits)) {
55
$ivl_filter = $filter->GetLimit('interval');
56
if ($ivl_filter) $props['window'] = $ivl_filter;
59
if ($searchprop === false) {
60
$props['search'] = $search_string;
62
if ($searchprop) $props[$searchprop] = $search_string;
66
$req = new REQUEST($props);
67
$xml_props = $req->GetQueryString($xml_props);
68
$xml = $xml_url . "?" . $xml_props;
70
if ($xml_props) $xml = $xml_url . "?" . $xml_props;
74
$html = $ADEI->TransformXML($xslt, $xml);
76
$result = new SEARCHResults(NULL, $this, $module, "");
77
$result->Append(preg_replace("/^\s*<\?xml.*$/m", "", $html));
b'\\ No newline at end of file'