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
3cab8029
Commit
3cab8029
authored
Apr 27, 2018
by
Karl Hasselbring
Browse files
Es gab ein problem mit nicht ersetzten leerzeichen
parent
a7aa037d
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/MetaGerSearch.php
View file @
3cab8029
...
@@ -5,7 +5,6 @@ namespace App\Http\Controllers;
...
@@ -5,7 +5,6 @@ namespace App\Http\Controllers;
use
App
;
use
App
;
use
App\MetaGer
;
use
App\MetaGer
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
LaravelLocalization
;
class
MetaGerSearch
extends
Controller
class
MetaGerSearch
extends
Controller
{
{
...
@@ -13,15 +12,15 @@ class MetaGerSearch extends Controller
...
@@ -13,15 +12,15 @@ class MetaGerSearch extends Controller
{
{
$focus
=
$request
->
input
(
"focus"
,
"web"
);
$focus
=
$request
->
input
(
"focus"
,
"web"
);
if
(
$focus
===
"maps"
)
{
if
(
$focus
===
"maps"
)
{
$searchinput
=
$request
->
input
(
'eingabe'
,
''
);
$searchinput
=
$request
->
input
(
'eingabe'
,
''
);
return
redirect
()
->
to
(
'https://maps.metager.de/map/'
.
$searchinput
.
'/1240908.5493525574,6638783.2192695495,6'
);
return
redirect
()
->
to
(
'https://maps.metager.de/map/'
.
$searchinput
.
'/1240908.5493525574,6638783.2192695495,6'
);
}
}
/*if ($focus !== "angepasst" && $this->startsWith($focus, "focus_")) {
/*if ($focus !== "angepasst" && $this->startsWith($focus, "focus_")) {
$metager->parseFormData($request);
$metager->parseFormData($request);
return $metager->createView();
return $metager->createView();
}*/
}*/
#die($request->header('User-Agent'));
#die($request->header('User-Agent'));
...
@@ -35,7 +34,7 @@ class MetaGerSearch extends Controller
...
@@ -35,7 +34,7 @@ class MetaGerSearch extends Controller
# Die Quicktips als Job erstellen
# Die Quicktips als Job erstellen
$quicktips
=
$metager
->
createQuicktips
();
$quicktips
=
$metager
->
createQuicktips
();
# Suche für alle zu verwendenden Suchmaschinen als Job erstellen,
# Suche für alle zu verwendenden Suchmaschinen als Job erstellen,
# auf Ergebnisse warten und die Ergebnisse laden
# auf Ergebnisse warten und die Ergebnisse laden
$metager
->
createSearchEngines
(
$request
);
$metager
->
createSearchEngines
(
$request
);
...
@@ -62,7 +61,7 @@ class MetaGerSearch extends Controller
...
@@ -62,7 +61,7 @@ class MetaGerSearch extends Controller
public
function
get
(
$url
)
public
function
get
(
$url
)
{
{
$ctx
=
stream_context_create
(
array
(
'http'
=>
array
(
'timeout'
=>
2
,
)));
$ctx
=
stream_context_create
(
array
(
'http'
=>
array
(
'timeout'
=>
2
)));
return
file_get_contents
(
$url
,
false
,
$ctx
);
return
file_get_contents
(
$url
,
false
,
$ctx
);
}
}
...
...
app/Models/Quicktips/Quicktips.php
View file @
3cab8029
...
@@ -13,6 +13,7 @@ class Quicktips
...
@@ -13,6 +13,7 @@ class Quicktips
use
DispatchesJobs
;
use
DispatchesJobs
;
const
QUICKTIP_URL
=
"https://quicktips.metager3.de/quicktips.xml"
;
const
QUICKTIP_URL
=
"https://quicktips.metager3.de/quicktips.xml"
;
//const QUICKTIP_URL = "http://localhost:63825/quicktips.xml";
const
QUICKTIP_NAME
=
"quicktips"
;
const
QUICKTIP_NAME
=
"quicktips"
;
const
CACHE_DURATION
=
60
;
const
CACHE_DURATION
=
60
;
...
@@ -25,7 +26,7 @@ class Quicktips
...
@@ -25,7 +26,7 @@ class Quicktips
public
function
startSearch
(
$search
,
$locale
,
$max_time
)
public
function
startSearch
(
$search
,
$locale
,
$max_time
)
{
{
$url
=
self
::
QUICKTIP_URL
.
"?search="
.
$
search
.
"&locale="
.
$locale
;
$url
=
self
::
QUICKTIP_URL
.
"?search="
.
$
this
->
normalize_search
(
$search
)
.
"&locale="
.
$locale
;
$hash
=
md5
(
$url
);
$hash
=
md5
(
$url
);
...
@@ -82,6 +83,7 @@ class Quicktips
...
@@ -82,6 +83,7 @@ class Quicktips
Redis
::
hdel
(
'search.'
.
$hash
,
self
::
QUICKTIP_NAME
);
Redis
::
hdel
(
'search.'
.
$hash
,
self
::
QUICKTIP_NAME
);
Cache
::
put
(
$hash
,
$body
,
self
::
CACHE_DURATION
);
Cache
::
put
(
$hash
,
$body
,
self
::
CACHE_DURATION
);
#}
#}
if
(
$body
!==
""
)
{
if
(
$body
!==
""
)
{
return
$body
;
return
$body
;
}
else
{
}
else
{
...
@@ -168,4 +170,10 @@ class Quicktips
...
@@ -168,4 +170,10 @@ class Quicktips
return
[];
return
[];
}
}
}
}
public
function
normalize_search
(
$search
)
{
$search
=
str_replace
(
' '
,
'+'
,
$search
);
return
$search
;
}
}
}
Write
Preview
Markdown
is supported
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