function webfm_fdesc::webfm_fdesc in Web File Manager 5.2
Same name and namespace in other branches
- 5 webfm.module \webfm_fdesc::webfm_fdesc()
File
- ./
webfm.module, line 1613
Class
- webfm_fdesc
- File description class
Code
function webfm_fdesc($file) {
$cwd = getcwd();
$this->result = FALSE;
$dir = dirname($file->fpath);
//assume the object $file record path has a directory before the file name
if (is_dir($dir)) {
if (chdir($dir)) {
if ($handle = opendir('.')) {
while (($readdir = readdir($handle)) !== false) {
if (is_dir($readdir)) {
continue;
}
if (is_file($readdir) && $readdir == basename($file->fpath)) {
$this->id = $file->fid;
$this->n = strrev(substr(strrev($file->fpath), 0, strpos(strrev($file->fpath), '/')));
$this->p = $dir;
$this->e = $file->fmime;
$this->s = $file->fsize;
$this->uid = $file->uid;
/* rename fields for expected js variables
$this->fid = $file->fid;
$this->fpath = $file->fpath;
$this->fname = $file->fname;
$this->fsize = $file->fsize;
$this->fmime = $file->fmime;
*/
$this->ftitle = $file->ftitle;
$this->fdesc = $file->fdesc;
$this->fcreatedate = $file->fcreatedate;
$this->flang = $file->flang;
$this->fpublisher = $file->fpublisher;
$this->fformat = $file->fformat;
$this->fversion = $file->fversion;
$this->m = filemtime($readdir) ? date('d/m/y g:i a', @filemtime($readdir)) : "";
if ($i = @getimagesize($readdir)) {
$this->w = (int) $i[0];
$this->h = (int) $i[1];
$this->i = $i[2];
if ($i[0] == 0 || $i[1] == 0) {
$this->i = 0;
}
}
else {
$this->i = 0;
}
$this->result = TRUE;
break;
}
}
closedir($handle);
}
// Restore current working directory
chdir($cwd);
}
}
}