function filebrowser_form_delete_confirm_submit in Filebrowser 6.2
Same name and namespace in other branches
- 8 filebrowser.module \filebrowser_form_delete_confirm_submit()
- 7.4 filebrowser.module \filebrowser_form_delete_confirm_submit()
- 7.2 filebrowser.module \filebrowser_form_delete_confirm_submit()
- 7.3 filebrowser.module \filebrowser_form_delete_confirm_submit()
File delete confirmation form submit
File
- ./
filebrowser.module, line 416
Code
function filebrowser_form_delete_confirm_submit($form, &$form_state) {
foreach ($form_state['values']['fids'] as $fid) {
$content = _filebrowser_node_content_load($fid);
$node = node_load($content['nid']);
$target = _filebrowser_convert_to_fs_encoding($node, _filebrowser_get_path($node) . $content['path']);
if (is_file($target)) {
$result = unlink($target);
if (!$result) {
drupal_set_message(t('Unable to delete @file', array(
'@file' => $target,
)), 'warning');
}
}
else {
$result = rmdir($target);
if (!$result) {
drupal_set_message(t('Unable to prune @file (not empty ?)', array(
'@file' => $target,
)), 'warning');
}
}
}
$form_state['redirect'] = isset($_GET['destination']) ? $_GET['destination'] : '<front>';
}