Skip to content
Snippets Groups Projects
Commit e7db24c3 authored by Davide Aprea's avatar Davide Aprea
Browse files

fixed api and atom10 format

parent 336ad12f
No related branches found
No related tags found
3 merge requests!1895Development,!1747Development,!1731Resolve "removing integration of obsolete resultpage formats"
...@@ -18,6 +18,14 @@ class BrowserVerification ...@@ -18,6 +18,14 @@ class BrowserVerification
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if(($request->input("out", "") === "api" || $request->input("out", "") === "atom10") && app('App\Models\Key')->getStatus()) {
header('Content-type: application/xml; charset=utf-8');
} else {
header('Content-type: text/html; charset=utf-8');
}
header('X-Accel-Buffering: no');
if (($request->filled("loadMore") && Cache::has($request->input("loadMore"))) || app('App\Models\Key')->getStatus()) { if (($request->filled("loadMore") && Cache::has($request->input("loadMore"))) || app('App\Models\Key')->getStatus()) {
return $next($request); return $next($request);
} }
...@@ -55,9 +63,6 @@ class BrowserVerification ...@@ -55,9 +63,6 @@ class BrowserVerification
} }
} }
header('Content-type: text/html; charset=utf-8');
header('X-Accel-Buffering: no');
$key = md5($request->ip() . microtime(true)); $key = md5($request->ip() . microtime(true));
echo(view('layouts.resultpage.verificationHeader')->with('key', $key)->render()); echo(view('layouts.resultpage.verificationHeader')->with('key', $key)->render());
......
...@@ -206,14 +206,13 @@ class MetaGer ...@@ -206,14 +206,13 @@ class MetaGer
->with('browser', (new Agent())->browser()) ->with('browser', (new Agent())->browser())
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
/* WIP
case 'api': case 'api':
return response()->view('resultpages.metager3resultsatom10', ['results' => $viewResults, 'eingabe' => $this->eingabe, 'metager' => $this, 'resultcount' => sizeof($viewResults), 'key' => $this->apiKey, 'apiAuthorized' => $this->apiAuthorized])->header('Content-Type', 'application/xml'); return view('resultpages.metager3resultsatom10',['eingabe' => $this->eingabe, 'resultcount' => sizeof($viewResults), 'key' => $this->apiKey, 'metager' => $this]);
break; break;
case 'atom10': case 'atom10':
return response()->view('resultpages.metager3resultsatom10', ['results' => $viewResults, 'eingabe' => $this->eingabe, 'metager' => $this, 'resultcount' => sizeof($viewResults), 'key' => $this->apiKey, 'apiAuthorized' => true]) return view('resultpages.metager3resultsatom10',['eingabe' => $this->eingabe, 'resultcount' => sizeof($viewResults), 'key' => $this->apiKey, 'metager' => $this]);
->header('Content-Type', 'application/xml'); break;
break;*/
case 'result-count': case 'result-count':
# Wir geben die Ergebniszahl und die benötigte Zeit zurück: # Wir geben die Ergebniszahl und die benötigte Zeit zurück:
return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2); return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2);
...@@ -1204,7 +1203,7 @@ class MetaGer ...@@ -1204,7 +1203,7 @@ class MetaGer
$this->out = $request->input('out', "html"); $this->out = $request->input('out', "html");
# Standard output format html # Standard output format html
if ($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style" && $this->out !== "result-count" /*WIP && $this->out !== "atom10" && $this->out !== "api"*/) { if ($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style" && $this->out !== "result-count" && $this->out !== "atom10" && $this->out !== "api") {
$this->out = "html"; $this->out = "html";
} }
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll # Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg="http://metager.de/opensearch/" xmlns:mg="http://metager.de/opensearch/"
xmlns:ad="http://a9.com/-/opensearch/extensions/advertisement/1.0/"> xmlns:ad="http://a9.com/-/opensearch/extensions/advertisement/1.0/">
<title>{!! htmlspecialchars($eingabe, ENT_XML1, 'UTF-8'); !!} - MetaGer</title> <title>{{ htmlspecialchars($eingabe, ENT_XML1, 'UTF-8') }} - MetaGer</title>
<link href="{{ url()->full() }}"/> <link href="{{ url()->full() }}"/>
<updated>{{ date('c') }}</updated> <updated>{{ date('c') }}</updated>
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults> <opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<link rel="next" href="{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}" type="application/atom+xml"/> <link rel="next" href="{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}" type="application/atom+xml"/>
<id>urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240</id> <id>urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()]) @include('layouts.atom10ad', ['ad' => $metager->popAd()])
@if($apiAuthorized) @if(app('App\Models\Key')->getStatus())
@foreach($metager->getResults() as $index => $result) @foreach($metager->getResults() as $index => $result)
@if(($index+1) % 5 === 0) @if(($index+1) % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()]) @include('layouts.atom10ad', ['ad' => $metager->popAd()])
......
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