fbd4e92e9f
Full rewrite: swap out the v1 framework (src/, controllers/, views/, twig/, sass/, skeleton/) for the working v2 codebase from phpproject (App/, novaconium/, public/).
23 lines
525 B
PHP
23 lines
525 B
PHP
<?php
|
|
|
|
use App\Response;
|
|
use Lib\Csrf;
|
|
use Lib\Input;
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if (!Csrf::verify(Input::post('csrf_token'))) {
|
|
return Response::redirect('/admin/clear-cache?error=security');
|
|
}
|
|
|
|
$cache->clear();
|
|
|
|
return Response::redirect('/admin/clear-cache?cleared=1');
|
|
}
|
|
|
|
return [
|
|
'cleared' => Input::get('cleared') !== null,
|
|
'securityError' => Input::get('error') === 'security',
|
|
'csrfField' => Csrf::fieldName(),
|
|
'csrfToken' => Csrf::token(),
|
|
];
|