Commit 79e7d7f8 authored by Dominik Hebeler's avatar Dominik Hebeler

Removed settings from the plugin

parent 21bd43fe
......@@ -88,52 +88,15 @@ class StartpageController extends Controller
return loadPage($subpage);
}
public function loadPlugin($params, $locale = "de")
public function loadPlugin($locale = "de")
{
$params = unserialize(base64_decode($params));
$requests = $params;
$params = [];
foreach ($requests as $key => $value) {
if (strpos($key, "param_") === 0) {
$key = substr($key, strpos($key, "param_") + 6);
}
$params[$key] = $value;
}
if (!isset($params['focus'])) {
$params['focus'] = 'web';
}
if (!isset($params['encoding'])) {
$params['encoding'] = 'utf8';
}
if (!isset($params['lang'])) {
$params['lang'] = 'all';
}
if (isset($params['request']) && ($params['request'] === "GET" || $params['request'] === "POST")) {
$request = $params['request'];
} else {
$request = "GET";
}
array_forget($params, 'eingabe');
array_forget($params, 'out');
array_forget($params, 'page');
array_forget($params, 'request');
array_forget($params, 'focus');
array_forget($params, 'encoding');
array_forget($params, 'lang');
$link = action('MetaGerSearch@search', []);
$response = Response::make(
view('plugin')
->with('link', $link)
->with('params', $params)
->with('hostname', gethostname())
->with('request', $request), "200");
, "200");
$response->header('Content-Type', "application/opensearchdescription+xml");
return $response;
}
......
......@@ -12,7 +12,7 @@
<meta name="mm" content="{{ $metager->getVerificationId() }}" />
<meta name="mn" content="{{ $metager->getVerificationCount() }}" />
<meta name="searchkey" content="{{ $metager->getSearchUid() }}" />
<link rel="search" type="application/opensearchdescription+xml" title="{!! trans('resultPage.opensearch') !!}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin', ['params' => base64_encode(serialize(Request::all()))])) }}">
<link rel="search" type="application/opensearchdescription+xml" title="{!! trans('resultPage.opensearch') !!}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin')) }}">
<link href="/fonts/liberationsans/stylesheet.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ mix('css/fontawesome-solid.css') }}" />
......
......@@ -12,7 +12,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="{{ trans('staticPages.opensearch') }}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin', ['params' => base64_encode(serialize(Request::all()))])) }}">
<link rel="search" type="application/opensearchdescription+xml" title="{{ trans('staticPages.opensearch') }}" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('StartpageController@loadPlugin')) }}">
<link type="text/css" rel="stylesheet" href="{{ mix('css/bootstrap.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ mix('css/themes/metager.css') }}" />
<link type="text/css" rel="stylesheet" href="{{ mix('css/utility.css') }}" />
......
......@@ -4,17 +4,6 @@
<Description>{{ trans('plugin.description') }}</Description>
<Contact>office@suma-ev.de</Contact>
<Image width="16" height="16" type="image/x-icon">{{ url('/favicon.ico') }}</Image>
@if ($request == "POST")
<Url type="text/html" template="{{ $link }}" method="{{$request}}">
<Param name="eingabe" value="{searchTerms}" />
@foreach($params as $key => $value)
<Param name="{{$key}}" value="{{$value}}" />
@endforeach
</Url>
@else
<Url type="text/html" template="{{ $link }}?eingabe={searchTerms}@foreach($params as $key => $value)&amp;{{$key}}={{$value}}@endforeach" method="{{$request}}" />
@endif
<Url type="text/html" template="{{ $link }}?eingabe={searchTerms}" method="GET" />
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>
......@@ -189,7 +189,7 @@ Route::group(
Route::get('qt', 'MetaGerSearch@quicktips');
Route::get('tips', 'MetaGerSearch@tips');
Route::get('/plugins/{params}/opensearch.xml', 'StartpageController@loadPlugin');
Route::get('/plugins/opensearch.xml', 'StartpageController@loadPlugin');
Route::get('owi', function () {
return redirect('https://metager.de/klassik/en/owi/');
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment