Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
b1a09786
Commit
b1a09786
authored
Apr 12, 2019
by
Dominik Hebeler
Browse files
settings can now be deleted one by one or all at once
parent
15697a02
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/SettingsController.php
View file @
b1a09786
...
...
@@ -218,4 +218,26 @@ class SettingsController extends Controller
->
with
(
'url'
,
$request
->
input
(
'url'
,
''
))
->
with
(
'sumaFile'
,
$sumaFile
);
}
public
function
removeOneSetting
(
Request
$request
)
{
$key
=
$request
->
input
(
'key'
,
''
);
$path
=
\
Request
::
path
();
$cookiePath
=
"/"
.
substr
(
$path
,
0
,
strpos
(
$path
,
"meta/"
)
+
5
);
Cookie
::
queue
(
$key
,
""
,
0
,
$cookiePath
,
null
,
false
,
false
);
return
redirect
(
$request
->
input
(
'url'
,
'https://metager.de'
));
}
public
function
removeAllSettings
(
Request
$request
)
{
$path
=
\
Request
::
path
();
$cookiePath
=
"/"
.
substr
(
$path
,
0
,
strpos
(
$path
,
"meta/"
)
+
5
);
foreach
(
Cookie
::
get
()
as
$key
=>
$value
)
{
Cookie
::
queue
(
$key
,
""
,
0
,
$cookiePath
,
null
,
false
,
false
);
}
return
redirect
(
$request
->
input
(
'url'
,
'https://metager.de'
));
}
}
app/MetaGer.php
View file @
b1a09786
...
...
@@ -524,6 +524,7 @@ class MetaGer
}
}
# Implements Yahoo Ads if Yahoo is not enabled as a searchengine
if
(
!
$this
->
apiAuthorized
&&
empty
(
$this
->
enabledSearchengines
[
"yahoo"
])
&&
$this
->
fokus
!=
"bilder"
&&
!
empty
(
$this
->
sumaFile
->
sumas
->
{
"yahoo-ads"
}))
{
$this
->
enabledSearchengines
[
"yahoo-ads"
]
=
$this
->
sumaFile
->
sumas
->
{
"yahoo-ads"
};
...
...
resources/views/settings/allSettings.blade.php
View file @
b1a09786
...
...
@@ -34,12 +34,39 @@
Ihr
Schlüssel
für
die
werbefreie
Suche
@
endif
</
td
>
<
td
></
td
>
<
td
>
<
form
action
=
"{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('removeOneSetting')) }}"
method
=
"post"
>
<
input
type
=
"hidden"
name
=
"key"
value
=
"{{
$key
}}"
>
<
input
type
=
"hidden"
name
=
"url"
value
=
"{{ url()->full() }}"
>
<
button
type
=
"submit"
title
=
"Diesen Cookie entfernen"
>
<
i
class
=
"fas fa-trash-alt"
></
i
>
</
button
>
</
form
>
</
td
>
</
tr
>
@
endforeach
</
tbody
>
</
table
>
<
div
id
=
"actions"
>
<
a
href
=
"{{
$url
}}"
class
=
"btn btn-sm btn-default"
>
Zurück
zur
letzten
Seite
</
a
>
<
form
action
=
"{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('removeAllSettings'))}}"
method
=
"post"
>
<
input
type
=
"hidden"
name
=
"url"
value
=
"{{ url()->full() }}"
>
<
button
type
=
"submit"
class
=
"btn btn-sm btn-danger"
>
Alle
Einstellungen
entfernen
</
button
>
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
<
style
>
#actions {
display
:
flex
;
margin
-
left
:
-
8
px
;
align
-
items
:
center
;
justify
-
content
:
center
;
}
#actions > a, #actions > form {
margin
-
left
:
8
px
;
}
</
style
>
@
endsection
routes/cookie.php
View file @
b1a09786
...
...
@@ -22,6 +22,9 @@ Route::group(
# Route to show and delete all settings
Route
::
get
(
'all-settings'
,
'SettingsController@allSettingsIndex'
)
->
name
(
'showAllSettings'
);
Route
::
post
(
'all-settings/removeOne'
,
'SettingsController@removeOneSetting'
)
->
name
(
'removeOneSetting'
);
Route
::
post
(
'all-settings/removeAll'
,
'SettingsController@removeAllSettings'
)
->
name
(
'removeAllSettings'
);
});
}
);
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