Provide 2 layers: 1. Public API (commands) 2. abstract fs API All abstract methods begin with "_"
Author: Dmitry (dio) Levashov
Author: Troex Nevelin
Author: Alexey Sukhotin
 /**
  * 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';
     }
 }
 protected function configure()
 {
     parent::configure();
     if (!empty($this->options['tmpPath'])) {
         if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
             $this->tmpPath = $this->options['tmpPath'];
         }
     }
     $this->mimeDetect = 'internal';
 }
 protected function configure()
 {
     parent::configure();
     $this->tmpPath = '';
     if (!empty($this->options['tmpPath'])) {
         if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
             $this->tmpPath = $this->options['tmpPath'];
         }
     }
     if (!$this->tmpPath && ($tmp = elFinder::getStaticVar('commonTempPath'))) {
         $this->tmpPath = $tmp;
     }
     $this->mimeDetect = 'internal';
 }
 protected function configure()
 {
     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 ($this->attr($this->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 .= '/';
             }
         }
     }
     $this->aroot = realpath($this->root);
 }
 /**
  * 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);
     }
     parent::configure();
     // 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';
     }
 }
 /**
  * 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;
 }
 /**
  * "Mount" volume.
  * Return true if volume available for read or write, 
  * false - otherwise
  *
  * @return bool
  * @author Dmitry (dio) Levashov
  * @author Alexey Sukhotin
  **/
 public function mount(array $opts)
 {
     if (empty($opts['path'])) {
         return false;
     }
     $this->options = array_merge($this->options, $opts);
     $this->id = $this->driverId . (!empty($this->options['id']) ? $this->options['id'] : elFinder::$volumesCnt++) . '_';
     $this->root = $this->_normpath($this->options['path']);
     $this->separator = isset($this->options['separator']) ? $this->options['separator'] : DIRECTORY_SEPARATOR;
     // default file attribute
     $this->defaults = array('read' => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true, 'write' => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true, 'locked' => false, 'hidden' => false);
     // root attributes
     $this->attributes[] = array('pattern' => '~^' . preg_quote(DIRECTORY_SEPARATOR) . '$~', 'locked' => true, 'hidden' => false);
     // set files attributes
     if (!empty($this->options['attributes']) && is_array($this->options['attributes'])) {
         foreach ($this->options['attributes'] as $a) {
             // attributes must contain pattern and at least one rule
             if (!empty($a['pattern']) || count($a) > 1) {
                 $this->attributes[] = $a;
             }
         }
     }
     if (!empty($this->options['accessControl'])) {
         if (is_string($this->options['accessControl']) && function_exists($this->options['accessControl'])) {
             $this->access = $this->options['accessControl'];
         } elseif (is_array($this->options['accessControl']) && count($this->options['accessControl']) > 1 && is_object($this->options['accessControl'][0]) && method_exists($this->options['accessControl'][0], $this->options['accessControl'][1])) {
             $this->access = array($this->options['accessControl'][0], $this->options['accessControl'][1]);
         }
     }
     // debug($this->attributes);
     if (!$this->init()) {
         return false;
     }
     $this->today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
     $this->yesterday = $this->today - 86400;
     // check some options is arrays
     $this->uploadAllow = isset($this->options['uploadAllow']) && is_array($this->options['uploadAllow']) ? $this->options['uploadAllow'] : array();
     $this->uploadDeny = isset($this->options['uploadDeny']) && is_array($this->options['uploadDeny']) ? $this->options['uploadDeny'] : array();
     $parts = explode(',', isset($this->options['uploadOrder']) ? $this->options['uploadOrder'] : 'deny,allow');
     $this->uploadOrder = array(trim($parts[0]), trim($parts[1]));
     if (!empty($this->options['uploadMaxSize'])) {
         $size = '' . $this->options['uploadMaxSize'];
         $unit = strtolower(substr($size, strlen($size) - 1));
         $n = 1;
         switch ($unit) {
             case 'k':
                 $n = 1024;
                 break;
             case 'm':
                 $n = 1048576;
                 break;
             case 'g':
                 $n = 1073741824;
         }
         $this->uploadMaxSize = intval($size) * $n;
     }
     $this->disabled = isset($this->options['disabled']) && is_array($this->options['disabled']) ? $this->options['disabled'] : array();
     $this->cryptLib = $this->options['cryptLib'];
     $this->mimeDetect = $this->options['mimeDetect'];
     // find available mimetype detect method
     $type = strtolower($this->options['mimeDetect']);
     $type = preg_match('/^(finfo|mime_content_type|internal|auto)$/i', $type) ? $type : 'auto';
     $regexp = '/text\\/x\\-(php|c\\+\\+)/';
     if (($type == 'finfo' || $type == 'auto') && class_exists('finfo') && preg_match($regexp, array_shift(explode(';', @finfo_file(finfo_open(FILEINFO_MIME), __FILE__))))) {
         $type = 'finfo';
     } elseif (($type == 'mime_content_type' || $type == 'auto') && function_exists('mime_content_type') && preg_match($regexp, array_shift(explode(';', mime_content_type(__FILE__))))) {
         $type = 'mime_content_type';
     } else {
         $type = 'internal';
     }
     $this->mimeDetect = $type;
     // load mimes from external file for mimeDetect == 'internal'
     // based on Alexey Sukhotin idea and patch: http://elrte.org/redmine/issues/163
     // file must be in file directory or in parent one
     if ($this->mimeDetect == 'internal' && !self::$mimetypesLoaded) {
         self::$mimetypesLoaded = true;
         $this->mimeDetect = 'internal';
         $file = false;
         if (!empty($this->options['mimefile']) && file_exists($this->options['mimefile'])) {
             $file = $this->options['mimefile'];
         } elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types')) {
             $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types';
         } elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types')) {
             $file = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types';
         }
         if ($file && file_exists($file)) {
             $mimecf = file($file);
             foreach ($mimecf as $line_num => $line) {
                 if (!preg_match('/^\\s*#/', $line)) {
                     $mime = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
                     for ($i = 1, $size = count($mime); $i < $size; $i++) {
                         if (!isset(self::$mimetypes[$mime[$i]])) {
                             self::$mimetypes[$mime[$i]] = $mime[0];
                         } else {
                             // echo $mime[$i].' '.$mime[0].'<br>';
                         }
                     }
                 }
             }
         }
     }
     // debug(self::$mimetypes);
     // set root path
     if (!$this->_isDir($this->root)) {
         return false;
     }
     $read = $this->attr($this->root, 'read');
     // echo $this->attr($this->root.'/.tmb', 'hidden');
     if (!$read && !$this->attr($this->root, 'write')) {
         return false;
     }
     if ($read) {
         // check startPath - path to open by default instead of root
         if ($this->options['startPath']) {
             $path = $this->_normpath($this->options['startPath']);
             if ($this->_isDir($path) && $this->attr($path, 'read') && !$this->attr($path, 'hidden') && $this->_inpath($path, $this->root)) {
                 $this->startPath = $path;
             }
         }
     } else {
         $this->options['URL'] = '';
         $this->options['tmbURL'] = '';
         $this->options['tmbPath'] = '';
         // read only volume
         array_unshift($this->attributes, array('pattern' => '/.*/', 'read' => false));
     }
     $this->rootName = empty($this->options['alias']) ? $this->_basename($this->root) : $this->options['alias'];
     $this->treeDeep = $this->options['treeDeep'] > 0 ? (int) $this->options['treeDeep'] : 1;
     $this->tmbSize = $this->options['tmbSize'] > 0 ? (int) $this->options['tmbSize'] : 48;
     $this->URL = $this->options['URL'];
     if ($this->URL && preg_match("|[^/?&=]\$|", $this->URL)) {
         $this->URL .= '/';
     }
     $this->tmbURL = !empty($this->options['tmbURL']) ? $this->options['tmbURL'] : '';
     if ($this->tmbURL && preg_match("|[^/?&=]\$|", $this->tmbURL)) {
         $this->tmbURL .= '/';
     }
     $this->nameValidator = is_string($this->options['acceptedName']) && !empty($this->options['acceptedName']) ? $this->options['acceptedName'] : '';
     $this->_checkArchivers();
     // manual control archive types to create
     if (!empty($this->options['archiveMimes']) && is_array($this->options['archiveMimes'])) {
         foreach ($this->archivers['create'] as $mime => $v) {
             if (!in_array($mime, $this->options['archiveMimes'])) {
                 unset($this->archivers['create'][$mime]);
             }
         }
     }
     // manualy add archivers
     if (!empty($this->options['archivers']['create']) && is_array($this->options['archivers']['create'])) {
         foreach ($this->options['archivers']['create'] as $mime => $conf) {
             if (strpos($mime, 'application/') === 0 && !empty($conf['cmd']) && isset($conf['argc']) && !empty($conf['ext']) && !isset($this->archivers['create'][$mime])) {
                 $this->archivers['create'][$mime] = $conf;
             }
         }
     }
     if (!empty($this->options['archivers']['extract']) && is_array($this->options['archivers']['extract'])) {
         foreach ($this->options['archivers']['extract'] as $mime => $conf) {
             if (substr($mime, 'application/') === 0 && !empty($cons['cmd']) && isset($conf['argc']) && !empty($conf['ext']) && !isset($this->archivers['extract'][$mime])) {
                 $this->archivers['extract'][$mime] = $conf;
             }
         }
     }
     $this->configure();
     return $this->mounted = true;
 }
 /**
  * Recursive symlinks search
  *
  * @param  string  $path  file/dir path
  * @return bool
  * @author Dmitry (dio) Levashov
  **/
 protected function _findSymlinks($path)
 {
     if (is_link($path)) {
         return true;
     }
     if (is_dir($path)) {
         foreach (scandir($path) as $name) {
             if ($name != '.' && $name != '..') {
                 $p = $path . DIRECTORY_SEPARATOR . $name;
                 if (is_link($p) || !$this->nameAccepted($name) || ($mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name)) && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) {
                     $this->setError(elFinder::ERROR_SAVE, $name);
                     return true;
                 }
                 if (is_dir($p) && $this->_findSymlinks($p)) {
                     return true;
                 } elseif (is_file($p)) {
                     $this->archiveSize += sprintf('%u', filesize($p));
                 }
             }
         }
     } else {
         $this->archiveSize += sprintf('%u', filesize($path));
     }
     return false;
 }
 /**
  * Configure after successfull mount.
  *
  * @return void
  * @author Dmitry (dio) Levashov
  **/
 protected function configure()
 {
     parent::configure();
     if (!empty($this->options['tmpPath'])) {
         if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'], 0755, true)) && is_writable($this->options['tmpPath'])) {
             $this->tmp = $this->options['tmpPath'];
         }
     }
     if (!$this->tmp && ($tmp = elFinder::getStaticVar('commonTempPath'))) {
         $this->tmp = $tmp;
     }
     if (!$this->tmp && $this->tmbPath) {
         $this->tmp = $this->tmbPath;
     }
     if (!$this->tmp) {
         $this->disabled[] = 'mkfile';
         $this->disabled[] = 'paste';
         $this->disabled[] = 'duplicate';
         $this->disabled[] = 'upload';
         $this->disabled[] = 'edit';
         $this->disabled[] = 'archive';
         $this->disabled[] = 'extract';
     }
     // echo $this->tmp;
 }
 /**
  * Create new file and write into it from file pointer
  * Return new file path or false on error.
  *
  * @param  resource  $fp   file pointer
  * @param  string    $dir  target dir path
  * @param  string    $name file name
  * @return bool|string
  * @author Dmitry (dio) Levashov
  **/
 protected function _save($fp, $dir, $name)
 {
     $this->clearstat();
     $id = $this->_joinPath($dir, $name);
     if ($this->tmpPath) {
         $tmp = $this->tmpPath . DIRECTORY_SEPARATOR . $name;
         if (!($target = @fopen($tmp, 'wb'))) {
             return false;
         }
         while (!feof($fp)) {
             fwrite($target, fread($fp, 8192));
         }
         fclose($target);
         $mime = parent::mimetype($tmp);
         $width = $height = 0;
         if (strpos($mime, 'image') === 0) {
             if ($s = getimagesize($tmp)) {
                 $width = $s[0];
                 $height = $s[1];
             }
         }
         $sql = $id > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $id . ', %d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)';
         $sql = sprintf($sql, $this->tbf, $dir, $this->db->real_escape_string($name), realpath($tmp), filesize($tmp), time(), $mime, $width, $height);
     } else {
         $this->mimeDetect = 'internal';
         $mime = parent::mimetype($name);
         $stat = fstat($fp);
         $size = $stat['size'];
         $content = '';
         while (!feof($fp)) {
             $content .= fread($fp, 8192);
         }
         $sql = $id > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $id . ', %d, "%s", "%s", %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", "%s", %d, %d, "%s", %d, %d)';
         $sql = sprintf($sql, $this->tbf, $dir, $this->db->real_escape_string($name), '0x' . bin2hex($content), $size, time(), $mime, 0, 0);
     }
     if ($this->query($sql)) {
         if ($tmp) {
             unlink($tmp);
         }
         return $id > 0 ? $id : $this->db->insert_id;
     }
     if ($tmp) {
         unlink($tmp);
     }
     return false;
 }
 /**
  * Return file mimetype
  *
  * @param  string  $path  file path
  * @return string
  * @author Dmitry (dio) Levashov
  **/
 protected function mimetype($path, $name = '')
 {
     $type = '';
     if ($name === '') {
         $name = $path;
     }
     $ext = false === ($pos = strrpos($name, '.')) ? '' : substr($name, $pos + 1);
     if ($this->mimeDetect == 'finfo') {
         if ($type = @finfo_file($this->finfo, $path)) {
             if ($ext && preg_match('~^application/(?:octet-stream|(?:x-)?zip)~', $type)) {
                 if (isset(elFinderVolumeDriver::$mimetypes[$ext])) {
                     $type = elFinderVolumeDriver::$mimetypes[$ext];
                 }
             } else {
                 if ($ext === 'js' && preg_match('~^text/~', $type)) {
                     $type = 'text/javascript';
                 }
             }
         } else {
             $type = 'unknown';
         }
     } elseif ($this->mimeDetect == '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';
     }
     // mime type normalization
     $_checkKey = strtolower($ext . ':' . $type);
     if (isset($this->options['mimeMap'][$_checkKey])) {
         $type = $this->options['mimeMap'][$_checkKey];
     }
     return $type == 'unknown' && $this->mimeDetect != 'internal' ? elFinderVolumeDriver::mimetypeInternalDetect($path) : $type;
 }
Exemple #12
0
 /**
  * Recursive files search
  *
  * @param  string  $path   dir path
  * @param  string  $q      search string
  * @param  array   $mimes
  * @return array
  * @author Naoki Sawada
  **/
 protected function doSearch($path, $q, $mimes)
 {
     if ($path != $this->root) {
         return parent::doSearch($path, $q, $mimes);
     } else {
         $result = array();
         $q = '%' . mysql_real_escape_string($q) . '%';
         $sql = 'SELECT `file_id`, `mime`, `uid`, `gid`, `gids`, `perm`, `home_of` FROM ' . $this->tbf . ' WHERE `name` LIKE \'' . $q . '\'';
         $res = $this->query($sql);
         if ($res) {
             while ($stat = $this->db->fetchArray($res)) {
                 if ($stat['mime'] === 'directory' || !$this->mimeAccepted($stat['mime'], $mimes)) {
                     continue;
                 }
                 $this->setAuthByPerm($stat);
                 if (empty($stat['hidden'])) {
                     $result[] = $this->stat($stat['file_id']);
                 }
             }
         }
         return $result;
     }
 }
class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {protected $driverId = 'l';public function __construct() {$this->options['alias']    = '';$this->options['dirMode']  = 0777;$this->options['fileMode'] = 0666;}protected function configure() {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 ($this->attr($this->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 .= '/';}}}$this->aroot = realpath($this->root);}protected function _dirname($vd6fe1d0be6347b8ef2427fa629c04485) {return dirname($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _basename($vd6fe1d0be6347b8ef2427fa629c04485) {return basename($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _joinPath($v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297) {return $v736007832d2167baaae763fd3a3f3cf1.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;}protected function _normpath($vd6fe1d0be6347b8ef2427fa629c04485) {if (empty($vd6fe1d0be6347b8ef2427fa629c04485)) {return '.';}if (strpos($vd6fe1d0be6347b8ef2427fa629c04485, '/') === 0) {$vfdac4ab05d92d57054e15e5cf027bbb8 = true;}else {$vfdac4ab05d92d57054e15e5cf027bbb8 = false;}if (($vfdac4ab05d92d57054e15e5cf027bbb8)  && (strpos($vd6fe1d0be6347b8ef2427fa629c04485, '//') === 0)  && (strpos($vd6fe1d0be6347b8ef2427fa629c04485, '///') === false)) {$vfdac4ab05d92d57054e15e5cf027bbb8 = 2;}$vfdac4ab05d92d57054e15e5cf027bbb8 = (int) $vfdac4ab05d92d57054e15e5cf027bbb8;$vdf05b7ad61706b638b2f032978f0c19e = explode('/', $vd6fe1d0be6347b8ef2427fa629c04485);$vc602ff896b51cb4a55b121ac0e6106fa = array();foreach ($vdf05b7ad61706b638b2f032978f0c19e as $v005480c8a6a0357d17cff2e8eb7e060d) {if (in_array($v005480c8a6a0357d17cff2e8eb7e060d, array('', '.'))) {continue;}if (($v005480c8a6a0357d17cff2e8eb7e060d != '..')   || (!$vfdac4ab05d92d57054e15e5cf027bbb8 && !$vc602ff896b51cb4a55b121ac0e6106fa)   || ($vc602ff896b51cb4a55b121ac0e6106fa && (end($vc602ff896b51cb4a55b121ac0e6106fa) == '..'))) {array_push($vc602ff896b51cb4a55b121ac0e6106fa, $v005480c8a6a0357d17cff2e8eb7e060d);}elseif ($vc602ff896b51cb4a55b121ac0e6106fa) {array_pop($vc602ff896b51cb4a55b121ac0e6106fa);}}$vdf05b7ad61706b638b2f032978f0c19e = $vc602ff896b51cb4a55b121ac0e6106fa;$vd6fe1d0be6347b8ef2427fa629c04485 = implode('/', $vdf05b7ad61706b638b2f032978f0c19e);if ($vfdac4ab05d92d57054e15e5cf027bbb8) {$vd6fe1d0be6347b8ef2427fa629c04485 = str_repeat('/', $vfdac4ab05d92d57054e15e5cf027bbb8) . $vd6fe1d0be6347b8ef2427fa629c04485;}return $vd6fe1d0be6347b8ef2427fa629c04485 ? $vd6fe1d0be6347b8ef2427fa629c04485 : '.';}protected function _relpath($vd6fe1d0be6347b8ef2427fa629c04485) {return $vd6fe1d0be6347b8ef2427fa629c04485 == $this->root ? '' : substr($vd6fe1d0be6347b8ef2427fa629c04485, strlen($this->root)+1);}protected function _abspath($vd6fe1d0be6347b8ef2427fa629c04485) {return $vd6fe1d0be6347b8ef2427fa629c04485 == DIRECTORY_SEPARATOR ? $this->root : $this->root.DIRECTORY_SEPARATOR.$vd6fe1d0be6347b8ef2427fa629c04485;}protected function _path($vd6fe1d0be6347b8ef2427fa629c04485) {return $this->rootName.($vd6fe1d0be6347b8ef2427fa629c04485 == $this->root ? '' : $this->separator.$this->_relpath($vd6fe1d0be6347b8ef2427fa629c04485));}protected function _inpath($vd6fe1d0be6347b8ef2427fa629c04485, $vd0e45878043844ffc41aac437e86b602) {return $vd6fe1d0be6347b8ef2427fa629c04485 == $vd0e45878043844ffc41aac437e86b602 || strpos($vd6fe1d0be6347b8ef2427fa629c04485, $vd0e45878043844ffc41aac437e86b602.DIRECTORY_SEPARATOR) === 0;}protected function _fileExists($vd6fe1d0be6347b8ef2427fa629c04485) {return file_exists($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _isDir($vd6fe1d0be6347b8ef2427fa629c04485) {return is_dir($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _isFile($vd6fe1d0be6347b8ef2427fa629c04485) {return is_file($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _isLink($vd6fe1d0be6347b8ef2427fa629c04485) {return is_link($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _isReadable($vd6fe1d0be6347b8ef2427fa629c04485) {return is_readable($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _isWritable($vd6fe1d0be6347b8ef2427fa629c04485) {return is_writable($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _isLocked($vd6fe1d0be6347b8ef2427fa629c04485) {return false;}protected function _isHidden($vd6fe1d0be6347b8ef2427fa629c04485) {return false;}protected function _filesize($vd6fe1d0be6347b8ef2427fa629c04485) {return @filesize($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _filemtime($vd6fe1d0be6347b8ef2427fa629c04485) {return @filemtime($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _subdirs($vd6fe1d0be6347b8ef2427fa629c04485) {if (is_dir($vd6fe1d0be6347b8ef2427fa629c04485) && is_readable($vd6fe1d0be6347b8ef2427fa629c04485)) {$v736007832d2167baaae763fd3a3f3cf1 = dir($vd6fe1d0be6347b8ef2427fa629c04485);while (($v1043bfc77febe75fafec0c4309faccf1 = $v736007832d2167baaae763fd3a3f3cf1->read()) !== false) {$v83878c91171338902e0fe0fb97a8c47a = $v736007832d2167baaae763fd3a3f3cf1->path.DIRECTORY_SEPARATOR.$v1043bfc77febe75fafec0c4309faccf1;if ($v1043bfc77febe75fafec0c4309faccf1 != '.' && $v1043bfc77febe75fafec0c4309faccf1 != '..' && is_dir($v83878c91171338902e0fe0fb97a8c47a) && !$this->attr($v83878c91171338902e0fe0fb97a8c47a, 'hidden')) {$v736007832d2167baaae763fd3a3f3cf1->close();return true;}}$v736007832d2167baaae763fd3a3f3cf1->close();}return false;}protected function _dimensions($vd6fe1d0be6347b8ef2427fa629c04485, $vd02a169f33469c888396a24dd9d9f1c6) {return strpos($vd02a169f33469c888396a24dd9d9f1c6, 'image') === 0 && ($v03c7c0ace395d80182db07ae2c30f034 = @getimagesize($vd6fe1d0be6347b8ef2427fa629c04485)) !== false   ? $v03c7c0ace395d80182db07ae2c30f034[0].'x'.$v03c7c0ace395d80182db07ae2c30f034[1]   : false;}protected function _lstat($vd6fe1d0be6347b8ef2427fa629c04485) {return lstat($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _readlink($vd6fe1d0be6347b8ef2427fa629c04485) {if (!($v42aefbae01d2dfd981f7da7d823d689e = @readlink($vd6fe1d0be6347b8ef2427fa629c04485))) {return false;}if (substr($v42aefbae01d2dfd981f7da7d823d689e, 0, 1) != DIRECTORY_SEPARATOR) {$v42aefbae01d2dfd981f7da7d823d689e = dirname($vd6fe1d0be6347b8ef2427fa629c04485).DIRECTORY_SEPARATOR.$v42aefbae01d2dfd981f7da7d823d689e;}$veb5f43c01d9f67247dfac6b155735906 = realpath($v42aefbae01d2dfd981f7da7d823d689e);if (!$veb5f43c01d9f67247dfac6b155735906) {return false;}if ($this->_inpath($veb5f43c01d9f67247dfac6b155735906, $this->aroot)) {return $this->_normpath($this->root.DIRECTORY_SEPARATOR.substr($veb5f43c01d9f67247dfac6b155735906, strlen($this->aroot)+1));}return false;}protected function _scandir($vd6fe1d0be6347b8ef2427fa629c04485) {$v45b963397aa40d4a0063e0d85e4fe7a1 = array();foreach (scandir($vd6fe1d0be6347b8ef2427fa629c04485) as $vb068931cc450442b63f5b3d276ea4297) {if ($vb068931cc450442b63f5b3d276ea4297 != '.' && $vb068931cc450442b63f5b3d276ea4297 != '..') {$v45b963397aa40d4a0063e0d85e4fe7a1[] = $vd6fe1d0be6347b8ef2427fa629c04485.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;}}return $v45b963397aa40d4a0063e0d85e4fe7a1;}protected function _fopen($vd6fe1d0be6347b8ef2427fa629c04485, $v15d61712450a686a7f365adf4fef581f='rb') {return @fopen($vd6fe1d0be6347b8ef2427fa629c04485, $v15d61712450a686a7f365adf4fef581f);}protected function _fclose($v0666f0acdeed38d4cd9084ade1739498, $vd6fe1d0be6347b8ef2427fa629c04485) {return @fclose($v0666f0acdeed38d4cd9084ade1739498);}protected function _mkdir($vd6fe1d0be6347b8ef2427fa629c04485, $vb068931cc450442b63f5b3d276ea4297) {$vd6fe1d0be6347b8ef2427fa629c04485 = $vd6fe1d0be6347b8ef2427fa629c04485.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;if (@mkdir($vd6fe1d0be6347b8ef2427fa629c04485)) {@chmod($vd6fe1d0be6347b8ef2427fa629c04485, $this->options['dirMode']);return true;}return false;}protected function _mkfile($vd6fe1d0be6347b8ef2427fa629c04485, $vb068931cc450442b63f5b3d276ea4297) {$vd6fe1d0be6347b8ef2427fa629c04485 = $vd6fe1d0be6347b8ef2427fa629c04485.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;if (($v0666f0acdeed38d4cd9084ade1739498 = @fopen($vd6fe1d0be6347b8ef2427fa629c04485, 'w'))) {@fclose($v0666f0acdeed38d4cd9084ade1739498);@chmod($vd6fe1d0be6347b8ef2427fa629c04485, $this->options['fileMode']);return true;}return false;}protected function _symlink($v42aefbae01d2dfd981f7da7d823d689e, $vd6fe1d0be6347b8ef2427fa629c04485, $vb068931cc450442b63f5b3d276ea4297='') {if (!$vb068931cc450442b63f5b3d276ea4297) {$vb068931cc450442b63f5b3d276ea4297 = basename($vd6fe1d0be6347b8ef2427fa629c04485);}return @symlink('.'.DIRECTORY_SEPARATOR.$this->_relpath($v42aefbae01d2dfd981f7da7d823d689e), $vd6fe1d0be6347b8ef2427fa629c04485.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297);}protected function _copy($v36cd38f49b9afa08222c0dc9ebfe35eb, $v1baf8770b1d8a6e742d5e7d6d241e5d2, $vb068931cc450442b63f5b3d276ea4297='') {$v42aefbae01d2dfd981f7da7d823d689e = $v1baf8770b1d8a6e742d5e7d6d241e5d2.DIRECTORY_SEPARATOR.($vb068931cc450442b63f5b3d276ea4297 ? $vb068931cc450442b63f5b3d276ea4297 : basename($v36cd38f49b9afa08222c0dc9ebfe35eb));return copy($v36cd38f49b9afa08222c0dc9ebfe35eb, $v42aefbae01d2dfd981f7da7d823d689e);}protected function _move($v36cd38f49b9afa08222c0dc9ebfe35eb, $v1baf8770b1d8a6e742d5e7d6d241e5d2, $vb068931cc450442b63f5b3d276ea4297='') {$v42aefbae01d2dfd981f7da7d823d689e = $v1baf8770b1d8a6e742d5e7d6d241e5d2.DIRECTORY_SEPARATOR.($vb068931cc450442b63f5b3d276ea4297 ? $vb068931cc450442b63f5b3d276ea4297 : basename($v36cd38f49b9afa08222c0dc9ebfe35eb));return @rename($v36cd38f49b9afa08222c0dc9ebfe35eb, $v42aefbae01d2dfd981f7da7d823d689e);}protected function _unlink($vd6fe1d0be6347b8ef2427fa629c04485) {return @unlink($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _rmdir($vd6fe1d0be6347b8ef2427fa629c04485) {return @rmdir($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _save($v0666f0acdeed38d4cd9084ade1739498, $v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297) {$vd6fe1d0be6347b8ef2427fa629c04485 = $v736007832d2167baaae763fd3a3f3cf1.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;if (!($v42aefbae01d2dfd981f7da7d823d689e = @fopen($vd6fe1d0be6347b8ef2427fa629c04485, 'wb'))) {return false;}while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {fwrite($v42aefbae01d2dfd981f7da7d823d689e, fread($v0666f0acdeed38d4cd9084ade1739498, 8192));}fclose($v42aefbae01d2dfd981f7da7d823d689e);@chmod($vd6fe1d0be6347b8ef2427fa629c04485, $this->options['fileMode']);clearstatcache();return $vd6fe1d0be6347b8ef2427fa629c04485;}protected function _getContents($vd6fe1d0be6347b8ef2427fa629c04485) {return file_get_contents($vd6fe1d0be6347b8ef2427fa629c04485);}protected function _filePutContents($vd6fe1d0be6347b8ef2427fa629c04485, $v9a0364b9e99bb480dd25e1f0284c8555) {if (@file_put_contents($vd6fe1d0be6347b8ef2427fa629c04485, $v9a0364b9e99bb480dd25e1f0284c8555, LOCK_EX)) {clearstatcache();return true;}return false;}protected function _checkArchivers() {if (!function_exists('exec')) {$this->options['archivers'] = $this->options['archive'] = array();return;}$vf8d59458d418fd16e7e3873414455064 = array(   'create'  => array(),   'extract' => array()   );$this->procExec('tar --version', $vd95679752134a2d9eb61dbd7b91c4bcc, $vc3ba283e7b4b7a91db1fd3115ef6ad3f);if ($vc3ba283e7b4b7a91db1fd3115ef6ad3f == 0) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-tar']  = array('cmd' => 'tar', 'argc' => '-cf', 'ext' => 'tar');$vf8d59458d418fd16e7e3873414455064['extract']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-xf', 'ext' => 'tar');$v098f6bcd4621d373cade4e832627b4f6 = $this->procExec('gzip --version', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33 == 0) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-gzip']  = array('cmd' => 'tar', 'argc' => '-czf', 'ext' => 'tgz');$vf8d59458d418fd16e7e3873414455064['extract']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-xzf', 'ext' => 'tgz');}$v098f6bcd4621d373cade4e832627b4f6 = $this->procExec('bzip2 --version', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33 == 0) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-bzip2']  = array('cmd' => 'tar', 'argc' => '-cjf', 'ext' => 'tbz');$vf8d59458d418fd16e7e3873414455064['extract']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-xjf', 'ext' => 'tbz');}}$this->procExec('zip --version', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33 == 0) {$vf8d59458d418fd16e7e3873414455064['create']['application/zip']  = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip');}$this->procExec('unzip --help', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33 == 0) {$vf8d59458d418fd16e7e3873414455064['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '',  'ext' => 'zip');}$this->procExec('rar --version', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33 == 0 || $v4a8a08f09d37b73795649038408b5f33 == 7) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-rar']  = array('cmd' => 'rar', 'argc' => 'a -inul', 'ext' => 'rar');$vf8d59458d418fd16e7e3873414455064['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y',    'ext' => 'rar');}else {$v098f6bcd4621d373cade4e832627b4f6 = $this->procExec('unrar', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33==0 || $v4a8a08f09d37b73795649038408b5f33 == 7) {$vf8d59458d418fd16e7e3873414455064['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar');}}$this->procExec('7za --help', $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);if ($v4a8a08f09d37b73795649038408b5f33 == 0) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-7z-compressed']  = array('cmd' => '7za', 'argc' => 'a', 'ext' => '7z');$vf8d59458d418fd16e7e3873414455064['extract']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'e -y', 'ext' => '7z');if (empty($vf8d59458d418fd16e7e3873414455064['create']['application/x-gzip'])) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-gzip'] = array('cmd' => '7za', 'argc' => 'a -tgzip', 'ext' => 'tar.gz');}if (empty($vf8d59458d418fd16e7e3873414455064['extract']['application/x-gzip'])) {$vf8d59458d418fd16e7e3873414455064['extract']['application/x-gzip'] = array('cmd' => '7za', 'argc' => 'e -tgzip -y', 'ext' => 'tar.gz');}if (empty($vf8d59458d418fd16e7e3873414455064['create']['application/x-bzip2'])) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-bzip2'] = array('cmd' => '7za', 'argc' => 'a -tbzip2', 'ext' => 'tar.bz');}if (empty($vf8d59458d418fd16e7e3873414455064['extract']['application/x-bzip2'])) {$vf8d59458d418fd16e7e3873414455064['extract']['application/x-bzip2'] = array('cmd' => '7za', 'argc' => 'a -tbzip2 -y', 'ext' => 'tar.bz');}if (empty($vf8d59458d418fd16e7e3873414455064['create']['application/zip'])) {$vf8d59458d418fd16e7e3873414455064['create']['application/zip'] = array('cmd' => '7za', 'argc' => 'a -tzip -l', 'ext' => 'zip');}if (empty($vf8d59458d418fd16e7e3873414455064['extract']['application/zip'])) {$vf8d59458d418fd16e7e3873414455064['extract']['application/zip'] = array('cmd' => '7za', 'argc' => 'e -tzip -y', 'ext' => 'zip');}if (empty($vf8d59458d418fd16e7e3873414455064['create']['application/x-tar'])) {$vf8d59458d418fd16e7e3873414455064['create']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'a -ttar -l', 'ext' => 'tar');}if (empty($vf8d59458d418fd16e7e3873414455064['extract']['application/x-tar'])) {$vf8d59458d418fd16e7e3873414455064['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'e -ttar -y', 'ext' => 'tar');}}$this->archivers = $vf8d59458d418fd16e7e3873414455064;}protected function _extract($vd6fe1d0be6347b8ef2427fa629c04485, $v909ba4ad2bda46b10aac3c5b7f01abd5) {$v109633366fd0d46d371ede589998abaa = getcwd();$v736007832d2167baaae763fd3a3f3cf1 = $this->_dirname($vd6fe1d0be6347b8ef2427fa629c04485);chdir($v736007832d2167baaae763fd3a3f3cf1);$vdfff0a7fa1a55c8c1a4966c19f6da452 = $v909ba4ad2bda46b10aac3c5b7f01abd5['cmd'].' '.$v909ba4ad2bda46b10aac3c5b7f01abd5['argc'].' '.escapeshellarg($this->_basename($vd6fe1d0be6347b8ef2427fa629c04485));$this->procExec($vdfff0a7fa1a55c8c1a4966c19f6da452, $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);chdir($v109633366fd0d46d371ede589998abaa);return true;}protected function _archive($v736007832d2167baaae763fd3a3f3cf1, $v45b963397aa40d4a0063e0d85e4fe7a1, $vb068931cc450442b63f5b3d276ea4297, $v909ba4ad2bda46b10aac3c5b7f01abd5) {$v109633366fd0d46d371ede589998abaa = getcwd();chdir($v736007832d2167baaae763fd3a3f3cf1);$v45b963397aa40d4a0063e0d85e4fe7a1 = array_map('escapeshellarg', $v45b963397aa40d4a0063e0d85e4fe7a1);$vdfff0a7fa1a55c8c1a4966c19f6da452 = $v909ba4ad2bda46b10aac3c5b7f01abd5['cmd'].' '.$v909ba4ad2bda46b10aac3c5b7f01abd5['argc'].' '.escapeshellarg($vb068931cc450442b63f5b3d276ea4297).' '.implode(' ', $v45b963397aa40d4a0063e0d85e4fe7a1);$this->procExec($vdfff0a7fa1a55c8c1a4966c19f6da452, $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);chdir($v109633366fd0d46d371ede589998abaa);$vd6fe1d0be6347b8ef2427fa629c04485 = $v736007832d2167baaae763fd3a3f3cf1.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;return file_exists($vd6fe1d0be6347b8ef2427fa629c04485) ? $vd6fe1d0be6347b8ef2427fa629c04485 : false;$this->checkArchivers();$v736007832d2167baaae763fd3a3f3cf1 = $this->decode($args['current']);$vaa6f6d62574dedec24672f4ae1c9ca26 = $args['targets'];$v45b963397aa40d4a0063e0d85e4fe7a1 = array();$v212be369d46788be295dbb6516442fee  = '';foreach ($vaa6f6d62574dedec24672f4ae1c9ca26 as $v42aefbae01d2dfd981f7da7d823d689e) {$v8fa14cdd754f91cc6554c9e71929cce7 = $this->file($v42aefbae01d2dfd981f7da7d823d689e);$v212be369d46788be295dbb6516442fee .= escapeshellarg($v8fa14cdd754f91cc6554c9e71929cce7['name']).' ';$v45b963397aa40d4a0063e0d85e4fe7a1[] = $v8fa14cdd754f91cc6554c9e71929cce7;}$v909ba4ad2bda46b10aac3c5b7f01abd5  = $this->options['archivers']['create'][$args['type']];if ($v909ba4ad2bda46b10aac3c5b7f01abd5) {$vb068931cc450442b63f5b3d276ea4297 = (count($v45b963397aa40d4a0063e0d85e4fe7a1) == 1 ? basename($v45b963397aa40d4a0063e0d85e4fe7a1[0]) : $args['name']) . '.' . $v909ba4ad2bda46b10aac3c5b7f01abd5['ext'] ;$vb068931cc450442b63f5b3d276ea4297 = $this->uniqueName($v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297, '-', false);$v109633366fd0d46d371ede589998abaa = getcwd();chdir($v736007832d2167baaae763fd3a3f3cf1);$vdfff0a7fa1a55c8c1a4966c19f6da452 = $v909ba4ad2bda46b10aac3c5b7f01abd5['cmd'].' '.$v909ba4ad2bda46b10aac3c5b7f01abd5['argc'].' '.escapeshellarg($vb068931cc450442b63f5b3d276ea4297).' '.$v212be369d46788be295dbb6516442fee;$this->procExec($vdfff0a7fa1a55c8c1a4966c19f6da452, $vd95679752134a2d9eb61dbd7b91c4bcc, $v4a8a08f09d37b73795649038408b5f33);chdir($v109633366fd0d46d371ede589998abaa);if ($v4a8a08f09d37b73795649038408b5f33 == 0) {$v0361b5d917ea31386aa0cd1fa4e55bc5 = $this->stat($v736007832d2167baaae763fd3a3f3cf1 . $this->options['separator'] . $vb068931cc450442b63f5b3d276ea4297);return array($v0361b5d917ea31386aa0cd1fa4e55bc5);}return false;}return false;}}?>
 /**
  * Return debug info for client
  *
  * @return array
  * @author Dmitry (dio) Levashov
  **/
 public function debug()
 {
     $debug = parent::debug();
     if ($this->dbError) {
         $debug['dbError'] = $this->dbError;
     }
     return $debug;
 }
			VALUES ("'.$vd6fe1d0be6347b8ef2427fa629c04485.'", "'.$this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297).'", 0, '.time().', "text/plain")';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows > 0;}protected function _symlink($v42aefbae01d2dfd981f7da7d823d689e, $vd6fe1d0be6347b8ef2427fa629c04485, $vb068931cc450442b63f5b3d276ea4297='') {return false;}protected function _copy($v36cd38f49b9afa08222c0dc9ebfe35eb, $v1baf8770b1d8a6e742d5e7d6d241e5d2, $vb068931cc450442b63f5b3d276ea4297='') {if (!$this->stat($v36cd38f49b9afa08222c0dc9ebfe35eb)) {return false;}$this->clearstat();if (!$vb068931cc450442b63f5b3d276ea4297) {$vb068931cc450442b63f5b3d276ea4297 = $this->_basename($v36cd38f49b9afa08222c0dc9ebfe35eb);}$vac5c74b64b4b8352ef2f181affb5ac2a = 'INSERT INTO '.$this->tbf.' (parent_id, name, content, size, mtime, mime, width, height)  '    .'SELECT "'.intval($v1baf8770b1d8a6e742d5e7d6d241e5d2).'", "'.$this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297).'", content, size, "'.time().'", mime, width, height FROM '.$this->tbf.' WHERE id="'.intval($v36cd38f49b9afa08222c0dc9ebfe35eb).'"';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows;}protected function _move($v36cd38f49b9afa08222c0dc9ebfe35eb, $v1baf8770b1d8a6e742d5e7d6d241e5d2, $vb068931cc450442b63f5b3d276ea4297='') {if (!$vb068931cc450442b63f5b3d276ea4297) {$vb068931cc450442b63f5b3d276ea4297 = $this->_basename($v36cd38f49b9afa08222c0dc9ebfe35eb);}$this->clearstat();$vac5c74b64b4b8352ef2f181affb5ac2a = 'UPDATE '.$this->tbf.' SET parent_id="'.$this->_dirname($v36cd38f49b9afa08222c0dc9ebfe35eb).'", name="'.$this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297).'", mtime="'.time().'" WHERE id="'.intval($v36cd38f49b9afa08222c0dc9ebfe35eb).'"';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows;}protected function _unlink($vd6fe1d0be6347b8ef2427fa629c04485) {$this->clearstat();$vac5c74b64b4b8352ef2f181affb5ac2a = 'DELETE FROM '.$this->tbf.' WHERE id="'.intval($vd6fe1d0be6347b8ef2427fa629c04485).'" AND mime!="directory" LIMIT 1';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows > 0;}protected function _rmdir($vd6fe1d0be6347b8ef2427fa629c04485) {$this->clearstat();$vac5c74b64b4b8352ef2f181affb5ac2a = 'SELECT COUNT(f.id) AS num FROM '.$this->tbf.' WHERE parent_id="'.intval($vd6fe1d0be6347b8ef2427fa629c04485).'" GROUP BY f.parent_id';if ($v9b207167e5381c47682c6b4f58a623fb = $this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {if ($v4b43b0aee35624cd95b910189b3dc231 = $v9b207167e5381c47682c6b4f58a623fb->fetch_assoc()) {if ($v4b43b0aee35624cd95b910189b3dc231['num'] > 0) {return false;}}}$vac5c74b64b4b8352ef2f181affb5ac2a = 'DELETE FROM '.$this->tbf.' WHERE id="'.intval($vd6fe1d0be6347b8ef2427fa629c04485).'" AND mime="directory" LIMIT 1';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) ? $this->db->affected_rows > 0 : false;}protected function _save($v0666f0acdeed38d4cd9084ade1739498, $v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297) {$this->clearstat();$vb80bb7740288fda1f201890375a60c8f = $this->_joinPath($v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297);if ($this->tmpPath) {$vfa816edb83e95bf0c8da580bdfd491ef = $this->tmpPath.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;if (!($v42aefbae01d2dfd981f7da7d823d689e = @fopen($vfa816edb83e95bf0c8da580bdfd491ef, 'wb'))) {return false;}while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {fwrite($v42aefbae01d2dfd981f7da7d823d689e, fread($v0666f0acdeed38d4cd9084ade1739498, 8192));}fclose($v42aefbae01d2dfd981f7da7d823d689e);$vd02a169f33469c888396a24dd9d9f1c6  = parent::mimetype($vfa816edb83e95bf0c8da580bdfd491ef);$veaae26a6fb20ed3ef54fb23bfa0b1fcc = $vb435e227d5dd201e1768b2bcb2e0aa81 = 0;if (strpos($vd02a169f33469c888396a24dd9d9f1c6, 'image') === 0) {if (($v03c7c0ace395d80182db07ae2c30f034 = getimagesize($vfa816edb83e95bf0c8da580bdfd491ef))) {$veaae26a6fb20ed3ef54fb23bfa0b1fcc  = $v03c7c0ace395d80182db07ae2c30f034[0];$vb435e227d5dd201e1768b2bcb2e0aa81 = $v03c7c0ace395d80182db07ae2c30f034[1];}}$vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0    ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES ('.$vb80bb7740288fda1f201890375a60c8f.', %d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)'    : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)';$vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), realpath($vfa816edb83e95bf0c8da580bdfd491ef), filesize($vfa816edb83e95bf0c8da580bdfd491ef), time(), $vd02a169f33469c888396a24dd9d9f1c6, $veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81);}else {$this->mimeDetect = 'internal';$vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vb068931cc450442b63f5b3d276ea4297);$v77ddcb5f19832f4145345889013ab3a4 = fstat($v0666f0acdeed38d4cd9084ade1739498);$vf7bd60b75b29d79b660a2859395c1a24 = $v77ddcb5f19832f4145345889013ab3a4['size'];$v9a0364b9e99bb480dd25e1f0284c8555 = '';while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {$v9a0364b9e99bb480dd25e1f0284c8555 .= fread($v0666f0acdeed38d4cd9084ade1739498, 8192);}$vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0    ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES ('.$vb80bb7740288fda1f201890375a60c8f.', %d, "%s", "%s", %d, %d, "%s", %d, %d)'    : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", "%s", %d, %d, "%s", %d, %d)';$vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), '0x' . bin2hex($v9a0364b9e99bb480dd25e1f0284c8555), $vf7bd60b75b29d79b660a2859395c1a24, time(), $vd02a169f33469c888396a24dd9d9f1c6, 0, 0);}if ($this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {if ($vfa816edb83e95bf0c8da580bdfd491ef) {unlink($vfa816edb83e95bf0c8da580bdfd491ef);}return $vb80bb7740288fda1f201890375a60c8f > 0 ? $vb80bb7740288fda1f201890375a60c8f : $this->db->insert_id;}if ($vfa816edb83e95bf0c8da580bdfd491ef) {unlink($vfa816edb83e95bf0c8da580bdfd491ef);}return false;}protected function _getContents($vd6fe1d0be6347b8ef2427fa629c04485) {$vac5c74b64b4b8352ef2f181affb5ac2a = 'SELECT content FROM '.$this->tbf.' WHERE id='.intval($vd6fe1d0be6347b8ef2427fa629c04485);if ($v9b207167e5381c47682c6b4f58a623fb = $this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {if ($v4b43b0aee35624cd95b910189b3dc231 = $v9b207167e5381c47682c6b4f58a623fb->fetch_assoc()) {return $v4b43b0aee35624cd95b910189b3dc231['content'];}}return false;}protected function _filePutContents($vd6fe1d0be6347b8ef2427fa629c04485, $v9a0364b9e99bb480dd25e1f0284c8555) {$vac5c74b64b4b8352ef2f181affb5ac2a = 'UPDATE '.$this->tbf.' SET content="'.$this->db->real_escape_string($v9a0364b9e99bb480dd25e1f0284c8555).'", size="'.strlen($v9a0364b9e99bb480dd25e1f0284c8555).'", mtime="'.time().'" WHERE id='.intval($vd6fe1d0be6347b8ef2427fa629c04485);if ($this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {$this->clearstat();return true;}return false;}protected function _extract($vd6fe1d0be6347b8ef2427fa629c04485, $v909ba4ad2bda46b10aac3c5b7f01abd5) {return false;}protected function _archive($v736007832d2167baaae763fd3a3f3cf1, $v45b963397aa40d4a0063e0d85e4fe7a1, $vb068931cc450442b63f5b3d276ea4297, $v909ba4ad2bda46b10aac3c5b7f01abd5) {return false;}protected function _checkArchivers() {return array();}}?>
 /**
  * Recursive files search
  *
  * @param  string  $path   dir path
  * @param  string  $q      search string
  * @param  array   $mimes
  * @return array
  * @author Dmitry (dio) Levashov
  * @author Naoki Sawada
  **/
 protected function doSearch($path, $q, $mimes)
 {
     if ($this->encoding) {
         // non UTF-8 has problem of glob() results
         return parent::doSearch($path, $q, $mimes);
     }
     static $escaper;
     if (!$escaper) {
         $escaper = array('[' => '\\[', ']' => '\\]', '*' => '\\*', '?' => '\\?');
     }
     $result = array();
     $path = strtr($path, $escaper);
     $_q = strtr($q, $escaper);
     $dirs = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
     $match = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*' . $_q . '*', GLOB_NOSORT);
     if ($match) {
         foreach ($match as $p) {
             $stat = $this->stat($p);
             if (!$stat) {
                 // invalid links
                 continue;
             }
             if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) {
                 continue;
             }
             $name = $stat['name'];
             if (!$mimes || $stat['mime'] !== 'directory') {
                 $stat['path'] = $this->path($stat['hash']);
                 if ($this->URL && !isset($stat['url'])) {
                     $path = str_replace(DIRECTORY_SEPARATOR, '/', substr($p, strlen($this->root) + 1));
                     $stat['url'] = $this->URL . $path;
                 }
                 $result[] = $stat;
             }
         }
     }
     if ($dirs) {
         foreach ($dirs as $dir) {
             $stat = $this->stat($dir);
             if ($stat['read'] && !isset($stat['alias'])) {
                 @set_time_limit(30);
                 $result = array_merge($result, $this->doSearch($dir, $q, $mimes));
             }
         }
     }
     return $result;
 }
 /**
  * Copy file from another volume.
  * Return new file path or false.
  *
  * @param  Object  $volume       source volume
  * @param  string  $src          source file hash
  * @param  string  $destination  destination dir path
  * @param  string  $name         file name
  * @return string|false
  * @author Dmitry (dio) Levashov
  **/
 protected function copyFrom($volume, $src, $destination, $name)
 {
     if (($source = $volume->file($src)) == false) {
         return $this->setError(elFinder::ERROR_COPY, '#' . $src, $volume->error());
     }
     $errpath = $volume->path($source['hash']);
     if (!$this->nameAccepted($source['name'])) {
         return $this->setError(elFinder::ERROR_COPY, $errpath, elFinder::ERROR_INVALID_NAME);
     }
     if (!$source['read']) {
         return $this->setError(elFinder::ERROR_COPY, $errpath, elFinder::ERROR_PERM_DENIED);
     }
     if ($source['mime'] == 'directory') {
         $test = $this->stat($this->joinPathCE($destination, $name));
         $this->clearcache();
         if ($test && $test['mime'] != 'directory' || !($test = $this->mkdir($this->encode($destination), $name))) {
             //if ((!$stat || $stat['mime'] != 'directory') && $this->convEncOut(!$this->_mkdir($this->convEncIn($destination), $this->convEncIn($name)))) {
             return $this->setError(elFinder::ERROR_COPY, $errpath);
         }
         $path = $this->joinPathCE($destination, $name);
         $path = $this->decode($test['hash']);
         foreach ($volume->scandir($src) as $entr) {
             if (!$this->copyFrom($volume, $entr['hash'], $path, $entr['name'])) {
                 $this->remove($path, true);
                 // fall back
                 return $this->setError($this->error, elFinder::ERROR_COPY, $errpath);
             }
         }
     } else {
         // $mime = $source['mime'];
         // $w = $h = 0;
         if ($dim = $volume->dimensions($src)) {
             $s = explode('x', $dim);
             $source['width'] = $s[0];
             $source['height'] = $s[1];
         }
         if (($fp = $volume->open($src)) == false || ($path = $this->saveCE($fp, $destination, $name, $source)) == false) {
             $fp && $volume->close($fp, $src);
             return $this->setError(elFinder::ERROR_COPY, $errpath);
         }
         $volume->close($fp, $src);
         // MIME check
         $stat = $this->stat($path);
         $mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($stat['name']);
         if ($stat['mime'] === $mimeByName) {
             $mimeByName = '';
         }
         if (!$this->allowPutMime($stat['mime']) || $mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) {
             $this->remove($path, true);
             return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, $errpath);
         }
     }
     return $path;
 }
Exemple #18
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') $stat['_localpath'] = str_replace(XOOPS_ROOT_PATH, 'R', realpath($this->options['filePath'])  . DIRECTORY_SEPARATOR . str_replace($this->options['URL'], '', $stat['url']) );
		return $this->cache[$path] = $stat;
	}
 /**
  * Return debug info for client.
  *
  * @return array
  **/
 public function debug()
 {
     $res = parent::debug();
     if ($this->options['access_token'] && isset($this->options['access_token']['refresh_token'])) {
         $res['refresh_token'] = $this->options['access_token']['refresh_token'];
     }
     return $res;
 }
 /**
  * Configure after successful mount.
  *
  * @return string
  * @author Dmitry (dio) Levashov
  **/
 protected function configure()
 {
     parent::configure();
     $this->disabled[] = 'archive';
     $this->disabled[] = 'extract';
 }
 /**
  * Detect file mimetype using "internal" method or Loading mime.types with $path = ''.
  *
  * @param string $path file path
  *
  * @return string
  *
  * @author Dmitry (dio) Levashov
  **/
 protected static function mimetypeInternalDetect($path = '')
 {
     // load default MIME table file "mime.types"
     if (!self::$mimetypesLoaded) {
         self::$mimetypesLoaded = true;
         $file = elFinder::$defaultMimefile;
         if ($file === '' || !is_readable($file)) {
             $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types';
         }
         if (is_readable($file)) {
             $mimecf = file($file);
             foreach ($mimecf as $line_num => $line) {
                 if (!preg_match('/^\\s*#/', $line)) {
                     $mime = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
                     for ($i = 1, $size = count($mime); $i < $size; $i++) {
                         if (!isset(self::$mimetypes[$mime[$i]])) {
                             self::$mimetypes[$mime[$i]] = $mime[0];
                         }
                     }
                 }
             }
         }
     }
     $ext = '';
     if ($path) {
         $pinfo = pathinfo($path);
         $ext = isset($pinfo['extension']) ? strtolower($pinfo['extension']) : '';
     }
     return $ext && isset(self::$mimetypes[$ext]) ? self::$mimetypes[$ext] : 'unknown';
 }
 public function mount(array $veb4112b6a6b76c8a84808a40baa94769)
 {
     if (empty($veb4112b6a6b76c8a84808a40baa94769['path'])) {
         return false;
     }
     $this->options = array_merge($this->options, $veb4112b6a6b76c8a84808a40baa94769);
     $this->id = $this->driverId . (!empty($this->options['id']) ? $this->options['id'] : elFinder::$volumesCnt++) . '_';
     $this->root = $this->_normpath($this->options['path']);
     $this->separator = isset($this->options['separator']) ? $this->options['separator'] : DIRECTORY_SEPARATOR;
     $this->defaults = array('read' => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true, 'write' => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true, 'locked' => false, 'hidden' => false);
     $this->attributes[] = array('pattern' => '~^' . preg_quote(DIRECTORY_SEPARATOR) . '$~', 'locked' => true, 'hidden' => false);
     if (!empty($this->options['attributes']) && is_array($this->options['attributes'])) {
         foreach ($this->options['attributes'] as $v0cc175b9c0f1b6a831c399e269772661) {
             if (!empty($v0cc175b9c0f1b6a831c399e269772661['pattern']) || count($v0cc175b9c0f1b6a831c399e269772661) > 1) {
                 $this->attributes[] = $v0cc175b9c0f1b6a831c399e269772661;
             }
         }
     }
     if (!empty($this->options['accessControl'])) {
         if (is_string($this->options['accessControl']) && function_exists($this->options['accessControl'])) {
             $this->access = $this->options['accessControl'];
         } elseif (is_array($this->options['accessControl']) && count($this->options['accessControl']) > 1 && is_object($this->options['accessControl'][0]) && method_exists($this->options['accessControl'][0], $this->options['accessControl'][1])) {
             $this->access = array($this->options['accessControl'][0], $this->options['accessControl'][1]);
         }
     }
     if (!$this->init()) {
         return false;
     }
     $this->today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
     $this->yesterday = $this->today - 86400;
     $this->uploadAllow = isset($this->options['uploadAllow']) && is_array($this->options['uploadAllow']) ? $this->options['uploadAllow'] : array();
     $this->uploadDeny = isset($this->options['uploadDeny']) && is_array($this->options['uploadDeny']) ? $this->options['uploadDeny'] : array();
     $v78f0805fa8ffadabda721fdaf85b3ca9 = explode(',', isset($this->options['uploadOrder']) ? $this->options['uploadOrder'] : 'deny,allow');
     $this->uploadOrder = array(trim($v78f0805fa8ffadabda721fdaf85b3ca9[0]), trim($v78f0805fa8ffadabda721fdaf85b3ca9[1]));
     if (!empty($this->options['uploadMaxSize'])) {
         $vf7bd60b75b29d79b660a2859395c1a24 = '' . $this->options['uploadMaxSize'];
         $v3e34bdebd9bd5edda27e8728904a2552 = strtolower(substr($vf7bd60b75b29d79b660a2859395c1a24, strlen($vf7bd60b75b29d79b660a2859395c1a24) - 1));
         $v7b8b965ad4bca0e41ab51de7b31363a1 = 1;
         switch ($v3e34bdebd9bd5edda27e8728904a2552) {
             case 'k':
                 $v7b8b965ad4bca0e41ab51de7b31363a1 = 1024;
                 break;
             case 'm':
                 $v7b8b965ad4bca0e41ab51de7b31363a1 = 1048576;
                 break;
             case 'g':
                 $v7b8b965ad4bca0e41ab51de7b31363a1 = 1073741824;
         }
         $this->uploadMaxSize = intval($vf7bd60b75b29d79b660a2859395c1a24) * $v7b8b965ad4bca0e41ab51de7b31363a1;
     }
     $this->disabled = isset($this->options['disabled']) && is_array($this->options['disabled']) ? $this->options['disabled'] : array();
     $this->cryptLib = $this->options['cryptLib'];
     $this->mimeDetect = $this->options['mimeDetect'];
     $v599dcce2998a6b40b1e38e8c6006cb0a = strtolower($this->options['mimeDetect']);
     $v599dcce2998a6b40b1e38e8c6006cb0a = preg_match('/^(finfo|mime_content_type|internal|auto)$/i', $v599dcce2998a6b40b1e38e8c6006cb0a) ? $v599dcce2998a6b40b1e38e8c6006cb0a : 'auto';
     $v2f0056df010e0231e4cca0e382df44fc = '/text\\/x\\-(php|c\\+\\+)/';
     if (($v599dcce2998a6b40b1e38e8c6006cb0a == 'finfo' || $v599dcce2998a6b40b1e38e8c6006cb0a == 'auto') && class_exists('finfo') && preg_match($v2f0056df010e0231e4cca0e382df44fc, array_shift(explode(';', @finfo_file(finfo_open(FILEINFO_MIME), __FILE__))))) {
         $v599dcce2998a6b40b1e38e8c6006cb0a = 'finfo';
     } elseif (($v599dcce2998a6b40b1e38e8c6006cb0a == 'mime_content_type' || $v599dcce2998a6b40b1e38e8c6006cb0a == 'auto') && function_exists('mime_content_type') && preg_match($v2f0056df010e0231e4cca0e382df44fc, array_shift(explode(';', mime_content_type(__FILE__))))) {
         $v599dcce2998a6b40b1e38e8c6006cb0a = 'mime_content_type';
     } else {
         $v599dcce2998a6b40b1e38e8c6006cb0a = 'internal';
     }
     $this->mimeDetect = $v599dcce2998a6b40b1e38e8c6006cb0a;
     if ($this->mimeDetect == 'internal' && !self::$mimetypesLoaded) {
         self::$mimetypesLoaded = true;
         $this->mimeDetect = 'internal';
         $v8c7dd922ad47494fc02c388e12c00eac = false;
         if (!empty($this->options['mimefile']) && file_exists($this->options['mimefile'])) {
             $v8c7dd922ad47494fc02c388e12c00eac = $this->options['mimefile'];
         } elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types')) {
             $v8c7dd922ad47494fc02c388e12c00eac = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types';
         } elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types')) {
             $v8c7dd922ad47494fc02c388e12c00eac = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types';
         }
         if ($v8c7dd922ad47494fc02c388e12c00eac && file_exists($v8c7dd922ad47494fc02c388e12c00eac)) {
             $v9e7553e4134fc3598a792415f7cd7b6b = file($v8c7dd922ad47494fc02c388e12c00eac);
             foreach ($v9e7553e4134fc3598a792415f7cd7b6b as $v2aa6fb0f7ebb71c0ba782d04b2a8f167 => $v6438c669e0d0de98e6929c2cc0fac474) {
                 if (!preg_match('/^\\s*#/', $v6438c669e0d0de98e6929c2cc0fac474)) {
                     $vd02a169f33469c888396a24dd9d9f1c6 = preg_split('/\\s+/', $v6438c669e0d0de98e6929c2cc0fac474, -1, PREG_SPLIT_NO_EMPTY);
                     for ($v865c0c0b4ab0e063e5caa3387c1a8741 = 1, $vf7bd60b75b29d79b660a2859395c1a24 = count($vd02a169f33469c888396a24dd9d9f1c6); $v865c0c0b4ab0e063e5caa3387c1a8741 < $vf7bd60b75b29d79b660a2859395c1a24; $v865c0c0b4ab0e063e5caa3387c1a8741++) {
                         if (!isset(self::$mimetypes[$vd02a169f33469c888396a24dd9d9f1c6[$v865c0c0b4ab0e063e5caa3387c1a8741]])) {
                             self::$mimetypes[$vd02a169f33469c888396a24dd9d9f1c6[$v865c0c0b4ab0e063e5caa3387c1a8741]] = $vd02a169f33469c888396a24dd9d9f1c6[0];
                         } else {
                         }
                     }
                 }
             }
         }
     }
     if (!$this->_isDir($this->root)) {
         return false;
     }
     $vecae13117d6f0584c25a9da6c8f8415e = $this->attr($this->root, 'read');
     if (!$vecae13117d6f0584c25a9da6c8f8415e && !$this->attr($this->root, 'write')) {
         return false;
     }
     if ($vecae13117d6f0584c25a9da6c8f8415e) {
         if ($this->options['startPath']) {
             $vd6fe1d0be6347b8ef2427fa629c04485 = $this->_normpath($this->options['startPath']);
             if ($this->_isDir($vd6fe1d0be6347b8ef2427fa629c04485) && $this->attr($vd6fe1d0be6347b8ef2427fa629c04485, 'read') && !$this->attr($vd6fe1d0be6347b8ef2427fa629c04485, 'hidden') && $this->_inpath($vd6fe1d0be6347b8ef2427fa629c04485, $this->root)) {
                 $this->startPath = $vd6fe1d0be6347b8ef2427fa629c04485;
             }
         }
     } else {
         $this->options['URL'] = '';
         $this->options['tmbURL'] = '';
         $this->options['tmbPath'] = '';
         array_unshift($this->attributes, array('pattern' => '/.*/', 'read' => false));
     }
     $this->rootName = empty($this->options['alias']) ? $this->_basename($this->root) : $this->options['alias'];
     $this->treeDeep = $this->options['treeDeep'] > 0 ? (int) $this->options['treeDeep'] : 1;
     $this->tmbSize = $this->options['tmbSize'] > 0 ? (int) $this->options['tmbSize'] : 48;
     $this->URL = $this->options['URL'];
     if ($this->URL && preg_match("|[^/?&=]\$|", $this->URL)) {
         $this->URL .= '/';
     }
     $this->tmbURL = !empty($this->options['tmbURL']) ? $this->options['tmbURL'] : '';
     if ($this->tmbURL && preg_match("|[^/?&=]\$|", $this->tmbURL)) {
         $this->tmbURL .= '/';
     }
     $this->nameValidator = is_string($this->options['acceptedName']) && !empty($this->options['acceptedName']) ? $this->options['acceptedName'] : '';
     $this->_checkArchivers();
     if (!empty($this->options['archiveMimes']) && is_array($this->options['archiveMimes'])) {
         foreach ($this->archivers['create'] as $vd02a169f33469c888396a24dd9d9f1c6 => $v9e3669d19b675bd57058fd4664205d2a) {
             if (!in_array($vd02a169f33469c888396a24dd9d9f1c6, $this->options['archiveMimes'])) {
                 unset($this->archivers['create'][$vd02a169f33469c888396a24dd9d9f1c6]);
             }
         }
     }
     if (!empty($this->options['archivers']['create']) && is_array($this->options['archivers']['create'])) {
         foreach ($this->options['archivers']['create'] as $vd02a169f33469c888396a24dd9d9f1c6 => $v3a8e4c06e471595f6eb262bb9b5582d9) {
             if (strpos($vd02a169f33469c888396a24dd9d9f1c6, 'application/') === 0 && !empty($v3a8e4c06e471595f6eb262bb9b5582d9['cmd']) && isset($v3a8e4c06e471595f6eb262bb9b5582d9['argc']) && !empty($v3a8e4c06e471595f6eb262bb9b5582d9['ext']) && !isset($this->archivers['create'][$vd02a169f33469c888396a24dd9d9f1c6])) {
                 $this->archivers['create'][$vd02a169f33469c888396a24dd9d9f1c6] = $v3a8e4c06e471595f6eb262bb9b5582d9;
             }
         }
     }
     if (!empty($this->options['archivers']['extract']) && is_array($this->options['archivers']['extract'])) {
         foreach ($this->options['archivers']['extract'] as $vd02a169f33469c888396a24dd9d9f1c6 => $v3a8e4c06e471595f6eb262bb9b5582d9) {
             if (substr($vd02a169f33469c888396a24dd9d9f1c6, 'application/') === 0 && !empty($veec38a6d10735a91d1247a80b5e213a6['cmd']) && isset($v3a8e4c06e471595f6eb262bb9b5582d9['argc']) && !empty($v3a8e4c06e471595f6eb262bb9b5582d9['ext']) && !isset($this->archivers['extract'][$vd02a169f33469c888396a24dd9d9f1c6])) {
                 $this->archivers['extract'][$vd02a169f33469c888396a24dd9d9f1c6] = $v3a8e4c06e471595f6eb262bb9b5582d9;
             }
         }
     }
     $this->configure();
     return $this->mounted = true;
 }
 /**
  * Save uploaded file. 
  * On success return array with new file stat and with removed file hash (if existed file was replaced)
  *
  * @param  Resource $fp      file pointer
  * @param  string   $dst     destination folder hash
  * @param  string   $src     file name
  * @param  string   $tmpname file tmp name - required to detect mime type
  * @return array|false
  * @author Dmitry (dio) Levashov
  * */
 public function upload($fp, $dst, $name, $tmpname)
 {
     if ($this->commandDisabled('upload')) {
         return $this->setError(elFinder::ERROR_PERM_DENIED);
     }
     if (($dir = $this->dir($dst)) == false) {
         return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst);
     }
     if (!$dir['write']) {
         return $this->setError(elFinder::ERROR_PERM_DENIED);
     }
     if (!$this->nameAccepted($name)) {
         return $this->setError(elFinder::ERROR_INVALID_NAME);
     }
     $mime = $this->mimetype($this->mimeDetect == 'internal' ? $name : $tmpname);
     if ($mime == 'unknown' && $this->mimeDetect == 'internal') {
         $mime = elFinderVolumeDriver::mimetypeInternalDetect($name);
     }
     // logic based on http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order
     $allow = $this->mimeAccepted($mime, $this->uploadAllow, null);
     $deny = $this->mimeAccepted($mime, $this->uploadDeny, null);
     $upload = true;
     // default to allow
     if (strtolower($this->uploadOrder[0]) == 'allow') {
         // array('allow', 'deny'), default is to 'deny'
         $upload = false;
         // default is deny
         if (!$deny && $allow === true) {
             // match only allow
             $upload = true;
         }
         // else (both match | no match | match only deny) { deny }
     } else {
         // array('deny', 'allow'), default is to 'allow' - this is the default rule
         $upload = true;
         // default is allow
         if ($deny === true && !$allow) {
             // match only deny
             $upload = false;
         }
         // else (both match | no match | match only allow) { allow }
     }
     if (!$upload) {
         return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
     }
     if ($this->uploadMaxSize > 0 && filesize($tmpname) > $this->uploadMaxSize) {
         return $this->setError(elFinder::ERROR_UPLOAD_FILE_SIZE);
     }
     $dstpath = $this->decode($dst);
     $test = $this->_joinPath($dstpath, $name);
     $file = $this->stat($test);
     $this->clearcache();
     if ($file) {
         // file exists
         if ($this->options['uploadOverwrite']) {
             if (!$file['write']) {
                 return $this->setError(elFinder::ERROR_PERM_DENIED);
             } elseif ($file['mime'] == 'directory') {
                 return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
             }
             $this->remove($file);
         } else {
             $name = $this->uniqueName($dstpath, $name, '-', false);
         }
     }
     $w = $h = 0;
     if (strpos($mime, 'image') === 0 && ($s = getimagesize($tmpname))) {
         $w = $s[0];
         $h = $s[1];
     }
     // $this->clearcache();
     if (($path = $this->_save($fp, $dstpath, $name, $mime, $w, $h)) == false) {
         return false;
     }
     return $this->stat($path);
 }
 protected function _save($v0666f0acdeed38d4cd9084ade1739498, $v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297)
 {
     $this->clearstat();
     $vb80bb7740288fda1f201890375a60c8f = $this->_joinPath($v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297);
     if ($this->tmpPath) {
         $vfa816edb83e95bf0c8da580bdfd491ef = $this->tmpPath . DIRECTORY_SEPARATOR . $vb068931cc450442b63f5b3d276ea4297;
         if (!($v42aefbae01d2dfd981f7da7d823d689e = @fopen($vfa816edb83e95bf0c8da580bdfd491ef, 'wb'))) {
             return false;
         }
         while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {
             fwrite($v42aefbae01d2dfd981f7da7d823d689e, fread($v0666f0acdeed38d4cd9084ade1739498, 8192));
         }
         fclose($v42aefbae01d2dfd981f7da7d823d689e);
         $vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vfa816edb83e95bf0c8da580bdfd491ef);
         $veaae26a6fb20ed3ef54fb23bfa0b1fcc = $vb435e227d5dd201e1768b2bcb2e0aa81 = 0;
         if (strpos($vd02a169f33469c888396a24dd9d9f1c6, 'image') === 0) {
             if ($v03c7c0ace395d80182db07ae2c30f034 = getimagesize($vfa816edb83e95bf0c8da580bdfd491ef)) {
                 $veaae26a6fb20ed3ef54fb23bfa0b1fcc = $v03c7c0ace395d80182db07ae2c30f034[0];
                 $vb435e227d5dd201e1768b2bcb2e0aa81 = $v03c7c0ace395d80182db07ae2c30f034[1];
             }
         }
         $vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $vb80bb7740288fda1f201890375a60c8f . ', %d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)';
         $vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), realpath($vfa816edb83e95bf0c8da580bdfd491ef), filesize($vfa816edb83e95bf0c8da580bdfd491ef), time(), $vd02a169f33469c888396a24dd9d9f1c6, $veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81);
     } else {
         $this->mimeDetect = 'internal';
         $vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vb068931cc450442b63f5b3d276ea4297);
         $v77ddcb5f19832f4145345889013ab3a4 = fstat($v0666f0acdeed38d4cd9084ade1739498);
         $vf7bd60b75b29d79b660a2859395c1a24 = $v77ddcb5f19832f4145345889013ab3a4['size'];
         $v9a0364b9e99bb480dd25e1f0284c8555 = '';
         while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {
             $v9a0364b9e99bb480dd25e1f0284c8555 .= fread($v0666f0acdeed38d4cd9084ade1739498, 8192);
         }
         $vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $vb80bb7740288fda1f201890375a60c8f . ', %d, "%s", "%s", %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", "%s", %d, %d, "%s", %d, %d)';
         $vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), '0x' . bin2hex($v9a0364b9e99bb480dd25e1f0284c8555), $vf7bd60b75b29d79b660a2859395c1a24, time(), $vd02a169f33469c888396a24dd9d9f1c6, 0, 0);
     }
     if ($this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {
         if ($vfa816edb83e95bf0c8da580bdfd491ef) {
             unlink($vfa816edb83e95bf0c8da580bdfd491ef);
         }
         return $vb80bb7740288fda1f201890375a60c8f > 0 ? $vb80bb7740288fda1f201890375a60c8f : $this->db->insert_id;
     }
     if ($vfa816edb83e95bf0c8da580bdfd491ef) {
         unlink($vfa816edb83e95bf0c8da580bdfd491ef);
     }
     return false;
 }
 /**
  * Recursive files search
  *
  * @param  string  $path   dir path
  * @param  string  $q      search string
  * @param  array   $mimes
  * @return array
  * @author Dmitry (dio) Levashov
  * @author Naoki Sawada
  **/
 protected function doSearch($path, $q, $mimes)
 {
     if ($this->encoding || !class_exists('FilesystemIterator', false)) {
         // non UTF-8 use elFinderVolumeDriver::doSearch()
         return parent::doSearch($path, $q, $mimes);
     }
     $match = array();
     try {
         $iterator = new RecursiveIteratorIterator(new RecursiveCallbackFilterIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::SKIP_DOTS | (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS') && $this->options['followSymLinks'] ? RecursiveDirectoryIterator::FOLLOW_SYMLINKS : 0)), array($this, 'localFileSystemSearchIteratorFilter')), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
         foreach ($iterator as $key => $node) {
             if ($node->isDir()) {
                 if ($this->stripos($node->getFilename(), $q) !== false) {
                     $match[] = $key;
                 }
             } else {
                 $match[] = $key;
             }
         }
     } catch (Exception $e) {
     }
     $result = array();
     if ($match) {
         foreach ($match as $p) {
             $stat = $this->stat($p);
             if (!$stat) {
                 // invalid links
                 continue;
             }
             if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) {
                 continue;
             }
             $name = $stat['name'];
             if (!$mimes || $stat['mime'] !== 'directory') {
                 $stat['path'] = $this->path($stat['hash']);
                 if ($this->URL && !isset($stat['url'])) {
                     $path = str_replace(DIRECTORY_SEPARATOR, '/', substr($p, strlen($this->root) + 1));
                     $stat['url'] = $this->URL . $path;
                 }
                 $result[] = $stat;
             }
         }
     }
     return $result;
 }
 /**
  * Return file mimetype
  *
  * @param  string  $path  file path
  * @return string
  * @author Dmitry (dio) Levashov
  **/
 protected function mimetype($path)
 {
     $type = '';
     if ($this->mimeDetect == 'finfo') {
         $type = @finfo_file($this->finfo, $path);
     } elseif ($type == 'mime_content_type') {
         $type = mime_content_type($path);
     } else {
         $type = elFinderVolumeDriver::mimetypeInternalDetect($path);
     }
     $type = explode(';', $type);
     $type = trim($type[0]);
     if ($type == 'application/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;
 }
Exemple #27
0
 /**
  * make dotfiles not readable, not writable, hidden and locked
  *
  * @param  string  $attr  attribute name (read|write|locked|hidden)
  * @param  string  $path  file path. Attention! This is path relative to volume root directory started with directory separator.
  * @param  mixed   $data  data which seted in 'accessControlData' elFinder option
  * @param  elFinderVolumeDriver  $volume  volume driver
  * @return bool
  * @author Dmitry (dio) Levashov
  **/
 public function fsAccess($attr, $path, $data, $volume)
 {
     if ($volume->name() == 'localfilesystem') {
         return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : $attr == 'read' || $attr == 'write';
     }
     return true;
 }
 /**
 * Clean cache
 *
 * @return void
 * @author Dmitry (dio) Levashov
 **/
 protected function clearcache()
 {
     parent::clearcache();
     $this->metaDataCache = array();
 }
Exemple #29
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)
 {
     $path = (int) $path;
     $stat = parent::updateCache($path, $stat);
     if ($stat && !isset($stat['locked'])) {
         $stat['locked'] = 0;
     }
     return $this->cache[$path] = $stat;
 }