Commit 990ddfd7 authored by Dominik Hebeler's avatar Dominik Hebeler

disabled quotes for every language that is not german

parent 9110940d
......@@ -289,11 +289,12 @@ class MetaGerSearch extends Controller
public function quicktips(Request $request)
{
$search = $request->input('search', '');
$quotes = $request->input('quotes', 'on');
if(empty($search)){
abort(404);
}
$quicktips = new \App\Models\Quicktips\Quicktips($search);
$quicktips = new \App\Models\Quicktips\Quicktips($search, $quotes);
return view('quicktips')
->with('quicktips', $quicktips->getResults())
->with('search', $search);
......
......@@ -244,7 +244,7 @@ class MetaGer
->with('apiAuthorized', $this->apiAuthorized)
->with('metager', $this)
->with('browser', (new Agent())->browser())
->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe]))
->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe, "quotes" => $this->sprueche]))
->with('resultcount', count($this->results))
->with('focus', $this->fokus);
break;
......@@ -951,11 +951,13 @@ class MetaGer
$this->agent = new Agent();
$this->mobile = $this->agent->isMobile();
# Sprüche
$this->sprueche = $request->input('sprueche', 'on');
if ($this->sprueche === "on") {
$this->sprueche = true;
} else {
$this->sprueche = false;
if (!App::isLocale("de") || (\Cookie::has('quotes') && \Cookie::get('quotes') === "off")) {
$this->sprueche = "off";
}else{
$this->sprueche = "on";
}
if($request->filled("quotes") && $request->input('quotes') === "on" || $request->input('quotes') === "off"){
$this->sprueche = $request->input('quotes');
}
$this->newtab = $request->input('newtab', 'on');
......@@ -982,9 +984,7 @@ class MetaGer
}
$request->replace($newInput);
}
if (App::isLocale("en")) {
$this->sprueche = "off";
}
if ($this->resultCount <= 0 || $this->resultCount > 200) {
$this->resultCount = 1000;
}
......
......@@ -16,7 +16,7 @@ class Quicktips
private $hash;
public function __construct($search/*, $locale, $max_time*/)
public function __construct($search, $quotes)
{
$locale = LaravelLocalization::getCurrentLocale();
if (env("APP_ENV") === "production") {
......@@ -24,12 +24,12 @@ class Quicktips
} else {
$this->quicktipUrl = "https://dev.quicktips.metager.de" . $this->quicktipUrl;
}
$this->startSearch($search, $locale);
$this->startSearch($search, $quotes, $locale);
}
public function startSearch($search, $locale)
public function startSearch($search, $quotes, $locale)
{
$url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale;
$url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale . "&quotes=" . $quotes;
$this->hash = md5($url);
if (!Cache::has($this->hash)) {
......
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