You are here

function webfm_get_file_record in Web File Manager 5

Same name and namespace in other branches
  1. 5.2 webfm.module \webfm_get_file_record()

Given a file id or file path this function returns webfm_file table record

Parameters

int $fid:

string $path:

Return value

row object or FALSE if none was found

9 calls to webfm_get_file_record()
webfm_ajax in ./webfm.module
Ajax post requests
webfm_build_dir_list::webfm_build_dir_list in ./webfm.module
webfm_delete_file in ./webfm_file.inc
webfm_putmeta in ./webfm.module
webfm_rename in ./webfm_file.inc
webfm_rename -called from the ajax action - switch case 'rename':

... See full list

File

./webfm.module, line 2806

Code

function webfm_get_file_record($fid = '', $path = '') {
  if (is_numeric($fid)) {
    $query = "SELECT * FROM {webfm_file} WHERE fid = %d";
    if (($result = db_query($query, $fid)) !== FALSE) {
      if ($row = db_fetch_object($result)) {
        return $row;
      }
    }
  }
  else {
    if (is_string($path)) {
      $query = "SELECT * FROM {webfm_file} WHERE fpath = '%s'";
      if (($result = db_query($query, $path)) !== FALSE) {
        if ($row = db_fetch_object($result)) {
          return $row;
        }
      }
    }
  }
  return FALSE;
}