Overview
Comment:Throw user message if the file has already been deleted
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stable
Files: files | file ages | folders
SHA1: d69e17e90dd5bd4d82a9cd390e720057027f6592
User & Date: bohwaz on 2020-12-06 23:05:47
Other Links: manifest | tags
Context
2020-12-07
16:17
Set selected analytical account in edit form check-in: da4fe1bd04 user: bohwaz tags: stable
2020-12-06
23:05
Throw user message if the file has already been deleted check-in: d69e17e90d user: bohwaz tags: stable
18:41
New release check-in: e45b645e78 user: bohwaz tags: trunk, stable, 1.0.0-rc8
Changes

Modified src/www/admin/common/delete_file.php from [f9d6581182] to [dbcb7d7cc0].

1
2
3
4
5
6
7
8
9
10
11
12
13

14




15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace Garradin;

use Garradin\Services\Services;

if (!defined('Garradin\ROOT')) {
	die('Access denied.');
}

if (!isset($csrf_key, $redirect)) {
	throw new \InvalidArgumentException('Missing params');
}


$file = new Fichiers(qg('id'));





if (!$file->checkAccess($session))
{
    throw new UserException('Vous n\'avez pas accès à ce fichier.');
}

$form->runIf('delete', function () use ($file) {
	$file->remove();
}, $csrf_key, $redirect);

$tpl->assign(compact('file', 'csrf_key'));

$tpl->display('common/delete_file.tpl');













>
|
>
>
>
>













1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Garradin;

use Garradin\Services\Services;

if (!defined('Garradin\ROOT')) {
	die('Access denied.');
}

if (!isset($csrf_key, $redirect)) {
	throw new \InvalidArgumentException('Missing params');
}

try {
	$file = new Fichiers(qg('id'));
}
catch (\InvalidArgumentException $e) {
	throw new UserException($e->getMessage());
}

if (!$file->checkAccess($session))
{
    throw new UserException('Vous n\'avez pas accès à ce fichier.');
}

$form->runIf('delete', function () use ($file) {
	$file->remove();
}, $csrf_key, $redirect);

$tpl->assign(compact('file', 'csrf_key'));

$tpl->display('common/delete_file.tpl');