Commit d6f4cc3a authored by Davide Aprea's avatar Davide Aprea

added button to clear black list

parent 623e3d2a
......@@ -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'));
}
}
......@@ -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>
......
......@@ -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');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment