: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Header to use to accelerate sending local files to clients (e.g. 'X-Sendfile', 'X-Accel-Redirect')
// Root path to xsendfile target. Probably, this is required for 'X-Accel-Redirect' on Nginx.
protected $defaults = array(
* Access control function/class
protected $attributes = array();
* Access control function/class
protected $access = null;
* Mime types allowed to upload
protected $uploadAllow = array();
* Mime types denied to upload
protected $uploadDeny = array();
* Order to validate uploadAllow and uploadDeny
protected $uploadOrder = array();
* Maximum allowed upload file size.
* Set as number or string with unit - "10M", "500K", "1G"
protected $uploadMaxSize = 0;
* Run time setting of overwrite items on upload
protected $uploadOverwrite = true;
* Maximum allowed get file size.
* Set as number or string with unit - "10M", "500K", "1G"
protected $getMaxSize = -1;
protected $mimeDetect = 'auto';
* Flag - mimetypes from externail file was loaded
private static $mimetypesLoaded = false;
* Finfo resource for mimeDetect == 'finfo'
* List of disabled client's commands
protected $disabled = array();
* overwrite extensions/mimetypes to mime.types
protected static $mimetypes = array(
'exe' => 'application/x-executable',
'jar' => 'application/x-jar',
'gz' => 'application/x-gzip',
'tgz' => 'application/x-gzip',
'tbz' => 'application/x-bzip2',
'rar' => 'application/x-rar',
'js' => 'text/javascript',
'rtfd' => 'application/rtfd',
'sh' => 'text/x-shellscript',
'cpp' => 'text/x-c++src',
'md' => 'text/x-markdown',
'markdown' => 'text/x-markdown',
'bmp' => 'image/x-ms-bmp',
'tga' => 'image/x-targa',
'wm' => 'video/x-ms-wmv',
'm3u8' => 'application/x-mpegURL',
'mpd' => 'application/dash+xml'
* Directory separator - required by client
protected $separator = DIRECTORY_SEPARATOR;
* Directory separator for decode/encode hash
protected $separatorForHash = '';
* System Root path (Unix like: '/', Windows: '\', 'C:\' or 'D:\'...)
protected $systemRoot = DIRECTORY_SEPARATOR;
* Mimetypes allowed to display
protected $onlyMimes = array();
* Store files moved or overwrited files info
protected $removed = array();
* Store files added files info
protected $added = array();
protected $cache = array();
protected $dirsCache = array();
* You should use `$this->sessionCache['subdirs']` instead
protected $subdirsCache = array();
* This volume session cache
* Session caching item list
protected $sessionCaching = array('rootstat' => true, 'subdirs' => true);
* elFinder session wrapper object
* @var elFinderSessionInterface
* Current query word on doSearch
protected $doSearchCurrentQuery = array();
* Is root modified (for clear root stat cache)
protected $rootModified = false;
* Is disable of command `url`
protected $disabledGetUrl = false;
* Accepted filename validator
protected $nameValidator;
* Accepted dirname validator
protected $dirnameValidator;
* This request require online state
/*********************************************************************/
/*********************************************************************/
* @param boolean $state The state
public function setNeedOnline($state = null)
$this->needOnline = (bool)$state;
$target = !empty($arg['target'])? $arg['target'] : (!empty($arg['dst'])? $arg['dst'] : '');
$targets = !empty($arg['targets'])? $arg['targets'] : array();
if (!is_array($targets)) {
$targets = array($targets);
if ($target && strpos($target, $id) === 0) {
foreach($targets as $t) {
if ($t && strpos($t, $id) === 0) {
$this->needOnline = $need;
* Prepare driver before mount volume.
* Return true if volume is ready.
* @author Dmitry (dio) Levashov
protected function init()
* Configure after successfull mount.
* By default set thumbnails path and image manipulation library.
* @throws elFinderAbortException
* @author Dmitry (dio) Levashov
protected function configure()
$path = $this->options['tmbPath'];
if (!file_exists($path)) {
chmod($path, $this->options['tmbPathMode']);
if (is_dir($path) && is_readable($path)) {
$this->tmbPathWritable = is_writable($path);
if (!is_dir($this->options['resourcePath'])) {
$this->options['resourcePath'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resources';
// set image manipulation library
$type = preg_match('/^(imagick|gd|convert|auto|none)$/i', $this->options['imgLib'])
? strtolower($this->options['imgLib'])
if (($type === 'imagick' || $type === 'auto') && extension_loaded('imagick')) {
$this->imgLib = 'imagick';
} else if (($type === 'gd' || $type === 'auto') && function_exists('gd_info')) {
$convertCache = 'imgLibConvert';
if (($convertCmd = $this->session->get($convertCache, false)) !== false) {
$this->imgLib = $convertCmd;
$this->imgLib = ($this->procExec(ELFINDER_CONVERT_PATH . ' -version') === 0) ? 'convert' : '';
$this->session->set($convertCache, $this->imgLib);
if ($type !== 'auto' && $this->imgLib === '') {
$this->imgLib = extension_loaded('imagick') ? 'imagick' : (function_exists('gd_info') ? 'gd' : '');
// check video to img converter
if (!empty($this->options['imgConverter']) && is_array($this->options['imgConverter'])) {
foreach ($this->options['imgConverter'] as $_type => $_converter) {
if (isset($_converter['func'])) {
$this->imgConverter[strtolower($_type)] = $_converter;
if (!isset($this->imgConverter['video'])) {
$videoLibCache = 'videoLib';
if (($videoLibCmd = $this->session->get($videoLibCache, false)) === false) {
$videoLibCmd = ($this->procExec(ELFINDER_FFMPEG_PATH . ' -version') === 0) ? 'ffmpeg' : '';
$this->session->set($videoLibCache, $videoLibCmd);
$this->imgConverter['video'] = array(
'func' => array($this, $videoLibCmd . 'ToImg'),
'maxlen' => $this->options['tmbVideoConvLen']
if (strtolower($this->options['onetimeUrl']) === 'auto') {
$this->options['onetimeUrl'] = elFinder::getStaticVar('commonTempPath')? true : false;
if (empty($this->archivers['create'])) {
$this->disabled[] = 'archive';
if (empty($this->archivers['extract'])) {
$this->disabled[] = 'extract';
$_arc = $this->getArchivers();
if (empty($_arc['create'])) {
$this->disabled[] = 'zipdl';
if ($this->options['maxArcFilesSize']) {
$this->options['maxArcFilesSize'] = elFinder::getIniBytes('', $this->options['maxArcFilesSize']);
self::$maxArcFilesSize = $this->options['maxArcFilesSize'];
// check 'statOwner' for command `chmod`
if (empty($this->options['statOwner'])) {
$this->disabled[] = 'chmod';
if (!is_array($this->options['mimeMap'])) {
$this->options['mimeMap'] = array();
if (is_array($this->options['staticMineMap']) && $this->options['staticMineMap']) {
$this->options['mimeMap'] = array_merge($this->options['mimeMap'], $this->options['staticMineMap']);
if (is_array($this->options['additionalMimeMap']) && $this->options['additionalMimeMap']) {
$this->options['mimeMap'] = array_merge($this->options['mimeMap'], $this->options['additionalMimeMap']);
// check 'url' in disabled commands
if (in_array('url', $this->disabled)) {
$this->disabledGetUrl = true;
// set run time setting uploadOverwrite
$this->uploadOverwrite = $this->options['uploadOverwrite'];
protected function sessionRestart()
$this->sessionCache = $this->session->start()->get($this->id, array());
/*********************************************************************/
/*********************************************************************/
* Return driver id. Used as a part of volume id.
* @author Dmitry (dio) Levashov
public function driverId()
* @author Dmitry (dio) Levashov