function filebrowser_validate in Filebrowser 6.2
Same name and namespace in other branches
- 7.4 filebrowser.module \filebrowser_validate()
- 7.2 filebrowser.module \filebrowser_validate()
- 7.3 filebrowser.module \filebrowser_validate()
Implementation of hook_validate().
File
- ./
filebrowser.module, line 160
Code
function filebrowser_validate(&$node) {
$node->folder_presentation = (object) $node->folder_presentation;
$path = _filebrowser_get_path($node);
$encoded_path = _filebrowser_convert_to_fs_encoding($node, $path);
if (!is_dir($encoded_path)) {
$success = mkdir($encoded_path, 0777, TRUE);
if (!$success) {
form_set_error('file_path', t('The directory %dir is not a valid directory and I\'m unable to help this.', array(
'%dir' => $encoded_path,
)));
}
else {
drupal_set_message(t('The directory %dir has been created.', array(
'%dir' => $path,
)));
}
}
else {
if (!is_readable($encoded_path)) {
form_set_error('file_path', t('The directory %dir is not readable.', array(
'%dir' => $path,
)));
}
}
}