20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
$csrf_key = 'attach_' . $page->id();
$form->runIf('delete', function () use ($page, $session) {
$path = Utils::dirname($page->file_path) . '/' . f('delete');
$file = Files::get($path);
if (!$file || !$file->checkDeleteAccess($session)) {
throw new UserException('Vous ne pouvez pas supprimer ce fichier');
}
$file->delete();
}, $csrf_key);
|
|
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
$csrf_key = 'attach_' . $page->id();
$form->runIf('delete', function () use ($page, $session) {
$path = Utils::dirname($page->file_path) . '/' . f('delete');
$file = Files::get($path);
if (!$file || !$file->canDelete()) {
throw new UserException('Vous ne pouvez pas supprimer ce fichier');
}
$file->delete();
}, $csrf_key);
|