From c4c64847e7265ee9de0d9497a5a737e4d357e0f4 Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 14:54:45 +0200 Subject: [PATCH 01/13] Remove compare since it's overwritten --- php/elFinder.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/php/elFinder.class.php b/php/elFinder.class.php index 0f748ff8f..2eab2ff6e 100644 --- a/php/elFinder.class.php +++ b/php/elFinder.class.php @@ -970,7 +970,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; From 16641a68c1c6b8ae7ed7f04639d956514be955db Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:02:54 +0200 Subject: [PATCH 02/13] Fix PHPDoc --- php/elFinder.class.php | 115 +++-- php/elFinderConnector.class.php | 17 +- php/elFinderFlysystemGoogleDriveNetmount.php | 16 +- php/elFinderVolumeDriver.class.php | 509 ++++++++++--------- php/elFinderVolumeDropbox.class.php | 197 +++---- php/elFinderVolumeFTP.class.php | 179 ++++--- php/elFinderVolumeLocalFileSystem.class.php | 93 ++-- php/elFinderVolumeMsSQL.class.php | 108 ++-- php/elFinderVolumeMySQL.class.php | 101 ++-- php/libs/GdBmp.php | 18 +- 10 files changed, 720 insertions(+), 633 deletions(-) diff --git a/php/elFinder.class.php b/php/elFinder.class.php index 2eab2ff6e..f3645fa15 100644 --- a/php/elFinder.class.php +++ b/php/elFinder.class.php @@ -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'; @@ -760,12 +759,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; @@ -1696,7 +1696,7 @@ class elFinder { } /** - * Get temporary dirctroy path + * Get temporary directory path * * @param string $volumeTempPath * @return string @@ -1774,17 +1774,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]; @@ -2297,13 +2298,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']; @@ -2461,7 +2463,7 @@ class elFinder { } /** - * Return image dimmensions + * Return image dimensions * * @param array $args command arguments * @return array @@ -2760,28 +2762,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)); @@ -2821,12 +2825,13 @@ class elFinder { public static 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; } diff --git a/php/elFinderConnector.class.php b/php/elFinderConnector.class.php index 2174b0fb3..03937422a 100644 --- a/php/elFinderConnector.class.php +++ b/php/elFinderConnector.class.php @@ -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; diff --git a/php/elFinderFlysystemGoogleDriveNetmount.php b/php/elFinderFlysystemGoogleDriveNetmount.php index 0bffcfb0a..89bd7fa87 100644 --- a/php/elFinderFlysystemGoogleDriveNetmount.php +++ b/php/elFinderFlysystemGoogleDriveNetmount.php @@ -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; diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index d7fb2c01b..6ab0bbba0 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -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); @@ -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)); } @@ -2799,15 +2814,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 +2881,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 +3140,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 +3439,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 +3668,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 +4032,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 +4345,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 +4540,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 +4643,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 +4669,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) { @@ -5030,14 +5056,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 @@ -5312,28 +5339,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); /** diff --git a/php/elFinderVolumeDropbox.class.php b/php/elFinderVolumeDropbox.class.php index caabae9a8..745fa5005 100644 --- a/php/elFinderVolumeDropbox.class.php +++ b/php/elFinderVolumeDropbox.class.php @@ -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 = ''; @@ -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); @@ -1397,11 +1406,13 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver { return array(); } - /** - * chmod implementation - * - * @return bool - **/ + /** + * chmod implementation + * + * @param string $path + * @param string $mode + * @return bool + */ protected function _chmod($path, $mode) { return false; } diff --git a/php/elFinderVolumeFTP.class.php b/php/elFinderVolumeFTP.class.php index d412d07cf..ddff13fe4 100644 --- a/php/elFinderVolumeFTP.class.php +++ b/php/elFinderVolumeFTP.class.php @@ -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, - *
- * 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, + *
+ * 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)) { diff --git a/php/elFinderVolumeLocalFileSystem.class.php b/php/elFinderVolumeLocalFileSystem.class.php index 89008b0f0..93df9e552 100644 --- a/php/elFinderVolumeLocalFileSystem.class.php +++ b/php/elFinderVolumeLocalFileSystem.class.php @@ -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); @@ -1204,7 +1208,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(); diff --git a/php/elFinderVolumeMsSQL.class.php b/php/elFinderVolumeMsSQL.class.php index 512138945..c4838a594 100644 --- a/php/elFinderVolumeMsSQL.class.php +++ b/php/elFinderVolumeMsSQL.class.php @@ -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', @@ -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); @@ -741,12 +743,13 @@ class elFinderVolumeMsSQL extends elFinderVolumeDriver { 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'; diff --git a/php/elFinderVolumeMySQL.class.php b/php/elFinderVolumeMySQL.class.php index 5d29fb34b..6a9a04a8c 100644 --- a/php/elFinderVolumeMySQL.class.php +++ b/php/elFinderVolumeMySQL.class.php @@ -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', @@ -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; } diff --git a/php/libs/GdBmp.php b/php/libs/GdBmp.php index f99f052ea..b2b5f8019 100644 --- a/php/libs/GdBmp.php +++ b/php/libs/GdBmp.php @@ -1,10 +1,10 @@ Date: Wed, 6 Apr 2016 15:21:43 +0200 Subject: [PATCH 03/13] Fix wrong return types --- php/elFinderVolumeDriver.class.php | 2 +- php/elFinderVolumeDropbox.class.php | 10 +++++----- php/elFinderVolumeMsSQL.class.php | 2 +- php/elFinderVolumeMySQL.class.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index 6ab0bbba0..8c980353a 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -5088,7 +5088,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) { diff --git a/php/elFinderVolumeDropbox.class.php b/php/elFinderVolumeDropbox.class.php index 745fa5005..7832b9c42 100644 --- a/php/elFinderVolumeDropbox.class.php +++ b/php/elFinderVolumeDropbox.class.php @@ -429,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() { @@ -444,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.'\''); @@ -664,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) { @@ -1399,7 +1399,7 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver { /** * Detect available archivers * - * @return void + * @return array **/ protected function _checkArchivers() { // die('Not yet implemented. (_checkArchivers)'); diff --git a/php/elFinderVolumeMsSQL.class.php b/php/elFinderVolumeMsSQL.class.php index c4838a594..44fccbaea 100644 --- a/php/elFinderVolumeMsSQL.class.php +++ b/php/elFinderVolumeMsSQL.class.php @@ -221,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) { diff --git a/php/elFinderVolumeMySQL.class.php b/php/elFinderVolumeMySQL.class.php index 6a9a04a8c..b34605a7f 100644 --- a/php/elFinderVolumeMySQL.class.php +++ b/php/elFinderVolumeMySQL.class.php @@ -220,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) { From 0d8b4b88a11ac60b27c6f9135fc8f9029739c6cd Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:23:15 +0200 Subject: [PATCH 04/13] Fix undefined database --- php/elFinderVolumeMsSQL.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/elFinderVolumeMsSQL.class.php b/php/elFinderVolumeMsSQL.class.php index 44fccbaea..9e36240f4 100644 --- a/php/elFinderVolumeMsSQL.class.php +++ b/php/elFinderVolumeMsSQL.class.php @@ -99,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; From 237b53c0e0556950eebac446fd4125fddc0ab47a Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:27:06 +0200 Subject: [PATCH 05/13] Remove duplicate keys since they lead to errors --- php/elFinderVolumeDriver.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index 8c980353a..038604dc7 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -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 From 630b876981064e27d96858601e5c691fc5d39db0 Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:30:37 +0200 Subject: [PATCH 06/13] sessionWrite cannot be called statically --- php/elFinder.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/elFinder.class.php b/php/elFinder.class.php index f3645fa15..5fd47e8c4 100644 --- a/php/elFinder.class.php +++ b/php/elFinder.class.php @@ -2822,7 +2822,7 @@ class elFinder { * @deprecated * @return void */ - public static function sessionWrite() { + public function sessionWrite() { $this->session->close(); } From 17fe7fed401a267692fbcacd5e3d3fbdaf3ca885 Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:33:08 +0200 Subject: [PATCH 07/13] fix unreachable code --- php/chars-test.php | 1 - php/elFinderVolumeDriver.class.php | 12 ------------ php/elFinderVolumeDropbox.class.php | 22 ---------------------- 3 files changed, 35 deletions(-) diff --git a/php/chars-test.php b/php/chars-test.php index 60f8a7bc7..80d86659c 100644 --- a/php/chars-test.php +++ b/php/chars-test.php @@ -6,7 +6,6 @@ header('Content-Type: text/html; charset=utf-8'); echo 'белая собака'; echo strToLower('белая собака'); -exit(); $orig = 'ёЁйЙØÅŻ'; echo $orig.'
'; $path = '../../../files/tmp/'; diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index 038604dc7..43741ee95 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -4713,18 +4713,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); } /** diff --git a/php/elFinderVolumeDropbox.class.php b/php/elFinderVolumeDropbox.class.php index 7832b9c42..1bded25e2 100644 --- a/php/elFinderVolumeDropbox.class.php +++ b/php/elFinderVolumeDropbox.class.php @@ -1429,7 +1429,6 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver { **/ protected function _unpack($path, $arc) { die('Not yet implemented. (_unpack)'); - return false; } /** @@ -1441,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; } /** @@ -1490,7 +1469,6 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver { **/ protected function _archive($dir, $files, $name, $arc) { die('Not yet implemented. (_archive)'); - return false; } } // END class From 7a941f6ae710ad5905d1c869d4aa44d4e729dead Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:33:42 +0200 Subject: [PATCH 08/13] Remove closing tag since it might lead to errors --- php/chars-test.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/php/chars-test.php b/php/chars-test.php index 80d86659c..4bcc27bfe 100644 --- a/php/chars-test.php +++ b/php/chars-test.php @@ -53,9 +53,4 @@ if (count($diff)) { echo ''; } else { echo "OK"; -} - - - - -?> \ No newline at end of file +} \ No newline at end of file From ada89885ac745e030e953adaf1297bc31ce5485b Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:35:07 +0200 Subject: [PATCH 09/13] Add todos for missing return statements --- php/elFinder.class.php | 1 + php/elFinderVolumeDriver.class.php | 2 ++ php/elFinderVolumeLocalFileSystem.class.php | 1 + 3 files changed, 4 insertions(+) diff --git a/php/elFinder.class.php b/php/elFinder.class.php index 5fd47e8c4..b12e003e8 100644 --- a/php/elFinder.class.php +++ b/php/elFinder.class.php @@ -719,6 +719,7 @@ class elFinder { } else { return $result; } + //TODO: Add return statement here } /** diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index 43741ee95..b33e900fc 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -2745,6 +2745,7 @@ abstract class elFinderVolumeDriver { // append volume id to make hash unique return $this->id.$hash; } + //TODO: Add return statement here } /** @@ -2766,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 } /** diff --git a/php/elFinderVolumeLocalFileSystem.class.php b/php/elFinderVolumeLocalFileSystem.class.php index 93df9e552..97dd82389 100644 --- a/php/elFinderVolumeLocalFileSystem.class.php +++ b/php/elFinderVolumeLocalFileSystem.class.php @@ -1092,6 +1092,7 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver { return (is_array($result) || file_exists($result)) ? $result : false; } + //TODO: Add return statement here } /** From 5316b6d60e57ea79c2e221f488361dd547955fc5 Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:38:09 +0200 Subject: [PATCH 10/13] Fix error used instead of setError --- php/elFinderVolumeDriver.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php/elFinderVolumeDriver.class.php b/php/elFinderVolumeDriver.class.php index b33e900fc..29a5bac07 100644 --- a/php/elFinderVolumeDriver.class.php +++ b/php/elFinderVolumeDriver.class.php @@ -2158,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); } } From 99590479019f958f7d6813b880f6a5eb8d8495ff Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:40:03 +0200 Subject: [PATCH 11/13] Fix archive size having leading 0 --- php/elFinderVolumeFTP.class.php | 4 ++-- php/elFinderVolumeLocalFileSystem.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/elFinderVolumeFTP.class.php b/php/elFinderVolumeFTP.class.php index ddff13fe4..29c89404d 100644 --- a/php/elFinderVolumeFTP.class.php +++ b/php/elFinderVolumeFTP.class.php @@ -1143,11 +1143,11 @@ class elFinderVolumeFTP extends elFinderVolumeDriver { if (is_dir($p) && $this->_findSymlinks($p)) { return true; } elseif (is_file($p)) { - $this->archiveSize += sprintf('%u', filesize($p)); + $this->archiveSize = sprintf('%u', filesize($p)); } } } else { - $this->archiveSize += sprintf('%u', filesize($path)); + $this->archiveSize = sprintf('%u', filesize($path)); } return false; diff --git a/php/elFinderVolumeLocalFileSystem.class.php b/php/elFinderVolumeLocalFileSystem.class.php index 97dd82389..e3fd04e13 100644 --- a/php/elFinderVolumeLocalFileSystem.class.php +++ b/php/elFinderVolumeLocalFileSystem.class.php @@ -973,12 +973,12 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver { if (is_dir($p) && $this->_findSymlinks($p)) { return true; } elseif (is_file($p)) { - $this->archiveSize += sprintf('%u', filesize($p)); + $this->archiveSize = sprintf('%u', filesize($p)); } } } else { - $this->archiveSize += sprintf('%u', filesize($path)); + $this->archiveSize = sprintf('%u', filesize($path)); } return false; From b8deae4d0174511ae7b1de8d3f9bbc561abf3dac Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 6 Apr 2016 15:41:46 +0200 Subject: [PATCH 12/13] Fix use of undefined variable --- php/elFinderVolumeMsSQL.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/elFinderVolumeMsSQL.class.php b/php/elFinderVolumeMsSQL.class.php index 9e36240f4..5d992b95e 100644 --- a/php/elFinderVolumeMsSQL.class.php +++ b/php/elFinderVolumeMsSQL.class.php @@ -739,7 +739,7 @@ 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); } From 8a1b37bf9eb802e4471fe79d547c1a169e938f0b Mon Sep 17 00:00:00 2001 From: Dominik Date: Fri, 8 Apr 2016 09:02:02 +0200 Subject: [PATCH 13/13] Revert 9959047 --- php/elFinderVolumeFTP.class.php | 4 ++-- php/elFinderVolumeLocalFileSystem.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/elFinderVolumeFTP.class.php b/php/elFinderVolumeFTP.class.php index 29c89404d..ddff13fe4 100644 --- a/php/elFinderVolumeFTP.class.php +++ b/php/elFinderVolumeFTP.class.php @@ -1143,11 +1143,11 @@ class elFinderVolumeFTP extends elFinderVolumeDriver { if (is_dir($p) && $this->_findSymlinks($p)) { return true; } elseif (is_file($p)) { - $this->archiveSize = sprintf('%u', filesize($p)); + $this->archiveSize += sprintf('%u', filesize($p)); } } } else { - $this->archiveSize = sprintf('%u', filesize($path)); + $this->archiveSize += sprintf('%u', filesize($path)); } return false; diff --git a/php/elFinderVolumeLocalFileSystem.class.php b/php/elFinderVolumeLocalFileSystem.class.php index e3fd04e13..97dd82389 100644 --- a/php/elFinderVolumeLocalFileSystem.class.php +++ b/php/elFinderVolumeLocalFileSystem.class.php @@ -973,12 +973,12 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver { if (is_dir($p) && $this->_findSymlinks($p)) { return true; } elseif (is_file($p)) { - $this->archiveSize = sprintf('%u', filesize($p)); + $this->archiveSize += sprintf('%u', filesize($p)); } } } else { - $this->archiveSize = sprintf('%u', filesize($path)); + $this->archiveSize += sprintf('%u', filesize($path)); } return false;