本文整理汇总了PHP中elFinderVolumeDriver类的典型用法代码示例。如果您正苦于以下问题:PHP elFinderVolumeDriver类的具体用法?PHP elFinderVolumeDriver怎么用?PHP elFinderVolumeDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了elFinderVolumeDriver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _findSymlinks
/**
* 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;
}
开发者ID:blrik,项目名称:bWorld,代码行数:32,代码来源:elFinderVolumeLocalFileSystem.class.php
示例2: mimetype
/**
* 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;
}
开发者ID:radumargina,项目名称:webstyle-antcr,代码行数:49,代码来源:elFinderVolumeDriver.class.php
示例3: __construct
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;}}?>
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:1,代码来源:elFinderVolumeLocalFileSystem.class.php
示例4: copyFrom
/**
* 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;
}
开发者ID:lalusaud,项目名称:mysite,代码行数:65,代码来源:elFinderVolumeDriver.class.php
示例5: upload
/**
* 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);
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:87,代码来源:elFinderVolumeDriver.php
示例6: doSearch
/**
* 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;
}
开发者ID:lalusaud,项目名称:mysite,代码行数:54,代码来源:elFinderVolumeLocalFileSystem.class.php
示例7: mimetype
/**
* 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;
}
开发者ID:serhatozles,项目名称:yii2-elfinder,代码行数:28,代码来源:elFinderVolumeDriver.class.php
示例8: fsAccess
/**
* 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;
}
开发者ID:bamboo0079,项目名称:shopcart,代码行数:17,代码来源:connector.php
示例9: configure
/**
* 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';
}
}
开发者ID:rb26,项目名称:zenphoto,代码行数:39,代码来源:elFinderVolumeLocalFileSystem.class.php
示例10: configure
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';
}
开发者ID:DrudgeRajen,项目名称:laravel-media-manager,代码行数:10,代码来源:elFinderVolumeS3.class.php
示例11: configure
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';
}
开发者ID:vkirpa,项目名称:elFinder,代码行数:14,代码来源:elFinderVolumeS3.class.php
示例12: configure
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);
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:16,代码来源:elFinderVolumeLocalFileSystem.class.php
示例13: configure
/**
* 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';
}
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:26,代码来源:elFinderVolumeLocalFileSystem.class.php
示例14: debug
/**
* 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;
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:15,代码来源:elFinderVolumeMySQL.class.php
示例15: mount
/**
* "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_c
|
请发表评论