-
Notifications
You must be signed in to change notification settings - Fork 453
/
filetypes.php
45 lines (35 loc) · 1.43 KB
/
filetypes.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Files;
use Concrete\Core\Page\Controller\DashboardPageController;
use Config;
use Loader;
class Filetypes extends DashboardPageController
{
public $helpers = array('form', 'concrete/ui', 'validation/token', 'concrete/file');
public function view()
{
$helper_file = Loader::helper('concrete/file');
$file_access_file_types = $helper_file->unserializeUploadFileExtensions(
Config::get('concrete.upload.extensions'));
$file_access_file_types = implode(', ', $file_access_file_types);
$this->set('file_access_file_types', $file_access_file_types);
}
public function saved()
{
$this->set('message', t('Allowed file types saved.'));
$this->view();
}
public function file_access_extensions()
{
$helper_file = Loader::helper('concrete/file');
$validation_token = Loader::helper('validation/token');
if (!$validation_token->validate("file_access_extensions")) {
$this->set('error', array($validation_token->getErrorMessage()));
return;
}
$types = preg_split('{,}', $this->post('file-access-file-types'), null, PREG_SPLIT_NO_EMPTY);
$types = $helper_file->serializeUploadFileExtensions($types);
Config::save('concrete.upload.extensions', $types);
$this->redirect('/dashboard/system/files/filetypes', 'saved');
}
}