function elfinder_admin_form_validate in elFinder file manager 6
Same name and namespace in other branches
- 6.2 inc/elfinder.admin.inc \elfinder_admin_form_validate()
- 6.2 inc/elfinder.admin.profiles.inc \elfinder_admin_form_validate()
- 7.3 inc/elfinder.admin.inc \elfinder_admin_form_validate()
- 7.3 inc/elfinder.admin.profiles.inc \elfinder_admin_form_validate()
- 7 inc/elfinder.admin.inc \elfinder_admin_form_validate()
- 7.2 inc/elfinder.admin.inc \elfinder_admin_form_validate()
- 7.2 inc/elfinder.admin.profiles.inc \elfinder_admin_form_validate()
Validate form data
File
- inc/
elfinder.admin.inc, line 218 - file manager admin settings page
Code
function elfinder_admin_form_validate($form, &$form_state) {
$tmbsize = $form_state['values']['tmbsize'];
if ($form_state['values']['filesystem_root'] == 'custom') {
$customroot = $form_state['values']['filesystem_root_custom'];
if ($customroot == '') {
form_set_error('filesystem_root_custom', t('Filesystem root cannot be empty'));
}
$customroot = elfinder_parse_path_tokens($customroot);
// checking directory accessibility by creating test file
if (!elfinder_prepare_directory($customroot)) {
form_set_error('filesystem_root_custom', t('Filesystem root is not writable'));
}
}
if (!preg_match('/^\\d{3,4}$/', $form_state['values']['file_perm'])) {
form_set_error('file_perm', t('Created file permissions should be a numeric'));
}
if (!preg_match('/^\\d{3,4}?$/', $form_state['values']['dir_perm'])) {
form_set_error('dir_perm', t('Created directory permissions should be a numeric'));
}
if ($tmbsize && !is_numeric($tmbsize)) {
form_set_error('tmbsize', t('Thumbnail size should be a number'));
}
}