Автор: Dmitry (dio) Levashov
Автор: Troex Nevelin
Наследование: extends elFinderVolumeDriver
Пример #1
0
 /**
  * Put file stat in cache and return it
  *
  * @param  string  $path   file path
  * @param  array   $stat   file stat
  * @return array
  * @author Dmitry (dio) Levashov
  **/
 protected function updateCache($path, $stat)
 {
     $stat = parent::updateCache($path, $stat);
     if ($stat && $stat['mime'] !== 'directory') {
         if (strpos($path, XOOPS_TRUST_PATH) === 0) {
             $stat['_localpath'] = str_replace(XOOPS_ROOT_PATH, 'T', $path);
         } else {
             $stat['_localpath'] = str_replace(XOOPS_ROOT_PATH, 'R', $path);
         }
     }
     return $this->cache[$path] = $stat;
 }
Пример #2
0
 /**
  * Return stat for given path.
  * Stat contains following fields:
  * - (int)    size    file size in b. required
  * - (int)    ts      file modification time in unix time. required
  * - (string) mime    mimetype. required for folders, others - optionally
  * - (bool)   read    read permissions. required
  * - (bool)   write   write permissions. required
  * - (bool)   locked  is object locked. optionally
  * - (bool)   hidden  is object hidden. optionally
  * - (string) alias   for symlinks - link target path relative to root path. optionally
  * - (string) target  for symlinks - link target path. optionally
  *
  * If file does not exists - returns empty array or false.
  *
  * @param  string  $path    file path
  * @return array|false
  * @author Dmitry (dio) Levashov
  **/
 protected function _stat($path)
 {
     $stat = parent::_stat($path);
     if ($stat) {
         $file = basename($path);
         $file_enc = rawurlencode($file);
         $stat['name'] = $this->enabledFiles[$file];
         $stat['url'] = $this->options['URL'] . $file_enc;
         if ($stat['mime'] !== 'directory') {
             $stat['_localpath'] = dirname(str_replace(XOOPS_ROOT_PATH, 'R', $path)) . DIRECTORY_SEPARATOR . $file_enc;
         }
     }
     return $stat;
 }