Commit 4b9c0f16 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

browserverification working

parent 577c81a5
......@@ -17,7 +17,7 @@ class BrowserVerification
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next, $isAsso = false)
public function handle($request, Closure $next, $route = "resultpage")
{
$bvEnabled = config("metager.metager.browserverification_enabled");
......@@ -43,10 +43,8 @@ class BrowserVerification
header('X-Accel-Buffering: no');
//use parameter for middleware to skip this when using associator
if(!$isAsso){
if (($request->filled("loadMore") && Cache::has($request->input("loadMore"))) || app('App\Models\Key')->getStatus()) {
return $next($request);
}
if (($request->filled("loadMore") && Cache::has($request->input("loadMore"))) || app('App\Models\Key')->getStatus()) {
return $next($request);
}
ini_set('zlib.output_compression', 'Off');
......@@ -86,7 +84,7 @@ class BrowserVerification
$params = $request->all();
$params["mgv"] = $key;
$url = route("resultpage", $params);
$url = route($route, $params);
echo(view('layouts.resultpage.unverifiedResultPage')
->with('url', $url)
......
@extends('layouts.subPages')
@section('title', $title )
@section('title', $title)
@section('content')
<h1 class="page-title">{{ trans('asso.head.1') }}</h1>
<div class="card-heavy">
<p>{{ trans('asso.1.1') }} <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), '/datenschutz') }}" target="_blank">{{ trans('asso.1.2') }}</a>{{ trans('asso.1.3') }}.</p>
<h1 class="page-title">{{ trans('asso.head.1') }}</h1>
<div class="card-heavy">
<p>{{ trans('asso.1.1') }} <a
href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), '/datenschutz') }}"
target="_blank">{{ trans('asso.1.2') }}</a>{{ trans('asso.1.3') }}.</p>
<form method="post" class="form-inline">
<input type="text" class="form-control search-input-mini" placeholder="{{ trans('asso.search.placeholder') }}" @if(isset($keywords)) value="{{$keywords}}" @endif name="q" required autofocus/><button type="submit" class="search-btn-mini"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
</div>
@if(isset($words))
<div class="card-heavy">
<div class="table-responsive">
<table class="table">
<caption>Assoziationen für "{{ $keywords }}"</caption>
<thead>
<tr>
<th>#</th>
<th>Assoziation</th>
<th>Relevanz</th>
</tr>
</thead>
<tbody>
@php $i = 1; @endphp
@foreach($words as $key => $value)
<tr>
<td>{{ $i }}</td>
<td class="association">
<a class="asso-search-link" href="{{ action('MetaGerSearch@search', ['eingabe' => $key]) }}" title="{{ trans('asso.searchasso.title') }}"><i class="fa fa-search" aria-hidden="true"></i></a>
<form method="POST">
<button name="q" value="{{ $key }}" class="reasso" type="submit" title="{{ trans('asso.reasso.title') }}">{{ $key }}</button>
</form>
</td>
<td>{{ round(($value / $wordCount) * 100, 2) }}%</td>
@php $i++; @endphp
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<form method="get" class="form-inline"
action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('assoresults')) }}">
<input type="text" class="form-control search-input-mini" placeholder="{{ trans('asso.search.placeholder') }}"
@if (isset($keywords)) value="{{ $keywords }}" @endif name="q" required autofocus /><button type="submit" class="search-btn-mini"><i
class="fa fa-search" aria-hidden="true"></i></button>
</form>
</div>
@if (isset($words))
<div class="card-heavy">
<div class="table-responsive">
<table class="table">
<caption>Assoziationen für "{{ $keywords }}"</caption>
<thead>
<tr>
<th>#</th>
<th>Assoziation</th>
<th>Relevanz</th>
</tr>
</thead>
<tbody>
@php $i = 1; @endphp
@foreach ($words as $key => $value)
<tr>
<td>{{ $i }}</td>
<td class="association">
<a class="asso-search-link"
href="{{ action('MetaGerSearch@search', ['eingabe' => $key]) }}"
title="{{ trans('asso.searchasso.title') }}"><i class="fa fa-search"
aria-hidden="true"></i></a>
<form method="POST">
<button name="q" value="{{ $key }}" class="reasso" type="submit"
title="{{ trans('asso.reasso.title') }}">{{ $key }}</button>
</form>
</td>
<td>{{ round(($value / $wordCount) * 100, 2) }}%</td>
@php $i++; @endphp
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
@endsection
......@@ -42,7 +42,7 @@ Route::group(
->with('css', [mix('css/asso/style.css')])
->with('darkcss', [mix('css/asso/dark.css')]);
});
Route::post('asso', 'Assoziator@asso')->middleware('browserverification:true', 'humanverification:true');
Route::get('asso/meta.ger3', 'Assoziator@asso')->middleware('browserverification:assoresults', 'humanverification:true')->name("assoresults");
Route::get('impressum', function () {
return view('impressum')
......
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