Skip to content

Commit

Permalink
Merge branch 'experiment' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dio-el-claire committed Nov 4, 2011
2 parents 71c2342 + 0f6d885 commit 29dc866
Show file tree
Hide file tree
Showing 4 changed files with 462 additions and 571 deletions.
111 changes: 71 additions & 40 deletions php/connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';

function debug($o) {
echo '<pre>';
Expand Down Expand Up @@ -229,7 +229,7 @@ function validName($name) {

$logger = new elFinderSimpleLogger('../files/temp/log.txt');

// debug(scandir('ftp://frontrow:frontrow@192.168.1.35/'));


$opts = array(
'locale' => 'en_US.UTF-8',
Expand All @@ -240,45 +240,76 @@ function validName($name) {

'roots' => array(

// array(
// 'driver' => 'LocalFileSystem',
// 'path' => '../files/',
// 'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/',
// 'alias' => 'File system',
// 'mimeDetect' => 'internal',
// 'tmbPath' => '.tmb',
// 'utf8fix' => true,
// 'tmbCrop' => false,
// 'startPath' => '../files/test',
// // 'separator' => ':',
// 'attributes' => array(
// array(
// 'pattern' => '~/\.~',
// // 'pattern' => '/^\/\./',
// 'read' => false,
// 'write' => false,
// 'hidden' => true,
// 'locked' => false
// ),
// array(
// 'pattern' => '~/replace/.+png$~',
// // 'pattern' => '/^\/\./',
// // 'read' => false,
// // 'write' => false,
// // 'hidden' => true,
// // 'locked' => true
// )
// ),
// // 'defaults' => array('read' => false, 'write' => true)
// ),

array(
'driver' => 'FTP',
'host' => '192.168.1.37',
'user' => 'dio',
'pass' => 'hane',
'path' => '/Users/dio/Sites'
'driver' => 'LocalFileSystem',
'path' => '../files/',
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/',
// 'alias' => 'File system',
'mimeDetect' => 'internal',
'tmbPath' => '.tmb',
'utf8fix' => true,
'tmbCrop' => false,
'startPath' => '../files/test',
// 'separator' => ':',
'attributes' => array(
array(
'pattern' => '~/\.~',
// 'pattern' => '/^\/\./',
'read' => false,
'write' => false,
'hidden' => true,
'locked' => false
),
array(
'pattern' => '~/replace/.+png$~',
// 'pattern' => '/^\/\./',
'read' => false,
'write' => false,
// 'hidden' => true,
'locked' => true
)
),
// 'defaults' => array('read' => false, 'write' => true)
),
array(
'driver' => 'LocalFileSystem',
'path' => '../files2/',
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files2/',
'alias' => 'File system',
'mimeDetect' => 'internal',
'tmbPath' => '.tmb',
'utf8fix' => true,
'tmbCrop' => false,
'startPath' => '../files/test',
// 'separator' => ':',
'attributes' => array(
array(
'pattern' => '~/\.~',
// 'pattern' => '/^\/\./',
'read' => false,
'write' => false,
'hidden' => true,
'locked' => false
),
array(
'pattern' => '~/replace/.+png$~',
// 'pattern' => '/^\/\./',
'read' => false,
'write' => false,
// 'hidden' => true,
'locked' => true
)
),
// 'defaults' => array('read' => false, 'write' => true)
),

// array(
// 'driver' => 'FTP',
// 'host' => '192.168.1.37',
// 'user' => 'dio',
// 'pass' => 'hane',
// 'path' => '/Users/dio/Sites'
// ),
// array(
// 'driver' => 'FTP',
// 'host' => 'work.std42.ru',
Expand Down
13 changes: 9 additions & 4 deletions php/elFinder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ class elFinder {
protected $uploadDebug = '';

/**
* Store copy files errors
* Errors from not mounted volumes
*
* @var array
**/
protected $copyError = array();
protected $mountErrors = array();

// Errors messages
const ERROR_UNKNOWN = 'errUnknown';
Expand Down Expand Up @@ -183,7 +183,7 @@ public function __construct($opts) {
if (isset($opts['roots']) && is_array($opts['roots'])) {

foreach ($opts['roots'] as $i => $o) {
$class = 'elFinderVolume'.$o['driver'];
$class = 'elFinderVolume'.(isset($o['driver']) ? $o['driver'] : '');

if (class_exists($class)) {
$volume = new $class();
Expand All @@ -196,7 +196,11 @@ public function __construct($opts) {
if (!$this->default && $volume->isReadable()) {
$this->default = $this->volumes[$id];
}
} else {
$this->mountErrors[] = 'Driver "'.$class.'" : '.implode(' ', $volume->error());
}
} else {
$this->mountErrors[] = 'Driver "'.$class.'" does not exists';
}
}
}
Expand Down Expand Up @@ -374,7 +378,8 @@ public function exec($cmd, $args) {
'time' => $this->utime() - $this->time,
'memory' => (function_exists('memory_get_peak_usage') ? ceil(memory_get_peak_usage()/1024).'Kb / ' : '').ceil(memory_get_usage()/1024).'Kb / '.ini_get('memory_limit'),
'upload' => $this->uploadDebug,
'volumes' => array()
'volumes' => array(),
'mountErrors' => $this->mountErrors
);

foreach ($this->volumes as $id => $volume) {
Expand Down

0 comments on commit 29dc866

Please sign in to comment.