Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
0d110f95
Commit
0d110f95
authored
7 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Plain Diff
Merge branch '504-mobile-styles-optimieren-inkl-quicktips' into 'development'
MetaGer-Key eingebaut Closes
#504
See merge request
!920
parents
0c1c99d8
98942b95
No related branches found
Branches containing commit
No related tags found
2 merge requests
!924
Development
,
!920
MetaGer-Key eingebaut
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/MetaGer.php
+37
-0
37 additions, 0 deletions
app/MetaGer.php
resources/views/metager3resultsrss20.blade.php
+2
-0
2 additions, 0 deletions
resources/views/metager3resultsrss20.blade.php
resources/views/metager3rich.blade.php
+1
-1
1 addition, 1 deletion
resources/views/metager3rich.blade.php
with
40 additions
and
1 deletion
app/MetaGer.php
+
37
−
0
View file @
0d110f95
...
...
@@ -40,6 +40,8 @@ class MetaGer
protected
$ip
;
protected
$language
;
protected
$agent
;
protected
$apiKey
=
""
;
protected
$apiAuthorized
=
false
;
# Konfigurationseinstellungen:
protected
$sumaFile
;
protected
$mobile
;
...
...
@@ -148,6 +150,7 @@ class MetaGer
->
with
(
'mobile'
,
$this
->
mobile
)
->
with
(
'warnings'
,
$this
->
warnings
)
->
with
(
'errors'
,
$this
->
errors
)
->
with
(
'apiAuthorized'
,
$this
->
apiAuthorized
)
->
with
(
'metager'
,
$this
)
->
with
(
'browser'
,
(
new
Agent
())
->
browser
());
break
;
...
...
@@ -155,6 +158,7 @@ class MetaGer
return
view
(
'metager3resultsrss20'
)
->
with
(
'results'
,
$viewResults
)
->
with
(
'eingabe'
,
$this
->
eingabe
)
->
with
(
'apiAuthorized'
,
$this
->
apiAuthorized
)
->
with
(
'metager'
,
$this
)
->
with
(
'resultcount'
,
sizeof
(
$viewResults
));
break
;
...
...
@@ -190,6 +194,9 @@ class MetaGer
// filter
// augment (boost&adgoal)
// authorize
if
(
$this
->
apiKey
)
{
$this
->
apiAuthorized
=
$this
->
authorize
(
$this
->
apiKey
);
}
// misc (WiP)
if
(
$this
->
fokus
==
"nachrichten"
)
{
$this
->
results
=
array_filter
(
$this
->
results
,
function
(
$v
,
$k
)
{
...
...
@@ -451,6 +458,34 @@ class MetaGer
return
$results
;
}
public
function
authorize
(
$key
)
{
$postdata
=
http_build_query
(
array
(
'dummy'
=>
rand
(),
));
$opts
=
array
(
'http'
=>
array
(
'method'
=>
'POST'
,
'header'
=>
'Content-type: application/x-www-form-urlencoded'
,
'content'
=>
$postdata
,
),
);
$context
=
stream_context_create
(
$opts
);
try
{
$link
=
"https://key.metager3.de/"
.
urlencode
(
$key
)
.
"/request-permission/api-access"
;
$result
=
json_decode
(
file_get_contents
(
$link
,
false
,
$context
));
if
(
$result
->
{
'api-access'
}
==
true
)
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
\ErrorException
$e
)
{
return
false
;
}
}
/*
* Die Erstellung der Suchmaschinen bis die Ergebnisse da sind mit Unterfunktionen
*/
...
...
@@ -983,6 +1018,8 @@ class MetaGer
}
else
{
$this
->
quicktips
=
true
;
}
$this
->
apiKey
=
$request
->
input
(
'key'
,
''
);
$this
->
validated
=
false
;
if
(
isset
(
$this
->
password
))
{
...
...
This diff is collapsed.
Click to expand it.
resources/views/metager3resultsrss20.blade.php
+
2
−
0
View file @
0d110f95
...
...
@@ -8,6 +8,7 @@
<opensearch:totalResults>
{{ $resultcount }}
</opensearch:totalResults>
<opensearch:Query
role=
"request"
searchTerms=
"{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"
/>
@if($apiAuthorized)
@foreach($metager->getResults() as $result)
<item>
<title>
{!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!}
</title>
...
...
@@ -18,5 +19,6 @@
</description>
</item>
@endforeach
@endif
</channel>
</rss>
This diff is collapsed.
Click to expand it.
resources/views/metager3rich.blade.php
+
1
−
1
View file @
0d110f95
...
...
@@ -33,7 +33,7 @@
</details>
<main
class=
"results-container"
>
@foreach($metager->getResults() as $result)
@if($result->number % 7 === 0)
@if($result->number % 7 === 0
&&
!$apiAuthorized
)
@include('layouts.rich.ad', ['result' => $metager->popAd()])
@endif
@include('layouts.rich.result', ['result' => $result])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment