function filebrowser_validate in Filebrowser 7.3
Same name and namespace in other branches
- 6.2 filebrowser.module \filebrowser_validate()
- 7.4 filebrowser.module \filebrowser_validate()
- 7.2 filebrowser.module \filebrowser_validate()
Implements hook_validate().
File
- ./
filebrowser.module, line 306
Code
function filebrowser_validate(&$node) {
$node->folder_presentation = (object) $node->folder_presentation;
$path = _filebrowser_get_node_root($node);
// get the folder path
$encoded_path = _filebrowser_encoding_to_fs($node, $path);
// check if this is an amazon s3 path, if so validate it via the s3_fb module
if (is_s3_filesystem($encoded_path)) {
validate_s3($encoded_path);
return;
}
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' => $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,
)));
}
}
}