Overview
Comment:Strip extension if typed by user
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: 2dd274b304c15205b896256f40d52e8c488fc11f035c39887c28aa4c9725a58f
User & Date: bohwaz on 2022-12-19 20:54:43
Other Links: branch diff | manifest | tags
Context
2022-12-20
20:59
Add PDF icon, fix check for creating HTML/JS files check-in: 3f902fb2fd user: bohwaz tags: dev
2022-12-19
20:54
Strip extension if typed by user check-in: 2dd274b304 user: bohwaz tags: dev
2022-12-18
22:19
Fix gallery grid check-in: bbeb156465 user: bohwaz tags: dev
Changes

Modified src/www/admin/docs/new_doc.php from [051fdd69c7] to [fbb0cfcc39].

18
19
20
21
22
23
24

25
26
27
28
29
30
31
	throw new UserException('Vous n\'avez pas le droit de créer de document ici.');
}

$csrf_key = 'create_doc';

$form->runIf('create', function () use ($parent, $ext) {
	$name = trim((string) f('name'));

	$file = Files::createDocument($parent, $name, $ext);
	Utils::redirect('!common/files/edit.php?p=' . rawurlencode($file->path));
}, $csrf_key);

if ($ext == 'ods') {
	$submit_name = 'Créer le tableau';
}







>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
	throw new UserException('Vous n\'avez pas le droit de créer de document ici.');
}

$csrf_key = 'create_doc';

$form->runIf('create', function () use ($parent, $ext) {
	$name = trim((string) f('name'));
	$name = preg_replace('/\.\w+$/', '', $name);
	$file = Files::createDocument($parent, $name, $ext);
	Utils::redirect('!common/files/edit.php?p=' . rawurlencode($file->path));
}, $csrf_key);

if ($ext == 'ods') {
	$submit_name = 'Créer le tableau';
}