You are here

function webfm_delete_file in Web File Manager 5.2

Same name and namespace in other branches
  1. 5 webfm_file.inc \webfm_delete_file()
2 calls to webfm_delete_file()
webfm_delete in ./webfm_file.inc
webfm_delete - called from the ajax action - switch case 'delete':
webfm_delete_dir_recur in ./webfm_file.inc

File

./webfm_file.inc, line 164

Code

function webfm_delete_file($source, $uid, &$error) {
  $file = webfm_get_file_record('', $source);
  if ($uid == 1 || $file && $uid == $file->uid) {
    if (@unlink($source)) {
      if ($file && !webfm_dbdelete_file($file->fid)) {
        $error = 'webfm_dbdelete_file() fail for ' . $source;
        return FALSE;
      }
    }
    else {
      if (file_exists($source)) {
        $error = $source . ' could not be deleted';
        return FALSE;
      }
    }
    return TRUE;
  }
  else {
    $error = "permission denied";
    return FALSE;
  }
}