Skip to content
Snippets Groups Projects
Commit a41a272b authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Option eingebaut mit der MetaGer über eine POST Request abgefragt werden kann.

parent 9242a629
No related branches found
No related tags found
2 merge requests!404Development,!394Resolve "Wir benötigen ein Tool mit dem das Übersetzen unsere Seiten stark vereinfacht wird."
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Jenssegers\Agent\Agent; use App;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
use Response; use Response;
use App;
class StartpageController extends Controller class StartpageController extends Controller
{ {
...@@ -19,24 +18,22 @@ class StartpageController extends Controller ...@@ -19,24 +18,22 @@ class StartpageController extends Controller
*/ */
/* public function loadStartPage($locale = "de") /* public function loadStartPage($locale = "de")
{ {
\App::setLocale($locale); \App::setLocale($locale);
return view('index', [ return view('index', [
'title' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen', 'title' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen',
'homeIcon']); 'homeIcon']);
} */ } */
public function loadStartPage(Request $request) public function loadStartPage(Request $request)
{ {
$focusPages = []; $focusPages = [];
foreach($request->all() as $key => $value) foreach ($request->all() as $key => $value) {
{ if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') {
if($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab') $focusPages[] = str_replace('param_', '', $key);
{
$focusPages[] = str_replace('param_', '', $key);
} }
} }
$agent = new Agent(); $agent = new Agent();
$browser = $agent->browser(); $browser = $agent->browser();
return view('index') return view('index')
...@@ -58,15 +55,15 @@ class StartpageController extends Controller ...@@ -58,15 +55,15 @@ class StartpageController extends Controller
{ {
/* TODO CSS und Titel laden /* TODO CSS und Titel laden
$css = array( $css = array(
'datenschutz' => 'privacy.css', 'datenschutz' => 'privacy.css',
); );
if (in_array($subpage, $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 { } else {
return view($subpage, [ 'title' => 'Datenschutz Richtlinien']);
}*/
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") public function loadLocalPage($locale = "de", $subpage = "datenschutz")
...@@ -77,66 +74,74 @@ class StartpageController extends Controller ...@@ -77,66 +74,74 @@ class StartpageController extends Controller
public function loadPlugin($params, $locale = "de") public function loadPlugin($params, $locale = "de")
{ {
$params = unserialize(base64_decode($params)); $params = unserialize(base64_decode($params));
$requests = $params; $requests = $params;
$params = []; $params = [];
foreach($requests as $key => $value) foreach ($requests as $key => $value) {
{ if (strpos($key, "param_") === 0) {
if( strpos($key, "param_") === 0 ) $key = substr($key, strpos($key, "param_") + 6);
{
$key = substr($key, strpos($key, "param_") + 6 );
} }
$params[$key] = $value; $params[$key] = $value;
} }
if(!isset($params['focus'])) if (!isset($params['focus'])) {
$params['focus'] = 'web'; $params['focus'] = 'web';
if(!isset($params['encoding'])) }
if (!isset($params['encoding'])) {
$params['encoding'] = 'utf8'; $params['encoding'] = 'utf8';
if(!isset($params['lang'])) }
if (!isset($params['lang'])) {
$params['lang'] = 'all'; $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, 'eingabe');
array_forget($params, 'out'); array_forget($params, 'out');
array_forget($params, 'page'); array_forget($params, 'page');
array_forget($params, 'request');
$link = action('MetaGerSearch@search', $params); $link = action('MetaGerSearch@search', $params);
$response = Response::make( $response = Response::make(
view('plugin')->with('link', $link), "200"); view('plugin')
->with('link', $link)
->with('request', $request), "200");
$response->header('Content-Type', "application/xml"); $response->header('Content-Type', "application/xml");
return $response; return $response;
return $link;
} }
public function loadSettings (Request $request) public function loadSettings(Request $request)
{ {
$sumaFile = ""; $sumaFile = "";
if(App::isLocale('en')) if (App::isLocale('en')) {
$sumaFile = config_path() . "/sumas.xml"; $sumaFile = config_path() . "/sumas.xml";
else } else {
$sumaFile = config_path() . "/sumas.xml"; $sumaFile = config_path() . "/sumas.xml";
}
$xml = simplexml_load_file($sumaFile); $xml = simplexml_load_file($sumaFile);
$sumas = $xml->xpath("suma"); $sumas = $xml->xpath("suma");
$foki = []; $foki = [];
foreach($sumas as $suma) foreach ($sumas as $suma) {
{ if ((!isset($suma['disabled']) || $suma['disabled'] === "") && (!isset($suma['userSelectable']) || $suma['userSelectable']->__toString() === "1")) {
if( (!isset($suma['disabled']) || $suma['disabled'] === "") && ( !isset($suma['userSelectable']) || $suma['userSelectable']->__toString() === "1") ) if (isset($suma['type'])) {
{
if( isset($suma['type']) )
{
$f = explode(",", $suma['type']->__toString()); $f = explode(",", $suma['type']->__toString());
foreach($f as $tmp) foreach ($f as $tmp) {
{ $displayName = $suma['displayName']->__toString();
$displayName = $suma['displayName']->__toString(); $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de";
$url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; $foki[$tmp][$suma['name']->__toString()] = ['displayName' => $displayName, 'url' => $url];
$foki[$tmp][$suma['name']->__toString()] = [ 'displayName' => $displayName, 'url' => $url];
} }
}else } else {
{ $displayName = $suma['displayName']->__toString();
$displayName = $suma['displayName']->__toString(); $url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de";
$url = isset($suma['homepage']) ? $suma['homepage']->__toString() : "https://metager.de"; $foki["andere"][$suma['name']->__toString()] = ['displayName' => $displayName, 'url' => $url];
$foki["andere"][$suma['name']->__toString()] = [ 'displayName' => $displayName, 'url' => $url];
} }
} }
} }
...@@ -151,4 +156,4 @@ class StartpageController extends Controller ...@@ -151,4 +156,4 @@ class StartpageController extends Controller
return $xml->saveXML(); return $xml->saveXML();
} }
} }
\ No newline at end of file
...@@ -147,7 +147,7 @@ Route::group( ...@@ -147,7 +147,7 @@ Route::group(
Route::get('settings', 'StartpageController@loadSettings'); 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('meta/picture', 'Pictureproxy@get');
Route::get('clickstats', 'LogController@clicklog'); Route::get('clickstats', 'LogController@clicklog');
Route::get('pluginClose', 'LogController@pluginClose'); Route::get('pluginClose', 'LogController@pluginClose');
......
...@@ -29,4 +29,6 @@ return [ ...@@ -29,4 +29,6 @@ return [
'speichern.2' => 'Einstellungen dauerhaft speichern', 'speichern.2' => 'Einstellungen dauerhaft speichern',
'speichern.3' => 'Plugin mit diesen Einstellungen generieren', 'speichern.3' => 'Plugin mit diesen Einstellungen generieren',
'speichern.4' => 'Einstellungen zurücksetzen', 'speichern.4' => 'Einstellungen zurücksetzen',
'request' => 'Mit welcher Methode soll MetaGer abgefragt werden',
]; ];
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
</label> </label>
</fieldset> </fieldset>
<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">
<div class="input-group-addon"> <div class="input-group-addon">
<button type="button" data-toggle="popover" data-html="true" data-container="body" title="{{ trans('index.design') }}" data-content='&lt;ul id="color-chooser" class="list-inline list-unstyled"&gt; <button type="button" data-toggle="popover" data-html="true" data-container="body" title="{{ trans('index.design') }}" data-content='&lt;ul id="color-chooser" class="list-inline list-unstyled"&gt;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</div> </div>
</li> </li>
<li class="pull-right"> <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"> <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 /> <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"> <div class="input-group-addon">
......
<?xml version="1.0" encoding="UTF-8"?> <?xmlversion = "1.0"encoding = "UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>MetaGer</ShortName> <ShortName>MetaGer</ShortName>
<Description>MetaGer: Sicher suchen &amp; finden, Privatsphäre schützen</Description> <Description>MetaGer: Sicher suchen &amp; finden, Privatsphäre schützen</Description>
<Contact>office@suma-ev.de</Contact> <Contact>office@suma-ev.de</Contact>
<Image width="16" height="16" type="image/x-icon">{{ url('/favicon.ico') }}</Image> <Image width="16" height="16" type="image/x-icon">{{ url('/favicon.ico') }}</Image>
<Url type="text/html" template="{{ $link }}&amp;eingabe={searchTerms}" method="get"></Url> <Url type="text/html" template="{{ $link }}&amp;eingabe={searchTerms}" method="{{$request}}"></Url>
<InputEncoding>UTF-8</InputEncoding> <InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription> </OpenSearchDescription>
\ No newline at end of file
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
<option value="5000">{!! trans('settings.zeit.4') !!}</option> <option value="5000">{!! trans('settings.zeit.4') !!}</option>
<option value="10000">{!! trans('settings.zeit.5') !!}</option> <option value="10000">{!! trans('settings.zeit.5') !!}</option>
<option value="20000">{!! trans('settings.zeit.6') !!}</option></select> <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> <h2>{!! trans('settings.suchmaschinen.1') !!} <small><a class="allUnchecker">{!! trans('settings.suchmaschinen.2') !!}</a></small></h2>
@foreach( $foki as $fokus => $sumas ) @foreach( $foki as $fokus => $sumas )
<div class="headingGroup {{ $fokus }}"> <div class="headingGroup {{ $fokus }}">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment