diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 932fff658100ca727c8d656cbbbb9138fc48651f..9d9ba93f7dbcd0e8ce5aac80fbce21814c0620ec 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -311,4 +311,23 @@ class SettingsController extends Controller return redirect($request->input('url', 'https://metager.de')); } + + public function clearBlacklist(Request $request) + { + //function to clear the whole black list + $fokus = $request->input('fokus', ''); + $url = $request->input('url', ''); + $path = \Request::path(); + $empty = $request->input('empty'); + $cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5); + $cookies = Cookie::get(); + + foreach($cookies as $key => $value){ + if(stripos($key, 'blpage') !== false) { + Cookie::queue($key, "", 0, $cookiePath, null, false, false); + } + } + + return redirect($request->input('url', 'https://metager.de')); + } } diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php index 29b187f470c819ce7e61da3aa2b6086829bd0858..9d9de6da9134a395dcb7ccef99bf0e81de927bf6 100644 --- a/resources/views/settings/index.blade.php +++ b/resources/views/settings/index.blade.php @@ -111,6 +111,9 @@ @endforeach </table> </form> + <form id="clearlist" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('clearBlacklist', ["fokus" => $fokus, "url" => $url])) }}" method="post"> + <button type="submit" name="clear" value="1">>clear black list<</button> + </form> @endif </div> diff --git a/routes/cookie.php b/routes/cookie.php index 8e58bfeec08198491601fa5de207de5388bb1d1b..0ff0328cd8434e44e706e181e90aba05ba175503 100644 --- a/routes/cookie.php +++ b/routes/cookie.php @@ -22,6 +22,7 @@ Route::group( Route::post('ds', 'SettingsController@deleteSettings')->name('deleteSettings'); Route::post('nb', 'SettingsController@newBlacklist')->name('newBlacklist'); Route::post('db', 'SettingsController@deleteBlacklist')->name('deleteBlacklist'); + Route::post('cb', 'SettingsController@clearBlacklist')->name('clearBlacklist'); # Route to show and delete all settings Route::get('all-settings', 'SettingsController@allSettingsIndex')->name('showAllSettings');