diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php index 0725cc28990486194103244cfa25c3eb43da83e0..1aef59d0b2d73c935892120752d711171fc1b4b8 100644 --- a/app/Http/Controllers/StartpageController.php +++ b/app/Http/Controllers/StartpageController.php @@ -2,12 +2,11 @@ namespace App\Http\Controllers; -use Jenssegers\Agent\Agent; - +use App; use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use Jenssegers\Agent\Agent; use Response; -use App; class StartpageController extends Controller { @@ -19,24 +18,22 @@ class StartpageController extends Controller */ /* public function loadStartPage($locale = "de") { - \App::setLocale($locale); - return view('index', [ - 'title' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen', - 'homeIcon']); + \App::setLocale($locale); + return view('index', [ + 'title' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen', + 'homeIcon']); } */ - public function loadStartPage(Request $request) + public function loadStartPage(Request $request) { $focusPages = []; - foreach($request->all() as $key => $value) - { - if($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') - { - $focusPages[] = str_replace('param_', '', $key); + foreach ($request->all() as $key => $value) { + if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') { + $focusPages[] = str_replace('param_', '', $key); } } - $agent = new Agent(); + $agent = new Agent(); $browser = $agent->browser(); return view('index') @@ -58,15 +55,15 @@ class StartpageController extends Controller { /* TODO CSS und Titel laden $css = array( - 'datenschutz' => 'privacy.css', + 'datenschutz' => 'privacy.css', ); if (in_array($subpage, $css)) { - return view($subpage, [ 'title' => 'Datenschutz Richtlinien', 'css' => $css[$subpage]]); + return view($subpage, [ 'title' => 'Datenschutz Richtlinien', 'css' => $css[$subpage]]); } else { - return view($subpage, [ 'title' => 'Datenschutz Richtlinien']); - }*/ return view($subpage, [ 'title' => 'Datenschutz Richtlinien']); + }*/ + return view($subpage, ['title' => 'Datenschutz Richtlinien']); } public function loadLocalPage($locale = "de", $subpage = "datenschutz") @@ -77,66 +74,74 @@ class StartpageController extends Controller public function loadPlugin($params, $locale = "de") { - $params = unserialize(base64_decode($params)); + $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 = []; + foreach ($requests as $key => $value) { + if (strpos($key, "param_") === 0) { + $key = substr($key, strpos($key, "param_") + 6); } $params[$key] = $value; } - if(!isset($params['focus'])) + if (!isset($params['focus'])) { $params['focus'] = 'web'; - if(!isset($params['encoding'])) + } + + if (!isset($params['encoding'])) { $params['encoding'] = 'utf8'; - if(!isset($params['lang'])) + } + + 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'); $link = action('MetaGerSearch@search', $params); $response = Response::make( - view('plugin')->with('link', $link), "200"); + view('plugin') + ->with('link', $link) + ->with('request', $request), "200"); $response->header('Content-Type', "application/xml"); return $response; - return $link; } - public function loadSettings (Request $request) + public function loadSettings(Request $request) { $sumaFile = ""; - if(App::isLocale('en')) + if (App::isLocale('en')) { $sumaFile = config_path() . "/sumas.xml"; - else + } else { $sumaFile = config_path() . "/sumas.xml"; + } - $xml = simplexml_load_file($sumaFile); + $xml = simplexml_load_file($sumaFile); $sumas = $xml->xpath("suma"); $foki = []; - foreach($sumas as $suma) - { - if( (!isset($suma['disabled']) || $suma['disabled'] === "") && ( !isset($suma['userSelectable']) || $suma['userSelectable']->__toString() === "1") ) - { - if( isset($suma['type']) ) - { + foreach ($sumas as $suma) { + if ((!isset($suma['disabled']) || $suma['disabled'] === "") && (!isset($suma['userSelectable']) || $suma['userSelectable']->__toString() === "1")) { + if (isset($suma['type'])) { $f = explode(",", $suma['type']->__toString()); - foreach($f as $tmp) - { - $displayName = $suma['displayName']->__toString(); - $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; - $foki[$tmp][$suma['name']->__toString()] = [ 'displayName' => $displayName, 'url' => $url]; + foreach ($f as $tmp) { + $displayName = $suma['displayName']->__toString(); + $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; + $foki[$tmp][$suma['name']->__toString()] = ['displayName' => $displayName, 'url' => $url]; } - }else - { - $displayName = $suma['displayName']->__toString(); - $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; - $foki["andere"][$suma['name']->__toString()] = [ 'displayName' => $displayName, 'url' => $url]; + } else { + $displayName = $suma['displayName']->__toString(); + $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; + $foki["andere"][$suma['name']->__toString()] = ['displayName' => $displayName, 'url' => $url]; } } } @@ -151,4 +156,4 @@ class StartpageController extends Controller return $xml->saveXML(); } -} \ No newline at end of file +} diff --git a/app/Http/routes.php b/app/Http/routes.php index 9c3cc316c264d4e0a03a5e8466039d0d136dc88e..04074ed736c0486d83457bce14b3e25e2f61bf00 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -147,7 +147,7 @@ Route::group( Route::get('settings', 'StartpageController@loadSettings'); - Route::get('meta/meta.ger3', 'MetaGerSearch@search'); + Route::match(['get', 'post'], 'meta/meta.ger3', 'MetaGerSearch@search'); Route::get('meta/picture', 'Pictureproxy@get'); Route::get('clickstats', 'LogController@clicklog'); Route::get('pluginClose', 'LogController@pluginClose'); diff --git a/app/Models/parserSkripte/Fernsehsuche.php b/app/Models/parserSkripte/Fernsehsuche.php index f33ff8f3e6f719f8990987f9185e33aa67d7fb56..817c64452a1936e3017563c79bca6ac5e7a123ff 100644 --- a/app/Models/parserSkripte/Fernsehsuche.php +++ b/app/Models/parserSkripte/Fernsehsuche.php @@ -28,23 +28,27 @@ class Fernsehsuche extends Searchengine $results = $content->response->docs; foreach ($results as $result) { - $title = $result->show . " : " . $result->title; - $link = urldecode($result->url); - $anzeigeLink = $link; - $descr = $result->description; - $image = "http://api-resources.fernsehsuche.de" . $result->thumbnail; - $this->counter++; - $this->results[] = new \App\Models\Result( - $this->engine, - $title, - $link, - $anzeigeLink, - $descr, - $this->gefVon, - $this->counter, - false, - $image - ); + try { + $title = $result->show . " : " . $result->title; + $link = urldecode($result->url); + $anzeigeLink = $link; + $descr = $result->description; + $image = "http://api-resources.fernsehsuche.de" . $result->thumbnail; + $this->counter++; + $this->results[] = new \App\Models\Result( + $this->engine, + $title, + $link, + $anzeigeLink, + $descr, + $this->gefVon, + $this->counter, + false, + $image + ); + } catch (\ErrorException $e) { + + } } } } diff --git a/resources/lang/de/settings.php b/resources/lang/de/settings.php index e809540e585157f7b2ddeaaff9e361362c3d197d..ea0ad63ed64463b25508b7afd537688705c7414f 100644 --- a/resources/lang/de/settings.php +++ b/resources/lang/de/settings.php @@ -29,4 +29,6 @@ return [ 'speichern.2' => 'Einstellungen dauerhaft speichern', 'speichern.3' => 'Plugin mit diesen Einstellungen generieren', 'speichern.4' => 'Einstellungen zurücksetzen', + + 'request' => 'Mit welcher Methode soll MetaGer abgefragt werden', ]; diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index dc71495bae2949e1089a7b2aeb36aaa18d1cf4e6..91046290d7d32502554b41f3a3bacfb3e3f9e5a2 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -160,7 +160,7 @@ </label> </fieldset> <fieldset> - <form id="searchForm" method="GET" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3") }}" accept-charset="UTF-8"> + <form id="searchForm" @if(Request::has('request') && Request::input('request') === "POST") method="POST" @elseif(Request::has('request') && Request::input('request') === "GET") method="GET" @else method="GET" @endif action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3") }}" accept-charset="UTF-8"> <div class="input-group"> <div class="input-group-addon"> <button type="button" data-toggle="popover" data-html="true" data-container="body" title="{{ trans('index.design') }}" data-content='<ul id="color-chooser" class="list-inline list-unstyled"> diff --git a/resources/views/layouts/researchandtabs.blade.php b/resources/views/layouts/researchandtabs.blade.php index 6b274cb4db76fca51cabc141e7a9219b09c4daa6..e321f55e4bd77084fd0e7caa5541c4f8c6b45727 100644 --- a/resources/views/layouts/researchandtabs.blade.php +++ b/resources/views/layouts/researchandtabs.blade.php @@ -11,7 +11,7 @@ </div> </li> <li class="pull-right"> - <form method="get" accept-charset="UTF-8" class="form" id="submitForm"> + <form method="{{ Request::method() }}" accept-charset="UTF-8" class="form" id="submitForm"> <div class="input-group"> <input autocomplete="off" class="form-control" form="submitForm" id="eingabeTop" name="eingabe" placeholder="Suchbegriffe erweitern/verändern, oder völlig neue Suche:" tabindex="1" type="text" value="{{ $eingabe }}" required /> <div class="input-group-addon"> diff --git a/resources/views/plugin.blade.php b/resources/views/plugin.blade.php index f4095e76d31713daed9c0a7d43d21f736692afc3..2f6c07d7fde99d5e0d0a5672db2b1c07aeb73b4a 100644 --- a/resources/views/plugin.blade.php +++ b/resources/views/plugin.blade.php @@ -1,9 +1,9 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xmlversion = "1.0"encoding = "UTF-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <ShortName>MetaGer</ShortName> <Description>MetaGer: Sicher suchen & finden, Privatsphäre schützen</Description> <Contact>office@suma-ev.de</Contact> <Image width="16" height="16" type="image/x-icon">{{ url('/favicon.ico') }}</Image> - <Url type="text/html" template="{{ $link }}&eingabe={searchTerms}" method="get"></Url> + <Url type="text/html" template="{{ $link }}&eingabe={searchTerms}" method="{{$request}}"></Url> <InputEncoding>UTF-8</InputEncoding> -</OpenSearchDescription> \ No newline at end of file +</OpenSearchDescription> diff --git a/resources/views/settings.blade.php b/resources/views/settings.blade.php index 9bfba205d5a5d382e13e9c3a47af5e9e43f25f1e..492de42a3e6ed84b6533cdb67b8881d4733eecde 100644 --- a/resources/views/settings.blade.php +++ b/resources/views/settings.blade.php @@ -33,6 +33,11 @@ <option value="5000">{!! trans('settings.zeit.4') !!}</option> <option value="10000">{!! trans('settings.zeit.5') !!}</option> <option value="20000">{!! trans('settings.zeit.6') !!}</option></select> + <label class="select-label">{{ trans('settings.request') }}:</label> + <select class="form-control" name="request"> + <option value="GET" selected>GET</option> + <option value="POST">POST</option> + </select> <h2>{!! trans('settings.suchmaschinen.1') !!} <small><a class="allUnchecker">{!! trans('settings.suchmaschinen.2') !!}</a></small></h2> @foreach( $foki as $fokus => $sumas ) <div class="headingGroup {{ $fokus }}">