Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
e7db24c3
Commit
e7db24c3
authored
Nov 05, 2020
by
Davide Aprea
Browse files
fixed api and atom10 format
parent
336ad12f
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Middleware/BrowserVerification.php
View file @
e7db24c3
...
...
@@ -18,6 +18,14 @@ class BrowserVerification
*/
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
())
{
return
$next
(
$request
);
}
...
...
@@ -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
));
echo
(
view
(
'layouts.resultpage.verificationHeader'
)
->
with
(
'key'
,
$key
)
->
render
());
...
...
app/MetaGer.php
View file @
e7db24c3
...
...
@@ -206,14 +206,13 @@ class MetaGer
->
with
(
'browser'
,
(
new
Agent
())
->
browser
())
->
with
(
'fokus'
,
$this
->
fokus
);
break
;
/* WIP
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
;
case
'atom10'
:
return response()->view('resultpages.metager3resultsatom10', ['results' => $viewResults, 'eingabe' => $this->eingabe, 'metager' => $this, 'resultcount' => sizeof($viewResults), 'key' => $this->apiKey, 'apiAuthorized' => true])
->header('Content-Type', 'application/xml');
break;*/
return
view
(
'resultpages.metager3resultsatom10'
,[
'eingabe'
=>
$this
->
eingabe
,
'resultcount'
=>
sizeof
(
$viewResults
),
'key'
=>
$this
->
apiKey
,
'metager'
=>
$this
]);
break
;
case
'result-count'
:
# Wir geben die Ergebniszahl und die benötigte Zeit zurück:
return
sizeof
(
$viewResults
)
.
";"
.
round
((
microtime
(
true
)
-
$this
->
starttime
),
2
);
...
...
@@ -1204,7 +1203,7 @@ class MetaGer
$this
->
out
=
$request
->
input
(
'out'
,
"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"
;
}
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
...
...
resources/views/resultpages/metager3resultsatom10.blade.php
View file @
e7db24c3
...
...
@@ -3,7 +3,7 @@
xmlns:opensearch=
"http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg=
"http://metager.de/opensearch/"
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() }}"
/>
<updated>
{{ date('c') }}
</updated>
<opensearch:totalResults>
{{ $resultcount }}
</opensearch:totalResults>
...
...
@@ -11,7 +11,7 @@
<link
rel=
"next"
href=
"{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}"
type=
"application/atom+xml"
/>
<id>
urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240
</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@if(
$
ap
iAuthorized
)
@if(ap
p('App\Models\Key')->getStatus()
)
@foreach($metager->getResults() as $index => $result)
@if(($index+1) % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment