Merge pull request #1314 from otoso/master

Fixed several bugs and fixed PHPDoc
This commit is contained in:
Naoki Sawada
2016-04-10 23:24:02 +09:00
11 changed files with 741 additions and 691 deletions
+1 -7
View File
@@ -6,7 +6,6 @@ header('Content-Type: text/html; charset=utf-8');
echo 'белая собака';
echo strToLower('белая собака');
exit();
$orig = 'ёЁйЙØÅŻ';
echo $orig.'<br>';
$path = '../../../files/tmp/';
@@ -54,9 +53,4 @@ if (count($diff)) {
echo '</pre>';
} else {
echo "OK";
}
?>
}
+62 -57
View File
@@ -300,13 +300,12 @@ class elFinder {
const ERROR_SEARCH_TIMEOUT = 'errSearchTimeout'; // 'Timed out while searching "$1". Search result is partial.'
const ERROR_REAUTH_REQUIRE = 'errReauthRequire'; // 'Re-authorization is required.'
/**
* Constructor
*
* @param array elFinder and roots configurations
* @return void
* @author Dmitry (dio) Levashov
**/
/**
* Constructor
*
* @param array elFinder and roots configurations
* @author Dmitry (dio) Levashov
*/
public function __construct($opts) {
if (! interface_exists('elFinderSessionInterface')) {
include_once dirname(__FILE__).'/elFinderSessionInterface.php';
@@ -720,6 +719,7 @@ class elFinder {
} else {
return $result;
}
//TODO: Add return statement here
}
/**
@@ -760,12 +760,13 @@ class elFinder {
$this->session->set('netvolume', $volumes);
}
/**
* Remove netmount volume
*
* @param string $key netvolume key
* @param object $volume volume driver instance
*/
/**
* Remove netmount volume
*
* @param string $key netvolume key
* @param object $volume volume driver instance
* @return bool
*/
protected function removeNetVolume($key, $volume) {
$netVolumes = $this->getNetVolumes();
$res = true;
@@ -970,7 +971,6 @@ class elFinder {
}
$limit = max(0, floor($standby / $sleep)) + 1;
$timelimit = ini_get('max_execution_time');
$compare = $args['compare'];
do {
$timelimit && @ set_time_limit($timelimit + $sleep);
$_mtime = 0;
@@ -1697,7 +1697,7 @@ class elFinder {
}
/**
* Get temporary dirctroy path
* Get temporary directory path
*
* @param string $volumeTempPath
* @return string
@@ -1775,17 +1775,18 @@ class elFinder {
return $result;
}
/**
* Check chunked upload files
*
* @param string $tmpname uploaded temporary file path
* @param string $chunk uploaded chunk file name
* @param string $cid uploaded chunked file id
* @param string $tempDir temporary dirctroy path
* @return array (string JoinedTemporaryFilePath, string FileName) or (empty, empty)
* @author Naoki Sawada
*/
/**
* Check chunked upload files
*
* @param string $tmpname uploaded temporary file path
* @param string $chunk uploaded chunk file name
* @param string $cid uploaded chunked file id
* @param string $tempDir temporary dirctroy path
* @param null $volume
* @return array or (empty, empty)
* @author Naoki Sawada
*/
private function checkChunkedFile($tmpname, $chunk, $cid, $tempDir, $volume = null) {
if (preg_match('/^(.+)(\.\d+_(\d+))\.part$/s', $chunk, $m)) {
$fname = $m[1];
@@ -2298,13 +2299,14 @@ class elFinder {
return array('content' => $content);
}
/**
* Save content into text file
*
* @return array
* @author Dmitry (dio) Levashov
**/
/**
* Save content into text file
*
* @param $args
* @return array
* @author Dmitry (dio) Levashov
*/
protected function put($args) {
$target = $args['target'];
@@ -2462,7 +2464,7 @@ class elFinder {
}
/**
* Return image dimmensions
* Return image dimensions
*
* @param array $args command arguments
* @return array
@@ -2761,28 +2763,30 @@ class elFinder {
return $metadata['seekable'];
}
/**
* serialize and base64_encode of session data (If needed)
*
* @deprecated
* @param mixed $var target variable
* @author Naoki Sawada
*/
/**
* serialize and base64_encode of session data (If needed)
*
* @deprecated
* @param mixed $var target variable
* @author Naoki Sawada
* @return mixed|string
*/
public static function sessionDataEncode($var) {
if (self::$base64encodeSessionData) {
$var = base64_encode(serialize($var));
}
return $var;
}
/**
* base64_decode and unserialize of session data (If needed)
*
* @deprecated
* @param mixed $var target variable
* @param bool $checkIs data type for check (array|string|object|int)
* @author Naoki Sawada
*/
/**
* base64_decode and unserialize of session data (If needed)
*
* @deprecated
* @param mixed $var target variable
* @param bool $checkIs data type for check (array|string|object|int)
* @author Naoki Sawada
* @return bool|mixed
*/
public static function sessionDataDecode(&$var, $checkIs = null) {
if (self::$base64encodeSessionData) {
$data = @unserialize(@base64_decode($var));
@@ -2819,15 +2823,16 @@ class elFinder {
* @deprecated
* @return void
*/
public static function sessionWrite() {
public function sessionWrite() {
$this->session->close();
}
/**
* Retuen elFinder static variable
*
* @return void
*/
/**
* Return elFinder static variable
*
* @param $key
* @return mixed|null
*/
public static function getStaticVar($key) {
return isset(elFinder::$$key)? elFinder::$$key : null;
}
+9 -8
View File
@@ -26,14 +26,15 @@ class elFinderConnector {
* @var string
**/
protected $header = 'Content-Type: application/json';
/**
* Constructor
*
* @return void
* @author Dmitry (dio) Levashov
**/
/**
* Constructor
*
* @param $elFinder
* @param bool $debug
* @author Dmitry (dio) Levashov
*/
public function __construct($elFinder, $debug=false) {
$this->elFinder = $elFinder;
+10 -6
View File
@@ -59,9 +59,10 @@ class elFinderVolumeFlysystemGoogleDriveNetmount extends \Barryvdh\elFinderFlysy
* Prepare
* Call from elFinder::netmout() before volume->mount()
*
* @param $options
* @return Array
* @author Naoki Sawada
**/
*/
public function netmountPrepare($options)
{
if (empty($options['client_id']) && defined('ELFINDER_GOOGLEDRIVE_CLIENTID')) {
@@ -226,9 +227,11 @@ class elFinderVolumeFlysystemGoogleDriveNetmount extends \Barryvdh\elFinderFlysy
/**
* process of on netunmount
* Drop table `dropbox` & rm thumbs
*
* @param array $options
* @return boolean
*
* @param $netVolumes
* @param $key
* @return bool
* @internal param array $options
*/
public function netunmount($netVolumes, $key)
{
@@ -246,12 +249,13 @@ class elFinderVolumeFlysystemGoogleDriveNetmount extends \Barryvdh\elFinderFlysy
/**
* "Mount" volume.
* Return true if volume available for read or write,
* Return true if volume available for read or write,
* false - otherwise
*
* @param array $opts
* @return bool
* @author Naoki Sawada
**/
*/
public function mount(array $opts)
{
$creds = null;
+277 -258
View File
@@ -476,7 +476,7 @@ abstract class elFinderVolumeDriver {
'rb' => 'text/x-ruby',
'sh' => 'text/x-shellscript',
'pl' => 'text/x-perl',
'xml' => 'text/xml',
//'xml' => 'text/xml',
'sql' => 'text/x-sql',
'c' => 'text/x-csrc',
'h' => 'text/x-chdr',
@@ -496,7 +496,7 @@ abstract class elFinderVolumeDriver {
'tiff' => 'image/tiff',
'tga' => 'image/x-targa',
'psd' => 'image/vnd.adobe.photoshop',
'ai' => 'image/vnd.adobe.photoshop',
//'ai' => 'image/vnd.adobe.photoshop',
'xbm' => 'image/xbm',
'pxm' => 'image/pxm',
//audio
@@ -795,16 +795,17 @@ abstract class elFinderVolumeDriver {
clearstatcache();
$this->cache = $this->dirsCache = array();
}
/**
* "Mount" volume.
* Return true if volume available for read or write,
* false - otherwise
*
* @return bool
* @author Dmitry (dio) Levashov
* @author Alexey Sukhotin
**/
/**
* "Mount" volume.
* Return true if volume available for read or write,
* false - otherwise
*
* @param array $opts
* @return bool
* @author Dmitry (dio) Levashov
* @author Alexey Sukhotin
*/
public function mount(array $opts) {
if (!isset($opts['path']) || $opts['path'] === '') {
return $this->setError('Path undefined.');
@@ -1173,14 +1174,15 @@ abstract class elFinderVolumeDriver {
public function root() {
return $this->encode($this->root);
}
/**
* Return target path hash
*
* @param string $path
* @param string $name
* @author Naoki Sawada
*/
/**
* Return target path hash
*
* @param string $path
* @param string $name
* @author Naoki Sawada
* @return string
*/
public function getHash($path, $name = '') {
if ($name !== '') {
$path = $this->joinPathCE($path, $name);
@@ -1197,13 +1199,14 @@ abstract class elFinderVolumeDriver {
public function defaultPath() {
return $this->encode($this->startPath ? $this->startPath : $this->root);
}
/**
* Return volume options required by client:
*
* @return array
* @author Dmitry (dio) Levashov
**/
/**
* Return volume options required by client:
*
* @param $hash
* @return array
* @author Dmitry (dio) Levashov
*/
public function options($hash) {
$create = $createext = array();
if (isset($this->archivers['create']) && is_array($this->archivers['create'])) {
@@ -1369,15 +1372,15 @@ abstract class elFinderVolumeDriver {
public function closest($hash, $attr, $val) {
return ($path = $this->closestByAttr($this->decode($hash), $attr, $val)) ? $this->encode($path) : false;
}
/**
* Return file info or false on error
*
* @param string $hash file hash
* @param bool $realpath add realpath field to file info
* @return array|false
* @author Dmitry (dio) Levashov
**/
/**
* Return file info or false on error
*
* @param string $hash file hash
* @return array|false
* @internal param bool $realpath add realpath field to file info
* @author Dmitry (dio) Levashov
*/
public function file($hash) {
$path = $this->decode($hash);
$isRoot = ($path == $this->root);
@@ -1390,15 +1393,16 @@ abstract class elFinderVolumeDriver {
return ($file) ? $file : $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
}
/**
* Return folder info
*
* @param string $hash folder hash
* @param bool $hidden return hidden file info
* @return array|false
* @author Dmitry (dio) Levashov
**/
/**
* Return folder info
*
* @param string $hash folder hash
* @param bool $resolveLink
* @return array|false
* @internal param bool $hidden return hidden file info
* @author Dmitry (dio) Levashov
*/
public function dir($hash, $resolveLink=false) {
if (($dir = $this->file($hash)) == false) {
return $this->setError(elFinder::ERROR_DIR_NOT_FOUND);
@@ -1430,13 +1434,14 @@ abstract class elFinderVolumeDriver {
: $this->setError(elFinder::ERROR_PERM_DENIED);
}
/**
* Return dir files names list
*
* @param string $hash file hash
* @return array
* @author Dmitry (dio) Levashov
**/
/**
* Return dir files names list
*
* @param string $hash file hash
* @param null $intersect
* @return array
* @author Dmitry (dio) Levashov
*/
public function ls($hash, $intersect = null) {
if (($dir = $this->dir($hash)) == false || !$dir['read']) {
return false;
@@ -1514,13 +1519,14 @@ abstract class elFinderVolumeDriver {
return $tree ? $tree : array($current);
}
/**
* Create thumbnail for required file and return its name of false on failed
*
* @return string|false
* @author Dmitry (dio) Levashov
**/
/**
* Create thumbnail for required file and return its name of false on failed
*
* @param $hash
* @return false|string
* @author Dmitry (dio) Levashov
*/
public function tmb($hash) {
$path = $this->decode($hash);
$stat = $this->stat($path);
@@ -1725,19 +1731,20 @@ abstract class elFinderVolumeDriver {
? false
: $this->stat($path);
}
/**
* 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
* @param array $hashes exists files hash array with filename as key
* @return array|false
* @author Dmitry (dio) Levashov
**/
/**
* 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 $name
* @param string $tmpname file tmp name - required to detect mime type
* @param array $hashes exists files hash array with filename as key
* @return array|false
* @internal param string $src file name
* @author Dmitry (dio) Levashov
*/
public function upload($fp, $dst, $name, $tmpname, $hashes = array()) {
if ($this->commandDisabled('upload')) {
return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -1822,17 +1829,19 @@ abstract class elFinderVolumeDriver {
return $stat;
}
/**
* Paste files
*
* @param Object $volume source volume
* @param string $source file hash
* @param string $dst destination dir hash
* @param bool $rmSrc remove source after copy?
* @return array|false
* @author Dmitry (dio) Levashov
**/
/**
* Paste files
*
* @param Object $volume source volume
* @param $src
* @param string $dst destination dir hash
* @param bool $rmSrc remove source after copy?
* @param array $hashes
* @return array|false
* @internal param string $source file hash
* @author Dmitry (dio) Levashov
*/
public function paste($volume, $src, $dst, $rmSrc = false, $hashes = array()) {
$err = $rmSrc ? elFinder::ERROR_MOVE : elFinder::ERROR_COPY;
@@ -2070,15 +2079,16 @@ abstract class elFinderVolumeDriver {
$this->clearcache();
return $this->convEncOut($this->_filePutContents($this->convEncIn($path), $content)) ? $this->stat($path) : false;
}
/**
* Extract files from archive
*
* @param string $hash archive hash
* @return array|bool
* @author Dmitry (dio) Levashov,
* @author Alexey Sukhotin
**/
/**
* Extract files from archive
*
* @param string $hash archive hash
* @param null $makedir
* @return array|bool
* @author Dmitry (dio) Levashov,
* @author Alexey Sukhotin
*/
public function extract($hash, $makedir = null) {
if ($this->commandDisabled('extract')) {
return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -2119,11 +2129,14 @@ abstract class elFinderVolumeDriver {
}
}
/**
* Add files to archive
*
* @return void
**/
/**
* Add files to archive
*
* @param $hashes
* @param $mime
* @param string $name
* @return array|bool
*/
public function archive($hashes, $mime, $name = '') {
if ($this->commandDisabled('archive')) {
return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -2145,17 +2158,17 @@ abstract class elFinderVolumeDriver {
foreach ($hashes as $hash) {
if (($file = $this->file($hash)) == false) {
return $this->error(elFinder::ERROR_FILE_NOT_FOUND, '#'+$hash);
return $this->setError(elFinder::ERROR_FILE_NOT_FOUND, '#'+$hash);
}
if (!$file['read']) {
return $this->error(elFinder::ERROR_PERM_DENIED);
return $this->setError(elFinder::ERROR_PERM_DENIED);
}
$path = $this->decode($hash);
if (!isset($dir)) {
$dir = $this->dirnameCE($path);
$stat = $this->stat($dir);
if (!$stat['write']) {
return $this->error(elFinder::ERROR_PERM_DENIED);
return $this->setError(elFinder::ERROR_PERM_DENIED);
}
}
@@ -2291,15 +2304,16 @@ abstract class elFinderVolumeDriver {
? $this->setError(elFinder::ERROR_PERM_DENIED)
: $this->remove($this->decode($hash));
}
/**
* Search files
*
* @param string $q search string
* @param array $mimes
* @return array
* @author Dmitry (dio) Levashov
**/
/**
* Search files
*
* @param string $q search string
* @param array $mimes
* @param null $hash
* @return array
* @author Dmitry (dio) Levashov
*/
public function search($q, $mimes, $hash = null) {
$dir = null;
if ($hash) {
@@ -2622,15 +2636,16 @@ abstract class elFinderVolumeDriver {
protected function inpathCE($path, $parent) {
return (!$this->encoding)? $this->_inpath($path, $parent) : $this->convEncOut($this->_inpath($this->convEncIn($path), $this->convEncIn($parent)));
}
/**
* Open file and return file pointer (with convert encording)
*
* @param string $path file path
* @param bool $write open file for writing
* @return resource|false
* @author Naoki Sawada
**/
/**
* Open file and return file pointer (with convert encording)
*
* @param string $path file path
* @param string $mode
* @return false|resource
* @internal param bool $write open file for writing
* @author Naoki Sawada
*/
protected function fopenCE($path, $mode='rb') {
return (!$this->encoding)? $this->_fopen($path, $mode) : $this->convEncOut($this->_fopen($this->convEncIn($path), $mode));
}
@@ -2730,6 +2745,7 @@ abstract class elFinderVolumeDriver {
// append volume id to make hash unique
return $this->id.$hash;
}
//TODO: Add return statement here
}
/**
@@ -2751,6 +2767,7 @@ abstract class elFinderVolumeDriver {
// append ROOT to path after it was cut in encode
return $this->abspathCE($path);//$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path);
}
//TODO: Add return statement here
}
/**
@@ -2799,15 +2816,19 @@ abstract class elFinderVolumeDriver {
}
return true;
}
/**
* Return new unique name based on file name and suffix
*
* @param string $path file path
* @param string $suffix suffix append to name
* @return string
* @author Dmitry (dio) Levashov
**/
/**
* Return new unique name based on file name and suffix
*
* @param $dir
* @param $name
* @param string $suffix suffix append to name
* @param bool $checkNum
* @param int $start
* @return string
* @internal param string $path file path
* @author Dmitry (dio) Levashov
*/
public function uniqueName($dir, $name, $suffix = ' copy', $checkNum = true, $start = 1) {
$ext = '';
@@ -2862,17 +2883,18 @@ abstract class elFinderVolumeDriver {
public function convEncOut($var = null, $restoreLocale = true, $unknown = '_') {
return (!$this->encoding)? $var : $this->convEnc($var, $this->encoding, 'UTF-8', $this->options['locale'], $restoreLocale, $unknown);
}
/**
* Converts character encoding (base function)
*
* @param mixed $var target string or array var
* @param string $from from character encoding
* @param string $to to character encoding
* @param string $locale local locale
* @param string $unknown replaces character for unknown
* @return mixed
*/
/**
* Converts character encoding (base function)
*
* @param mixed $var target string or array var
* @param string $from from character encoding
* @param string $to to character encoding
* @param string $locale local locale
* @param $restoreLocale
* @param string $unknown replaces character for unknown
* @return mixed
*/
protected function convEnc($var, $from, $to, $locale, $restoreLocale, $unknown = '_') {
if (strtoupper($from) !== strtoupper($to)) {
if ($locale) {
@@ -3120,15 +3142,16 @@ abstract class elFinderVolumeDriver {
return $perm === null ? (is_null($val)? $this->defaults[$name] : $val) : !!$perm;
}
/**
* Return true if file with given name can be created in given folder.
*
* @param string $dir parent dir path
* @param string $name new file name
* @return bool
* @author Dmitry (dio) Levashov
**/
/**
* Return true if file with given name can be created in given folder.
*
* @param string $dir parent dir path
* @param string $name new file name
* @param null $isDir
* @return bool
* @author Dmitry (dio) Levashov
*/
protected function allowCreate($dir, $name, $isDir = null) {
$path = $this->joinPathCE($dir, $name);
$perm = null;
@@ -3418,14 +3441,15 @@ abstract class elFinderVolumeDriver {
unset($this->sessionCache['rootstat'][md5($this->root)]);
$this->session->set($this->id, $this->sessionCache);
}
/**
* Return file mimetype
*
* @param string $path file path
* @return string
* @author Dmitry (dio) Levashov
**/
/**
* Return file mimetype
*
* @param string $path file path
* @param string $name
* @return string
* @author Dmitry (dio) Levashov
*/
protected function mimetype($path, $name = '') {
$type = '';
@@ -3646,16 +3670,17 @@ abstract class elFinderVolumeDriver {
return $files;
}
/**
* Return subdirs tree
*
* @param string $path parent dir path
* @param int $deep tree deep
* @return array
* @author Dmitry (dio) Levashov
**/
/**
* Return subdirs tree
*
* @param string $path parent dir path
* @param int $deep tree deep
* @param string $exclude
* @return array
* @author Dmitry (dio) Levashov
*/
protected function gettree($path, $deep, $exclude='') {
$dirs = array();
@@ -4009,15 +4034,16 @@ abstract class elFinderVolumeDriver {
protected function canResize($path, $stat) {
return $this->canCreateTmb($path, $stat, false);
}
/**
* Create thumnbnail and return it's URL on success
*
* @param string $path file path
* @param string $mime file mime type
* @return string|false
* @author Dmitry (dio) Levashov
**/
/**
* Create thumnbnail and return it's URL on success
*
* @param string $path file path
* @param $stat
* @return false|string
* @internal param string $mime file mime type
* @author Dmitry (dio) Levashov
*/
protected function createTmb($path, $stat) {
if (!$stat || !$this->canCreateTmb($path, $stat)) {
return false;
@@ -4321,21 +4347,21 @@ abstract class elFinderVolumeDriver {
return false;
}
/**
* Put image to square
*
* @param string $path image file
* @param int $width square width
* @param int $height square height
* @param int $align reserved
* @param int $valign reserved
* @param string $bgcolor square background color in #rrggbb format
* @param string $destformat image destination format
* @param int $jpgQuality JEPG quality (1-100)
* @return string|false
* @author Dmitry (dio) Levashov
* @author Alexey Sukhotin
**/
/**
* Put image to square
*
* @param string $path image file
* @param int $width square width
* @param int $height square height
* @param int|string $align reserved
* @param int|string $valign reserved
* @param string $bgcolor square background color in #rrggbb format
* @param string $destformat image destination format
* @param int $jpgQuality JEPG quality (1-100)
* @return false|string
* @author Dmitry (dio) Levashov
* @author Alexey Sukhotin
*/
protected function imgSquareFit($path, $width, $height, $align = 'center', $valign = 'middle', $bgcolor = '#0000ff', $destformat = null, $jpgQuality = null) {
if (($s = @getimagesize($path)) == false) {
return false;
@@ -4516,16 +4542,16 @@ abstract class elFinderVolumeDriver {
return false;
}
/**
* Execute shell command
*
* @param string $command command line
* @param array $output stdout strings
* @param array $return_var process exit code
* @param array $error_output stderr strings
* @return int exit code
* @author Alexey Sukhotin
**/
/**
* Execute shell command
*
* @param string $command command line
* @param array $output stdout strings
* @param array|int $return_var process exit code
* @param array $error_output stderr strings
* @return int exit code
* @author Alexey Sukhotin
*/
protected function procExec($command , array &$output = null, &$return_var = -1, array &$error_output = null) {
if (! function_exists('proc_open')) {
@@ -4619,15 +4645,16 @@ abstract class elFinderVolumeDriver {
return false;
}
/**
* Output gd image to file
*
* @param resource $image gd image resource
* @param string $filename The path to save the file to.
* @param string $destformat The Image type to use for $filename
* @param string $mime The original image mime type
* @param int $jpgQuality JEPG quality (1-100)
*/
/**
* Output gd image to file
*
* @param resource $image gd image resource
* @param string $filename The path to save the file to.
* @param string $destformat The Image type to use for $filename
* @param string $mime The original image mime type
* @param int $jpgQuality JEPG quality (1-100)
* @return bool
*/
protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null ){
if (!$jpgQuality) {
@@ -4644,14 +4671,15 @@ abstract class elFinderVolumeDriver {
return imagepng($image, $filename, 7);
}
/**
* Output imagick image to file
*
* @param resource $img imagick image resource
* @param string $filename The path to save the file to.
* @param string $destformat The Image type to use for $filename
* @param int $jpgQuality JEPG quality (1-100)
*/
/**
* Output imagick image to file
*
* @param resource $img imagick image resource
* @param string $filename The path to save the file to.
* @param string $destformat The Image type to use for $filename
* @param int $jpgQuality JEPG quality (1-100)
* @return bool
*/
protected function imagickImage($img, $filename, $destformat, $jpgQuality = null ){
if (!$jpgQuality) {
@@ -4687,18 +4715,6 @@ abstract class elFinderVolumeDriver {
}
return $result;
if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) {
return imagejpeg($image, $filename, $jpgQuality);
}
if ($destformat == 'gif' || ($destformat == null && $mime == 'image/gif')) {
return imagegif($image, $filename, 7);
}
return imagepng($image, $filename, 7);
}
/**
@@ -5030,14 +5046,15 @@ abstract class elFinderVolumeDriver {
}
$remove && unlink($path);
}
/**
* Return files of target directory that is dotfiles excludes.
*
* @param string $dir target directory path
* @return array
* @author Naoki Sawada
**/
/**
* Return files of target directory that is dotfiles excludes.
*
* @param string $dir target directory path
* @return array
* @throws Exception
* @author Naoki Sawada
*/
protected static function localScandir($dir) {
// PHP function scandir() is not work well in specific environment. I dont know why.
// ref. https://github.com/Studio-42/elFinder/issues/1248
@@ -5061,7 +5078,7 @@ abstract class elFinderVolumeDriver {
* @param string $dir target dir
* @param array $files files names list
* @param string|object $zipPath Zip archive name
* @return void
* @return bool
* @author Naoki Sawada
*/
protected static function zipArchiveZip($dir, $files, $zipPath) {
@@ -5312,28 +5329,30 @@ abstract class elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
abstract protected function _symlink($source, $targetDir, $name);
/**
* Copy file into another file (only inside one volume)
*
* @param string $source source file path
* @param string $target target dir path
* @param string $name file name
* @return string|bool
* @author Dmitry (dio) Levashov
**/
/**
* Copy file into another file (only inside one volume)
*
* @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
*/
abstract protected function _copy($source, $targetDir, $name);
/**
* 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
*/
abstract protected function _move($source, $targetDir, $name);
/**
+109 -120
View File
@@ -82,15 +82,14 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
private $DB_TableName = '';
private $tmbPrefix = '';
/**
* 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() {
if (@include_once 'Dropbox/autoload.php') {
@@ -129,13 +128,14 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
$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($options['consumerKey']) && defined('ELFINDER_DROPBOX_CONSUMERKEY')) $options['consumerKey'] = ELFINDER_DROPBOX_CONSUMERKEY;
if (empty($options['consumerSecret']) && defined('ELFINDER_DROPBOX_CONSUMERSECRET')) $options['consumerSecret'] = ELFINDER_DROPBOX_CONSUMERSECRET;
@@ -234,14 +234,16 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
unset($options['user'], $options['pass']);
return $options;
}
/**
* process of on netunmount
* Drop table `dropbox` & rm thumbs
*
* @param array $options
* @return boolean
*/
/**
* process of on netunmount
* Drop table `dropbox` & rm thumbs
*
* @param $netVolumes
* @param $key
* @return bool
* @internal param array $options
*/
public function netunmount($netVolumes, $key) {
$count = 0;
$dropboxUid = '';
@@ -427,9 +429,9 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
/**
* Configure after successfull mount.
* Configure after successful mount.
*
* @return void
* @return string
* @author Dmitry (dio) Levashov
**/
protected function configure() {
@@ -442,7 +444,7 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
/**
* Check DB for delta cache
*
* @return void
* @return bool
*/
private function checkDB() {
$res = $this->query('SELECT * FROM sqlite_master WHERE type=\'table\' AND name=\''.$this->DB_TableName.'\'');
@@ -662,7 +664,7 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
* Cache dir contents
*
* @param string $path dir path
* @return void
* @return string
* @author Dmitry Levashov
**/
protected function cacheDir($path) {
@@ -742,16 +744,17 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
? $this->_joinPath($dst, $name)
: $this->setError(elFinder::ERROR_COPY, $this->_path($src));
}
/**
* Remove file/ recursive remove dir
*
* @param string $path file path
* @param bool $force try to remove even if file locked
* @return bool
* @author Dmitry (dio) Levashov
* @author Naoki Sawada
**/
/**
* Remove file/ recursive remove dir
*
* @param string $path file path
* @param bool $force try to remove even if file locked
* @param bool $recursive
* @return bool
* @author Dmitry (dio) Levashov
* @author Naoki Sawada
*/
protected function remove($path, $force = false, $recursive = false) {
$stat = $this->stat($path);
$stat['realpath'] = $path;
@@ -779,16 +782,17 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
$this->removed[] = $stat;
return true;
}
/**
* Create thumnbnail and return it's URL on success
*
* @param string $path file path
* @param string $mime file mime type
* @return string|false
* @author Dmitry (dio) Levashov
* @author Naoki Sawada
**/
/**
* Create thumnbnail and return it's URL on success
*
* @param string $path file path
* @param $stat
* @return false|string
* @internal param string $mime file mime type
* @author Dmitry (dio) Levashov
* @author Naoki Sawada
*/
protected function createTmb($path, $stat) {
if (!$stat || !$this->canCreateTmb($path, $stat)) {
return false;
@@ -1143,14 +1147,15 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
: $this->cacheDir($path);
}
/**
* 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') {
if (($mode == 'rb' || $mode == 'r')) {
@@ -1185,13 +1190,14 @@ class elFinderVolumeDropbox 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) {
@@ -1236,14 +1242,15 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
return $this->_filePutContents($path.'/'.$name, '');
}
/**
* 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;
}
@@ -1268,16 +1275,17 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
return true;
}
/**
* 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->_normpath($targetDir.'/'.$name);
try {
@@ -1317,17 +1325,18 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
return $this->_unlink($path);
}
/**
* 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
* @param array $stat file stat (required by some virtual fs)
* @return bool|string
* @author Dmitry (dio) Levashov
**/
/**
* 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 $path
* @param string $name file name
* @param array $stat file stat (required by some virtual fs)
* @return bool|string
* @internal param string $dir target dir path
* @author Dmitry (dio) Levashov
*/
protected function _save($fp, $path, $name, $stat) {
if ($name) $path .= '/'.$name;
$path = $this->_normpath($path);
@@ -1390,18 +1399,20 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
/**
* Detect available archivers
*
* @return void
* @return array
**/
protected function _checkArchivers() {
// die('Not yet implemented. (_checkArchivers)');
return array();
}
/**
* chmod implementation
*
* @return bool
**/
/**
* chmod implementation
*
* @param string $path
* @param string $mode
* @return bool
*/
protected function _chmod($path, $mode) {
return false;
}
@@ -1418,7 +1429,6 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
**/
protected function _unpack($path, $arc) {
die('Not yet implemented. (_unpack)');
return false;
}
/**
@@ -1430,26 +1440,6 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
**/
protected function _findSymlinks($path) {
die('Not yet implemented. (_findSymlinks)');
if (is_link($path)) {
return true;
}
if (is_dir($path)) {
foreach (self::localScandir($path) as $name) {
$p = $path.DIRECTORY_SEPARATOR.$name;
if (is_link($p)) {
return true;
}
if (is_dir($p) && $this->_findSymlinks($p)) {
return true;
} elseif (is_file($p)) {
$this->archiveSize += filesize($p);
}
}
} else {
$this->archiveSize += filesize($path);
}
return false;
}
/**
@@ -1479,7 +1469,6 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
**/
protected function _archive($dir, $files, $name, $arc) {
die('Not yet implemented. (_archive)');
return false;
}
} // END class
+95 -84
View File
@@ -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)) {
+52 -42
View File
@@ -43,14 +43,13 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
* @var int
**/
protected $archiveSize = 0;
/**
* Constructor
* Extend options with required fields
*
* @return void
* @author Dmitry (dio) Levashov
**/
/**
* Constructor
* Extend options with required fields
*
* @author Dmitry (dio) Levashov
*/
public function __construct() {
$this->options['alias'] = ''; // alias to replace root dir name
$this->options['dirMode'] = 0755; // new dirs mode
@@ -718,26 +717,28 @@ class elFinderVolumeLocalFileSystem 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') {
return @fopen($path, $mode);
}
/**
* 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='') {
return @fclose($fp);
}
@@ -811,17 +812,18 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
$ret && clearstatcache();
return $ret;
}
/**
* 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);
$ret = @rename($source, $target) ? $target : false;
@@ -933,11 +935,13 @@ class elFinderVolumeLocalFileSystem 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));
$ret = @chmod($path, $modeOct);
@@ -1088,6 +1092,7 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
return (is_array($result) || file_exists($result)) ? $result : false;
}
//TODO: Add return statement here
}
/**
@@ -1204,7 +1209,12 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
return $result;
}
/******************** Original local functions *************************/
/******************** Original local functions ************************
* @param $file
* @param $key
* @param $iterator
* @return bool
*/
public function localFileSystemSearchIteratorFilter($file, $key, $iterator) {
$name = $file->getFilename();
+62 -52
View File
@@ -53,13 +53,12 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
**/
protected $dbError = '';
/**
* Constructor
* Extend options with required fields
*
* @return void
* @author Dmitry (dio) Levashov
**/
/**
* Constructor
* Extend options with required fields
*
* @author Dmitry (dio) Levashov
*/
public function __construct() {
$opts = array(
'host' => 'localhost',
@@ -100,7 +99,7 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
}
$this->conn = odbc_connect("Driver={SQL Server};Server=".$this->options['host'].";Database=$database;", $this->options['user'], $this->options['pass']);
$this->conn = odbc_connect("Driver={SQL Server};Server=".$this->options['host'].";Database=$this->options['db'];", $this->options['user'], $this->options['pass']);
if (odbc_errormsg($this->conn)) {
return false;
@@ -222,7 +221,7 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
* Cache dir contents
*
* @param string $path dir path
* @return void
* @return string
* @author Dmitry Levashov
**/
protected function cacheDir($path) {
@@ -626,13 +625,14 @@ class elFinderVolumeMsSQL 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) {
@@ -666,14 +666,15 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
return $this->make($path, $name, 'text/plain') ? $this->_joinPath($path, $name) : 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;
}
@@ -698,16 +699,17 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
return $this->query($sql);
}
/**
* 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) {
$sql = 'UPDATE %s SET parent_id=%d, name="%s" WHERE id=%d';
$sql = sprintf($sql, $this->tbf, $targetDir, addslashes($name), $source);
@@ -737,16 +739,17 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
**/
protected function _rmdir($path) {
$sql = sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory"', $this->tbf, $path);
$res = $this->query($qry);
$res = $this->query($sql);
return $res && odbc_num_rows($res);
}
/**
* undocumented function
*
* @return void
* @author Dmitry Levashov
**/
/**
* undocumented function
*
* @param $path
* @param $fp
* @author Dmitry Levashov
*/
protected function _setContent($path, $fp) {
rewind($fp);
$fstat = fstat($fp);
@@ -874,11 +877,13 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
return;
}
/**
* chmod implementation
*
* @return bool
**/
/**
* chmod implementation
*
* @param string $path
* @param string $mode
* @return bool
*/
protected function _chmod($path, $mode) {
return false;
}
@@ -935,12 +940,17 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver {
return false;
}
/**
* Update MsSQL database *
* @param update root name with alias
* @param update read, write, locked, hidden permission
* @author Raja Sharma
**/
/**
* Update MsSQL database *
* @param $alias
* @param $read
* @param $write
* @param $locked
* @param $hidden
* @internal param root $update name with alias
* @internal param read $update , write, locked, hidden permission
* @author Raja Sharma
*/
protected function rootparameter($alias, $read, $write, $locked, $hidden) {
if($alias == ""){
$sql = 'UPDATE elfinder_file set name = "DATABASE" where id=1';
+54 -49
View File
@@ -51,14 +51,13 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @var string
**/
protected $dbError = '';
/**
* Constructor
* Extend options with required fields
*
* @return void
* @author Dmitry (dio) Levashov
**/
/**
* Constructor
* Extend options with required fields
*
* @author Dmitry (dio) Levashov
*/
public function __construct() {
$opts = array(
'host' => 'localhost',
@@ -221,7 +220,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* Cache dir contents
*
* @param string $path dir path
* @return void
* @return string
* @author Dmitry Levashov
**/
protected function cacheDir($path) {
@@ -617,14 +616,15 @@ class elFinderVolumeMySQL 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) {
@@ -657,15 +657,16 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
protected function _mkfile($path, $name) {
return $this->make($path, $name, 'text/plain') ? $this->_joinPath($path, $name) : 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;
}
@@ -689,17 +690,18 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
return $this->query($sql);
}
/**
* 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) {
$sql = 'UPDATE %s SET parent_id=%d, name=\'%s\' WHERE id=%d LIMIT 1';
$sql = sprintf($sql, $this->tbf, $targetDir, $this->db->real_escape_string($name), $source);
@@ -727,13 +729,14 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
protected function _rmdir($path) {
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime=\'directory\' LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
}
/**
* undocumented function
*
* @return void
* @author Dmitry Levashov
**/
/**
* undocumented function
*
* @param $path
* @param $fp
* @author Dmitry Levashov
*/
protected function _setContent($path, $fp) {
rewind($fp);
$fstat = fstat($fp);
@@ -842,11 +845,13 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
return;
}
/**
* chmod implementation
*
* @return bool
**/
/**
* chmod implementation
*
* @param string $path
* @param string $mode
* @return bool
*/
protected function _chmod($path, $mode) {
return false;
}
+10 -8
View File
@@ -1,10 +1,10 @@
<?php
/**
* Copyright (c) 2011, oov. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@@ -24,20 +24,20 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* bmp ファイルを GD で使えるように
*
*
* 使用例:
* //ファイルから読み込む場合はGDでPNGなどを読み込むのと同じような方法で可
* $image = imagecreatefrombmp("test.bmp");
* imagedestroy($image);
*
*
* //文字列から読み込む場合は以下の方法で可
* $image = GdBmp::loadFromString(file_get_contents("test.bmp"));
* //自動判定されるので破損ファイルでなければこれでも上手くいく
* //$image = imagecreatefrombmp(file_get_contents("test.bmp"));
* imagedestroy($image);
*
*
* //その他任意のストリームからの読み込みも可能
* $stream = fopen("http://127.0.0.1/test.bmp");
* $image = GdBmp::loadFromStream($stream);
@@ -45,7 +45,7 @@
* //$image = imagecreatefrombmp($stream);
* fclose($stream);
* imagedestroy($image);
*
*
* 対応フォーマット
* 1bit
* 4bit
@@ -61,7 +61,9 @@
*
* 以下のものは非対応
* BITMAPV4HEADER と BITMAPV5HEADER に含まれる色空間に関する様々な機能
**/
* @param $filename_or_stream_or_binary
* @return bool|resource
*/
function imagecreatefrombmp($filename_or_stream_or_binary){
return elFinderLibGdBmp::load($filename_or_stream_or_binary);