mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
src build elFinder-2.1-d7fe38b
This commit is contained in:
@@ -75,15 +75,14 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
* @var string
|
||||
*/
|
||||
private $cacheDirTarget = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Extend options with required fields
|
||||
*
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
* @author Cem (DiscoFever)
|
||||
**/
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Extend options with required fields
|
||||
*
|
||||
* @author Dmitry (dio) Levashov
|
||||
* @author Cem (DiscoFever)
|
||||
*/
|
||||
public function __construct() {
|
||||
$opts = array(
|
||||
'host' => 'localhost',
|
||||
@@ -104,14 +103,15 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
$this->options = array_merge($this->options, $opts);
|
||||
$this->options['mimeDetect'] = 'internal';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare
|
||||
* Call from elFinder::netmout() before volume->mount()
|
||||
*
|
||||
* @return Array
|
||||
* @author Naoki Sawada
|
||||
**/
|
||||
|
||||
/**
|
||||
* Prepare
|
||||
* Call from elFinder::netmout() before volume->mount()
|
||||
*
|
||||
* @param $options
|
||||
* @return Array
|
||||
* @author Naoki Sawada
|
||||
*/
|
||||
public function netmountPrepare($options) {
|
||||
if (!empty($_REQUEST['encoding']) && @iconv('UTF-8', $_REQUEST['encoding'], '') !== false) {
|
||||
$options['encoding'] = $_REQUEST['encoding'];
|
||||
@@ -293,13 +293,15 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse line from ftp_rawlist() output and return file stat (array)
|
||||
*
|
||||
* @param string $raw line from ftp_rawlist() output
|
||||
* @return array
|
||||
* @author Dmitry Levashov
|
||||
**/
|
||||
/**
|
||||
* Parse line from ftp_rawlist() output and return file stat (array)
|
||||
*
|
||||
* @param string $raw line from ftp_rawlist() output
|
||||
* @param $base
|
||||
* @param bool $nameOnly
|
||||
* @return array
|
||||
* @author Dmitry Levashov
|
||||
*/
|
||||
protected function parseRaw($raw, $base, $nameOnly = false) {
|
||||
$info = preg_split("/\s+/", $raw, 9);
|
||||
$stat = array();
|
||||
@@ -391,14 +393,15 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse permissions string. Return array(read => true/false, write => true/false)
|
||||
*
|
||||
* @param string $perm permissions string
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
|
||||
/**
|
||||
* Parse permissions string. Return array(read => true/false, write => true/false)
|
||||
*
|
||||
* @param string $perm permissions string
|
||||
* @param string $user
|
||||
* @return string
|
||||
* @author Dmitry (dio) Levashov
|
||||
*/
|
||||
protected function parsePermissions($perm, $user = '') {
|
||||
$res = array();
|
||||
$parts = array();
|
||||
@@ -864,15 +867,16 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open file and return file pointer
|
||||
*
|
||||
* @param string $path file path
|
||||
* @param bool $write open file for writing
|
||||
* @return resource|false
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
|
||||
/**
|
||||
* Open file and return file pointer
|
||||
*
|
||||
* @param string $path file path
|
||||
* @param string $mode
|
||||
* @return false|resource
|
||||
* @internal param bool $write open file for writing
|
||||
* @author Dmitry (dio) Levashov
|
||||
*/
|
||||
protected function _fopen($path, $mode='rb') {
|
||||
// try ftp stream wrapper
|
||||
if ($this->options['mode'] == 'passive' && ini_get('allow_url_fopen')) {
|
||||
@@ -902,14 +906,15 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close opened file
|
||||
*
|
||||
* @param resource $fp file pointer
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
|
||||
/**
|
||||
* Close opened file
|
||||
*
|
||||
* @param resource $fp file pointer
|
||||
* @param string $path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
*/
|
||||
protected function _fclose($fp, $path='') {
|
||||
@fclose($fp);
|
||||
if ($path) {
|
||||
@@ -955,15 +960,16 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create symlink. FTP driver does not support symlinks.
|
||||
*
|
||||
* @param string $target link target
|
||||
* @param string $path symlink path
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
|
||||
/**
|
||||
* Create symlink. FTP driver does not support symlinks.
|
||||
*
|
||||
* @param string $target link target
|
||||
* @param string $path symlink path
|
||||
* @param string $name
|
||||
* @return bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
*/
|
||||
protected function _symlink($target, $path, $name) {
|
||||
return false;
|
||||
}
|
||||
@@ -993,17 +999,18 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move file into another parent dir.
|
||||
* Return new file path or false.
|
||||
*
|
||||
* @param string $source source file path
|
||||
* @param string $target target dir path
|
||||
* @param string $name file name
|
||||
* @return string|bool
|
||||
* @author Dmitry (dio) Levashov
|
||||
**/
|
||||
|
||||
/**
|
||||
* Move file into another parent dir.
|
||||
* Return new file path or false.
|
||||
*
|
||||
* @param string $source source file path
|
||||
* @param $targetDir
|
||||
* @param string $name file name
|
||||
* @return bool|string
|
||||
* @internal param string $target target dir path
|
||||
* @author Dmitry (dio) Levashov
|
||||
*/
|
||||
protected function _move($source, $targetDir, $name) {
|
||||
$target = $this->_joinPath($targetDir, $name);
|
||||
return ftp_rename($this->connect, $source, $target) ? $target : false;
|
||||
@@ -1104,11 +1111,13 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* chmod availability
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
/**
|
||||
* chmod availability
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $mode
|
||||
* @return bool
|
||||
*/
|
||||
protected function _chmod($path, $mode) {
|
||||
$modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode));
|
||||
return @ftp_chmod($this->connect, $modeOct, $path);
|
||||
@@ -1458,16 +1467,18 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of strings containing all files and folders in the specified local directory.
|
||||
* @param $dir
|
||||
* @param string $prefix
|
||||
* @internal param string $path path to directory to scan.
|
||||
* @return array array of files and folders names relative to the $path
|
||||
* or an empty array if the directory $path is empty,
|
||||
* <br />
|
||||
* false if $path is not a directory or does not exist.
|
||||
*/
|
||||
/**
|
||||
* Returns array of strings containing all files and folders in the specified local directory.
|
||||
* @param $dir
|
||||
* @param $omitSymlinks
|
||||
* @param string $prefix
|
||||
* @return array array of files and folders names relative to the $path
|
||||
* or an empty array if the directory $path is empty,
|
||||
* <br />
|
||||
* false if $path is not a directory or does not exist.
|
||||
* @throws Exception
|
||||
* @internal param string $path path to directory to scan.
|
||||
*/
|
||||
private static function listFilesInDirectory($dir, $omitSymlinks, $prefix = '')
|
||||
{
|
||||
if (!is_dir($dir)) {
|
||||
|
||||
Reference in New Issue
Block a user