/** * Configure after successfull mount. * * @return void * @author Dmitry (dio) Levashov **/ protected function configure() { $this->aroot = realpath($this->root); $root = $this->stat($this->root); if ($this->options['quarantine']) { $this->attributes[] = array('pattern' => '~^' . preg_quote(DIRECTORY_SEPARATOR . $this->options['quarantine']) . '$~', 'read' => false, 'write' => false, 'locked' => true, 'hidden' => true); } // chek thumbnails path if ($this->options['tmbPath']) { $this->options['tmbPath'] = strpos($this->options['tmbPath'], DIRECTORY_SEPARATOR) === false ? $this->root . DIRECTORY_SEPARATOR . $this->options['tmbPath'] : $this->_normpath($this->options['tmbPath']); } parent::configure(); // if no thumbnails url - try detect it if ($root['read'] && !$this->tmbURL && $this->URL) { if (strpos($this->tmbPath, $this->root) === 0) { $this->tmbURL = $this->URL . str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root) + 1)); if (preg_match("|[^/?&=]\$|", $this->tmbURL)) { $this->tmbURL .= '/'; } } } // check quarantine dir if (!empty($this->options['quarantine'])) { $this->quarantine = $this->root . DIRECTORY_SEPARATOR . $this->options['quarantine']; if (!is_dir($this->quarantine) && !$this->_mkdir($this->root, $this->options['quarantine']) || !is_writable($this->quarantine)) { $this->archivers['extract'] = array(); $this->disabled[] = 'extract'; } } else { $this->archivers['extract'] = array(); $this->disabled[] = 'extract'; } }
public function mount(array $opts) { // If path is not set, use the root if (!isset($opts['path']) || $opts['path'] === '') { $opts['path'] = '/'; } return parent::mount($opts); }
/** * Configure after successfull mount. * * @return void * @author Dmitry (dio) Levashov **/ protected function configure() { parent::configure(); if (!$this->tmp) { $this->disabled[] = 'archive'; $this->disabled[] = 'extract'; } }
/** * Return file mimetype * * @param string $path file path * @return string * @author Dmitry (dio) Levashov **/ protected function mimetype($path, $name = '') { $type = ''; if ($this->mimeDetect == 'finfo') { if ($type = @finfo_file($this->finfo, $path)) { if ($name === '') { $name = $path; } $ext = false === ($pos = strrpos($name, '.')) ? '' : substr($name, $pos + 1); if ($ext && preg_match('~^application/(?:octet-stream|(?:x-)?zip)~', $type)) { if (isset(ElFinderVolumeDriver::$mimetypes[$ext])) { $type = ElFinderVolumeDriver::$mimetypes[$ext]; } } } } elseif ($type == 'mime_content_type') { $type = mime_content_type($path); } else { $type = ElFinderVolumeDriver::mimetypeInternalDetect($path); } $type = explode(';', $type); $type = trim($type[0]); if (in_array($type, array('application/x-empty', 'inode/x-empty'))) { // finfo return this mime for empty files $type = 'text/plain'; } elseif ($type == 'application/x-zip') { // http://elrte.org/redmine/issues/163 $type = 'application/zip'; } return $type == 'unknown' && $this->mimeDetect != 'internal' ? ElFinderVolumeDriver::mimetypeInternalDetect($path) : $type; }
protected function configure() { parent::configure(); $this->mimeDetect = 'internal'; }
/** * Return debug info for client * * @return array * @author Dmitry (dio) Levashov **/ public function debug() { $debug = parent::debug(); $debug['sqlCount'] = $this->sqlCnt; if ($this->dbError) { $debug['dbError'] = $this->dbError; } return $debug; }
/** * {@inheritdoc). */ public function uniqueName($dir, $name, $suffix = ' copy', $checkNum = true) { return $this->driver->uniqueName($dir, $name, $suffix, $checkNum); }