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
c5890d03
Commit
c5890d03
authored
Jun 11, 2019
by
Dominik Hebeler
Browse files
implemented stronger caching for possible spam
parent
ddb68893
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/MetaGerSearch.php
View file @
c5890d03
...
...
@@ -16,6 +16,11 @@ class MetaGerSearch extends Controller
{
public
function
search
(
Request
$request
,
MetaGer
$metager
)
{
$spamEntries
=
[];
if
(
file_exists
(
config_path
(
'spam.txt'
)))
{
$spamEntries
=
file
(
config_path
(
'spam.txt'
));
}
$focus
=
$request
->
input
(
"focus"
,
"web"
);
if
(
$focus
===
"maps"
)
{
...
...
@@ -35,6 +40,10 @@ class MetaGerSearch extends Controller
# Nach Spezialsuchen überprüfen:
$metager
->
checkSpecialSearches
(
$request
);
if
(
Cache
::
has
(
'spam.'
.
$metager
->
getFokus
()
.
"."
.
md5
(
$metager
->
getQ
())))
{
return
response
(
Cache
::
get
(
'spam.'
.
$metager
->
getFokus
()
.
"."
.
md5
(
$metager
->
getQ
())));
}
# Die Quicktips als Job erstellen
$quicktips
=
$metager
->
createQuicktips
();
...
...
@@ -66,7 +75,14 @@ class MetaGerSearch extends Controller
$pipeline
->
execute
();
# Die Ausgabe erstellen:
return
$metager
->
createView
(
$quicktipResults
);
$resultpage
=
$metager
->
createView
(
$quicktipResults
);
foreach
(
$spamEntries
as
$index
=>
$entry
)
{
$entry
=
trim
(
$entry
);
if
(
preg_match
(
"/"
.
$entry
.
"/si"
,
$metager
->
getEingabe
()))
{
Cache
::
put
(
'spam.'
.
$metager
->
getFokus
()
.
"."
.
md5
(
$metager
->
getQ
()),
$resultpage
->
render
(),
1440
);
}
}
return
$resultpage
;
}
public
function
loadMore
(
Request
$request
)
...
...
config/spam.txt
0 → 100644
View file @
c5890d03
^[\d]{3}chan
"155chan"
^hebe chan$
^jailbait chan$
^http[s]{0,1}:\/\/[\d]{3}chan\..{2}
^susimail\s+-site:[^\s]+\s-site:
\ No newline at end of file
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